Documentation
¶
Index ¶
- Variables
- func InitTenant(tx *gorm.DB) error
- func MenuTransferToTreeSlice(list []*Menu) []pkg.TreeImp
- func PasswordReset(ctx context.Context, userID string, password string) error
- func SaveAPI(routes gin.RoutesInfo) error
- func SortMenu(tree MenuList)
- func TaskOnce(id string) error
- func TenantIDScope(ctx *gin.Context) (any, error)
- func UserRegister(ctx *gin.Context, user *User) error
- type API
- type AdminUser
- type AppConfig
- type ArrayString
- type CasbinRule
- type DataScope
- type Department
- type DepartmentList
- type Field
- type FieldFrontend
- type Fields
- type JsonRawMessage
- type Language
- type LanguageDefine
- type LanguageDefines
- type Menu
- func (e *Menu) AddChildren(children []pkg.TreeImp)
- func (e *Menu) AfterDelete(tx *gorm.DB) error
- func (e *Menu) BeforeCreate(tx *gorm.DB) error
- func (e *Menu) BeforeSave(_ *gorm.DB) error
- func (e *Menu) GetIndex() string
- func (e *Menu) GetParentID() string
- func (e *Menu) SortChildren()
- func (*Menu) TableName() string
- type MenuList
- type Metadata
- type Model
- type ModelCreator
- type ModelGormTenant
- type Notice
- type NoticeType
- type Option
- type OptionItem
- type OptionItems
- type Post
- func (e *Post) AddChildren(children []pkg.TreeImp)
- func (e *Post) AfterFind(_ *gorm.DB) error
- func (e *Post) BeforeSave(_ *gorm.DB) error
- func (e *Post) GetAllChildrenID(tx *gorm.DB) []string
- func (e *Post) GetChildrenID(tx *gorm.DB) []string
- func (e *Post) GetIndex() string
- func (e *Post) GetParentID() string
- func (e *Post) SortChildren()
- func (*Post) TableName() string
- type PostList
- type Role
- type Statistics
- func (e *Statistics) Calibrate(ctx *gin.Context, object center.StatisticsObject) error
- func (e *Statistics) NowIncrease(ctx *gin.Context, object center.StatisticsObject) error
- func (e *Statistics) NowReduce(ctx *gin.Context, object center.StatisticsObject) error
- func (*Statistics) TableName() string
- type SystemConfig
- type Tag
- type Task
- func (t *Task) AfterCreate(tx *gorm.DB) error
- func (t *Task) AfterDelete(tx *gorm.DB) error
- func (t *Task) AfterFind(_ *gorm.DB) (err error)
- func (t *Task) AfterUpdate(tx *gorm.DB) error
- func (t *Task) BeforeDelete(_ *gorm.DB) (err error)
- func (t *Task) GetArgs() []string
- func (t *Task) GetCommand() []string
- func (t *Task) Run()
- func (*Task) TableName() string
- type TaskProvider
- type TaskRun
- type TaskRunLog
- type TaskStorage
- func (t *TaskStorage) Get(key string) (entryID cron.EntryID, spec string, job cron.Job, exist bool, err error)
- func (t *TaskStorage) ListKeys() ([]string, error)
- func (t *TaskStorage) Remove(key string) error
- func (t *TaskStorage) Set(key string, entryID cron.EntryID, spec string, job cron.Job) error
- func (t *TaskStorage) Update(key string, entryID cron.EntryID) error
- type Tenant
- func (t *Tenant) AfterCreate(tx *gorm.DB) error
- func (t *Tenant) AfterDelete(tx *gorm.DB) error
- func (t *Tenant) AfterSave(tx *gorm.DB) error
- func (t *Tenant) BeforeSave(_ *gorm.DB) error
- func (t *Tenant) GetDB(ctx *gin.Context, table schema.Tabler) *gorm.DB
- func (t *Tenant) GetDefault() bool
- func (t *Tenant) GetID() any
- func (t *Tenant) GetMigrateDB(ctx *gin.Context, tx *gorm.DB, table schema.Tabler) *gorm.DB
- func (t *Tenant) GetTenant(ctx *gin.Context) (center.TenantImp, error)
- func (t *Tenant) Migrate(tenantImp center.TenantImp, tx *gorm.DB) error
- func (t *Tenant) Scope(ctx *gin.Context, table schema.Tabler) func(db *gorm.DB) *gorm.DB
- func (*Tenant) TableName() string
- type TenantDomain
- type User
- func (e *User) AfterCreate(tx *gorm.DB) error
- func (e *User) AfterDelete(tx *gorm.DB) error
- func (e *User) BeforeCreate(tx *gorm.DB) error
- func (e *User) BeforeSave(*gorm.DB) error
- func (e *User) CheckToken(ctx context.Context, token string) error
- func (e *User) GetUserID() string
- func (e *User) StatisticsCalibrate() (int, error)
- func (*User) StatisticsName() string
- func (*User) StatisticsStep() int
- func (*User) StatisticsTime() string
- func (*User) StatisticsType() string
- func (*User) TableName() string
- type UserAuthToken
- type UserConfig
- type UserLogin
- func (e *UserLogin) GetCustomDepartmentUserID(tx *gorm.DB) []string
- func (e *UserLogin) GetDepartmentAndChildrenUserID(tx *gorm.DB) []string
- func (e *UserLogin) GetDepartmentUserID(tx *gorm.DB) []string
- func (e *UserLogin) GetEmail() string
- func (e *UserLogin) GetPersonAccessToken() string
- func (e *UserLogin) GetPostAndAllChildrenUserID(tx *gorm.DB) []string
- func (e *UserLogin) GetPostAndChildrenUserID(tx *gorm.DB) []string
- func (e *UserLogin) GetPostUserID(tx *gorm.DB) []string
- func (e *UserLogin) GetRefreshTokenDisable() bool
- func (e *UserLogin) GetRoleID() string
- func (e *UserLogin) GetTenantID() string
- func (e *UserLogin) GetUserGithubOAuth2(c *gin.Context) (*UserOAuth2, error)
- func (e *UserLogin) GetUserID() string
- func (e *UserLogin) GetUserLarkOAuth2(c *gin.Context) (*UserOAuth2, error)
- func (e *UserLogin) GetUsername() string
- func (e *UserLogin) Root() bool
- func (e *UserLogin) Scope(ctx *gin.Context, table schema.Tabler) func(db *gorm.DB) *gorm.DB
- func (e *UserLogin) SetPersonAccessToken(token string)
- func (e *UserLogin) SetRefreshTokenDisable(support bool)
- func (e *UserLogin) TableName() string
- func (e *UserLogin) Verify(ctx context.Context) (bool, security.Verifier, error)
- type UserOAuth2
Constants ¶
This section is empty.
Variables ¶
View Source
var BeforeGithubVerify func(ctx context.Context, user *pkg.GithubUser, token string) error
View Source
var TaskFuncMap = make(map[string]pkg.TaskFunc)
Functions ¶
func InitTenant ¶
func MenuTransferToTreeSlice ¶
func PasswordReset ¶
PasswordReset reset password
func SaveAPI ¶
func SaveAPI(routes gin.RoutesInfo) error
func TenantIDScope ¶
TenantIDScope get tenant id scope
Types ¶
type API ¶
type AppConfig ¶
type AppConfig struct {
ModelGormTenant
// Name 名称
Name string `gorm:"column:name;size:128;index;default:'';not null" json:"name" binding:"required"`
// Group 分组
Group string `gorm:"column:group;size:128;index;default:'';not null" json:"group" binding:"required"`
// Value 值
Value string `gorm:"column:value;size:255;default:'';not null" json:"value"`
// Auth 是否需要认证 如果为true,只有登录后才会返回
Auth bool `gorm:"column:auth;default:false;not null" json:"auth"`
}
func (*AppConfig) GetAppConfig ¶
func (*AppConfig) SetAppConfig ¶
type ArrayString ¶
type ArrayString []string
func (*ArrayString) Scan ¶
func (a *ArrayString) Scan(val any) error
type CasbinRule ¶
type CasbinRule struct {
ID int `json:"id" gorm:"column:id"`
PType string `json:"ptype" gorm:"column:ptype"`
V0 string `json:"v0" gorm:"column:v0"`
V1 string `json:"v1" gorm:"column:v1"`
V2 string `json:"v2" gorm:"column:v2"`
V3 string `json:"v3" gorm:"column:v3"`
V4 string `json:"v4" gorm:"column:v4"`
V5 string `json:"v5" gorm:"column:v5"`
}
func (*CasbinRule) TableName ¶
func (*CasbinRule) TableName() string
type DataScope ¶
type DataScope string
const ( // DataScopeAll 全部数据权限 DataScopeAll DataScope = "all" // DataScopeCurrentDept 当前部门数据权限 DataScopeCurrentDept DataScope = "currentDept" // DataScopeCurrentAndChildrenDept 当前部门及以下数据权限 DataScopeCurrentAndChildrenDept DataScope = "currentAndChildrenDept" // DataScopeCustomDept 自定义部门 DataScopeCustomDept DataScope = "customDept" // DataScopeSelf 自己数据权限 DataScopeSelf DataScope = "self" // DataScopeSelfAndChildren 自己和直属下级 DataScopeSelfAndChildren DataScope = "selfAndChildren" // DataScopeSelfAndAllChildren 自己和全部下级 DataScopeSelfAndAllChildren DataScope = "selfAndAllChildren" )
type Department ¶
type Department struct {
ModelGormTenant
// ParentID 父级id
ParentID string `json:"parentID,omitempty" gorm:"column:parent_id;comment:父级id;type:varchar(255);default:'';index"`
// Name 部门名称
Name string `json:"name" gorm:"column:name;comment:部门名称;type:varchar(255);not null"`
// LeaderID 部分负责人ID
LeaderID string `json:"leaderID" gorm:"column:leader_id;comment:部分负责人id;type:varchar(64)"`
// Phone 联系电话
Phone string `json:"phone" gorm:"column:phone;comment:联系电话;type:varchar(255)"`
// Email 邮箱
Email string `json:"email" gorm:"column:email;comment:邮箱;type:varchar(255)"`
// Code 部门编码
Code string `json:"code" gorm:"column:code;comment:部门编码;type:varchar(255);not null"`
// Status 状态
Status enum.Status `json:"status" gorm:"column:status;comment:状态;size:10"`
// Sort 排序
Sort int `json:"sort" gorm:"column:sort;comment:排序;size:5;defualt:0"`
// Children 子部门
Children []*Department `json:"children,omitempty" gorm:"foreignKey:ParentID;references:ID" swaggerignore:"true"`
}
func (*Department) AddChildren ¶
func (e *Department) AddChildren(children []pkg.TreeImp)
func (*Department) GetAllChildrenID ¶
func (e *Department) GetAllChildrenID(tx *gorm.DB) []string
func (*Department) GetIndex ¶
func (e *Department) GetIndex() string
func (*Department) GetParentID ¶
func (e *Department) GetParentID() string
func (*Department) SortChildren ¶
func (e *Department) SortChildren()
func (*Department) TableName ¶
func (*Department) TableName() string
type DepartmentList ¶
type DepartmentList []*Department
func (DepartmentList) Len ¶
func (x DepartmentList) Len() int
func (DepartmentList) Less ¶
func (x DepartmentList) Less(i, j int) bool
func (DepartmentList) Swap ¶
func (x DepartmentList) Swap(i, j int)
type Field ¶
type Field struct {
actions.ModelGorm
ModelID string `gorm:"column:model_id;type:varchar(64);not null;index;comment:模型id" json:"modelID"`
Name string `gorm:"column:name;type:varchar(64);not null;comment:名称" json:"name"`
AssociationsID string `gorm:"column:associations_id;type:varchar(64);comment:关联id" json:"associationsID"`
JsonTag string `gorm:"column:json_tag;type:varchar(64);not null;comment:json标签" json:"jsonTag"`
Label string `gorm:"column:label;type:varchar(64);not null;comment:标签" json:"label"`
Type string `gorm:"column:type;type:varchar(64);not null;comment:数据类型" json:"type"`
Size int `gorm:"column:size;type:int;default:0;comment:大小" json:"size"`
Sort uint `gorm:"column:sort;type:int;default:0;comment:排序" json:"sort"`
PrimaryKey string `gorm:"column:primary_key;type:varchar(100);default:'';comment:主键" json:"primaryKey"`
UniqueIndex string `gorm:"column:unique_index;type:varchar(100);default:'';comment:唯一" json:"unique"`
Index string `gorm:"column:index;type:varchar(100);default:'';comment:索引" json:"index"`
Default string `gorm:"column:default;type:varchar(255);not null;comment:默认值" json:"default"`
Comment string `gorm:"column:comment;type:varchar(255);not null;comment:注释" json:"comment"`
Search string `gorm:"column:search;type:varchar(64);not null;comment:搜索类型" json:"search"`
NotNull bool `gorm:"column:not_null;size:1;not null;comment:是否非空" json:"notNull"`
ValueEnumName string `gorm:"column:value_enum_name;type:varchar(64);not null;comment:枚举值名称" json:"valueEnumName"`
*FieldFrontend `gorm:"column:field_frontend;type:json;comment:前端配置"`
}
type FieldFrontend ¶
type FieldFrontend struct {
HideInTable bool `json:"hideInTable,omitempty"`
HideInForm bool `json:"hideInForm,omitempty"`
HideInDescriptions bool `json:"hideInDescriptions,omitempty"`
Width string `json:"width,omitempty"`
Rules []pkg.BaseRule `json:"rules,omitempty"`
FormComponent string `json:"formComponent,omitempty"`
TableComponent string `json:"tableComponent,omitempty"`
}
func (*FieldFrontend) Scan ¶
func (f *FieldFrontend) Scan(val any) error
type JsonRawMessage ¶ added in v0.4.7
type JsonRawMessage string
func (*JsonRawMessage) Scan ¶ added in v0.4.7
func (j *JsonRawMessage) Scan(val any) error
type Language ¶
type Language struct {
ModelGormTenant
// Name 名称
Name string `json:"name" gorm:"column:name;comment:名称;type:varchar(255);not null" binding:"required"`
// Remark 备注
Remark string `json:"remark" gorm:"column:remark;comment:备注;type:varchar(255);not null"`
// Statue 状态
Status enum.Status `json:"status" gorm:"column:status;comment:状态;size:10"`
// Defines
Defines *LanguageDefines `json:"defines,omitempty" gorm:"column:defines;comment:定义;type:json"`
}
type LanguageDefine ¶
type LanguageDefine struct {
// ID 主键
ID string `json:"id"`
// Group 分组
Group string `json:"group" gorm:"column:group;comment:分组;type:varchar(20);not null" binding:"required"`
// Key 键
Key string `json:"key" gorm:"column:key;comment:键;type:varchar(20);not null" binding:"required"`
// Value 值
Value string `json:"value" gorm:"column:value;comment:值;type:varchar(100);not null" binding:"required"`
}
type LanguageDefines ¶
type LanguageDefines []*LanguageDefine
func (*LanguageDefines) Scan ¶
func (l *LanguageDefines) Scan(val any) error
type Menu ¶
type Menu struct {
ModelGormTenant
// ParentID 父级id
ParentID string `json:"parentID,omitempty" gorm:"column:parent_id;comment:父级id;type:varchar(255);default:'';index"`
// Name 菜单名称
Name string `json:"name" gorm:"column:name;comment:菜单名称;type:varchar(255);not null"`
// Path 路由
Path string `json:"path" gorm:"column:path;comment:菜单路径;type:varchar(255);not null"`
// Method 请求方法
Method string `json:"method" gorm:"column:method;comment:请求方法;type:varchar(10);default:'GET'"`
// Component 组件
Component string `json:"component" gorm:"column:component;comment:菜单组件;type:varchar(255);not null"`
// Icon 图标
Icon string `json:"icon" gorm:"column:icon;comment:菜单图标;type:varchar(255);not null"`
// Target 新页面打开
Target string `json:"target" gorm:"column:target;comment:菜单打开方式;type:varchar(255);not null"`
// HeaderRender 不展示顶栏
HeaderRender bool `json:"headerRender,omitempty" gorm:"column:header_render;comment:是否显示在头部;size:1;not null"`
FooterRender bool `json:"footerRender,omitempty" gorm:"column:footer_render;comment:是否显示在底部;size:1;not null"`
// MenuRender 不展示菜单
MenuRender bool `json:"menuRender,omitempty" gorm:"column:menu_render;comment:是否显示在菜单;size:1;not null"`
// MenuHeaderRender 不展示菜单头部
MenuHeaderRender bool `json:"menuHeaderRender,omitempty" gorm:"column:menu_header_render;comment:是否显示在菜单头部;size:1;not null"`
// Access 权限配置,需要与 plugin-access 插件配合使用
Access string `json:"access,omitempty" gorm:"-"`
// HideChildrenInMenu 隐藏子菜单
HideChildrenInMenu bool `json:"hideChildrenInMenu,omitempty" gorm:"column:hide_children_in_menu;comment:是否隐藏子菜单;size:1;not null"`
// HideInMenu 隐藏自己和子菜单
HideInMenu bool `json:"hideInMenu,omitempty" gorm:"column:hide_in_menu;comment:是否隐藏菜单;size:1;not null"`
// HideInBreadcrumb 在面包屑中隐藏
HideInBreadcrumb bool `json:"hideInBreadcrumb,omitempty" gorm:"column:hide_in_breadcrumb;comment:是否隐藏面包屑;size:1;not null"`
// FlatMenu 子项往上提,仍旧展示
FlatMenu bool `json:"flatMenu,omitempty" gorm:"column:flat_menu;comment:是否平级菜单;size:1;not null"`
// FixedHeader 固定顶栏
FixedHeader bool `json:"fixedHeader,omitempty" gorm:"column:fixed_header;comment:是否固定头部;size:1;not null"`
// FixedSideBar 固定菜单
FixSiderbar bool `json:"fixSiderbar,omitempty" gorm:"column:fix_siderbar;comment:是否固定菜单;size:1;not null"`
NavTheme string `json:"navTheme,omitempty" gorm:"column:nav_theme;comment:菜单主题;type:varchar(255);not null"`
// Layout 导航菜单的位置, side 为正常模式,top菜单显示在顶部,mix 两种兼有
Layout string `json:"layout,omitempty" gorm:"column:layout;comment:布局;type:varchar(255);not null"`
// HeaderTheme 顶部导航的主题,mix 模式生效
HeaderTheme string `json:"headerTheme,omitempty" gorm:"column:header_theme;comment:头部主题;type:varchar(255);not null"`
// Type 菜单类型
Type pkg.AccessType `json:"type" gorm:"column:type;comment:菜单类型;type:varchar(20);not null"`
// Permission 菜单权限
Permission string `json:"permission" gorm:"column:permission;comment:菜单权限;type:varchar(255);not null"`
// Status 状态
Status enum.Status `json:"status" gorm:"column:status;comment:状态;size:10"`
// Sort 排序
Sort int `json:"sort" gorm:"column:sort;comment:排序;size:11;not null;default:0"`
// Children 子菜单
Children []*Menu `json:"children,omitempty" gorm:"foreignKey:ParentID;references:ID" swaggerignore:"true"`
ParentPath string `json:"parentPath" gorm:"-" swaggerignore:"true"`
}
func TreeTransferToMenuSlice ¶
func (*Menu) AddChildren ¶
func (*Menu) GetParentID ¶
func (*Menu) SortChildren ¶
func (e *Menu) SortChildren()
type Model ¶
type Model struct {
actions.ModelGorm
Name string `gorm:"column:name;type:varchar(255);not null;comment:名称" json:"name"`
Description string `gorm:"column:description;type:text;not null;comment:描述" json:"description"`
HardDeleted bool `gorm:"column:hard_deleted;size:1;not null;default:0;comment:是否硬删除" json:"hardDeleted"`
Table string `gorm:"column:table_name;type:varchar(255);not null;comment:表名" json:"table"`
Path string `gorm:"column:path;type:varchar(255);not null;comment:http路径" json:"path"`
Fields []*Field `gorm:"foreignKey:ModelID;references:ID" json:"fields"`
MultiTenant bool `gorm:"column:multi_tenant;size:1;default:0;comment:多租户" json:"multiTenant"`
Auth bool `gorm:"column:auth;size:1;default:0;comment:是否需要认证" json:"auth"`
GeneratedData bool `gorm:"column:generated_data;size:1;not null;default:0;comment:是否生成数据" json:"generatedData"`
}
func (*Model) MakeVirtualModel ¶
type ModelCreator ¶
type ModelCreator struct {
// CreatorID creator id
CreatorID string `gorm:"column:creator_id;type:varchar(64);not null;index;comment:创建人ID" json:"creatorID"`
}
type ModelGormTenant ¶
type ModelGormTenant struct {
actions.ModelGorm
// TenantID tenant id
TenantID string `gorm:"column:tenant_id;type:varchar(64);not null;index;comment:租户ID" json:"tenantID"`
}
ModelGormTenant model gorm support multi tenant
func (*ModelGormTenant) BeforeCreate ¶
func (e *ModelGormTenant) BeforeCreate(tx *gorm.DB) (err error)
func (*ModelGormTenant) BeforeDelete ¶
func (e *ModelGormTenant) BeforeDelete(tx *gorm.DB) error
type Notice ¶
type Notice struct {
ModelGormTenant
UserID string `json:"userID" gorm:"column:user_id;type:varchar(64)"`
Title string `json:"title" gorm:"column:title;type:varchar(255)"`
Key string `json:"key" gorm:"column:key;type:varchar(255)"`
Read bool `json:"read" gorm:"column:read;size:1"`
Avatar string `json:"avatar" gorm:"column:avatar;type:varchar(255)"`
Extra string `json:"extra" gorm:"column:extra;type:varchar(255)"`
Status string `json:"status" gorm:"column:status;size:10"`
Description string `json:"description" gorm:"column:description;type:text"`
Datetime *time.Time `json:"datetime" gorm:"column:datetime"`
Type NoticeType `json:"type" gorm:"column:type;type:varchar(20)"`
}
type NoticeType ¶
type NoticeType string
const ( NoticeTypeNotification NoticeType = "notification" NoticeTypeMessage NoticeType = "message" NoticeTypeEvent NoticeType = "event" NoticeTypeMail NoticeType = "mail" )
func (NoticeType) String ¶
func (e NoticeType) String() string
type Option ¶
type Option struct {
ModelGormTenant
// Name 选项名称
Name string `json:"name" gorm:"column:name;type:varchar(255);not null;unique_index:idx_name;comment:选项名称"`
// Remark 备注
Remark string `json:"remark" gorm:"column:remark;type:varchar(255);not null;comment:备注"`
// Items 选项内容
Items *OptionItems `json:"items" gorm:"column:items;type:json;comment:选项内容"`
// Status 状态
Status enum.Status `json:"status" gorm:"column:status;comment:状态;size:10"`
}
type OptionItem ¶
type OptionItems ¶
type OptionItems []*OptionItem
func (*OptionItems) Scan ¶
func (o *OptionItems) Scan(val any) error
type Post ¶
type Post struct {
ModelGormTenant
// ParentID 父级id
ParentID string `json:"parentID,omitempty" gorm:"column:parent_id;comment:父级id;type:varchar(255);default:'';index"`
// Name 岗位名称
Name string `json:"name" gorm:"column:name;comment:岗位名称;type:varchar(255);not null"`
// Code 岗位编码
Code string `json:"code" gorm:"column:code;comment:岗位编码;type:varchar(255);not null"`
// Status 状态
Status enum.Status `json:"status" gorm:"column:status;comment:状态;size:10"`
// Sort 排序
Sort int `json:"sort" gorm:"column:sort;comment:排序;type:int;size:5;defualt:0"`
// DataScope 数据权限
DataScope DataScope `json:"dataScope" gorm:"column:data_scope;comment:数据权限;type:varchar(50)"`
// DeptIDS 部门id
DeptIDS string `json:"-" gorm:"column:dept_ids;comment:部门id;type:varchar(255)"` // 部门id
// DeptIDSArr 部门id数组
DeptIDSArr []string `json:"deptIDS" gorm:"-"`
// Children 子岗位
Children []*Post `json:"children,omitempty" gorm:"foreignKey:ParentID;references:ID" swaggerignore:"true"`
}
func (*Post) AddChildren ¶
func (*Post) GetParentID ¶
func (*Post) SortChildren ¶
func (e *Post) SortChildren()
type Role ¶
type Statistics ¶
type Statistics struct {
ModelGormTenant
// Name 统计名称
Name string `gorm:"column:name;type:varchar(255);not null;comment:统计名称" json:"name"`
// Type 统计类型
Type string `gorm:"column:type;type:varchar(255);not null;comment:统计类型" json:"type"`
// Value 统计值 * 100
Value int `gorm:"column:value;type:int;not null;comment:统计值 * 100" json:"value"`
// Time 统计时间
Time string `gorm:"column:time;type:varchar(50);not null;comment:统计时间" json:"time"`
}
func (*Statistics) Calibrate ¶
func (e *Statistics) Calibrate(ctx *gin.Context, object center.StatisticsObject) error
func (*Statistics) NowIncrease ¶
func (e *Statistics) NowIncrease(ctx *gin.Context, object center.StatisticsObject) error
func (*Statistics) NowReduce ¶
func (e *Statistics) NowReduce(ctx *gin.Context, object center.StatisticsObject) error
func (*Statistics) TableName ¶
func (*Statistics) TableName() string
type SystemConfig ¶
type SystemConfig struct {
actions.ModelGorm
// Name 名称
Name string `gorm:"column:name;size:128;index;default:'';not null" json:"name" binding:"required"`
// Ext 扩展名
Ext source.Scheme `gorm:"column:ext;size:16;default:'';not null" json:"ext" binding:"required"`
// Content 内容
Content string `gorm:"column:content;type:text" json:"content"`
// remark 备注
Remark string `gorm:"column:remark;size:255;default:'';not null" json:"remark"`
// 内置配置
BuiltIn bool `gorm:"->" json:"isBuiltIn"`
}
func (*SystemConfig) GenerateBytes ¶
func (e *SystemConfig) GenerateBytes() ([]byte, error)
GenerateBytes generate bytes
func (*SystemConfig) GetExtend ¶
func (e *SystemConfig) GetExtend() source.Scheme
func (*SystemConfig) TableName ¶
func (*SystemConfig) TableName() string
type Task ¶
type Task struct {
ModelGormTenant
ModelCreator
Name string `json:"name" gorm:"type:varchar(255);not null;comment:任务名称"`
Namespace string `json:"namespace" gorm:"type:varchar(255);not null;comment:命名空间"`
Cluster string `json:"cluster" gorm:"type:varchar(50);comment:集群"`
Provider TaskProvider `json:"provider" gorm:"type:varchar(255);not null;comment:提供者"`
Image string `json:"image" gorm:"type:varchar(255);not null;default:default;comment:镜像"`
EntryID int `json:"entryID" gorm:"size:10;comment:任务ID"`
Spec string `json:"spec" gorm:"type:varchar(255);not null;comment:任务规则"`
Command JsonRawMessage `json:"command" gorm:"type:varchar(255);not null;comment:命令"`
Args JsonRawMessage `json:"args" gorm:"type:text"`
Once bool `json:"once" gorm:"-"`
Protocol string `json:"protocol" gorm:"size:10"`
Endpoint string `json:"endpoint" gorm:"type:varchar(255);not null;comment:地址"`
Body string `json:"body" gorm:"type:bytes"`
Status enum.Status `json:"status" gorm:"size:10"`
Remark string `json:"remark" gorm:"type:text"`
CheckedAtR *time.Time `gorm:"-" json:"checkedAt"`
CheckedAt sql.NullTime `gorm:"index" swaggertype:"string" json:"-"`
Timeout int `json:"timeout"`
Method string `gorm:"size:10" json:"method"`
Python string `json:"python"`
Metadata string `json:"metadata" gorm:"type:bytes"`
}
Task support http/grpc/script
func (*Task) GetCommand ¶ added in v0.4.6
type TaskProvider ¶ added in v0.4.6
type TaskProvider string
const ( TaskProviderDefault TaskProvider = "default" TaskProviderK8S TaskProvider = "k8s" TaskProviderFunc TaskProvider = "func" )
type TaskRun ¶
type TaskRun struct {
ID string `gorm:"primarykey" json:"id" form:"id" query:"id"`
CreatedAt time.Time `json:"createdAt"`
TaskID string `json:"taskID" gorm:"index;foreignKey:TaskID;references:ID"`
Status enum.Status `json:"status" gorm:"size:10"`
}
TaskRun support http/grpc/script status: 0: unknown, 1: success, 2: fail, 3: running
type TaskRunLog ¶
type TaskRunLog struct {
ID string `gorm:"primarykey" json:"id" form:"id" query:"id"`
TaskRunID string `json:"taskRunID" gorm:"index;foreignKey:TaskRunID;references:ID"`
CreatedAt time.Time `json:"createdAt"`
Content string `json:"content" gorm:"type:text"`
}
func (*TaskRunLog) BeforeCreate ¶
func (l *TaskRunLog) BeforeCreate(_ *gorm.DB) (err error)
func (*TaskRunLog) TableName ¶
func (*TaskRunLog) TableName() string
type TaskStorage ¶
func (*TaskStorage) Get ¶
func (t *TaskStorage) Get(key string) (entryID cron.EntryID, spec string, job cron.Job, exist bool, err error)
func (*TaskStorage) ListKeys ¶
func (t *TaskStorage) ListKeys() ([]string, error)
func (*TaskStorage) Remove ¶
func (t *TaskStorage) Remove(key string) error
func (*TaskStorage) Set ¶
func (t *TaskStorage) Set(key string, entryID cron.EntryID, spec string, job cron.Job) error
func (*TaskStorage) Update ¶
func (t *TaskStorage) Update(key string, entryID cron.EntryID) error
type Tenant ¶
type Tenant struct {
actions.ModelGorm
Name string `gorm:"column:name;type:varchar(255);not null;comment:租户名称" json:"name"`
Remark string `gorm:"column:remark;type:varchar(255);not null;comment:备注" json:"remark"`
Default bool `gorm:"column:default;size:1;comment:是否是默认租户;->" json:"default"`
Domains []*TenantDomain `gorm:"foreignKey:TenantID;references:ID" json:"domains"`
Status enum.Status `gorm:"column:status;type:varchar(10);not null;default:enabled;comment:状态" json:"status"`
Expire *time.Time `gorm:"column:expire;comment:过期时间" json:"expire"`
AdminUser `gorm:"-" json:",inline"`
}
func (*Tenant) GetDefault ¶ added in v0.4.4
func (*Tenant) GetMigrateDB ¶
type TenantDomain ¶
type TenantDomain struct {
actions.ModelGorm
TenantID string `gorm:"column:tenant_id;type:varchar(64);not null;index;comment:租户ID" json:"tenantId"`
Name string `gorm:"column:name;type:varchar(255);not null;index;comment:名称" json:"name"`
Domain string `gorm:"column:domain;type:varchar(255);not null;index;comment:域名" json:"domain"`
}
func (*TenantDomain) TableName ¶
func (*TenantDomain) TableName() string
type User ¶
type User struct {
ModelGormTenant
UserLogin `json:",inline"`
Name string `json:"name" gorm:"column:name;type:varchar(100)"`
Avatar string `json:"avatar" gorm:"column:avatar;type:varchar(255)"`
Signature string `json:"signature" gorm:"column:signature;type:varchar(255)"`
Title string `json:"title" gorm:"column:title;type:varchar(100)"`
Group string `json:"group" gorm:"column:group;type:varchar(255)"`
Country string `json:"country" gorm:"column:country;type:varchar(20)"`
Province string `json:"province" gorm:"column:province;type:varchar(20)"`
City string `json:"city" gorm:"column:city;type:varchar(20)"`
Address string `json:"address" gorm:"column:address;type:varchar(255)"`
Phone string `json:"phone" gorm:"column:phone;type:varchar(20)"`
Profile string `json:"profile" gorm:"column:profile;type:bytes"`
Tags ArrayString `json:"tags" swaggertype:"array,string" gorm:"type:text"`
Permissions map[string]bool `json:"permissions" gorm:"-"`
}
func GetUserByEmail ¶ added in v0.4.6
GetUserByEmail get user by email
func GetUserByUsername ¶
GetUserByUsername get user by username
func (*User) CheckToken ¶ added in v0.4.5
func (*User) StatisticsCalibrate ¶
StatisticsCalibrate statistics calibrate
func (*User) StatisticsStep ¶
type UserAuthToken ¶ added in v0.4.5
type UserAuthToken struct {
ModelGormTenant
UserID string `gorm:"type:varchar(64);index;comment:用户ID" json:"userID"`
Token string `gorm:"type:text;comment:token" json:"token"`
ExpiredAt time.Time `gorm:"index;comment:过期时间" json:"expiredAt"`
Revoked bool `gorm:"index;comment:是否撤销" json:"revoked"`
}
func GenerateUserAuthToken ¶ added in v0.4.5
func GenerateUserAuthToken(ctx *gin.Context, verify security.Verifier, validityPeriod time.Duration) (*UserAuthToken, error)
GenerateUserAuthToken 生成用户令牌
func (*UserAuthToken) TableName ¶ added in v0.4.5
func (*UserAuthToken) TableName() string
type UserConfig ¶
type UserConfig struct {
ModelGormTenant
// UserID 用户id
UserID string `json:"userID" gorm:"size:64;index;default:'';not null;comment:用户id" binding:"required"`
// Name 名称
Name string `json:"name" gorm:"size:128;index;default:'';not null;comment:名称" binding:"required"`
// Group 分组
Group string `json:"group" gorm:"size:128;default:'';not null;comment:分组" binding:"required"`
// Value 值
Value string `json:"value" gorm:"size:255;default:'';not null;comment:值"`
}
func (*UserConfig) GetUserConfig ¶
func (*UserConfig) SetUserConfig ¶
func (*UserConfig) TableName ¶
func (*UserConfig) TableName() string
type UserLogin ¶
type UserLogin struct {
RoleID string `json:"roleID" gorm:"index;type:varchar(64)" swaggerignore:"true"`
Role *Role `json:"role" gorm:"foreignKey:RoleID;references:ID"`
PostID string `json:"postID" gorm:"index;type:varchar(64)" swaggerignore:"true"`
Post *Post `json:"post" gorm:"foreignKey:PostID;references:ID"`
DepartmentID string `json:"departmentID" gorm:"index;type:varchar(64)" swaggerignore:"true"`
Department *Department `json:"department" gorm:"foreignKey:DepartmentID;references:ID"`
Username string `json:"username" gorm:"type:varchar(20);index"`
Email string `json:"email" gorm:"type:varchar(100);index"`
Password string `json:"password,omitempty" gorm:"-"`
PasswordHash string `json:"-" gorm:"size:255;comment:密码hash" swaggerignore:"true"`
PasswordStrength string `json:"passwordStrength" gorm:"size:20;comment:密码强度"`
Salt string `json:"-" gorm:"size:255;comment:加盐" swaggerignore:"true"`
Status enum.Status `json:"status" gorm:"size:10"`
OAuth2 []*UserOAuth2 `json:"oauth2" gorm:"foreignKey:UserID;references:ID"`
Provider pkg.LoginProvider `json:"type" gorm:"-"`
RefreshTokenDisable bool `json:"-" gorm:"-"`
PersonAccessToken string `json:"-" gorm:"-"`
Captcha string `json:"captcha" gorm:"-"`
}
func (*UserLogin) GetCustomDepartmentUserID ¶
func (*UserLogin) GetDepartmentAndChildrenUserID ¶
func (*UserLogin) GetDepartmentUserID ¶
func (*UserLogin) GetPersonAccessToken ¶ added in v0.4.5
func (*UserLogin) GetPostAndAllChildrenUserID ¶
func (*UserLogin) GetPostAndChildrenUserID ¶
func (*UserLogin) GetRefreshTokenDisable ¶ added in v0.4.5
func (*UserLogin) GetTenantID ¶
func (*UserLogin) GetUserGithubOAuth2 ¶ added in v0.4.7
func (e *UserLogin) GetUserGithubOAuth2(c *gin.Context) (*UserOAuth2, error)
func (*UserLogin) GetUserLarkOAuth2 ¶ added in v0.4.7
func (e *UserLogin) GetUserLarkOAuth2(c *gin.Context) (*UserOAuth2, error)
func (*UserLogin) GetUsername ¶
func (*UserLogin) SetPersonAccessToken ¶ added in v0.4.5
func (*UserLogin) SetRefreshTokenDisable ¶ added in v0.4.5
type UserOAuth2 ¶
type UserOAuth2 struct {
ModelGormTenant
User *User `json:"user" gorm:"foreignKey:UserID;references:ID" swaggerignore:"true"`
UserID string `json:"user_id" gorm:"size:64"`
OpenID string `json:"openID" gorm:"size:64"`
UnionID string `json:"unionID" gorm:"column:union_id;size:64"`
Sub string `json:"sub" gorm:"size:255;comment:主题"`
Name string `json:"name" gorm:"size:255;comment:名称"`
GivenName string `json:"given_name" gorm:"size:255;comment:名"`
FamilyName string `json:"family_name" gorm:"size:255;comment:姓"`
MiddleName string `json:"middle_name" gorm:"size:255;comment:中间名"`
NickName string `json:"nickname" gorm:"size:255;comment:昵称"`
PreferredUsername string `json:"preferred_username" gorm:"size:255;comment:首选用户名"`
Profile string `json:"profile" gorm:"size:255;comment:个人资料"`
Picture string `json:"picture" gorm:"size:255;comment:图片"`
Website string `json:"website" gorm:"size:255;comment:网站"`
Email string `json:"email" gorm:"size:255;comment:邮箱"`
EmailVerified bool `json:"email_verified" gorm:"default:false;comment:邮箱是否验证"`
Gender string `json:"gender" gorm:"size:255;comment:性别"`
Birthdata string `json:"birthdata" gorm:"size:255;comment:出生日期"`
Zoneinfo string `json:"zoneinfo" gorm:"size:255;comment:时区"`
Locale string `json:"locale" gorm:"size:255;comment:语言"`
PhoneNumber string `json:"phone_number" gorm:"size:255;comment:手机号"`
PhoneNumberVerified bool `json:"phone_number_verified" gorm:"default:false;comment:手机号是否验证"`
Address string `json:"address" gorm:"size:255;comment:地址"`
EmployeeNO string `json:"employee_no" gorm:"column:employee_no;size:255;comment:员工编号"`
Provider pkg.LoginProvider `json:"type" gorm:"size:20;comment:登录类型"`
}
func (*UserOAuth2) TableName ¶
func (*UserOAuth2) TableName() string
Click to show internal directories.
Click to hide internal directories.