todo

package
v0.0.0-...-8336b8e Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateTodo

func CreateTodo(userId int64, content string, ctx context.Context, db *gorm.DB) error

func DeleteTodo

func DeleteTodo(userId, todoId int64, ctx context.Context, db *gorm.DB) error

func UpdateTodo

func UpdateTodo(userId, todoId int64, content string, ctx context.Context, db *gorm.DB) error

Types

type CreateTodoFlow

type CreateTodoFlow struct {

	// request data
	UserId  int64
	Content string
	// contains filtered or unexported fields
}

func NewCreateTodoFlow

func NewCreateTodoFlow(userId int64, content string, ctx context.Context, db *gorm.DB) *CreateTodoFlow

func (*CreateTodoFlow) Do

func (f *CreateTodoFlow) Do() error

type DeleteTodoFlow

type DeleteTodoFlow struct {

	// request data
	UserId int64
	TodoId int64
	// contains filtered or unexported fields
}

func NewDeleteTodoFlow

func NewDeleteTodoFlow(userId, todoId int64, ctx context.Context, db *gorm.DB) *DeleteTodoFlow

func (*DeleteTodoFlow) Do

func (f *DeleteTodoFlow) Do() error

type DetailUser

type DetailUser struct {
	ID        int64     `json:"id"`
	Username  string    `json:"username"`
	Email     string    `json:"email"`
	Avatar    string    `json:"avatar"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

type GetTodoFlow

type GetTodoFlow struct {

	// request data
	Username string
	UserId   int64
	TodoId   int64

	// response data
	UserAndTodo *UserAndTodoDetail
	// contains filtered or unexported fields
}

func NewGetTodoFlow

func NewGetTodoFlow(Username string, userId, todoId int64, ctx context.Context, db *gorm.DB) *GetTodoFlow

func (*GetTodoFlow) Do

func (f *GetTodoFlow) Do() (*UserAndTodoDetail, error)

type MGetTodoFlow

type MGetTodoFlow struct {

	// request data
	UserIds []int64

	// response data
	UserAndTodo []*UserAndTodoDetail
	// contains filtered or unexported fields
}

func NewMGetTodoFlow

func NewMGetTodoFlow(userIds []int64, ctx context.Context, db *gorm.DB) *MGetTodoFlow

func (*MGetTodoFlow) Do

func (f *MGetTodoFlow) Do() ([]*UserAndTodoDetail, error)

type UpdateTodoFlow

type UpdateTodoFlow struct {

	// request data
	UserId  int64
	TodoId  int64
	Content string
	// contains filtered or unexported fields
}

func NewUpdateTodoFlow

func NewUpdateTodoFlow(userId, todoId int64, content string, ctx context.Context, db *gorm.DB) *UpdateTodoFlow

func (*UpdateTodoFlow) Do

func (f *UpdateTodoFlow) Do() error

type UserAndTodoDetail

type UserAndTodoDetail struct {
	*DetailUser
	Todos []*model.Todo `json:"todos,omitempty"`
}

func GetTodo

func GetTodo(username string, userId, todoId int64, ctx context.Context, db *gorm.DB) (*UserAndTodoDetail, error)

func MGetTodo

func MGetTodo(UserIds []int64, ctx context.Context, db *gorm.DB) ([]*UserAndTodoDetail, error)

Jump to

Keyboard shortcuts

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