models

package
v0.0.0-...-17837d5 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SecLocalTimeFormat  = "2023-02-02 15:04:05"
	DateLocalTimeFormat = "2023-02-02"
)
View Source
const (
	DefaultPage     = 1
	DefaultPageSize = 15
)

Default values for page and page size

Variables

This section is empty.

Functions

This section is empty.

Types

type Cluster

type Cluster struct {
	Mode
	ClusterName    string `json:"clusterName" gorm:"comment:clusterName" binding:"required"`
	KubeConfig     string `json:"kubeConfig" gorm:"comment:clusterCertificate;type:varchar(15360)" binding:"required"`
	NodeCount      int    `json:"nodeCount" gorm:"comment:cluster node counts"`
	ClusterVersion string `json:"clusterVersion" gorm:"cluster version"`
}

func (*Cluster) TableName

func (c *Cluster) TableName() string

type ClusterIds

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

type CreateRoleRequest

type CreateRoleRequest struct {
	Name string `json:"name" binding:"required"`
	Desc string `json:"desc"`
	Code string `json:"code" binding:"required"`
}

type DeleteUsersRequest

type DeleteUsersRequest struct {
	Ids []int `json:"ids"`
}

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 {
	UserName string `json:"username",binding:"required"`
	Password string `json:"password",binding:"required"`
}

type Mode

type Mode struct {
	ID        uint           `gorm:"primarykey;comment:'Self-increment numbering'" json:"id" form:"id"` //主键
	CreatedAt LocalTime      `json:"createdAt,omitempty"`
	UpdatedAt LocalTime      `json:"updatedAt,omitempty"`
	DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
}

https://gorm.io/docs/models.html

func (*Mode) TableName

func (*Mode) TableName(name string) string

type NodeStatus

type NodeStatus 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 usage"`
	CpuCore         float64 `json:"cpu_core"`
	CpuCapacityCore float64 `json:"cpu_capacity_core"`
	MemoryUsage     float64 `json:"memory_usage" desc:"memory usage"`
	MemoryUsed      float64 `json:"memory_used"`
	MemoryTotal     float64 `json:"memory_total"`
}

type PageResult

type PageResult struct {
	Items    interface{} `form:"items" json:"items"`       // Items holds the paginated data.
	Total    int64       `form:"total" json:"total"`       // Total is the total number of items.
	Page     int         `form:"page" json:"page"`         // Page is the current page number.
	PageSize int         `form:"pageSize" json:"pageSize"` // PageSize is the number of items per page.
}

func SetPageDefaults

func SetPageDefaults(p *PageResult) (page *PageResult, offset int)

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 {
	Mode
	Name         string           `gorm:"column:name;comment:'role name';size:256" json:"name"`
	Desc         string           `gorm:"column:desc;comment:'role description';size:256" json:"desc"`
	Code         string           `gorm:"column:name;comment:'role code';size:256" json:"code"`
	Users        []User           `gorm:"foreignkey:RoleId" json:"users"`
	PermissionId int              `gorm:"column:permission_id;comment:'Permission id Foreign key'" json:"permission_id"`
	Permission   []RolePermission `gorm:"foreignkey:PermissionId" json:"permission"`
}

func (Role) TableName

func (m Role) TableName() string

type RolePermission

type RolePermission struct {
	Mode
	RoleId       int `gorm:"column:role_id;comment:'role id'" json:"role_id"`
	PermissionId int `gorm:"column:permission_id;comment:'permission id'" json:"permission_id"`
}

func (RolePermission) TableName

func (m RolePermission) TableName() string

type SystemSafeSettingsRequest

type SystemSafeSettingsRequest struct {
	LoginFail      int `json:"loginFail"`
	LockTime       int `json:"lockTime"`
	PasswordExpire int `jsopasswordExpiren:""`
}

type SystemSettings

type SystemSettings struct {
	Mode
	LoginFail      int `gorm:"column:login_fail;default:3;comment:Limit the number of login failures" json:"loginFail"`
	LockTime       int `gorm:"column:lock_time;default:30;comment:Login lock duration (zw)" json:"lockTime"`
	PasswordExpire int `` /* 138-byte string literal not displayed */
}

func (SystemSettings) TableName

func (system SystemSettings) TableName() string

type User

type User struct {
	Mode
	UID      string `gorm:"column:uid;comment:'user uid'" json:"uid"`
	UserName string `gorm:"column:username;comment:'user name'" json:"username",binding:"required"`
	Password string `gorm:"column:password;comment:'user password'" json:"password",binding:"required"`
	Status   *bool  `gorm:"type:tinyint(1);default:true;comment:'user status(enable/disable)'"`
	RoleId   uint   `gorm:"column:role_id;comment:'role foreign id'" json:"role_id"`
	Role     Role   `gorm:"foreignkey:RoleId" json:"role"`
}

func (*User) TableName

func (u *User) TableName() string

type UserRequest

type UserRequest struct {
	UserName string `json:"username",binding:"required"`
	Status   *bool  `json:"status",binding:"required"`
}

type UsersChangePasswordRequest

type UsersChangePasswordRequest struct {
	OldPassword string `json:"old_password"`
	NewPassword string `json:"new_password"`
}

type UsersListResponse

type UsersListResponse struct {
	ID       int    `gorm:"column:id" json:"id"`
	UID      string `gorm:"column:uid" json:"uid"`
	UserName string `gorm:"column:username" json:"username"`
}

Jump to

Keyboard shortcuts

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