Files
go-gin-api/internal/api/model/user_model/user.go
T
2021-01-09 20:10:13 +08:00

69 lines
2.1 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package user_model
import (
"time"
)
// 用户Demo表
type UserDemo struct {
Id uint `gorm:"column:id;primary_key;AUTO_INCREMENT"` // 主键
UserName string `gorm:"column:user_name;NOT NULL"` // 用户名
NickName string `gorm:"column:nick_name;NOT NULL"` // 昵称
Mobile string `gorm:"column:mobile;NOT NULL"` // 手机号
IsDeleted int `gorm:"column:is_deleted;default:-1;NOT NULL"` // 是否删除 1:是 -1:否
CreatedAt time.Time `gorm:"column:created_at;default:CURRENT_TIMESTAMP;NOT NULL"` // 创建时间
UpdatedAt time.Time `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;NOT NULL"` // 更新时间
}
func (m *UserDemo) TableName() string {
return "user_demo"
}
// user_handler Create Request
type CreateRequest struct {
UserName string `json:"user_name"` // 用户名
NickName string `json:"nick_name"` // 昵称
Mobile string `json:"mobile"` // 手机号
}
// user_handler Create Response
type CreateResponse struct {
Id uint `json:"id"` //主键ID
}
// user_handler UpdateNickNameByID Request
type UpdateNickNameByIDRequest struct {
Id uint `json:"id"` // 用户主键ID
NickName string `json:"nick_name"` // 昵称
}
// user_handler UpdateNickNameByID Response
type UpdateNickNameByIDResponse struct {
Id uint `json:"id"` // 用户主键ID
}
// user_handler Login Request
type LoginRequest struct {
UserID int `json:"user_id" form:"user_id"` // 用户ID>0
UserName string `json:"user_name" form:"user_name"` // 用户名
}
// user_handler Login Response
type LoginResponse struct {
Authorization string `json:"authorization"` // 签名
ExpireTime int64 `json:"expire_time"` // 过期时间
}
// user_handler Detail Request
type DetailRequest struct {
UserName string `uri:"username"` // 用户名
}
// user_handler Detail Response
type DetailResponse struct {
Id uint `json:"id"` // 用户主键ID
UserName string `json:"user_name"` // 用户名
NickName string `json:"nick_name"` // 昵称
Mobile string `json:"mobile"` // 手机号
}