model

package
v0.0.0-...-10cedd8 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SysUserOrder = iota
	MenuAuthorityOrder
	SysBaseMenuOrder
	SysAuthorityOrder
	SysApisInitOrder
	CasbinInitOrder
	OperatorationOrder
	WorkFlowOrder
)

初始化顺序

Variables

View Source
var CasbinApi = buildCasbinRule(SysApis)
View Source
var InitializerList []*OrderedInitializer
View Source
var SysApis = []SysApi{

	{Path: "/api/sysApi/getAPiList", Description: "获取系统API列表", ApiGroup: "系统", Method: "GET"},

	{Path: "/api/user/login", Description: "用户登录", ApiGroup: "用户", Method: "POST"},
	{Path: "/api/user/loginout", Description: "用户退出", ApiGroup: "用户", Method: "GET"},
	{Path: "/api/user/getinfo", Description: "获取用户信息", ApiGroup: "用户", Method: "GET"},
	{Path: "/api/user/:id/set_auth", Description: "设置用户权限", ApiGroup: "用户", Method: "PUT"},
	{Path: "/api/user/:id/delete_user", Description: "删除用户", ApiGroup: "用户", Method: "DELETE"},
	{Path: "/api/user/:id/change_pwd", Description: "修改密码", ApiGroup: "用户", Method: "POST"},
	{Path: "/api/user/:id/reset_pwd", Description: "重置密码", ApiGroup: "用户", Method: "PUT"},

	{Path: "/api/operation/get_operations", Description: "查询操作记录列表", ApiGroup: "操作审计", Method: "GET"},
	{Path: "/api/operation/:id/delete_operation", Description: "删除单条记录", ApiGroup: "操作审计", Method: "DELETE"},
	{Path: "/api/operation/delete_operations", Description: "批量删除记录", ApiGroup: "操作审计", Method: "POST"},

	{Path: "/api/swagger/*any", Description: "swagger文档", ApiGroup: "Other", Method: "GET"},

	{Path: "/api/menu/:authID/getMenuByAuthID", Description: "根据角色获取菜单", ApiGroup: "菜单", Method: "GET"},
	{Path: "/api/menu/getBaseMenuTree", Description: "获取菜单总树", ApiGroup: "菜单", Method: "GET"},
	{Path: "/api/menu/add_base_menu", Description: "添加菜单", ApiGroup: "菜单", Method: "POST"},
	{Path: "/api/menu/add_menu_authority", Description: "添加角色", ApiGroup: "菜单", Method: "POST"},

	{Path: "/api/authority/getPolicyPathByAuthorityId", Description: "获取角色api权限", ApiGroup: "权限", Method: "GET"},
	{Path: "/api/authority/updateCasbinByAuthority", Description: "更改角色api权限", ApiGroup: "用户", Method: "POST"},
	{Path: "/api/authority/getAuthorityList", Description: "获取角色列表", ApiGroup: "权限", Method: "GET"},

	{Path: "/api/k8s/deployment/create", Description: "创建deployment", ApiGroup: "Kubernetes", Method: "POST"},
	{Path: "/api/k8s/deployment/del", Description: "删除deployment", ApiGroup: "Kubernetes", Method: "DELETE"},
	{Path: "/api/k8s/deployment/update", Description: "更新deployment", ApiGroup: "Kubernetes", Method: "PUT"},
	{Path: "/api/k8s/deployment/list", Description: "查询deployment列表", ApiGroup: "Kubernetes", Method: "GET"},
	{Path: "/api/k8s/deployment/detail", Description: "查询deployment详情", ApiGroup: "Kubernetes", Method: "GET"},
	{Path: "/api/k8s/deployment/restart", Description: "重启deployment", ApiGroup: "Kubernetes", Method: "PUT"},
	{Path: "/api/k8s/deployment/scale", Description: "deployment扩缩容", ApiGroup: "Kubernetes", Method: "GET"},
	{Path: "/api/k8s/deployment/numnp", Description: "查询deployment数量信息", ApiGroup: "Kubernetes", Method: "GET"},
	{Path: "/api/k8s/pod/list", Description: "查询pod列表", ApiGroup: "Kubernetes", Method: "GET"},
	{Path: "/api/k8s/pod/detail", Description: "查询pod详情", ApiGroup: "Kubernetes", Method: "GET"},
	{Path: "/api/k8s/pod/del", Description: "删除pod", ApiGroup: "Kubernetes", Method: "DELETE"},
	{Path: "/api/k8s/pod/update", Description: "更新pod", ApiGroup: "Kubernetes", Method: "PUT"},
	{Path: "/api/k8s/pod/container", Description: "获取Pod内容器名", ApiGroup: "Kubernetes", Method: "GET"},
	{Path: "/api/k8s/pod/log", Description: "获取容器日志", ApiGroup: "Kubernetes", Method: "GET"},
	{Path: "/api/k8s/pod/numnp", Description: "查询pod数量信息", ApiGroup: "Kubernetes", Method: "GET"},
	{Path: "/api/k8s/pod/webshell", Description: "web终端", ApiGroup: "Kubernetes", Method: "GET"},
	{Path: "/api/k8s/daemonset/del", Description: "删除daemonset", ApiGroup: "Kubernetes", Method: "DELETE"},
	{Path: "/api/k8s/daemonset/update", Description: "更新daemonset", ApiGroup: "Kubernetes", Method: "PUT"},
	{Path: "/api/k8s/daemonset/list", Description: "查询daemonset列表", ApiGroup: "Kubernetes", Method: "GET"},
	{Path: "/api/k8s/daemonset/detail", Description: "查询daemonset详情", ApiGroup: "Kubernetes", Method: "GET"},
	{Path: "/api/k8s/statefulset/del", Description: "删除statefulset", ApiGroup: "Kubernetes", Method: "DELETE"},
	{Path: "/api/k8s/statefulset/update", Description: "更新statefulset", ApiGroup: "Kubernetes", Method: "PUT"},
	{Path: "/api/k8s/statefulset/list", Description: "查询statefulset列表", ApiGroup: "Kubernetes", Method: "GET"},
	{Path: "/api/k8s/statefulset/detail", Description: "查询statefulset详情", ApiGroup: "Kubernetes", Method: "GET"},
	{Path: "/api/k8s/node/list", Description: "查询node列表", ApiGroup: "Kubernetes", Method: "GET"},
	{Path: "/api/k8s/node/detail", Description: "查询node详情", ApiGroup: "Kubernetes", Method: "GET"},
	{Path: "/api/k8s/namespace/create", Description: "创建namespace", ApiGroup: "Kubernetes", Method: "PUT"},
	{Path: "/api/k8s/namespace/del", Description: "删除namespace", ApiGroup: "Kubernetes", Method: "DELETE"},
	{Path: "/api/k8s/namespace/list", Description: "查询namespace列表", ApiGroup: "Kubernetes", Method: "GET"},
	{Path: "/api/k8s/namespace/detail", Description: "查询namespace详情", ApiGroup: "Kubernetes", Method: "GET"},
	{Path: "/api/k8s/persistentvolume/del", Description: "删除persistentvolume", ApiGroup: "Kubernetes", Method: "DELETE"},
	{Path: "/api/k8s/persistentvolume/list", Description: "查询persistentvolume列表", ApiGroup: "Kubernetes", Method: "GET"},
	{Path: "/api/k8s/persistentvolume/detail", Description: "查询persistentvolume详情", ApiGroup: "Kubernetes", Method: "GET"},
	{Path: "/api/k8s/service/create", Description: "创建service", ApiGroup: "Kubernetes", Method: "POST"},
	{Path: "/api/k8s/service/del", Description: "删除service", ApiGroup: "Kubernetes", Method: "DELETE"},
	{Path: "/api/k8s/service/update", Description: "更新service", ApiGroup: "Kubernetes", Method: "PUT"},
	{Path: "/api/k8s/service/list", Description: "查询service列表", ApiGroup: "Kubernetes", Method: "GET"},
	{Path: "/api/k8s/service/detail", Description: "查询service详情", ApiGroup: "Kubernetes", Method: "GET"},
	{Path: "/api/k8s/service/numnp", Description: "查询service数量信息", ApiGroup: "Kubernetes", Method: "GET"},
	{Path: "/api/k8s/ingress/create", Description: "创建ingress", ApiGroup: "Kubernetes", Method: "PUT"},
	{Path: "/api/k8s/ingress/del", Description: "删除ingress", ApiGroup: "Kubernetes", Method: "DELETE"},
	{Path: "/api/k8s/ingress/update", Description: "更新ingress", ApiGroup: "Kubernetes", Method: "PUT"},
	{Path: "/api/k8s/ingress/list", Description: "查询ingress列表", ApiGroup: "Kubernetes", Method: "GET"},
	{Path: "/api/k8s/ingress/detail", Description: "查询ingress详情", ApiGroup: "Kubernetes", Method: "GET"},
	{Path: "/api/k8s/ingress/numnp", Description: "查询ingress数量信息", ApiGroup: "Kubernetes", Method: "GET"},
	{Path: "/api/k8s/configmap/del", Description: "删除configmap", ApiGroup: "Kubernetes", Method: "DELETE"},
	{Path: "/api/k8s/configmap/update", Description: "更新configmap", ApiGroup: "Kubernetes", Method: "PUT"},
	{Path: "/api/k8s/configmap/list", Description: "查询configmap列表", ApiGroup: "Kubernetes", Method: "GET"},
	{Path: "/api/k8s/configmap/detail", Description: "查询configmap详情", ApiGroup: "Kubernetes", Method: "GET"},
	{Path: "/api/k8s/persistentvolumeclaim/del", Description: "删除persistentvolumeclaim", ApiGroup: "Kubernetes", Method: "DELETE"},
	{Path: "/api/k8s/persistentvolumeclaim/update", Description: "更新persistentvolumeclaim", ApiGroup: "Kubernetes", Method: "PUT"},
	{Path: "/api/k8s/persistentvolumeclaim/list", Description: "查询persistentvolumeclaim列表", ApiGroup: "Kubernetes", Method: "GET"},
	{Path: "/api/k8s/persistentvolumeclaim/detail", Description: "查询persistentvolumeclaim详情", ApiGroup: "Kubernetes", Method: "GET"},
	{Path: "/api/k8s/secret/del", Description: "删除secret", ApiGroup: "Kubernetes", Method: "DELETE"},
	{Path: "/api/k8s/secret/update", Description: "更新secret", ApiGroup: "Kubernetes", Method: "PUT"},
	{Path: "/api/k8s/secret/list", Description: "查询secret列表", ApiGroup: "Kubernetes", Method: "GET"},
	{Path: "/api/k8s/secret/detail", Description: "查询secret详情", ApiGroup: "Kubernetes", Method: "GET"},
	{Path: "/api/k8s/workflow/create", Description: "创建workflow", ApiGroup: "Kubernetes", Method: "POST"},
	{Path: "/api/k8s/workflow/del", Description: "删除workflow", ApiGroup: "Kubernetes", Method: "DELETE"},
	{Path: "/api/k8s/workflow/list", Description: "查询workflow列表", ApiGroup: "Kubernetes", Method: "GET"},
	{Path: "/api/k8s/workflow/id", Description: "查看workflow", ApiGroup: "Kubernetes", Method: "GET"},
}
View Source
var (
	SysAuthorityEntities = []SysAuthority{
		{
			AuthorityId:   pkg.AdminDefaultAuth,
			AuthorityName: "管理员",
			DefaultRouter: "dashboard",
			ParentId:      0,
		},
		{
			AuthorityId:   pkg.UserDefaultAuth,
			AuthorityName: "普通用户",
			DefaultRouter: "dashboard",
			ParentId:      0,
		},
		{
			AuthorityId:   pkg.UserSubDefaultAuth,
			AuthorityName: "普通用户子角色",
			DefaultRouter: "dashboard",
			ParentId:      222,
		},
	}
)

SysAuthorityEntities 角色初始化数据

View Source
var (
	SysBaseMenuEntities = []SysBaseMenu{

		{MenuLevel: 0, Hidden: false, Disabled: true, ParentId: "0", Path: "dashboard", Name: "仪表盘", Sort: 1, Meta: Meta{Title: "仪表盘", Icon: "odometer"}},
		{MenuLevel: 0, Hidden: false, Disabled: false, ParentId: "0", Path: "cmdb", Name: "资产中心", Sort: 3, Meta: Meta{Title: "资产中心", Icon: "menu"}},
		{MenuLevel: 0, Hidden: false, Disabled: false, ParentId: "0", Path: "kubernetes", Name: "容器管理", Sort: 4, Meta: Meta{Title: "容器管理", Icon: "menu"}},
		{MenuLevel: 0, Hidden: false, Disabled: false, ParentId: "0", Path: "devops", Name: "应用发布", Sort: 5, Meta: Meta{Title: "应用发布", Icon: "compass"}},
		{MenuLevel: 0, Hidden: false, Disabled: false, ParentId: "0", Path: "setting", Name: "系统设置", Sort: 6, Meta: Meta{Title: "系统设置", Icon: "setting"}},

		{MenuLevel: 0, Hidden: false, Disabled: false, ParentId: "2", Path: "host", Name: "主机管理", Sort: 0, Meta: Meta{Title: "主机管理"}},
		{MenuLevel: 0, Hidden: false, Disabled: false, ParentId: "2", Path: "secret", Name: "授权管理", Sort: 1, Meta: Meta{Title: "授权管理"}},

		{MenuLevel: 0, Hidden: false, Disabled: false, ParentId: "3", Path: "cluster", Name: "集群管理", Sort: 0, Meta: Meta{Title: "集群管理"}},
		{MenuLevel: 0, Hidden: false, Disabled: false, ParentId: "3", Path: "deployment", Name: "工作负载", Sort: 1, Meta: Meta{Title: "工作负载"}},
		{MenuLevel: 0, Hidden: false, Disabled: false, ParentId: "3", Path: "service", Name: "服务发现", Sort: 2, Meta: Meta{Title: "服务发现"}},
		{MenuLevel: 0, Hidden: false, Disabled: false, ParentId: "3", Path: "node", Name: "节点管理", Sort: 3, Meta: Meta{Title: "节点管理"}},
		{MenuLevel: 0, Hidden: false, Disabled: false, ParentId: "3", Path: "config", Name: "配置中心", Sort: 4, Meta: Meta{Title: "配置中心"}},
		{MenuLevel: 0, Hidden: false, Disabled: false, ParentId: "3", Path: "events", Name: "事件中心", Sort: 5, Meta: Meta{Title: "事件中心"}},

		{MenuLevel: 0, Hidden: false, Disabled: false, ParentId: "5", Path: "authority", Name: "角色管理", Sort: 1, Meta: Meta{Title: "角色管理"}},
		{MenuLevel: 0, Hidden: false, Disabled: false, ParentId: "5", Path: "user", Name: "用户管理", Sort: 2, Meta: Meta{Title: "用户管理"}},
		{MenuLevel: 0, Hidden: false, Disabled: false, ParentId: "5", Path: "operation", Name: "操作历史", Sort: 3, Meta: Meta{Title: "操作历史"}},
	}
)

SysBaseMenuEntities 菜单初始化数据

View Source
var (
	SysUserEntities = []*SysUser{
		{
			UUID:        uuid.NewV4(),
			UserName:    "admin",
			Password:    "$2a$14$Zfb6w0UDBFMN0.nJeVXCUO3zH/iWKGtbBYyIzDDRnC..EgTS0Et0S",
			NickName:    "admin",
			SideMode:    "dark",
			Avatar:      "https://qmplusimg.henrongyi.top/gva_header.jpg",
			BaseColor:   "#fff",
			ActiveColor: "#1890ff",
			AuthorityId: pkg.AdminDefaultAuth,
			Phone:       "12345678901",
			Email:       "test@qq.com",
			Enable:      1,
			Status:      sql.NullInt64{Int64: 0, Valid: true},
		},
		{
			UUID:        uuid.NewV4(),
			UserName:    "chenteng",
			Password:    "$2a$14$yLCxKYP46M2NRnXujYe3mOfNe00GtBtjpaLM2eIzYCzYKQXqzsuka",
			NickName:    "chenteng",
			SideMode:    "dark",
			Avatar:      "https://qmplusimg.henrongyi.top/gva_header.jpg",
			BaseColor:   "#fff",
			ActiveColor: "#1890ff",
			AuthorityId: pkg.UserDefaultAuth,
			Phone:       "12345678901",
			Email:       "test@qq.com",
			Enable:      1,
			Status:      sql.NullInt64{Int64: 0, Valid: true},
		},
		{
			UUID:        uuid.NewV4(),
			UserName:    "chentengsub",
			Password:    "$2a$14$MPINiht5QO2wlR3DynizXOtuqcNAOrNZdrSUKXrbjqcKbK.jcfyAW",
			NickName:    "chentengsub",
			SideMode:    "dark",
			Avatar:      "https://qmplusimg.henrongyi.top/gva_header.jpg",
			BaseColor:   "#fff",
			ActiveColor: "#1890ff",
			AuthorityId: pkg.UserSubDefaultAuth,
			Phone:       "12345678901",
			Email:       "test@qq.com",
			Enable:      1,
			Status:      sql.NullInt64{Int64: 0, Valid: true},
		},
	}
)

SysUserEntities 用户初始化数据

Functions

func GetWorkflowTableName

func GetWorkflowTableName() string

func RegisterInitializer

func RegisterInitializer(order int, c DBInitializer)

Types

type CommonModel

type CommonModel struct {
	CreatedAt time.Time      `json:"created_at" gorm:"column:created_at"`
	UpdatedAt time.Time      `json:"updated_at" gorm:"column:updated_at"`
	DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
}

type DBInitializer

type DBInitializer interface {
	TableName() string
	MigrateTable(ctx context.Context, db *gorm.DB) error
	InitData(ctx context.Context, db *gorm.DB) error
	IsInitData(ctx context.Context, db *gorm.DB) (bool, error)
	TableCreated(ctx context.Context, db *gorm.DB) bool
}

DBInitializer 用于初始化数据表与数据

type MenuAuthority struct{}
func (i *MenuAuthority) InitData(ctx context.Context, db *gorm.DB) error
func (i *MenuAuthority) IsInitData(ctx context.Context, db *gorm.DB) (bool, error)
func (i *MenuAuthority) MigrateTable(ctx context.Context, db *gorm.DB) error
func (i *MenuAuthority) TableCreated(ctx context.Context, db *gorm.DB) bool
func (i MenuAuthority) TableName() string

type Meta

type Meta struct {
	ActiveName string `json:"activeName" gorm:"comment:高亮菜单"`
	KeepAlive  bool   `json:"keepAlive" gorm:"comment:是否缓存"`   // 是否缓存
	Title      string `json:"title" gorm:"comment:菜单名"`        // 菜单名
	Icon       string `json:"icon" gorm:"comment:菜单图标"`        // 菜单图标
	CloseTab   bool   `json:"closeTab" gorm:"comment:自动关闭tab"` // 自动关闭tab
}

type OrderedInitializer

type OrderedInitializer struct {
	Order int
	DBInitializer
}

OrderedInitializer 组合一个顺序字段,以供排序

type SysApi

type SysApi struct {
	ID          int    `gorm:"column:id;primary_key;AUTO_INCREMENT;not null" json:"id"`
	Path        string `json:"path" gorm:"comment:api路径"`             // api路径
	Description string `json:"description" gorm:"comment:api中文描述"`    // api中文描述
	ApiGroup    string `json:"apiGroup" gorm:"comment:api组"`          // api组
	Method      string `json:"method" gorm:"default:POST;comment:方法"` // 方法:创建POST(默认)|查看GET|更新PUT|删除DELETE
	CommonModel
}

func (*SysApi) InitData

func (a *SysApi) InitData(ctx context.Context, db *gorm.DB) error

func (*SysApi) IsInitData

func (a *SysApi) IsInitData(ctx context.Context, db *gorm.DB) (bool, error)

func (*SysApi) MigrateTable

func (a *SysApi) MigrateTable(ctx context.Context, db *gorm.DB) error

func (*SysApi) TableCreated

func (a *SysApi) TableCreated(ctx context.Context, db *gorm.DB) bool

func (*SysApi) TableName

func (*SysApi) TableName() string

type SysAuthority

type SysAuthority struct {
	CommonModel
	AuthorityId     uint            `json:"authorityId" gorm:"not null;unique;primary_key;comment:角色ID;size:90"` // 角色ID
	AuthorityName   string          `json:"authorityName" gorm:"comment:角色名"`                                    // 角色名
	ParentId        uint            `json:"parentId" gorm:"comment:父角色ID"`                                       // 父角色ID
	DataAuthorityId []*SysAuthority `json:"dataAuthorityId" gorm:"many2many:sys_data_authority_id;"`
	Children        []SysAuthority  `json:"children" gorm:"-"`
	SysBaseMenus    []SysBaseMenu   `json:"menus" gorm:"many2many:sys_authority_menus;"`
	Users           []SysUser       `json:"-" gorm:"many2many:sys_user_authority;"`
	DefaultRouter   string          `json:"defaultRouter" gorm:"comment:默认菜单;default:dashboard"` // 默认菜单(默认dashboard)
}

func (*SysAuthority) InitData

func (s *SysAuthority) InitData(ctx context.Context, db *gorm.DB) error

func (*SysAuthority) IsInitData

func (s *SysAuthority) IsInitData(ctx context.Context, db *gorm.DB) (bool, error)

func (*SysAuthority) MigrateTable

func (s *SysAuthority) MigrateTable(ctx context.Context, db *gorm.DB) error

func (*SysAuthority) TableCreated

func (s *SysAuthority) TableCreated(ctx context.Context, db *gorm.DB) bool

func (*SysAuthority) TableName

func (*SysAuthority) TableName() string

type SysAuthorityMenu

type SysAuthorityMenu struct {
	MenuId      string `json:"menuId" gorm:"comment:菜单ID;column:sys_base_menu_id"`
	AuthorityId string `json:"-" gorm:"comment:角色ID;column:sys_authority_authority_id"`
}

func (SysAuthorityMenu) TableName

func (s SysAuthorityMenu) TableName() string

type SysBaseMenu

type SysBaseMenu struct {
	ID            int                                        `gorm:"column:id;primary_key;AUTO_INCREMENT;not null" json:"id"`
	MenuLevel     uint                                       `json:"-"`
	ParentId      string                                     `json:"parentId" gorm:"comment:父菜单ID"`    // 父菜单ID
	Path          string                                     `json:"path" gorm:"comment:路由path"`       // 路由path
	Name          string                                     `json:"name" gorm:"comment:路由name"`       // 路由name
	Hidden        bool                                       `json:"hidden" gorm:"comment:是否在列表隐藏"`    // 是否在列表隐藏
	Disabled      bool                                       `json:"disabled" gorm:"comment:是否禁止修改菜单"` // 是否在列表隐藏
	Sort          int                                        `json:"sort" gorm:"comment:排序标记"`         // 排序标记
	Children      []SysBaseMenu                              `json:"children" gorm:"-"`
	Meta          `json:"meta" gorm:"embedded;comment:附加属性"` // 附加属性
	SysAuthoritys []SysAuthority                             `json:"authoritys" gorm:"many2many:sys_authority_menus;"`
	CommonModel
}

func (*SysBaseMenu) InitData

func (m *SysBaseMenu) InitData(ctx context.Context, db *gorm.DB) error

func (*SysBaseMenu) IsInitData

func (m *SysBaseMenu) IsInitData(ctx context.Context, db *gorm.DB) (bool, error)

func (*SysBaseMenu) MigrateTable

func (m *SysBaseMenu) MigrateTable(ctx context.Context, db *gorm.DB) error

func (*SysBaseMenu) TableCreated

func (m *SysBaseMenu) TableCreated(ctx context.Context, db *gorm.DB) bool

func (*SysBaseMenu) TableName

func (*SysBaseMenu) TableName() string

type SysMenu

type SysMenu struct {
	SysBaseMenu
	MenuId      string    `json:"menuId" gorm:"comment:菜单ID"`
	AuthorityId uint      `json:"-" gorm:"comment:角色ID"`
	Children    []SysMenu `json:"children" gorm:"-"`
}

type SysOperationRecord

type SysOperationRecord struct {
	ID           int           `gorm:"column:id;primary_key;AUTO_INCREMENT;not null" json:"id"`
	Ip           string        `json:"ip" form:"ip" gorm:"column:ip;comment:请求ip"`                                   // 请求ip
	Method       string        `json:"method" form:"method" gorm:"column:method;comment:请求方法"`                       // 请求方法
	Path         string        `json:"path" form:"path" gorm:"column:path;comment:请求路径"`                             // 请求路径
	Status       int           `json:"status" form:"status" gorm:"column:status;comment:请求状态"`                       // 请求状态
	Latency      time.Duration `json:"latency" form:"latency" gorm:"column:latency;comment:延迟" swaggertype:"string"` // 延迟
	Agent        string        `json:"agent" form:"agent" gorm:"column:agent;comment:代理"`                            // 代理
	ErrorMessage string        `json:"error_message" form:"error_message" gorm:"column:error_message;comment:错误信息"`  // 错误信息
	Body         string        `json:"body" form:"body" gorm:"type:text;column:body;comment:请求Body"`                 // 请求Body
	Resp         string        `json:"resp" form:"resp" gorm:"type:text;column:resp;comment:响应Body"`                 // 响应Body
	UserID       int           `json:"user_id" form:"user_id" gorm:"column:user_id;comment:用户id"`                    // 用户id
	User         SysUser       `json:"user"`
	CommonModel
}

func (*SysOperationRecord) InitData

func (s *SysOperationRecord) InitData(ctx context.Context, db *gorm.DB) error

func (*SysOperationRecord) IsInitData

func (s *SysOperationRecord) IsInitData(ctx context.Context, db *gorm.DB) (bool, error)

func (*SysOperationRecord) MigrateTable

func (s *SysOperationRecord) MigrateTable(ctx context.Context, db *gorm.DB) error

func (*SysOperationRecord) TableCreated

func (s *SysOperationRecord) TableCreated(ctx context.Context, db *gorm.DB) bool

func (*SysOperationRecord) TableName

func (s *SysOperationRecord) TableName() string

type SysUser

type SysUser struct {
	ID          int            `gorm:"column:id;primary_key;AUTO_INCREMENT;not null" json:"id"`
	UUID        uuid.UUID      `json:"uuid" gorm:"index;comment:用户UUID"`                                                  // 用户UUID
	UserName    string         `json:"userName" gorm:"index;comment:用户登录名"`                                               // 用户登录名
	Password    string         `json:"-"  gorm:"comment:用户登录密码"`                                                          // 用户登录密码
	NickName    string         `json:"nickName" gorm:"default:系统用户;comment:用户昵称"`                                         // 用户昵称
	SideMode    string         `json:"sideMode" gorm:"default:dark;comment:用户侧边主题"`                                       // 用户侧边主题
	Avatar      string         `json:"avatar" gorm:"default:https://qmplusimg.henrongyi.top/gva_header.jpg;comment:用户头像"` // 用户头像
	BaseColor   string         `json:"baseColor" gorm:"default:#fff;comment:基础颜色"`                                        // 基础颜色
	ActiveColor string         `json:"activeColor" gorm:"default:#1890ff;comment:活跃颜色"`                                   // 活跃颜色
	AuthorityId uint           `json:"authorityId" gorm:"default:2222;comment:用户角色ID"`                                    // 用户角色ID
	Authority   SysAuthority   `json:"authority" gorm:"foreignKey:AuthorityId;references:AuthorityId;comment:用户角色"`
	Authorities []SysAuthority `json:"authorities" gorm:"many2many:sys_user_authority;"`
	Phone       string         `json:"phone"  gorm:"comment:用户手机号"`                     // 用户手机号
	Email       string         `json:"email"  gorm:"comment:用户邮箱"`                      // 用户邮箱
	Enable      int            `json:"enable" gorm:"default:1;comment:用户是否被冻结 1正常 2冻结"` //用户是否被冻结 1正常 2冻结
	Status      sql.NullInt64  `gorm:"column:status;type:int(11);comment:0离线;1在线" json:"status"`
	CommonModel
}

func (*SysUser) InitData

func (u *SysUser) InitData(ctx context.Context, db *gorm.DB) error

func (*SysUser) IsInitData

func (u *SysUser) IsInitData(ctx context.Context, db *gorm.DB) (bool, error)

IsInitData 判断是否admin初始化成功

func (*SysUser) MigrateTable

func (u *SysUser) MigrateTable(ctx context.Context, db *gorm.DB) error

func (*SysUser) TableCreated

func (u *SysUser) TableCreated(ctx context.Context, db *gorm.DB) bool

func (*SysUser) TableName

func (u *SysUser) TableName() string

type Workflow

type Workflow struct {
	ID          int    `gorm:"column:id;primary_key;AUTO_INCREMENT;not null" json:"id"`
	Name        string `json:"name" gorm:"column:name"`
	NameSpace   string `json:"namespace" gorm:"column:namespace"`
	Replicas    int32  `json:"replicas" gorm:"column:replicas"`
	Deployment  string `json:"deployment" gorm:"column:deployment"`
	Service     string `json:"service" gorm:"column:service"`
	Ingress     string `json:"ingress" gorm:"column:ingress"`
	ServiceType string `json:"service_type" gorm:"column:service_type"`
	CommonModel
}

func (*Workflow) InitData

func (w *Workflow) InitData(ctx context.Context, db *gorm.DB) error

func (*Workflow) IsInitData

func (w *Workflow) IsInitData(ctx context.Context, db *gorm.DB) (bool, error)

func (*Workflow) MigrateTable

func (w *Workflow) MigrateTable(ctx context.Context, db *gorm.DB) error

func (*Workflow) TableCreated

func (w *Workflow) TableCreated(ctx context.Context, db *gorm.DB) bool

func (*Workflow) TableName

func (w *Workflow) TableName() string

Jump to

Keyboard shortcuts

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