mirror of
https://github.com/hay-kot/homebox.git
synced 2024-12-22 06:46:32 +00:00
20 lines
434 B
Go
20 lines
434 B
Go
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) {
|
|
return r.db.Group.Create().SetName(name).Save(ctx)
|
|
}
|
|
|
|
func (r *EntGroupRepository) GetOneId(ctx context.Context, id uuid.UUID) (*ent.Group, error) {
|
|
return r.db.Group.Get(ctx, id)
|
|
}
|