mirror of
https://github.com/hay-kot/homebox.git
synced 2024-11-17 06:08:42 +00:00
508e2e59bd
* refactor and add repo tests * add CI name * use atomic for test shutdown * use go 1.19 * add timeout
22 lines
431 B
Go
22 lines
431 B
Go
package repo
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/google/uuid"
|
|
"github.com/hay-kot/content/backend/ent"
|
|
)
|
|
|
|
type GroupRepository struct {
|
|
db *ent.Client
|
|
}
|
|
|
|
func (r *GroupRepository) Create(ctx context.Context, name string) (*ent.Group, error) {
|
|
return r.db.Group.Create().
|
|
SetName(name).
|
|
Save(ctx)
|
|
}
|
|
|
|
func (r *GroupRepository) GetOneId(ctx context.Context, id uuid.UUID) (*ent.Group, error) {
|
|
return r.db.Group.Get(ctx, id)
|
|
}
|