user

package
v0.0.0-...-8edd8d8 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AppName = "user"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateUserRequest

type CreateUserRequest struct {
	Username string `json:"username" gorm:"column:username"`
	Password string `json:"password"`
	Role     Role   `json:"role"`
	// contains filtered or unexported fields
}

func NewCreateUserRequest

func NewCreateUserRequest() *CreateUserRequest

func (*CreateUserRequest) PasswordHash

func (req *CreateUserRequest) PasswordHash()

func (*CreateUserRequest) SetIsHashed

func (req *CreateUserRequest) SetIsHashed()

func (*CreateUserRequest) Validate

func (req *CreateUserRequest) Validate() error

type DeleteUserRequest

type DeleteUserRequest struct {
	Id int64 `json:"id"`
}

type QueryUserBy

type QueryUserBy int
const (
	Query_UserBy_Id QueryUserBy = iota //普通用户 通过0 1来确定查询的id或者name条件
	Query_UserBy_Username
)

type QueryUserRequest

type QueryUserRequest struct {
	QueryUserBy         QueryUserBy `json:"queryuser_id"`
	QueryUserByUsername string      `json:"queryuser_username"`
}

func NewQueryUserRequestID

func NewQueryUserRequestID(id string) *QueryUserRequest

func NewQueryUserRequestName

func NewQueryUserRequestName(name string) *QueryUserRequest

type Role

type Role int
const (
	// 创建者, 负责博客创作
	ROLE_AUTHOR Role = iota
	// 审核员
	ROLE_AUDITOR
	// 系统管理员
	ROLE_ADMIN
)

type Service

type Service interface {
	CreateUser(context.Context, *CreateUserRequest) (*User, error)
	DeleteUser(context.Context, *DeleteUserRequest) error
	QueryUser(context.Context, *QueryUserRequest) (*User, error)
}

type User

type User struct {
	*common.Meta
	*CreateUserRequest
}

func NewUser

func NewUser(req *CreateUserRequest) *User

func (*User) CheckPassword

func (u *User) CheckPassword(password string) error

func (*User) String

func (u *User) String() string

func (*User) TableName

func (u *User) TableName() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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