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 }