Documentation ¶
Index ¶
- Variables
- func Category2Interfaces(categories []Category) []interface{}
- func Comments2Ints(comments []PostsComments) []interface{}
- func Configs2Interface(configs []Config) []interface{}
- func Links2Interfaces(links []FriendshipLink) []interface{}
- func Logs2Intefaces(logs []AuthUserLog) []interface{}
- func MenuToInterface(menus []Menu) []interface{}
- func Posts2Interfaces(posts []Posts) []interface{}
- func Socials2Interfaces(socials []AuthUserSocial) []interface{}
- func Tags2Interfaces(tags []Tags) []interface{}
- func Users2Interfaces(users []AuthUser) []interface{}
- type Action
- type AuthToken
- type AuthUser
- type AuthUserLog
- type AuthUserSocial
- type BlackList
- type Category
- type CategoryTags
- type ColumnInfo
- type Config
- type FriendshipLink
- type Menu
- type Model
- type Posts
- type PostsAttribute
- type PostsComments
- type PostsTags
- type TableInfo
- type Tags
Constants ¶
This section is empty.
Variables ¶
var ( // Create action when record is created Create = Action(0) // RetrieveOne action when a record is retrieved from db RetrieveOne = Action(1) // RetrieveMany action when record(s) are retrieved from db RetrieveMany = Action(2) // Update action when record is updated in db Update = Action(3) // Delete action when record is deleted in db Delete = Action(4) // FetchDDL action when fetching ddl info from db FetchDDL = Action(5) )
Functions ¶
func Category2Interfaces ¶
func Category2Interfaces(categories []Category) []interface{}
func Comments2Ints ¶
func Comments2Ints(comments []PostsComments) []interface{}
func Configs2Interface ¶
func Configs2Interface(configs []Config) []interface{}
func Links2Interfaces ¶
func Links2Interfaces(links []FriendshipLink) []interface{}
func Logs2Intefaces ¶
func Logs2Intefaces(logs []AuthUserLog) []interface{}
func MenuToInterface ¶
func MenuToInterface(menus []Menu) []interface{}
func Posts2Interfaces ¶
func Posts2Interfaces(posts []Posts) []interface{}
func Socials2Interfaces ¶
func Socials2Interfaces(socials []AuthUserSocial) []interface{}
func Tags2Interfaces ¶
func Tags2Interfaces(tags []Tags) []interface{}
func Users2Interfaces ¶
func Users2Interfaces(users []AuthUser) []interface{}
Types ¶
type AuthToken ¶
type AuthToken struct { //[ 0] id bigint null: false primary: true isArray: false auto: true col: bigint len: -1 default: [] ID int64 `gorm:"primaryKey;autoIncrement;column:id;" json:"id,omitempty" form:"id"` //[ 1] token varchar(256) null: false primary: false isArray: false auto: false col: varchar len: 256 default: [] Token string `gorm:"column:token;type:varchar(512);size:512;" json:"token,omitempty" form:"token"` // token //[ 2] expire_time datetime null: false primary: false isArray: false auto: false col: datetime len: -1 default: [] ExpireTime time.Time `gorm:"column:expire_time;type:datetime;" json:"expireTime,omitempty" form:"expireTime"` // 过期时间 //[ 3] user_id bigint null: false primary: false isArray: false auto: false col: bigint len: -1 default: [] UserID int64 `gorm:"column:user_id;type:bigint;" json:"userId,omitempty" form:"userId"` // 创建人 }
AuthToken struct is a row record of the auth_token table in the test database
func (*AuthToken) BeforeSave ¶
BeforeSave invoked before saving, return an error if field is not populated.
func (*AuthToken) Prepare ¶
func (a *AuthToken) Prepare()
Prepare invoked before saving, can be used to populate fields etc.
type AuthUser ¶
type AuthUser struct { //[ 0] id bigint null: false primary: true isArray: false auto: true col: bigint len: -1 default: [] ID int64 `gorm:"primaryKey;autoIncrement;column:id;" json:"id,omitempty" form:"id"` // 主键 //[ 1] social_id varchar(255) null: true primary: false isArray: false auto: false col: varchar len: 255 default: [] SocialID null.String `gorm:"column:social_id;type:varchar(255);size:255;" json:"socialId,omitempty" form:"socialId"` // 社交账户ID //[ 2] password varchar(255) null: false primary: false isArray: false auto: false col: varchar len: 255 default: [] Password string `gorm:"column:password;type:varchar(255);size:255;" json:"password,omitempty" form:"password"` // 密码 PasswordOld string `gorm:"-" json:"passwordOld,omitempty" form:"passwordOld"` //[ 3] name varchar(255) null: true primary: false isArray: false auto: false col: varchar len: 255 default: [] Name null.String `gorm:"column:name;type:varchar(255);size:255;" json:"name,omitempty" form:"name"` // 别名 //[ 4] role_id bigint null: false primary: false isArray: false auto: false col: bigint len: -1 default: [] RoleID int64 `gorm:"column:role_id;type:bigint;" json:"roleId,omitempty" form:"roleId"` // 角色主键 1 普通用户 2 admin //[ 5] email varchar(128) null: true primary: false isArray: false auto: false col: varchar len: 128 default: [] Email null.String `gorm:"column:email;type:varchar(128);size:128;" json:"email,omitempty" form:"email"` // 邮箱 //[ 6] introduction varchar(255) null: true primary: false isArray: false auto: false col: varchar len: 255 default: [] Introduction null.String `gorm:"column:introduction;type:varchar(255);size:255;" json:"introduction,omitempty" form:"introduction"` // 个人简介 //[ 7] avatar varchar(255) null: true primary: false isArray: false auto: false col: varchar len: 255 default: [] Avatar null.String `gorm:"column:avatar;type:varchar(255);size:255;" json:"avatar,omitempty" form:"avatar"` // 头像 //[ 8] create_time datetime null: false primary: false isArray: false auto: false col: datetime len: -1 default: [] CreateTime int64 `gorm:"column:create_time;autoCreateTime:milli;" json:"createTime,omitempty" form:"createTime"` // 注册时间 //[ 9] access_key varchar(255) null: true primary: false isArray: false auto: false col: varchar len: 255 default: [] AccessKey null.String `gorm:"column:access_key;type:varchar(255);size:255;" json:"accessKey,omitempty" form:"accessKey"` // ak //[10] secret_key varchar(255) null: true primary: false isArray: false auto: false col: varchar len: 255 default: [] SecretKey null.String `gorm:"column:secret_key;type:varchar(255);size:255;" json:"secretKey,omitempty" form:"secretKey"` // sk //[11] status int null: true primary: false isArray: false auto: false col: int len: -1 default: [0] Status null.Int `gorm:"column:status;type:int;default:0;not null;" json:"status,omitempty" form:"status"` // 0 正常 1 锁定 Token string `gorm:"-" json:"token,omitempty" form:"token"` Roles []string `gorm:"-" json:"roles,omitempty" form:"roles"` VerifyCode string `gorm:"-" json:"verifyCode,omitempty" form:"verifyCode"` *jwt.StandardClaims `gorm:"-"` *models.BaseVO AuthToken AuthToken `gorm:"foreignKey:UserID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"` }
AuthUser struct is a row record of the auth_user table in the test database
func (*AuthUser) BeforeSave ¶
BeforeSave invoked before saving, return an error if field is not populated.
func (*AuthUser) Prepare ¶
func (a *AuthUser) Prepare()
Prepare invoked before saving, can be used to populate fields etc.
type AuthUserLog ¶
type AuthUserLog struct { //[ 0] id bigint null: false primary: true isArray: false auto: true col: bigint len: -1 default: [] ID int64 `gorm:"primaryKey;autoIncrement;column:id;" json:"id,omitempty" form:"id"` // 主键 //[ 1] user_id varchar(20) null: false primary: false isArray: false auto: false col: varchar len: 20 default: [] UserID string `gorm:"column:user_id;type:varchar(20);size:20;" json:"userId,omitempty" form:"userId"` // 记录用户id(游客取系统id:-1) //[ 2] ip varchar(32) null: false primary: false isArray: false auto: false col: varchar len: 32 default: [] IP string `gorm:"column:ip;type:varchar(32);size:32;" json:"ip,omitempty" form:"ip"` // ip地址 //[ 3] url varchar(255) null: false primary: false isArray: false auto: false col: varchar len: 255 default: [] URL string `gorm:"column:url;type:varchar(255);size:255;" json:"url,omitempty" form:"url"` // 请求的url //[ 4] parameter varchar(5000) null: true primary: false isArray: false auto: false col: varchar len: 5000 default: [] Parameter null.String `gorm:"column:parameter;type:varchar(5000);size:5000;" json:"parameter,omitempty" form:"parameter"` // 需要记录的参数 //[ 5] device varchar(255) null: true primary: false isArray: false auto: false col: varchar len: 255 default: [] Device null.String `gorm:"column:device;type:varchar(255);size:255;" json:"device,omitempty" form:"device"` // 来自于哪个设备 eg 手机 型号 电脑浏览器 //[ 6] description varchar(255) null: true primary: false isArray: false auto: false col: varchar len: 255 default: [] Description null.String `gorm:"column:description;type:varchar(255);size:255;" json:"description,omitempty" form:"description"` // 描述 //[ 7] code varchar(10) null: true primary: false isArray: false auto: false col: varchar len: 10 default: [] Code null.String `gorm:"column:code;type:varchar(10);size:10;" json:"code,omitempty" form:"code"` // 日志类型 //[ 8] run_time bigint null: false primary: false isArray: false auto: false col: bigint len: -1 default: [] RunTime int64 `gorm:"column:run_time;type:bigint;" json:"runTime,omitempty" form:"runTime"` // 执行时间 //[ 9] create_time datetime null: false primary: false isArray: false auto: false col: datetime len: -1 default: [] CreateTime int64 `gorm:"column:create_time;type:datetime;autoCreateTime:milli;" json:"createTime,omitempty" form:"createTime"` // 创建时间 //[10] browser_name varchar(100) null: true primary: false isArray: false auto: false col: varchar len: 100 default: [] BrowserName null.String `gorm:"column:browser_name;type:varchar(100);size:100;" json:"browserName,omitempty" form:"browserName"` // 浏览器名称 //[11] browser_version varchar(100) null: true primary: false isArray: false auto: false col: varchar len: 100 default: [] BrowserVersion null.String `gorm:"column:browser_version;type:varchar(100);size:100;" json:"browserVersion,omitempty" form:"browserVersion"` // 浏览器版本号 Count int64 `gorm:"-" json:"count" form:"count"` *models.BaseVO `gorm:"-"` }
AuthUserLog struct is a row record of the auth_user_log table in the test database
func (*AuthUserLog) BeforeSave ¶
func (a *AuthUserLog) BeforeSave() error
BeforeSave invoked before saving, return an error if field is not populated.
func (*AuthUserLog) Prepare ¶
func (a *AuthUserLog) Prepare()
Prepare invoked before saving, can be used to populate fields etc.
func (*AuthUserLog) TableInfo ¶
func (a *AuthUserLog) TableInfo() *TableInfo
TableInfo return table meta data
func (*AuthUserLog) TableName ¶
func (a *AuthUserLog) TableName() string
TableName sets the insert table name for this struct type
func (*AuthUserLog) Validate ¶
func (a *AuthUserLog) Validate(action Action) error
Validate invoked before performing action, return an error if field is not populated.
type AuthUserSocial ¶
type AuthUserSocial struct { //[ 0] id bigint null: false primary: true isArray: false auto: true col: bigint len: -1 default: [] ID int64 `gorm:"primaryKey;autoIncrement;column:id;" json:"id,omitempty" form:"id"` // 主键 //[ 1] code varchar(32) null: false primary: false isArray: false auto: false col: varchar len: 32 default: [] Code string `gorm:"column:code;type:varchar(32);size:32;" json:"code,omitempty" form:"code"` // qq、csdn、wechat、weibo、email等 //[ 2] content varchar(100) null: true primary: false isArray: false auto: false col: varchar len: 100 default: [] Content null.String `gorm:"column:content;type:varchar(100);size:100;" json:"content,omitempty" form:"content"` // 社交内容 //[ 3] show_type smallint null: false primary: false isArray: false auto: false col: smallint len: -1 default: [] ShowType int32 `gorm:"column:show_type;type:smallint;" json:"showType,omitempty" form:"showType"` // 展示类型( 1、显示图片,2、显示账号,3、跳转链接) //[ 4] remark varchar(150) null: true primary: false isArray: false auto: false col: varchar len: 150 default: [] Remark null.String `gorm:"column:remark;type:varchar(150);size:150;" json:"remark,omitempty" form:"remark"` // 备注 //[ 5] icon varchar(100) null: true primary: false isArray: false auto: false col: varchar len: 100 default: [] Icon null.String `gorm:"column:icon;type:varchar(100);size:100;" json:"icon,omitempty" form:"icon"` // 图标 //[ 6] is_enabled smallint null: false primary: false isArray: false auto: false col: smallint len: -1 default: [0] IsEnabled int32 `gorm:"column:is_enabled;type:smallint;default:0;" json:"isEnabled,omitempty" form:"isEnabled"` // 是否启用 //[ 7] is_home smallint null: true primary: false isArray: false auto: false col: smallint len: -1 default: [0] IsHome null.Int `gorm:"column:is_home;type:smallint;default:0;" json:"isHome,omitempty" form:"isHome"` // 是否主页社交信息 //[ 8] create_time datetime null: false primary: false isArray: false auto: false col: datetime len: -1 default: [] CreateTime int64 `gorm:"column:create_time;autoCreateTime:milli" json:"createTime,omitempty" form:"createTime"` // 创建时间 //[ 9] update_time datetime null: false primary: false isArray: false auto: false col: datetime len: -1 default: [] UpdateTime int64 `gorm:"column:update_time;autoUpdateTime:milli" json:"updateTime,omitempty" form:"updateTime"` // 更新时间 *models.BaseVO `gorm:"-"` }
AuthUserSocial struct is a row record of the auth_user_social table in the test database
func (*AuthUserSocial) BeforeSave ¶
func (a *AuthUserSocial) BeforeSave() error
BeforeSave invoked before saving, return an error if field is not populated.
func (*AuthUserSocial) Prepare ¶
func (a *AuthUserSocial) Prepare()
Prepare invoked before saving, can be used to populate fields etc.
func (*AuthUserSocial) TableInfo ¶
func (a *AuthUserSocial) TableInfo() *TableInfo
TableInfo return table meta data
func (*AuthUserSocial) TableName ¶
func (a *AuthUserSocial) TableName() string
TableName sets the insert table name for this struct type
func (*AuthUserSocial) Validate ¶
func (a *AuthUserSocial) Validate(action Action) error
Validate invoked before performing action, return an error if field is not populated.
type BlackList ¶
type BlackList struct { //[ 0] id bigint null: false primary: true isArray: false auto: true col: bigint len: -1 default: [] ID int64 `gorm:"primaryKey;autoIncrement;column:id;" json:"id,omitempty" form:"id"` // 主键 //[ 1] ip_range varchar(150) null: true primary: false isArray: false auto: false col: varchar len: 150 default: [] IPRange null.String `gorm:"column:ip_range;type:varchar(150);size:150;" json:"ipRange,omitempty" form:"ipRange"` // ip范围 //[ 2] is_enable int null: true primary: false isArray: false auto: false col: int len: -1 default: [0] IsEnable null.Int `gorm:"column:is_enable;type:int;default:0;" json:"isEnable,omitempty" form:"isEnable"` // 是否启用 0 启用,1不启用 //[ 3] create_user varchar(255) null: true primary: false isArray: false auto: false col: varchar len: 255 default: [] CreateUser null.String `gorm:"column:create_user;type:varchar(255);size:255;" json:"createUser,omitempty" form:"createUser"` // 创建者 //[ 4] create_time datetime null: true primary: false isArray: false auto: false col: datetime len: -1 default: [] CreateTime null.Time `gorm:"column:create_time;type:datetime;autoCreateTime:milli;" json:"createTime,omitempty" form:"createTime"` // 创建时间 //[ 5] update_user datetime null: true primary: false isArray: false auto: false col: datetime len: -1 default: [] UpdateUser null.Time `gorm:"column:update_user;type:datetime;" json:"updateUser,omitempty" form:"updateUser"` // 更新者 //[ 6] update_time datetime null: true primary: false isArray: false auto: false col: datetime len: -1 default: [] UpdateTime null.Time `gorm:"column:update_time;type:datetime;autoUpdateTime:milli;" json:"updateTime,omitempty" form:"updateTime"` // 更新时间 }
BlackList struct is a row record of the black_list table in the test database
func (*BlackList) BeforeSave ¶
BeforeSave invoked before saving, return an error if field is not populated.
func (*BlackList) Prepare ¶
func (b *BlackList) Prepare()
Prepare invoked before saving, can be used to populate fields etc.
type Category ¶
type Category struct { //[ 0] id bigint null: false primary: true isArray: false auto: true col: bigint len: -1 default: [] ID int64 `gorm:"primaryKey;autoIncrement;column:id;" json:"id,omitempty" form:"id"` //[ 1] name varchar(32) null: false primary: false isArray: false auto: false col: varchar len: 32 default: [] Name string `gorm:"column:name;type:varchar(32);size:32;unique;" json:"name,omitempty" form:"name"` // 名称 //[ 2] sort smallint null: false primary: false isArray: false auto: false col: smallint len: -1 default: [0] Sort int32 `gorm:"column:sort;type:smallint;default:0;" json:"sort,omitempty" form:"sort"` // 排序 //[ 3] create_time datetime null: false primary: false isArray: false auto: false col: datetime len: -1 default: [] CreateTime int64 `gorm:"column:create_time;autoCreateTime:milli;" json:"createTime,omitempty" form:"createTime"` // 创建时间 //[ 4] create_by bigint null: true primary: false isArray: false auto: false col: bigint len: -1 default: [] CreateBy null.Int `gorm:"column:create_by;type:bigint;" json:"createBy,omitempty" form:"createBy"` // 创建人 //[ 5] update_time datetime null: false primary: false isArray: false auto: false col: datetime len: -1 default: [] UpdateTime int64 `gorm:"column:update_time;autoUpdateTime:milli;" json:"updateTime,omitempty" form:"updateTime"` // 更新时间 //[ 6] update_by bigint null: true primary: false isArray: false auto: false col: bigint len: -1 default: [] UpdateBy null.Int `gorm:"column:update_by;type:bigint;" json:"updateBy,omitempty" form:"updateBy"` // 更新人 Tags []Tags `` /* 247-byte string literal not displayed */ Total int64 `gorm:"-" json:"total,omitempty"` *models.BaseVO `gorm:"-"` }
Category struct is a row record of the category table in the test database
func (*Category) Prepare ¶
func (c *Category) Prepare()
Prepare invoked before saving, can be used to populate fields etc.
type CategoryTags ¶
type CategoryTags struct { //[ 0] id bigint null: false primary: true isArray: false auto: true col: bigint len: -1 default: [] ID int64 `gorm:"primaryKey;autoIncrement;column:id;" json:"id,omitempty" form:"id"` //[ 1] tags_id bigint null: false primary: false isArray: false auto: false col: bigint len: -1 default: [] TagsName string `gorm:"column:tags_id;type:varchar(32);size:32;" json:"tagsId,omitempty" form:"tagsId"` // 名称 //[ 2] category_id bigint null: false primary: false isArray: false auto: false col: bigint len: -1 default: [] CategoryName string `gorm:"column:category_id;type:varchar(32);size:32;" json:"categoryId,omitempty" form:"categoryId"` // 分类的主键 //[ 3] sort smallint null: false primary: false isArray: false auto: false col: smallint len: -1 default: [0] Sort int32 `gorm:"column:sort;type:smallint;default:0;" json:"sort,omitempty" form:"sort"` // 排序 //[ 4] create_time datetime null: false primary: false isArray: false auto: false col: datetime len: -1 default: [] CreateTime int64 `gorm:"column:create_time;autoCreateTime:milli;" json:"createTime,omitempty" form:"createTime"` // 创建时间 //[ 5] update_time datetime null: false primary: false isArray: false auto: false col: datetime len: -1 default: [] UpdateTime int64 `gorm:"column:update_time;autoUpdateTime:milli;" json:"updateTime,omitempty" form:"updateTime"` // 更新时间 }
CategoryTags struct is a row record of the category_tags table in the test database
func (*CategoryTags) Prepare ¶
func (c *CategoryTags) Prepare()
Prepare invoked before saving, can be used to populate fields etc.
func (*CategoryTags) TableInfo ¶
func (c *CategoryTags) TableInfo() *TableInfo
TableInfo return table meta data
func (*CategoryTags) TableName ¶
func (c *CategoryTags) TableName() string
TableName sets the insert table name for this struct type
func (*CategoryTags) Validate ¶
func (c *CategoryTags) Validate(action Action) error
Validate invoked before performing action, return an error if field is not populated.
type ColumnInfo ¶
type ColumnInfo struct { Index int `json:"index"` GoFieldName string `json:"go_field_name"` GoFieldType string `json:"go_field_type"` JSONFieldName string `json:"json_field_name"` ProtobufFieldName string `json:"protobuf_field_name"` ProtobufType string `json:"protobuf_field_type"` ProtobufPos int `json:"protobuf_field_pos"` Comment string `json:"comment"` Notes string `json:"notes"` Name string `json:"name"` Nullable bool `json:"is_nullable"` DatabaseTypeName string `json:"database_type_name"` DatabaseTypePretty string `json:"database_type_pretty"` IsPrimaryKey bool `json:"is_primary_key"` IsAutoIncrement bool `json:"is_auto_increment"` IsArray bool `json:"is_array"` ColumnType string `json:"column_type"` ColumnLength int64 `json:"column_length"` DefaultValue string `json:"default_value"` }
ColumnInfo describes a column in the database table
type Config ¶
type Config struct { //[ 0] id bigint null: false primary: true isArray: false auto: true col: bigint len: -1 default: [] ID int64 `gorm:"primaryKey;autoIncrement;column:id;" json:"id,omitempty" form:"id"` //[ 1] config_key varchar(128) null: false primary: false isArray: false auto: false col: varchar len: 128 default: [] ConfigKey string `gorm:"column:config_key;type:varchar(128);size:128;" json:"configKey,omitempty" form:"configKey" binding:"required"` // 配置key //[ 2] config_value varchar(255) null: false primary: false isArray: false auto: false col: varchar len: 255 default: [] ConfigValue string `gorm:"column:config_value;type:varchar(255);size:255;" json:"configValue,omitempty" form:"configValue" binding:"required"` // 配置值 //[ 3] type smallint null: false primary: false isArray: false auto: false col: smallint len: -1 default: [0] Type int32 `gorm:"column:type;type:smallint;default:0;" json:"type,omitempty" form:"type"` // 配置类型 }
Config struct is a row record of the config table in the test database
func (*Config) Prepare ¶
func (c *Config) Prepare()
Prepare invoked before saving, can be used to populate fields etc.
type FriendshipLink ¶
type FriendshipLink struct { //[ 0] id bigint null: false primary: true isArray: false auto: true col: bigint len: -1 default: [] ID int64 `gorm:"primaryKey;autoIncrement;column:id;" json:"id,omitempty" form:"id"` //[ 1] title varchar(30) null: true primary: false isArray: false auto: false col: varchar len: 30 default: [] Title null.String `gorm:"column:title;type:varchar(30);size:30;" json:"title,omitempty" form:"title"` // 标题 //[ 2] name varchar(32) null: false primary: false isArray: false auto: false col: varchar len: 32 default: [] Name string `gorm:"column:name;type:varchar(32);size:32;" json:"name,omitempty" form:"name" binding:"required"` // 名称 //[ 3] logo varchar(255) null: false primary: false isArray: false auto: false col: varchar len: 255 default: [] Logo string `gorm:"column:logo;type:varchar(255);size:255;" json:"logo,omitempty" form:"logo"` // 文件 //[ 4] href varchar(255) null: false primary: false isArray: false auto: false col: varchar len: 255 default: [] Href string `gorm:"column:href;type:varchar(255);size:255;" json:"href,omitempty" form:"href" binding:"required"` // 跳转的路径 //[ 5] sort smallint null: false primary: false isArray: false auto: false col: smallint len: -1 default: [0] Sort int32 `gorm:"column:sort;type:smallint;default:0;" json:"sort,omitempty" form:"sort"` // 排序 //[ 6] description varchar(255) null: true primary: false isArray: false auto: false col: varchar len: 255 default: [] Description null.String `gorm:"column:description;type:varchar(255);size:255;" json:"description,omitempty" form:"description"` // 描述 *models.BaseVO `gorm:"-"` }
FriendshipLink struct is a row record of the friendship_link table in the test database
func (*FriendshipLink) Prepare ¶
func (f *FriendshipLink) Prepare()
Prepare invoked before saving, can be used to populate fields etc.
func (*FriendshipLink) TableInfo ¶
func (f *FriendshipLink) TableInfo() *TableInfo
TableInfo return table meta data
func (*FriendshipLink) TableName ¶
func (f *FriendshipLink) TableName() string
TableName sets the insert table name for this struct type
func (*FriendshipLink) Validate ¶
func (f *FriendshipLink) Validate(action Action) error
Validate invoked before performing action, return an error if field is not populated.
type Menu ¶
type Menu struct { //[ 0] id bigint null: false primary: true isArray: false auto: true col: bigint len: -1 default: [] ID int64 `gorm:"column:id;primaryKey;autoIncrement;" json:"id,omitempty,omitempty" form:"id"` //[ 1] parent_id bigint null: true primary: false isArray: false auto: false col: bigint len: -1 default: [0] ParentID null.Int `gorm:"column:parent_id;type:bigint;default:null;" json:"parentId,omitempty,omitempty" form:"parentId"` // 父菜单Id //[ 2] title varchar(32) null: false primary: false isArray: false auto: false col: varchar len: 32 default: [] Title string `gorm:"column:title;type:varchar(32);size:32;" json:"title,omitempty,omitempty" form:"title"` // 名称 //[ 3] icon varchar(255) null: false primary: false isArray: false auto: false col: varchar len: 255 default: [] Icon string `gorm:"column:icon;type:varchar(255);size:255;" json:"icon,omitempty,omitempty" form:"icon"` // icon图标 //[ 4] url varchar(255) null: false primary: false isArray: false auto: false col: varchar len: 255 default: [] URL string `gorm:"column:url;type:varchar(255);size:255;" json:"url,omitempty,omitempty" form:"url"` // 跳转路径 //[ 5] sort smallint null: false primary: false isArray: false auto: false col: smallint len: -1 default: [0] Sort int32 `gorm:"column:sort;type:smallint;default:0;" json:"sort,omitempty,omitempty" form:"sort"` // 排序 Children []Menu `gorm:"foreignKey:ParentID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;" json:"child,omitempty" form:"child"` *models.BaseVO `gorm:"-"` }
Menu struct is a row record of the menu table in the test database
func (*Menu) BeforeSave ¶
BeforeSave invoked before saving, return an error if field is not populated.
func (*Menu) Prepare ¶
func (m *Menu) Prepare()
Prepare invoked before saving, can be used to populate fields etc.
type Model ¶
type Model interface { TableName() string BeforeSave() error Prepare() Validate(action Action) error TableInfo() *TableInfo }
Model interface methods for database structs generated
type Posts ¶
type Posts struct { //[ 0] id bigint null: false primary: true isArray: false auto: true col: bigint len: -1 default: [] ID int64 `gorm:"primaryKey;autoIncrement;column:id;" json:"id,omitempty" form:"id"` // 主键 //[ 1] author_id bigint null: true primary: false isArray: false auto: false col: bigint len: -1 default: [] AuthorID null.Int `gorm:"column:author_id;type:bigint;" json:"authorId,omitempty" form:"authorId"` // 文章创建人 //[ 2] title varchar(64) null: false primary: false isArray: false auto: false col: varchar len: 64 default: [] Title string `gorm:"column:title;type:varchar(64);size:64;" json:"title,omitempty" form:"title"` // 文章标题 //[ 3] thumbnail varchar(255) null: true primary: false isArray: false auto: false col: varchar len: 255 default: [] Thumbnail null.String `gorm:"column:thumbnail;type:varchar(255);size:255;" json:"thumbnail,omitempty" form:"thumbnail"` // 封面图 //[ 4] comments int null: false primary: false isArray: false auto: false col: int len: -1 default: [0] Comments int32 `gorm:"column:comments;type:int;default:0;" json:"comments,omitempty" form:"comments"` // 评论数 //[ 5] is_comment smallint null: true primary: false isArray: false auto: false col: smallint len: -1 default: [1] IsComment null.Int `gorm:"column:is_comment;type:smallint;default:1;" json:"isComment,omitempty" form:"isComment"` // 是否打开评论 (0 不打开 1 打开 ) //[ 6] category_id bigint null: true primary: false isArray: false auto: false col: bigint len: -1 default: [] CategoryID null.Int `gorm:"column:category_id;type:bigint;" json:"categoryId,omitempty" form:"categoryId"` // 分类主键 //[ 7] sync_status smallint null: false primary: false isArray: false auto: false col: smallint len: -1 default: [0] SyncStatus int32 `gorm:"column:sync_status;type:smallint;default:0;" json:"syncStatus,omitempty" form:"syncStatus"` // 同步到byteblogs状态 //[ 8] status int null: false primary: false isArray: false auto: false col: int len: -1 default: [1] Status int32 `gorm:"column:status;type:int;default:1;" json:"status,omitempty" form:"status"` // 状态 1 草稿 2 发布 //[ 9] summary varchar(255) null: false primary: false isArray: false auto: false col: varchar len: 255 default: [] Summary string `gorm:"column:summary;type:varchar(255);size:255;" json:"summary,omitempty" form:"summary"` // 摘要 //[10] views int null: false primary: false isArray: false auto: false col: int len: -1 default: [0] Views int32 `gorm:"column:views;type:int;default:0;" json:"views,omitempty" form:"views"` // 浏览次数 //[11] weight int null: false primary: false isArray: false auto: false col: int len: -1 default: [0] Weight int32 `gorm:"column:weight;type:int;default:0;" json:"weight,omitempty" form:"weight"` // 文章权重 //[12] create_time datetime null: false primary: false isArray: false auto: false col: datetime len: -1 default: [] CreateTime int64 `gorm:"column:create_time;type:datetime;autoCreateTime:milli;" json:"createTime,omitempty" form:"createTime"` // 创建时间 //[13] update_time datetime null: false primary: false isArray: false auto: false col: datetime len: -1 default: [] UpdateTime int64 `gorm:"column:update_time;type:datetime;autoUpdateTime:milli;" json:"updateTime,omitempty" form:"updateTime"` // 更新时间 PostsAttribute PostsAttribute `gorm:"foreignKey:PostsID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"` PostsTags []PostsTags `gorm:"foreignKey:PostsID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"` PostsComments []PostsComments `gorm:"foreignKey:PostsID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"` *models.BaseVO `gorm:"-"` Content string `gorm:"-" json:"content" form:"content"` CommentsTotal int64 `gorm:"-" json:"commentsTotal" form:"commentsTotal"` ViewsTotal int64 `gorm:"-" json:"viewsTotal" form:"viewsTotal"` DraftTotal int64 `gorm:"-" json:"draftTotal" form:"draftTotal"` SyncTotal int64 `gorm:"-" json:"syncTotal" form:"syncTotal"` TodayPublishTotal int64 `gorm:"-" json:"todayPublishTotal" form:"todayPublishTotal"` TagList []string `gorm:"-" json:"tagList" form:"tagList"` SocialID string `gorm:"-" json:"socialId" form:"socialId"` Year int64 `gorm:"-" json:"year" form:"year"` TagsName string `gorm:"-" json:"tagsName" form:"tagsName"` IsWeight int64 `gorm:"-" json:"isWeight" form:"isWeight"` CategoryName string `gorm:"-" json:"categoryName" form:"categoryName"` Author string `gorm:"-" json:"author" form:"author"` ArchivePosts []Posts `gorm:"-" json:"archivePosts" form:"archivePosts"` PostsTagsID int64 `gorm:"-" json:"postsTagsId" form:"postsTagsId"` TagsList []Tags `gorm:"-" json:"tagsList" form:"tagsList"` ArchiveDate *models.JSONTime `gorm:"-" json:"archiveDate" form:"archiveDate"` ArchiveTotal int64 `gorm:"-" json:"archiveTotal" form:"archiveTotal"` }
Posts struct is a row record of the posts table in the test database
func (*Posts) BeforeSave ¶
BeforeSave invoked before saving, return an error if field is not populated.
func (*Posts) Prepare ¶
func (p *Posts) Prepare()
Prepare invoked before saving, can be used to populate fields etc.
type PostsAttribute ¶
type PostsAttribute struct { //[ 0] id bigint null: false primary: true isArray: false auto: true col: bigint len: -1 default: [] ID int64 `gorm:"primaryKey;autoIncrement;column:id;" json:"id,omitempty" form:"id"` // 主键 //[ 1] content text(4294967295) null: false primary: false isArray: false auto: false col: text len: 4294967295 default: [] Content string `gorm:"column:content;type:text;size:4294967295;" json:"content,omitempty" form:"content"` // 内容 //[ 2] posts_id bigint null: false primary: false isArray: false auto: false col: bigint len: -1 default: [] PostsID int64 `gorm:"column:posts_id;type:bigint;" json:"postsId,omitempty" form:"postsId"` // 文章表主键 }
PostsAttribute struct is a row record of the posts_attribute table in the test database
func (*PostsAttribute) BeforeSave ¶
func (p *PostsAttribute) BeforeSave() error
BeforeSave invoked before saving, return an error if field is not populated.
func (*PostsAttribute) Prepare ¶
func (p *PostsAttribute) Prepare()
Prepare invoked before saving, can be used to populate fields etc.
func (*PostsAttribute) TableInfo ¶
func (p *PostsAttribute) TableInfo() *TableInfo
TableInfo return table meta data
func (*PostsAttribute) TableName ¶
func (p *PostsAttribute) TableName() string
TableName sets the insert table name for this struct type
func (*PostsAttribute) Validate ¶
func (p *PostsAttribute) Validate(action Action) error
Validate invoked before performing action, return an error if field is not populated.
type PostsComments ¶
type PostsComments struct { //[ 0] id bigint null: false primary: true isArray: false auto: true col: bigint len: -1 default: [] ID int64 `gorm:"primaryKey;autoIncrement;column:id;" json:"id,omitempty" form:"id"` //[ 1] author_id bigint null: false primary: false isArray: false auto: false col: bigint len: -1 default: [] AuthorID int64 `gorm:"column:author_id;type:bigint;" json:"authorId,omitempty" form:"authorId"` //[ 2] content varchar(255) null: false primary: false isArray: false auto: false col: varchar len: 255 default: [] Content string `gorm:"column:content;type:varchar(255);size:255;" json:"content,omitempty" form:"content"` //[ 3] parent_id bigint null: false primary: false isArray: false auto: false col: bigint len: -1 default: [0] ParentID int64 `gorm:"column:parent_id;type:bigint;default:0;" json:"parentId,omitempty" form:"parentId"` //[ 4] status int null: false primary: false isArray: false auto: false col: int len: -1 default: [0] Status int32 `gorm:"column:status;type:int;default:0;" json:"status,omitempty" form:"status"` //[ 5] posts_id bigint null: false primary: false isArray: false auto: false col: bigint len: -1 default: [] PostsID int64 `gorm:"column:posts_id;type:bigint;" json:"postsId,omitempty" form:"postsId"` //[ 6] tree_path varchar(128) null: true primary: false isArray: false auto: false col: varchar len: 128 default: [] TreePath null.String `gorm:"column:tree_path;type:varchar(128);size:128;" json:"treePath,omitempty" form:"treePath"` // 层级结构 //[ 7] create_time datetime null: true primary: false isArray: false auto: false col: datetime len: -1 default: [] CreateTime int64 `gorm:"column:create_time;type:datetime;autoCreateTime:milli;" json:"createTime,omitempty" form:"createTime"` Title string `gorm:"-" json:"title" form:"title"` AuthorAvatar string `gorm:"-" json:"authorAvatar" form:"authorAvatar"` AuthorName string `gorm:"-" json:"authorName" form:"authorName"` ParentUserName string `gorm:"-" json:"parentUserName" form:"parentUserName"` ParentComments *PostsComments `gorm:"foreignKey:ParentID"` Posts Posts `gorm:"foreignKey:PostsID;references:Posts.ID"` *models.BaseVO }
PostsComments struct is a row record of the posts_comments table in the test database
func (*PostsComments) BeforeSave ¶
func (p *PostsComments) BeforeSave() error
BeforeSave invoked before saving, return an error if field is not populated.
func (*PostsComments) Prepare ¶
func (p *PostsComments) Prepare()
Prepare invoked before saving, can be used to populate fields etc.
func (*PostsComments) TableInfo ¶
func (p *PostsComments) TableInfo() *TableInfo
TableInfo return table meta data
func (*PostsComments) TableName ¶
func (p *PostsComments) TableName() string
TableName sets the insert table name for this struct type
func (*PostsComments) Validate ¶
func (p *PostsComments) Validate(action Action) error
Validate invoked before performing action, return an error if field is not populated.
type PostsTags ¶
type PostsTags struct { //[ 0] id bigint null: false primary: true isArray: false auto: true col: bigint len: -1 default: [] ID int64 `gorm:"primaryKey;autoIncrement;column:id;" json:"id,omitempty" form:"id"` //[ 1] tags_id bigint null: false primary: false isArray: false auto: false col: bigint len: -1 default: [] TagsID int64 `gorm:"column:tags_id;type:bigint;" json:"tagsId,omitempty" form:"tagsId"` // 名称 //[ 2] posts_id bigint null: false primary: false isArray: false auto: false col: bigint len: -1 default: [] PostsID int64 `gorm:"column:posts_id;type:bigint;" json:"postsId,omitempty" form:"postsId"` // 文章主键 //[ 3] sort smallint null: false primary: false isArray: false auto: false col: smallint len: -1 default: [0] Sort int32 `gorm:"column:sort;type:smallint;default:0;" json:"sort,omitempty" form:"sort"` // 排序 //[ 4] create_time datetime null: false primary: false isArray: false auto: false col: datetime len: -1 default: [] CreateTime time.Time `gorm:"column:create_time;type:datetime;autoCreateTime:milli;" json:"createTime,omitempty" form:"createTime"` // 创建时间 //[ 5] update_time datetime null: false primary: false isArray: false auto: false col: datetime len: -1 default: [] UpdateTime time.Time `gorm:"column:update_time;type:datetime;autoUpdateTime:milli;" json:"updateTime,omitempty" form:"updateTime"` // 更新时间 }
PostsTags struct is a row record of the posts_tags table in the test database
func (*PostsTags) BeforeSave ¶
BeforeSave invoked before saving, return an error if field is not populated.
func (*PostsTags) Prepare ¶
func (p *PostsTags) Prepare()
Prepare invoked before saving, can be used to populate fields etc.
type TableInfo ¶
type TableInfo struct { Name string `json:"name"` Columns []*ColumnInfo `json:"columns"` }
TableInfo describes a table in the database
func GetTableInfo ¶
GetTableInfo retrieve TableInfo for a table
type Tags ¶
type Tags struct { //[ 0] id bigint null: false primary: true isArray: false auto: true col: bigint len: -1 default: [] ID int64 `gorm:"primaryKey;autoIncrement;column:id;" json:"id,omitempty" form:"id"` //[ 1] name varchar(32) null: false primary: false isArray: false auto: false col: varchar len: 32 default: [] Name string `gorm:"column:name;type:varchar(32);size:32;unique;" json:"name,omitempty" form:"name"` // 名称 //[ 2] sort smallint null: false primary: false isArray: false auto: false col: smallint len: -1 default: [0] Sort int32 `gorm:"column:sort;type:smallint;default:0;" json:"sort,omitempty" form:"sort"` // 排序 //[ 3] create_time datetime null: false primary: false isArray: false auto: false col: datetime len: -1 default: [] CreateTime int64 `gorm:"column:create_time;autoCreateTime:milli;" json:"createTime,omitempty" form:"createTime"` // 创建时间 //[ 4] create_by bigint null: true primary: false isArray: false auto: false col: bigint len: -1 default: [] CreateBy null.Int `gorm:"column:create_by;type:bigint;" json:"createBy,omitempty" form:"createBy"` // 创建人 //[ 5] update_time datetime null: false primary: false isArray: false auto: false col: datetime len: -1 default: [] UpdateTime int64 `gorm:"column:update_time;autoUpdateTime:milli;" json:"updateTime,omitempty" form:"updateTime"` // 更新时间 //[ 6] update_by bigint null: true primary: false isArray: false auto: false col: bigint len: -1 default: [] UpdateBy null.Int `gorm:"column:update_by;type:bigint;" json:"updateBy,omitempty" form:"updateBy"` // 更新人 PostsTotal int64 `gorm:"-" form:"postsTotal" json:"postsTotal,omitempty"` *models.BaseVO }
Tags struct is a row record of the tags table in the test database
func (*Tags) Prepare ¶
func (t *Tags) Prepare()
Prepare invoked before saving, can be used to populate fields etc.