forked from mirrors/homebox
tests: improve repo package coverage (#3)
* refactor and add repo tests * add CI name * use atomic for test shutdown * use go 1.19 * add timeout
This commit is contained in:
parent
888ecfde34
commit
508e2e59bd
20 changed files with 540 additions and 186 deletions
|
@ -7,14 +7,16 @@ import (
|
|||
"github.com/hay-kot/content/backend/ent"
|
||||
)
|
||||
|
||||
type EntGroupRepository struct {
|
||||
type GroupRepository 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 *GroupRepository) 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) {
|
||||
func (r *GroupRepository) GetOneId(ctx context.Context, id uuid.UUID) (*ent.Group, error) {
|
||||
return r.db.Group.Get(ctx, id)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue