categories

package
v0.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 8, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Category

type Category struct {
	datastore.Model
	User *users.User `gorm:"embedded;embeddedPrefix:user_;notNull"`
	Name string
	Tags pq.StringArray `gorm:"type:text[]"`
}

func NewCategory

func NewCategory(u *users.User, name string) *Category

type Service

type Service struct {
	// contains filtered or unexported fields
}

func NewService

func NewService(db Store) *Service

func (*Service) CreateCategory

func (s *Service) CreateCategory(ctx context.Context, u *users.User, name string) (*Category, error)

func (*Service) DeleteCategory

func (s *Service) DeleteCategory(ctx context.Context, cat *Category) error

func (*Service) GetCategory added in v0.3.0

func (s *Service) GetCategory(ctx context.Context, UUID uuid.UUID) (*Category, error)

func (*Service) GetUserCategories

func (s *Service) GetUserCategories(ctx context.Context, u *users.User) ([]*Category, error)

type Store

type Store interface {
	SaveCategory(ctx context.Context, cat *Category) error
	DeleteCategory(ctx context.Context, cat *Category) error
	GetCategory(ctx context.Context, uuid uuid.UUID) (*Category, error)
	GetUserCategories(ctx context.Context, u *users.User) ([]*Category, error)
}

func NewGormStore

func NewGormStore(db *gorm.DB) Store

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL