models

package
v0.0.0-...-1dfee00 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// 本地时间格式
	MsecLocalTimeFormat = "2006-01-02 15:04:05.000"
	SecLocalTimeFormat  = "2006-01-02 15:04:05"
	DateLocalTimeFormat = "2006-01-02"
)

Variables

This section is empty.

Functions

func InitError

func InitError()

func InitLdap

func InitLdap(ldap LdapSection)

func LdapReq

func LdapReq(user, pass string) (*ldap.SearchResult, error)

Types

type CasBinInReceive

type CasBinInReceive struct {
	Role        string       `json:"role"`
	CasBinInfos []CasBinInfo `json:"casBinInfos"`
}

CasBinInReceive structure for input parameters

type CasBinInfo

type CasBinInfo struct {
	Path   string `json:"path"`
	Method string `json:"method"`
}

type CasBinModel

type CasBinModel struct {
	PType  string `json:"p_type" gorm:"column:p_type"`
	Role   string `json:"role_name" gorm:"column:v0"`
	Path   string `json:"path" gorm:"column:v1"`
	Method string `json:"method" gorm:"column:v2"`
}

type Casbin

type Casbin struct {
	ModelPath string `mapstructure:"model-path" json:"modelPath" yaml:"model-path"`
}

type ClusterIds

type ClusterIds struct {
	Data interface{} `json:"clusterIds"`
}

type ClusterNodesStatus

type ClusterNodesStatus struct {
	NodeCount       int     `json:"node_count"`
	Ready           int     `json:"ready"`
	UnReady         int     `json:"unready"`
	Namespace       int     `json:"namespace"`
	Deployment      int     `json:"deployment"`
	Pod             int     `json:"pod"`
	CpuUsage        float64 `json:"cpu_usage" desc:"cpu使用率"`
	CpuCore         float64 `json:"cpu_core"`
	CpuCapacityCore float64 `json:"cpu_capacity_core"`
	MemoryUsage     float64 `json:"memory_usage" desc:"内存使用率"`
	MemoryUsed      float64 `json:"memory_used"`
	MemoryTotal     float64 `json:"memory_total"`
}

type ClusterVersion

type ClusterVersion struct {
	GModel
	Version string `json:"version"`
}

func (ClusterVersion) TableName

func (v ClusterVersion) TableName() string

type Dept

type Dept struct {
	GModel
	Name     string `gorm:"comment:'部门名称';size:64" json:"name"`
	Sort     int    `gorm:"default:0;type:int(3);comment:'排序'" json:"sort"`
	ParentId uint   `gorm:"default:0;comment:'父级部门(编号为0时表示根)'" json:"parent_id"`
	Children []Dept `gorm:"-" json:"children"` // 下属部门集合
	Users    []User `gorm:"foreignkey:DeptId"` // 一个部门有多个user
}

func (Dept) TableName

func (m Dept) TableName() string

type GModel

type GModel struct {
	ID        uint `gorm:"primarykey;comment:'自增编号'" json:"id" form:"id"`
	CreatedAt LocalTime
	UpdatedAt LocalTime
	DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
}

func (GModel) TableName

func (GModel) TableName(name string) string

type K8SCluster

type K8SCluster struct {
	//ID             uint   `json:"id" gorm:"primarykey;AUTO_INCREMENT" form:"id"`
	GModel
	ClusterName    string `json:"clusterName" gorm:"comment:集群名称" form:"clusterName" binding:"required"`
	KubeConfig     string `json:"kubeConfig" gorm:"comment:集群凭证;type:varchar(12800)" binding:"required"`
	ClusterVersion string `json:"clusterVersion" gorm:"comment:集群版本"`
	NodeNumber     int    `json:"nodeNumber" gorm:"comment:节点数"`
}

func (K8SCluster) TableName

func (ks K8SCluster) TableName() string

type LdapSection

type LdapSection struct {
	Enable          bool           `yaml:"enable"`
	Host            string         `yaml:"host"`
	Port            int            `yaml:"port"`
	BaseDn          string         `yaml:"baseDn"`
	BindUser        string         `yaml:"bindUser"`
	BindPass        string         `yaml:"bindPass"`
	AuthFilter      string         `yaml:"authFilter"`
	Attributes      ldapAttributes `yaml:"attributes"`
	CoverAttributes bool           `yaml:"coverAttributes"`
	TLS             bool           `yaml:"tls"`
	StartTLS        bool           `yaml:"startTLS"`
}
var LDAP LdapSection

type LocalTime

type LocalTime struct {
	time.Time
}

本地时间

func (LocalTime) DateString

func (t LocalTime) DateString() string

func (LocalTime) MarshalJSON

func (t LocalTime) MarshalJSON() ([]byte, error)

func (*LocalTime) Scan

func (t *LocalTime) Scan(v interface{}) error

func (LocalTime) String

func (t LocalTime) String() string

func (*LocalTime) UnmarshalJSON

func (t *LocalTime) UnmarshalJSON(data []byte) (err error)

func (LocalTime) Value

func (t LocalTime) Value() (driver.Value, error)

type LoginUser

type LoginUser struct {
	Email    string `json:"email"`
	Password string `json:"password"`
	Ldap     bool   `json:"ldap"`
}
type Menu struct {
	GModel
	Name     string `gorm:"comment:'菜单名称';size:64" json:"name"`
	Icon     string `gorm:"comment:'菜单图标';size:64" json:"icon"`
	Path     string `gorm:"comment:'菜单访问路径';size:64" json:"path"`
	Sort     int    `gorm:"default:0;type:int(3);comment:'菜单顺序(同级菜单, 从0开始, 越小显示越靠前)'" json:"sort"`
	ParentId uint   `gorm:"default:0;comment:'父菜单编号(编号为0时表示根菜单)'" json:"parent_id"`
	Creator  string `gorm:"comment:'创建人';size:64" json:"creator"`
	Children []Menu `gorm:"-" json:"children"`
	Roles    []Role `gorm:"many2many:relation_role_menu;" json:"roles"`
}
func (m Menu) TableName() string

type PaginationQ

type PaginationQ struct {
	Size    int    `form:"size" json:"size"`
	Page    int    `form:"page" json:"page"`
	Total   int64  `json:"total"`
	Keyword string `form:"keyword" json:"keyword"`
}

type Role

type Role struct {
	GModel
	Name  string `gorm:"column:name;comment:'角色名称';size:128" json:"name"`
	Desc  string `gorm:"column:desc;comment:'角色描述';size:128" json:"desc"`
	Menus []Menu `gorm:"many2many:relation_role_menu" json:"menus"`
	Users []User `gorm:"foreignkey:RoleId"`
}

func (Role) TableName

func (m Role) TableName() string

type User

type User struct {
	GModel
	UID      string `gorm:"column:uid;comment:'用戶uid'" json:"uid"`
	UserName string `gorm:"column:username;comment:'用户名';size:128;uniqueIndex:uk_username" json:"username" binding:"required"`
	Password string `gorm:"column:password;comment:'用户密码';size:128" json:"password" binding:"required"`
	Phone    string `gorm:"column:phone;comment:'手机号码';size:11" json:"phone"`
	Email    string `gorm:"column:email;comment:'邮箱';size:128" json:"email"`
	NickName string `gorm:"column:nick_name;comment:'用户昵称';size:128" json:"nick_name"`
	Avatar   string `gorm:"column:avatar;default:https://www.dnsjia.com/luban/img/head.png;comment:'用户头像';size:128" json:"avatar"`
	Status   *bool  `gorm:"type:tinyint(1);default:true;comment:'用户状态(正常/禁用, 默认正常)'"`
	RoleId   uint   `gorm:"column:role_id;comment:'角色id外键'" json:"role_id"`
	Role     Role   `gorm:"foreignkey:RoleId" json:"role"`
	DeptId   uint64 `gorm:"comment:'部门id外键'" json:"dept_id"`
	Dept     Dept   `gorm:"foreignkey:DeptId" json:"dept"`
	CreateBy string `gorm:"column:create_by;comment:'创建来源'" json:"create_by"`
}

func (User) TableName

func (u User) TableName() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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