Documentation
¶
Index ¶
- func OK[T any](c *gin.Context, data T)
- func OKWithMsg[T any](c *gin.Context, data T, msg string)
- func Throw(c *gin.Context, errCode errhandle.ErrCode)
- func ThrowBindError(c *gin.Context, obj any, err error)
- func ThrowError(c *gin.Context, err error)
- type Article
- type Category
- type Comment
- type CommonResponse
- type DelIdListRequest
- type GetUserResponse
- type Image
- type ImageResponse
- type ImageUpdateRequest
- type LoginWithEmailRequest
- type MenuItem
- type MenuRequest
- type MenuUptateRequest
- type ModifyPasswordRequest
- type ModifyUserRequest
- type PageRequest
- type QueryRequest
- type RegisterUserRequest
- type ResetPasswordRequest
- type Tag
- type TagRequest
- type TokenResponse
- type User
- type UserIDOnlyRequest
- type UserInfo
- type UserLoginRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Article ¶
type Article struct { ID int64 `json:"id,omitempty"` Title string `json:"title,omitempty"` Content string `gorm:"type:text" json:"content,omitempty"` LookCount uint `json:"look_count,omitempty"` //浏览量 CommentCount uint `json:"comment_count,omitempty"` //评论数 LikeCount uint `json:"like_count,omitempty"` //点赞数 User User `gorm:"foreignKey:UserID" json:"-,omitempty"` UserID int64 `json:"user_id,omitempty"` Comments []Comment `gorm:"foreignKey:ArticleID" json:"comments,omitempty"` Tags []Tag `gorm:"many2many:article_tags" json:"tags,omitempty"` CategoryID int64 `json:"category_id,omitempty"` Image Image `gorm:"foreignKey:ImageID" json:"image,omitempty"` //文章的封面 ImageID int64 `json:"image_id,omitempty"` CreatedAt time.Time `gorm:"column:createdAt" json:"created_at,omitempty"` UpdatedAt time.Time `gorm:"column:updatedAt" json:"Updated_at,omitempty"` }
type Category ¶
type Category struct { ID int64 `json:"id,omitempty"` Name string `gorm:"unique" json:"name,omitempty"` Articles []Article `gorm:"foreignKey:CategoryID" json:"articles,omitempty"` CreatedAt time.Time `gorm:"column:createdAt" json:"created_at,omitempty"` UpdatedAt time.Time `gorm:"column:updatedAt" json:"Updated_at,omitempty"` }
type Comment ¶
type Comment struct { ID int64 `json:"id,omitempty"` Content string `gorm:"type:text" json:"content,omitempty"` ArticleID uint `json:"article_id,omitempty"` UserID int64 `json:"user_id,omitempty"` User User `json:"user,omitempty"` CreatedAt time.Time `gorm:"column:createdAt" json:"created_at,omitempty"` UpdatedAt time.Time `gorm:"column:updatedAt" json:"Updated_at,omitempty"` }
type CommonResponse ¶
type DelIdListRequest ¶
type DelIdListRequest struct {
IdList []int64 `json:"id_list" binding:"required" msg:"请输入要删除的内容id列表"`
}
type GetUserResponse ¶
type GetUserResponse struct { ID int64 `json:"id,omitempty"` Name string `json:"name,omitempty"` Email string `json:"email,omitempty"` NickName string `gorm:"column:nickName" json:"nickName,omitempty"` Sex string `json:"sex,omitempty"` Avatar string `json:"avatar,omitempty"` IP string `json:"ip,omitempty"` Role string `json:"role,omitempty"` }
type Image ¶
type Image struct { ID int64 `json:"id,omitempty"` URL string `json:"url,omitempty"` Hash string `json:"hash,omitempty"` //判断图片是否重复 Name string `json:"name,omitempty"` ImageStoreType ctype.ImageStoreType `gorm:"default:1" json:"image_store_type,omitempty"` CreatedAt time.Time `gorm:"column:createdAt" json:"created_at,omitempty"` UpdatedAt time.Time `gorm:"column:updatedAt" json:"Updated_at,omitempty"` }
type ImageResponse ¶
type ImageUpdateRequest ¶
type LoginWithEmailRequest ¶
type MenuItem ¶
type MenuItem struct { ID int64 `gorm:"primaryKey" json:"id,omitempty"` Title string `json:"title,omitempty"` // 菜单项标题 URL string `json:"url,omitempty"` // 菜单项链接 ParentID *int64 `json:"parent_id,omitempty"` // 父菜单项ID,用于构建多级菜单 Children []MenuItem `gorm:"foreignKey:ParentID" json:"children,omitempty"` // 子菜单项列表 Sort int `json:"sort,omitempty"` //菜单的排序 CreatedAt time.Time `gorm:"column:createdAt" json:"created_at,omitempty"` UpdatedAt time.Time `gorm:"column:updatedAt" json:"Updated_at,omitempty"` }
MenuItem represents an item in the menu
type MenuRequest ¶
type MenuRequest struct { Title string `json:"title,omitempty" binding:"required" msg:"菜单标题"` URL string `json:"url,omitempty" binding:"required" msg:"菜单url"` ParentID *int `json:"parent_id,omitempty"` Sort int `json:"sort,omitempty" binding:"required" msg:"菜单的排序"` }
菜单
type MenuUptateRequest ¶
type ModifyPasswordRequest ¶
type ModifyPasswordRequest struct { UserIDOnlyRequest OldPwd string `json:"old_pwd,omitempty"` NewPwb string `json:"new_pwb,omitempty"` }
type ModifyUserRequest ¶
type PageRequest ¶
type PageRequest struct { Page int `form:"page" json:"page,omitempty"` //页码 Key string `form:"key" json:"key,omitempty"` //关键字 Limit int `form:"limit" json:"limit,omitempty"` //每页大小 Sort string `form:"sort" json:"sort,omitempty"` //排序(升序/降序) }
PageRequest 分页请求
type QueryRequest ¶
type QueryRequest struct { UserID int `json:"id,omitempty"` Name string `json:"name,omitempty"` Email string `json:"email,omitempty"` NickName string `json:"nick_name,omitempty"` }
用户
type RegisterUserRequest ¶
type RegisterUserRequest struct { Name string `json:"name,omitempty"` Password string `json:"password,omitempty"` Email string `json:"email,omitempty"` NickName string `json:"nick_name,omitempty"` Sex string `json:"sex,omitempty"` Avatar string `json:"avatar,omitempty"` VerificationCode *string `json:"verificationCode"` }
type ResetPasswordRequest ¶
type ResetPasswordRequest struct { Email string `json:"email" binding:"required,email" msg:"请输入邮箱"` VerificationCode *string `json:"verificationCode,omitempty"` NewPassword string `json:"newPassword,omitempty"` }
ResetPasswordRequest 绑定重置密码的请求数据
type Tag ¶
type Tag struct { ID int64 `json:"id,omitempty"` Name string `gorm:"unique" json:"name,omitempty"` Articles []Article `gorm:"many2many:article_tags" json:"articles,omitempty"` CreatedAt time.Time `gorm:"column:createdAt" json:"created_at,omitempty"` UpdatedAt time.Time `gorm:"column:updatedAt" json:"Updated_at,omitempty"` }
type TagRequest ¶
type TagRequest struct {
Name string `json:"Name,omitempty" binding:"required" msg:"请输入标签名"`
}
标签
type TokenResponse ¶
type User ¶
type User struct { ID int64 `gorm:"column:id" json:"id,omitempty"` Name string `gorm:"column:name" json:"name,omitempty"` Password string `gorm:"column:password" json:"password,omitempty"` Email string `gorm:"column:email" json:"email,omitempty"` NickName string `gorm:"column:nickName" json:"nick_name,omitempty"` IP string `gorm:"column:ip" json:"ip,omitempty"` Role string `gorm:"column:role" json:"role,omitempty"` //权限(管理员,普通用户) Sex string `gorm:"column:sex" json:"sex,omitempty"` Avatar string `gorm:"type:varchar(256);comment:头像" json:"avatar,omitempty"` //头像地址 Articles []Article `gorm:"foreignKey:UserID" json:"articles,omitempty"` CollectArticles []Article `gorm:"many2many:user_collect_articles" json:"collect_articles,omitempty"` CreatedAt time.Time `gorm:"column:createdAt" json:"created_at,omitempty"` UpdatedAt time.Time `gorm:"column:updatedAt" json:"Updated_at,omitempty"` }
type UserIDOnlyRequest ¶
type UserIDOnlyRequest struct {
UserID int64 `json:"id"`
}
type UserLoginRequest ¶
Click to show internal directories.
Click to hide internal directories.