user

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: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateUser

func CreateUser(username, password, email, avatar string, ctx context.Context, db *gorm.DB) error

func RetrieveUser

func RetrieveUser(username, password string, ctx context.Context, db *gorm.DB) (*model.User, error)

func UpdateUser

func UpdateUser(username, newPassword string, ctx context.Context, db *gorm.DB) error

Types

type CreateUserFlow

type CreateUserFlow struct {

	// request data
	Username string
	Password string
	Email    string
	Avatar   string
	// contains filtered or unexported fields
}

func NewCreateUserFlow

func NewCreateUserFlow(username, password, email, avatar string, ctx context.Context, db *gorm.DB) *CreateUserFlow

func (*CreateUserFlow) Do

func (f *CreateUserFlow) Do() error

type DetailTodo

type DetailTodo struct {
	Id        int64     `json:"id"`
	Content   string    `json:"content"`
	Completed bool      `json:"completed"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

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 DetailUserAndTodo

type DetailUserAndTodo struct {
	*DetailUser
	Todos []*model.Todo `json:"todos,omitempty"` // 空的列表返回null
}

func MGetUser

func MGetUser(userIds []int64, ctx context.Context, db *gorm.DB) ([]*DetailUserAndTodo, error)

type MGetUserFlow

type MGetUserFlow struct {

	// request data
	UserIds []int64

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

func NewMGetUserFlow

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

func (*MGetUserFlow) Do

func (f *MGetUserFlow) Do() ([]*DetailUserAndTodo, error)

type RetrieveUserFlow

type RetrieveUserFlow struct {

	// request data
	Username string
	Password string

	// response data
	User *model.User
	// contains filtered or unexported fields
}

func NewRetrieveUserFlow

func NewRetrieveUserFlow(username, password string, ctx context.Context, db *gorm.DB) *RetrieveUserFlow

func (*RetrieveUserFlow) Do

func (f *RetrieveUserFlow) Do() (*model.User, error)

type UpdateUserFlow

type UpdateUserFlow struct {

	// request data
	Username    string
	NewPassword string
	// contains filtered or unexported fields
}

func NewUpdateUserFlow

func NewUpdateUserFlow(username, newPassword string, ctx context.Context, db *gorm.DB) *UpdateUserFlow

func (*UpdateUserFlow) Do

func (f *UpdateUserFlow) Do() error

Jump to

Keyboard shortcuts

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