homebox/backend/internal/repo/repo_group.go

23 lines
431 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 GroupRepository struct {
2022-08-30 18:05:11 +00:00
db *ent.Client
}
func (r *GroupRepository) Create(ctx context.Context, name string) (*ent.Group, error) {
return r.db.Group.Create().
SetName(name).
Save(ctx)
2022-08-30 18:05:11 +00:00
}
func (r *GroupRepository) 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
}