homebox/backend/internal/repo/repo_group.go

21 lines
434 B
Go
Raw Normal View History

2022-08-30 18:05:11 +00:00
package repo
import (
"context"
"github.com/google/uuid"
"github.com/hay-kot/content/backend/ent"
)
type EntGroupRepository struct {
db *ent.Client
}
func (r *EntGroupRepository) Create(ctx context.Context, name string) (*ent.Group, error) {
2022-08-31 03:21:18 +00:00
return r.db.Group.Create().SetName(name).Save(ctx)
2022-08-30 18:05:11 +00:00
}
func (r *EntGroupRepository) GetOneId(ctx context.Context, id uuid.UUID) (*ent.Group, error) {
2022-08-31 03:21:18 +00:00
return r.db.Group.Get(ctx, id)
2022-08-30 18:05:11 +00:00
}