ginWarpExampleApi

package
v0.0.0-...-6031783 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ServiceName = "ginWarp-example"
	RootGroup   = urls.RootGroup
	V1          = urls.V1
)
View Source
const (
	UserGroup = "/user"
)

Variables

View Source
var (
	V1UserCreateUrl urls.Url
	V1UserUpdateUrl urls.Url
	V1UserDeleteUrl urls.Url
	V1UserDetailUrl urls.Url
)

Functions

This section is empty.

Types

type UserCreateRequest

type UserCreateRequest struct {
	Account string `json:"account" binding:"required,min=4,max=24"` // 用户账号
	Pwd     string `json:"pwd" binding:"required,min=8,max=16"`     // 用户密码
}

type UserCreateResponse

type UserCreateResponse struct {
	ID      int64  `json:"id,string"` // 用户ID int64的字段, 统一在json tag中增加 string标识, 避免前端接收数据失真的问题.
	Account string `json:"account"`   // 用户账号
}

type UserDeleteRequest

type UserDeleteRequest struct {
	ID      int64  `json:"id,string" form:"id"`                                    // 用户ID int64的字段, 统一在json tag中增加 string标识, 避免前端接收数据失真的问题.
	Account string `json:"account" form:"account" binding:"required,min=4,max=24"` // 用户账号
}

type UserDeleteResponse

type UserDeleteResponse struct {
	DeleteUser int64 `json:"delete_user,string"` // 如果成功则返回被删除的用户ID, 如果失败则为0

} // 不需要返回值, 通过http状态码就可以判断了

type UserDetailRequest

type UserDetailRequest struct {
	ID      int64  `json:"id,string" form:"id"`                                    // 用户ID int64的字段, 统一在json tag中增加 string标识, 避免前端接收数据失真的问题.
	Account string `json:"account" form:"account" binding:"required,min=4,max=24"` // 用户账号
}

type UserDetailResponse

type UserDetailResponse struct {
	ID        int64     `json:"id,string"` // 用户ID int64的字段, 统一在json tag中增加 string标识, 避免前端接收数据失真的问题.
	Account   string    // 用户账号
	LoginTime time.Time `json:"login_time" gorm:"time"` //用户登陆时间
	LoginIp   string    `json:"login_ip"`               // 用户登陆IP
	CreatedAt time.Time `json:"created_at"`             // 用户创建时间
}

func UserDetail

func UserDetail(ctx mux.Context, request UserDetailRequest) (UserDetailResponse, int, error)

type UserUpdatePasswordRequest

type UserUpdatePasswordRequest struct {
	Account string `form:"account" json:"account"` // 用户账号
	Pwd     string `form:"pwd" json:"pwd"`         // 用户密码
	NewPwd  string `form:"new_pwd" json:"new_pwd"` // 用户新密码
}

type UserUpdatePasswordResponse

type UserUpdatePasswordResponse struct {
	SetPassword bool `json:"set_password"` // 设置密码是否成功
}

Jump to

Keyboard shortcuts

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