model

package
v1.1.30 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Models

func Models() []any

Models 注册 model 下全部模型

Types

type AllFieldModel

type AllFieldModel struct {
	ID uint32 `gorm:"column:id;primaryKey;autoIncrement" json:"id"`
	BaseModel
}

AllFieldModel gorm包含所有字段的模型

func (*AllFieldModel) GetID added in v1.1.0

func (a *AllFieldModel) GetID() uint32

type BaseModel

type BaseModel struct {
	CreatedAt *types.Time           `gorm:"column:created_at;type:timestamp;not null;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"`
	UpdatedAt *types.Time           `gorm:"column:updated_at;type:timestamp;not null;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"`
	DeletedAt soft_delete.DeletedAt `gorm:"column:deleted_at;type:bigint;not null;default:0;" json:"deleted_at"`

	// 创建人
	CreatorID uint32 `gorm:"column:creator;type:int unsigned;not null;comment:创建者" json:"creator_id"`
	// contains filtered or unexported fields
}

BaseModel gorm基础模型

func (*BaseModel) BeforeCreate

func (u *BaseModel) BeforeCreate(_ *gorm.DB) (err error)

BeforeCreate 创建前的hook

func (*BaseModel) GetContext

func (u *BaseModel) GetContext() context.Context

GetContext 获取上下文

func (*BaseModel) GetCreatedAt added in v1.1.0

func (u *BaseModel) GetCreatedAt() *types.Time

func (*BaseModel) GetCreatorID added in v1.1.0

func (u *BaseModel) GetCreatorID() uint32

func (*BaseModel) GetDeletedAt added in v1.1.0

func (u *BaseModel) GetDeletedAt() soft_delete.DeletedAt

func (*BaseModel) GetUpdatedAt added in v1.1.0

func (u *BaseModel) GetUpdatedAt() *types.Time

func (*BaseModel) WithContext

func (u *BaseModel) WithContext(ctx context.Context) *BaseModel

WithContext 获取上下文

type EasyModel

type EasyModel struct {
	ID        uint32                `gorm:"column:id;primaryKey;autoIncrement" json:"id"`
	CreatedAt *types.Time           `gorm:"column:created_at;type:timestamp;not null;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"`
	UpdatedAt *types.Time           `gorm:"column:updated_at;type:timestamp;not null;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"`
	DeletedAt soft_delete.DeletedAt `gorm:"column:deleted_at;type:bigint;not null;default:0;" json:"deleted_at"`
}

EasyModel gorm包含基础字段的模型

func (*EasyModel) GetCreatedAt added in v1.1.0

func (e *EasyModel) GetCreatedAt() *types.Time

func (*EasyModel) GetDeletedAt added in v1.1.0

func (e *EasyModel) GetDeletedAt() soft_delete.DeletedAt

func (*EasyModel) GetID added in v1.1.0

func (e *EasyModel) GetID() uint32

func (*EasyModel) GetUpdatedAt added in v1.1.0

func (e *EasyModel) GetUpdatedAt() *types.Time

type StrategyLevelTemplate

type StrategyLevelTemplate struct {
	AllFieldModel
	// 所属策略模板
	StrategyTemplateID uint32            `gorm:"column:strategy_template_id;type:int unsigned;not null;comment:策略模板ID" json:"strategy_template_id"`
	StrategyTemplate   *StrategyTemplate `gorm:"foreignKey:StrategyTemplateID" json:"strategy_template"`

	// 持续时间
	Duration *types.Duration `gorm:"column:duration;type:bigint(20);not null;comment:告警持续时间" json:"duration"`
	// 持续次数
	Count uint32 `gorm:"column:count;type:int unsigned;not null;comment:持续次数" json:"count"`
	// 持续事件类型
	SustainType vobj.Sustain `gorm:"column:sustain_type;type:int(11);not null;comment:持续类型" json:"sustain_type"`
	// 条件
	Condition vobj.Condition `gorm:"column:condition;type:int;not null;comment:条件" json:"condition"`
	// 阈值
	Threshold float64 `gorm:"column:threshold;type:text;not null;comment:阈值" json:"threshold"`
	// 告警等级 对应sys_dict字典id
	LevelID uint32   `gorm:"column:level_id;type:int unsigned;not null;comment:告警等级" json:"level_id"`
	Level   *SysDict `gorm:"foreignKey:LevelID" json:"level"`

	// 状态
	Status vobj.Status `gorm:"column:status;type:int;not null;comment:策略状态" json:"status"`
}

StrategyLevelTemplate 策略等级明细模型

func (*StrategyLevelTemplate) MarshalBinary

func (c *StrategyLevelTemplate) MarshalBinary() (data []byte, err error)

MarshalBinary StrategyLevelTemplate's MarshalBinary

func (*StrategyLevelTemplate) String

func (c *StrategyLevelTemplate) String() string

String json string

func (*StrategyLevelTemplate) TableName

func (*StrategyLevelTemplate) TableName() string

TableName StrategyLevelTemplate's table name

func (*StrategyLevelTemplate) UnmarshalBinary

func (c *StrategyLevelTemplate) UnmarshalBinary(data []byte) error

UnmarshalBinary StrategyLevelTemplate's UnmarshalBinary

type StrategyTemplate

type StrategyTemplate struct {
	AllFieldModel
	Alert       string            `gorm:"column:alert;type:varchar(64);not null;comment:策略名称" json:"alert"`
	Expr        string            `gorm:"column:expr;type:text;not null;comment:告警表达式" json:"expr"`
	Status      vobj.Status       `gorm:"column:status;type:int;not null;comment:策略状态" json:"status"`
	Remark      string            `gorm:"column:remark;type:varchar(255);not null;comment:备注" json:"remark"`
	Labels      *vobj.Labels      `gorm:"column:labels;type:JSON;not null;comment:标签" json:"labels"`
	Annotations *vobj.Annotations `gorm:"column:annotations;type:JSON;not null;comment:注解" json:"annotations"`
	// 告警等级数据
	StrategyLevelTemplates []*StrategyLevelTemplate `gorm:"foreignKey:StrategyTemplateID" json:"strategy_level_templates"`
	//策略模板类型
	Categories []*SysDict `gorm:"many2many:strategy_template_categories"`
}

StrategyTemplate 策略模板gorm模型

func (*StrategyTemplate) MarshalBinary

func (c *StrategyTemplate) MarshalBinary() (data []byte, err error)

MarshalBinary 实现 encoding.MarshalBinary 接口

func (*StrategyTemplate) String

func (c *StrategyTemplate) String() string

String json string

func (*StrategyTemplate) TableName

func (*StrategyTemplate) TableName() string

TableName StrategyTemplate's table name

func (*StrategyTemplate) UnmarshalBinary

func (c *StrategyTemplate) UnmarshalBinary(data []byte) error

UnmarshalBinary 实现 encoding.BinaryUnmarshaler 接口

type StrategyTemplateCategories

type StrategyTemplateCategories struct {
	BaseModel
	StrategyTemplateID uint32 `gorm:"primaryKey"`
	SysDictID          uint32 `gorm:"primaryKey"`
}

StrategyTemplateCategories 策略模板类型

func (*StrategyTemplateCategories) MarshalBinary

func (c *StrategyTemplateCategories) MarshalBinary() (data []byte, err error)

MarshalBinary 实现redis数据转换

func (*StrategyTemplateCategories) String

func (c *StrategyTemplateCategories) String() string

String json string

func (*StrategyTemplateCategories) TableName

func (*StrategyTemplateCategories) TableName() string

TableName StrategyTemplateCategories's table name

func (*StrategyTemplateCategories) UnmarshalBinary

func (c *StrategyTemplateCategories) UnmarshalBinary(data []byte) error

UnmarshalBinary 实现redis数据转换

type SysAPI

type SysAPI struct {
	AllFieldModel
	Name   string      `gorm:"column:name;type:varchar(64);not null;uniqueIndex:idx__api__name,priority:1;comment:api名称" json:"name"`  // api名称
	Path   string      `gorm:"column:path;type:varchar(255);not null;uniqueIndex:idx__api__path,priority:1;comment:api路径" json:"path"` // api路径
	Status vobj.Status `gorm:"column:status;type:tinyint;not null;comment:状态" json:"status"`                                           // 状态
	Remark string      `gorm:"column:remark;type:varchar(255);not null;comment:备注" json:"remark"`                                      // 备注
	Module int32       `gorm:"column:module;type:int;not null;comment:模块" json:"module"`                                               // 模块
	Domain int32       `gorm:"column:domain;type:int;not null;comment:领域" json:"domain"`                                               // 领域
	Allow  vobj.Allow  `gorm:"column:allow;type:tinyint;not null;comment:允许类型" json:"allow"`                                           // 放行规则
}

SysAPI mapped from table <sys_apis>

func (*SysAPI) GetAllow added in v1.1.0

func (c *SysAPI) GetAllow() vobj.Allow

func (*SysAPI) GetDomain added in v1.1.0

func (c *SysAPI) GetDomain() int32

func (*SysAPI) GetModule added in v1.1.0

func (c *SysAPI) GetModule() int32

func (*SysAPI) GetName added in v1.1.0

func (c *SysAPI) GetName() string

func (*SysAPI) GetPath added in v1.1.0

func (c *SysAPI) GetPath() string

func (*SysAPI) GetRemark added in v1.1.0

func (c *SysAPI) GetRemark() string

func (*SysAPI) GetStatus added in v1.1.0

func (c *SysAPI) GetStatus() vobj.Status

func (*SysAPI) MarshalBinary

func (c *SysAPI) MarshalBinary() (data []byte, err error)

MarshalBinary 实现redis存储

func (*SysAPI) String

func (c *SysAPI) String() string

String json string

func (*SysAPI) TableName

func (*SysAPI) TableName() string

TableName SysAPI's table name

func (*SysAPI) UnmarshalBinary

func (c *SysAPI) UnmarshalBinary(data []byte) error

UnmarshalBinary 实现redis存储

type SysDict

type SysDict struct {
	AllFieldModel
	Name         string        `gorm:"column:name;type:varchar(100);not null;uniqueIndex:idx__p__name__dict,priority:1;comment:字典名称"`
	Value        string        `gorm:"column:value;type:varchar(100);not null;default:'';comment:字典键值"`
	DictType     vobj.DictType `` /* 135-byte string literal not displayed */
	ColorType    string        `gorm:"column:color_type;type:varchar(32);not null;default:warning;comment:颜色类型"`
	CSSClass     string        `gorm:"column:css_class;type:varchar(100);not null;default:#165DFF;comment:css 样式"`
	Icon         string        `gorm:"column:icon;type:varchar(500);default:'';comment:图标"`
	ImageURL     string        `gorm:"column:image_url;type:varchar(500);default:'';comment:图片url"`
	Status       vobj.Status   `gorm:"column:status;type:tinyint;not null;default:1;comment:状态 1:开启 2:关闭"`
	LanguageCode vobj.Language `gorm:"column:language_code;type:tinyint;not null;default:1;comment:语言:zh-CN:中文 en-US:英文"`
	Remark       string        `gorm:"column:remark;type:varchar(500);not null;comment:字典备注"`
}

SysDict 字典数据

func (*SysDict) GetCSSClass

func (c *SysDict) GetCSSClass() string

GetCSSClass get css class

func (*SysDict) GetColorType

func (c *SysDict) GetColorType() string

GetColorType get color type

func (*SysDict) GetCreatorID

func (c *SysDict) GetCreatorID() uint32

GetCreatorID get creator id

func (*SysDict) GetDeletedAt

func (c *SysDict) GetDeletedAt() soft_delete.DeletedAt

GetDeletedAt get deleted at

func (*SysDict) GetDictType

func (c *SysDict) GetDictType() vobj.DictType

GetDictType get dict type

func (*SysDict) GetID

func (c *SysDict) GetID() uint32

GetID get id

func (*SysDict) GetIcon

func (c *SysDict) GetIcon() string

GetIcon get icon

func (*SysDict) GetImageURL

func (c *SysDict) GetImageURL() string

GetImageURL get image url

func (*SysDict) GetLanguageCode

func (c *SysDict) GetLanguageCode() vobj.Language

GetLanguageCode get language code

func (*SysDict) GetName

func (c *SysDict) GetName() string

GetName get name

func (*SysDict) GetRemark

func (c *SysDict) GetRemark() string

GetRemark get remark

func (*SysDict) GetStatus

func (c *SysDict) GetStatus() vobj.Status

GetStatus get status

func (*SysDict) GetValue

func (c *SysDict) GetValue() string

GetValue get value

func (*SysDict) String

func (c *SysDict) String() string

String json string

func (*SysDict) TableName

func (*SysDict) TableName() string

TableName SysDict's table name

type SysMenu

type SysMenu struct {
	AllFieldModel
	Name       string        `gorm:"column:name;type:varchar(64);not null;uniqueIndex:idx__menu__name,priority:1;comment:菜单名称" json:"name"`
	EnName     string        `` /* 128-byte string literal not displayed */
	Path       string        `gorm:"column:path;type:varchar(255);not null;uniqueIndex:idx__menu__path,priority:1;comment:api路径" json:"path"`
	Status     vobj.Status   `gorm:"column:status;type:tinyint;not null;comment:状态" json:"status"`
	Type       vobj.MenuType `gorm:"column:status;type:tinyint;not null;comment:菜单类型" json:"type"`
	Icon       string        `gorm:"column:icon;type:varchar(255);not null;comment:图标" json:"icon"`
	Component  string        `gorm:"column:component;type:varchar(255);not null;comment:组件路径" json:"component"`
	Permission string        `gorm:"column:permission;type:varchar(255);not null;comment:权限标识" json:"permission"`
	ParentID   uint32        `gorm:"column:parent_id;type:int unsigned;not null;default:0;comment:父级ID" json:"parent_id"`
	Level      int32         `gorm:"column:level;type:int;not null;comment:层级" json:"level"`
	Sort       int32         `gorm:"column:sort;type:int;not null;comment:排序" json:"sort"`

	Parent *SysMenu `gorm:"foreignKey:ParentID;references:ID" json:"parent"`
}

SysMenu mapped from table <sys_menus>

func (*SysMenu) MarshalBinary

func (c *SysMenu) MarshalBinary() (data []byte, err error)

MarshalBinary redis存储实现

func (*SysMenu) String

func (c *SysMenu) String() string

String json string

func (*SysMenu) TableName

func (*SysMenu) TableName() string

TableName SysAPI's table name

func (*SysMenu) UnmarshalBinary

func (c *SysMenu) UnmarshalBinary(data []byte) error

UnmarshalBinary redis存储实现

type SysOAuthUser

type SysOAuthUser struct {
	AllFieldModel
	OAuthID   uint32        `gorm:"column:oauth_id;type:int unsigned;index:uk__oauth_id__sys_user_id__app,unique" json:"oauth_id"`
	SysUserID uint32        `` /* 138-byte string literal not displayed */
	Row       string        `gorm:"column:row;type:text;comment:github用户信息" json:"row"`
	APP       vobj.OAuthAPP `gorm:"column:app;type:tinyint;not null;comment:oauth应用;index:uk__oauth_id__sys_user_id__app,unique" json:"app"`
}

SysOAuthUser mapped from table <sys_oauth_users>

func (*SysOAuthUser) MarshalBinary

func (c *SysOAuthUser) MarshalBinary() (data []byte, err error)

MarshalBinary redis缓存实现

func (*SysOAuthUser) String

func (c *SysOAuthUser) String() string

String json string

func (*SysOAuthUser) TableName

func (*SysOAuthUser) TableName() string

TableName SysUser's table name

func (*SysOAuthUser) UnmarshalBinary

func (c *SysOAuthUser) UnmarshalBinary(data []byte) error

UnmarshalBinary redis缓存实现

type SysTeam

type SysTeam struct {
	AllFieldModel
	Name     string      `gorm:"column:name;type:varchar(64);not null;uniqueIndex:idx__team__name,priority:1;comment:团队空间名" json:"name"`         // 团队空间名
	Status   vobj.Status `gorm:"column:status;type:int;not null;comment:状态" json:"status"`                                                       // 状态
	Remark   string      `gorm:"column:remark;type:varchar(255);not null;comment:备注" json:"remark"`                                              // 备注
	LeaderID uint32      `gorm:"column:leader_id;type:int unsigned;not null;index:sys_teams__sys_users,priority:1;comment:负责人" json:"leader_id"` // 负责人
	UUID     string      `gorm:"column:uuid;type:varchar(64);not null" json:"uuid"`

	Admins []uint32 `gorm:"-" json:"admins"`
}

SysTeam mapped from table <sys_teams>

func (*SysTeam) MarshalBinary

func (c *SysTeam) MarshalBinary() (data []byte, err error)

MarshalBinary redis存储实现

func (*SysTeam) String

func (c *SysTeam) String() string

String json string

func (*SysTeam) TableName

func (*SysTeam) TableName() string

TableName SysTeam's table name

func (*SysTeam) UnmarshalBinary

func (c *SysTeam) UnmarshalBinary(data []byte) error

UnmarshalBinary redis存储实现

type SysTeamEmail

type SysTeamEmail struct {
	AllFieldModel
	TeamID uint32      `` /* 130-byte string literal not displayed */
	User   string      `gorm:"column:user;type:varchar(255);not null;comment:邮箱" json:"user"`
	Pass   string      `gorm:"column:pass;type:varchar(255);not null;comment:密码" json:"pass"`
	Host   string      `gorm:"column:host;type:varchar(255);not null;comment:主机" json:"host"`
	Port   uint32      `gorm:"column:port;type:int unsigned;not null;comment:端口" json:"port"`
	Remark string      `gorm:"column:remark;type:varchar(255);not null;comment:备注" json:"remark"`
	Status vobj.Status `gorm:"column:status;type:tinyint;not null;default:1;comment:启用状态1:启用;2禁用" json:"status"`
}

SysTeamEmail mapped from table <sys_team_email>

func (*SysTeamEmail) MarshalBinary

func (c *SysTeamEmail) MarshalBinary() (data []byte, err error)

MarshalBinary redis存储实现

func (*SysTeamEmail) String

func (c *SysTeamEmail) String() string

String json string

func (*SysTeamEmail) TableName

func (*SysTeamEmail) TableName() string

TableName SysTeamEmail's table name

func (*SysTeamEmail) UnmarshalBinary

func (c *SysTeamEmail) UnmarshalBinary(data []byte) error

UnmarshalBinary redis存储实现

type SysTeamInvite added in v1.0.2

type SysTeamInvite struct {
	AllFieldModel
	UserID uint32 `` // 系统用户ID
	/* 138-byte string literal not displayed */
	TeamID uint32 `` // 团队ID
	/* 132-byte string literal not displayed */
	InviteType vobj.InviteType `` // 状态
	/* 136-byte string literal not displayed */
	RolesIds *types.Slice[uint32] `gorm:"column:roles_ids;type:varchar(255);not null;comment:团队角色id数组" json:"roles_ids"`
	Role     vobj.Role            `gorm:"column:role;type:int;not null;comment:角色" json:"role"`
}

SysTeamInvite mapped from table <sys_team_invites>

func (*SysTeamInvite) GetRolesIds added in v1.0.2

func (c *SysTeamInvite) GetRolesIds() []uint32

GetRolesIds 获取角色id数组

func (*SysTeamInvite) MarshalBinary added in v1.0.2

func (c *SysTeamInvite) MarshalBinary() (data []byte, err error)

MarshalBinary redis存储实现

func (*SysTeamInvite) String added in v1.0.2

func (c *SysTeamInvite) String() string

String json string

func (*SysTeamInvite) TableName added in v1.0.2

func (*SysTeamInvite) TableName() string

TableName SysTeamInvite's table name

func (*SysTeamInvite) UnmarshalBinary added in v1.0.2

func (c *SysTeamInvite) UnmarshalBinary(data []byte) error

UnmarshalBinary redis存储实现

type SysUser

type SysUser struct {
	AllFieldModel
	Username string      `gorm:"column:username;type:varchar(64);not null;index:idx__sys_user__username,priority:1;comment:用户名" json:"username"` // 用户名
	Nickname string      `gorm:"column:nickname;type:varchar(64);not null;comment:昵称" json:"nickname"`                                           // 昵称
	Password string      `gorm:"column:password;type:varchar(255);not null;comment:密码" json:"-"`                                                 // 密码
	Email    string      `gorm:"column:email;type:varchar(64);not null;comment:邮箱;uniqueIndex:uk__sys_user__email,priority:1;" json:"email"`     // 邮箱
	Phone    string      `gorm:"column:phone;type:varchar(64);not null;index:idx__sys_user__phone,priority:1;comment:手机号" json:"phone"`          // 手机号
	Remark   string      `gorm:"column:remark;type:varchar(255);not null;comment:备注" json:"remark"`                                              // 备注
	Avatar   string      `gorm:"column:avatar;type:varchar(255);not null;comment:头像" json:"avatar"`                                              // 头像
	Salt     string      `gorm:"column:salt;type:varchar(16);not null;comment:盐" json:"-"`                                                       // 盐
	Gender   vobj.Gender `gorm:"column:gender;type:int;not null;comment:性别" json:"gender"`                                                       // 性别
	Role     vobj.Role   `gorm:"column:role;type:int;not null;comment:系统默认角色类型" json:"role"`                                                     // 系统默认角色类型
	Status   vobj.Status `gorm:"column:status;type:int;not null;comment:状态" json:"status"`                                                       // 状态
}

SysUser mapped from table <sys_users>

func (*SysUser) MarshalBinary

func (c *SysUser) MarshalBinary() (data []byte, err error)

MarshalBinary redis缓存实现

func (*SysUser) String

func (c *SysUser) String() string

String json string

func (*SysUser) TableName

func (*SysUser) TableName() string

TableName SysUser's table name

func (*SysUser) UnmarshalBinary

func (c *SysUser) UnmarshalBinary(data []byte) error

UnmarshalBinary redis缓存实现

type SysUserMessage added in v1.0.2

type SysUserMessage struct {
	AllFieldModel
	Content  string               `gorm:"column:name;type:varchar(255);not null;comment:菜单名称" json:"name"`
	Category vobj.UserMessageType `gorm:"column:category;type:tinyint;not null;comment:消息类型" json:"category"`
	UserID   uint32               `gorm:"column:user_id;type:int unsigned;not null;comment:用户ID;index:idx__user_msg__user_id,priority:1;" json:"user_id"`
	Biz      vobj.BizType         `gorm:"column:biz;type:tinyint;not null;comment:业务类型" json:"biz"`
	BizID    uint32               `gorm:"column:biz_id;type:int unsigned;not null;comment:业务ID" json:"biz_id"`

	User *SysUser `gorm:"foreignKey:UserID" json:"user"`
}

SysUserMessage mapped from table <sys_user_messages>

func (*SysUserMessage) MarshalBinary added in v1.0.2

func (c *SysUserMessage) MarshalBinary() (data []byte, err error)

MarshalBinary redis存储实现

func (*SysUserMessage) String added in v1.0.2

func (c *SysUserMessage) String() string

String json string

func (*SysUserMessage) TableName added in v1.0.2

func (*SysUserMessage) TableName() string

TableName SysAPI's table name

func (*SysUserMessage) UnmarshalBinary added in v1.0.2

func (c *SysUserMessage) UnmarshalBinary(data []byte) error

UnmarshalBinary redis存储实现

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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