Documentation ¶
Index ¶
Constants ¶
View Source
const DefaultAdminUserAlias = "Administrator"
DefaultAdminUserAlias default admin user alias
View Source
const RoleAdmin = "admin"
RoleAdmin admin role
Variables ¶
This section is empty.
Functions ¶
func GetRegisterModels ¶
GetRegisterModels will return the register models
Types ¶
type Article ¶
type Article struct { BaseModel Slug string `json:"slug" gorm:"primaryKey"` Title string `json:"title"` Description string `json:"description"` Body string `json:"body"` TagList []string `json:"tagList"` Favorited bool `json:"favorited"` FavoritesCount int `json:"favoritesCount"` }
func (*Article) PrimaryKey ¶
PrimaryKey return custom primary key
func (*Article) ShortTableName ¶
ShortTableName return custom table name
type BaseModel ¶
type BaseModel struct { CreateTime time.Time `json:"createTime"` UpdateTime time.Time `json:"updateTime"` }
BaseModel common model
func (*BaseModel) SetCreateTime ¶
SetCreateTime set create time
func (*BaseModel) SetUpdateTime ¶
SetUpdateTime set update time
type CustomClaims ¶
type CustomClaims struct { Email string `json:"email"` GrantType string `json:"grantType"` jwt.RegisteredClaims }
CustomClaims is the custom claims
type Tag ¶
type Tag struct { BaseModel Name string `json:"name" gorm:"primaryKey"` Slug []string `json:"slug"` }
func (*Tag) ShortTableName ¶
ShortTableName return custom table name
type User ¶
type User struct { BaseModel Name string `json:"username" gorm:"primaryKey"` Email string `json:"email"` Password string `json:"password,omitempty"` Bio string `json:"bio"` Image string `json:"image"` }
Article is the model of user
func (*User) ShortTableName ¶
ShortTableName return custom table name
type UserArticle ¶
func (*UserArticle) Index ¶
func (u *UserArticle) Index() map[string]interface{}
Index return custom index
func (*UserArticle) PrimaryKey ¶
func (u *UserArticle) PrimaryKey() string
PrimaryKey return custom primary key
func (*UserArticle) ShortTableName ¶
func (u *UserArticle) ShortTableName() string
ShortTableName return custom table name
func (*UserArticle) TableName ¶
func (u *UserArticle) TableName() string
TableName return custom table name
Click to show internal directories.
Click to hide internal directories.