entity

package
v0.0.0-...-422268b Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTitleEmpty          = errors.New("title cannot be empty")
	ErrItemDeleted         = errors.New("item is deleted")
	ErrCannotCreateItem    = errors.New("cannot create new TODO item")
	ErrCannotGetItemLikes  = errors.New("cannot get item likes")
	ErrCannotGetItem       = errors.New("cannot get TODO item")
	ErrCannotGetItems      = errors.New("cannot get TODO items")
	ErrCannotUpdateItem    = errors.New("cannot update TODO item")
	ErrCannotDeleteItem    = errors.New("cannot delete TODO item")
	ErrRequesterIsNotOwner = errors.New("no permission, only TODO owner can do this")
	ErrItemIDInvalid       = errors.New("invalid TODO id")
)

Functions

This section is empty.

Types

type Filter

type Filter struct {
	Status string `json:"status" form:"status"`
}

type TodoItem

type TodoItem struct {
	core.SQLModel
	UserID      int              `json:"-" gorm:"column:user_id;"`
	Title       string           `json:"title" gorm:"column:title;"`
	Description string           `json:"description" gorm:"column:description;"`
	Status      string           `json:"status" gorm:"column:status;"`
	LikedCount  int              `json:"liked_count" gorm:"column:liked_count;"`
	Image       *core.Images     `json:"image" gorm:"column:image"`
	Owner       *core.SimpleUser `json:"owner" gorm:"foreignKey:UserID;"`
}

func (*TodoItem) Mask

func (i *TodoItem) Mask()

func (TodoItem) TableName

func (TodoItem) TableName() string

type TodoItemCreation

type TodoItemCreation struct {
	ID          int          `json:"id" gorm:"column:id;"`
	UserID      int          `json:"-" gorm:"column:user_id;"`
	Title       string       `json:"title" gorm:"column:title;"`
	Description string       `json:"description" gorm:"column:description;"`
	Image       *core.Images `json:"image" gorm:"column:image"`
}

func (TodoItemCreation) TableName

func (TodoItemCreation) TableName() string

func (*TodoItemCreation) Validate

func (i *TodoItemCreation) Validate() error

type TodoItemUpdate

type TodoItemUpdate struct {
	Title       *string      `json:"title" gorm:"column:title;"`
	Description *string      `json:"description" gorm:"column:description;"`
	Status      *string      `json:"status" gorm:"column:status;"`
	Image       *core.Images `json:"image" gorm:"column:image"`
}

func (TodoItemUpdate) TableName

func (TodoItemUpdate) TableName() string

Jump to

Keyboard shortcuts

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