You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

47 lines
1.1 KiB

package models
import "context"
type Group struct {
ID string `json:"id" db:"group_id"`
UserID string `json:"-" db:"user_id"`
Name string `json:"name" db:"name"`
Icon string `json:"icon" db:"icon"`
Description string `json:"description" db:"description"`
}
func (g *Group) Update(update GroupUpdate) {
if update.Name != nil {
g.Name = *update.Name
}
if update.Icon != nil {
g.Icon = *update.Icon
}
if update.Description != nil {
g.Description = *update.Description
}
}
type GroupUpdate struct {
Name *string `json:"name"`
Icon *string `jsoN:"icon"`
Description *string `json:"description"`
}
type GroupResult struct {
Group
Items []*Item `json:"items"`
}
type GroupFilter struct {
UserID string
IDs []string
}
type GroupRepository interface {
Find(ctx context.Context, id string) (*Group, error)
List(ctx context.Context, filter GroupFilter) ([]*Group, error)
Insert(ctx context.Context, group Group) error
Update(ctx context.Context, group Group) error
Delete(ctx context.Context, group Group) error
}