domain

package
v0.0.0-...-ffd3783 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrorCreateCategoryCommandInvalidId = errors.New("category Id must be a valid ULID")
View Source
var ErrorCreateCategoryCommandInvalidName = errors.New("category Name cannot be empty")
View Source
var ErrorUpdateCategoryCommandInvalidName = errors.New("category Name cannot be empty")

Functions

This section is empty.

Types

type Category

type Category struct {
	Id   ulid.ULID `json:"id"`
	Name string    `json:"name"`
}

type CategoryRepository

type CategoryRepository interface {
	GetCategories(ctx context.Context) ([]*Category, int, error)
	GetCategory(ctx context.Context, id ulid.ULID) (*Category, error)
	CreateCategory(ctx context.Context, ccc *CreateCategoryCommand) error
	UpdateCategory(ctx context.Context, id ulid.ULID, ccc *UpdateCategoryCommand) error
	DeleteCategory(ctx context.Context, id ulid.ULID) error
}

type CategoryService

type CategoryService interface {
	GetCategories(ctx context.Context) ([]*Category, int, error)
	GetCategory(ctx context.Context, id ulid.ULID) (*Category, error)
	CreateCategory(ctx context.Context, ccc *CreateCategoryCommand) (*ulid.ULID, error)
	UpdateCategory(ctx context.Context, id ulid.ULID, ccc *UpdateCategoryCommand) error
	DeleteCategory(ctx context.Context, id ulid.ULID) error
}

type CreateCategoryCommand

type CreateCategoryCommand struct {
	Id   ulid.ULID
	Name string `json:"name"`
}

func (*CreateCategoryCommand) Validate

func (ccc *CreateCategoryCommand) Validate() error

type UpdateCategoryCommand

type UpdateCategoryCommand struct {
	Name string `json:"name"`
}

func (*UpdateCategoryCommand) Validate

func (ccc *UpdateCategoryCommand) Validate() error

Jump to

Keyboard shortcuts

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