model

package
v2.0.1-a-rc1 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CDNStatusActive   = "active"
	CDNStatusInactive = "inactive"
)
View Source
const (
	SchedulerStatusActive   = "active"
	SchedulerStatusInactive = "inactive"
)
View Source
const (
	UserStateEnabled  = "enable"
	UserStateDisabled = "disable"
)

Variables

This section is empty.

Functions

func Paginate

func Paginate(page, perPage int) func(db *gorm.DB) *gorm.DB

Types

type CDN

type CDN struct {
	Model
	HostName     string     `gorm:"column:host_name;type:varchar(256);index:uk_cdn,unique;not null;comment:hostname" json:"host_name"`
	IDC          string     `gorm:"column:idc;type:varchar(1024);comment:internet data center" json:"idc"`
	Location     string     `gorm:"column:location;type:varchar(1024);comment:location" json:"location"`
	IP           string     `gorm:"column:ip;type:varchar(256);not null;comment:ip address" json:"ip"`
	Port         int32      `gorm:"column:port;not null;comment:grpc service listening port" json:"port"`
	DownloadPort int32      `gorm:"column:download_port;not null;comment:download service listening port" json:"download_port"`
	Status       string     `gorm:"column:status;type:varchar(256);default:'inactive';comment:service status" json:"status"`
	CDNClusterID uint       `gorm:"index:uk_cdn,unique;not null;comment:cdn cluster id"`
	CDNCluster   CDNCluster `json:"-"`
}

type CDNCluster

type CDNCluster struct {
	Model
	Name              string             `gorm:"column:name;type:varchar(256);index:uk_cdn_cluster_name,unique;not null;comment:name" json:"name"`
	BIO               string             `gorm:"column:bio;type:varchar(1024);comment:biography" json:"bio"`
	Config            JSONMap            `gorm:"column:config;not null;comment:configuration" json:"config"`
	SchedulerClusters []SchedulerCluster `gorm:"many2many:cdn_cluster_scheduler_cluster;" json:"-"`
	IsDefault         bool               `gorm:"column:is_default;not null;default:false;comment:default cdn cluster" json:"is_default"`
	CDNs              []CDN              `json:"-"`
	SecurityGroupID   uint               `gorm:"comment:security group id" json:"security_group_id"`
	SecurityGroup     SecurityGroup      `json:"-"`
}

type CasbinRule

type CasbinRule struct {
	ID    uint   `gorm:"primaryKey;autoIncrement;comment:id"`
	Ptype string `gorm:"type:varchar(100);default:NULL;uniqueIndex:uk_casbin_rule;comment:policy type"`
	V0    string `gorm:"type:varchar(100);default:NULL;uniqueIndex:uk_casbin_rule;comment:v0"`
	V1    string `gorm:"type:varchar(100);default:NULL;uniqueIndex:uk_casbin_rule;comment:v1"`
	V2    string `gorm:"type:varchar(100);default:NULL;uniqueIndex:uk_casbin_rule;comment:v2"`
	V3    string `gorm:"type:varchar(100);default:NULL;uniqueIndex:uk_casbin_rule;comment:v3"`
	V4    string `gorm:"type:varchar(100);default:NULL;uniqueIndex:uk_casbin_rule;comment:v4"`
	V5    string `gorm:"type:varchar(100);default:NULL;uniqueIndex:uk_casbin_rule;comment:v5"`
}

type JSONMap

type JSONMap map[string]interface{}

func (JSONMap) GormDBDataType

func (JSONMap) GormDBDataType(db *gorm.DB, field *schema.Field) string

func (JSONMap) GormDataType

func (m JSONMap) GormDataType() string

func (JSONMap) MarshalJSON

func (m JSONMap) MarshalJSON() ([]byte, error)

func (*JSONMap) Scan

func (m *JSONMap) Scan(val interface{}) error

func (*JSONMap) UnmarshalJSON

func (m *JSONMap) UnmarshalJSON(b []byte) error

func (JSONMap) Value

func (m JSONMap) Value() (driver.Value, error)

type Model

type Model struct {
	ID        uint                  `gorm:"primarykey;comment:id" json:"id"`
	CreatedAt time.Time             `gorm:"column:created_at;type:timestamp;comment:created timestamp" json:"created_at"`
	UpdatedAt time.Time             `gorm:"column:updated_at;type:timestamp;comment:updated timestamp" json:"updated_at"`
	IsDel     soft_delete.DeletedAt `gorm:"softDelete:flag;comment:soft delete flag" json:"-"`
}

type Oauth

type Oauth struct {
	Model
	Name         string `gorm:"column:name;type:varchar(256);index:uk_oauth2_name,unique;not null;comment:oauth2 name" json:"name"`
	BIO          string `gorm:"column:bio;type:varchar(1024);comment:biography" json:"bio"`
	ClientID     string `` /* 129-byte string literal not displayed */
	ClientSecret string `gorm:"column:client_secret;type:varchar(1024);not null;comment:client secret for oauth2" json:"client_secret"`
	RedirectURL  string `gorm:"column:redirect_url;type:varchar(1024);comment:authorization callback url" json:"redirect_url"`
}

type Scheduler

type Scheduler struct {
	Model
	HostName           string           `gorm:"column:host_name;type:varchar(256);index:uk_scheduler,unique;not null;comment:hostname" json:"host_name"`
	VIPs               string           `gorm:"column:vips;type:varchar(1024);comment:virtual ip address" json:"vips"`
	IDC                string           `gorm:"column:idc;type:varchar(1024);comment:internet data center" json:"idc"`
	Location           string           `gorm:"column:location;type:varchar(1024);comment:location" json:"location"`
	NetConfig          JSONMap          `gorm:"column:net_config;comment:network configuration" json:"net_config"`
	IP                 string           `gorm:"column:ip;type:varchar(256);not null;comment:ip address" json:"ip"`
	Port               int32            `gorm:"column:port;not null;comment:grpc service listening port" json:"port"`
	Status             string           `gorm:"column:status;type:varchar(256);default:'inactive';comment:service status" json:"status"`
	SchedulerClusterID uint             `gorm:"index:uk_scheduler,unique;not null;comment:scheduler cluster id"`
	SchedulerCluster   SchedulerCluster `json:"-"`
}

type SchedulerCluster

type SchedulerCluster struct {
	Model
	Name            string        `gorm:"column:name;type:varchar(256);index:uk_scheduler_cluster_name,unique;not null;comment:name" json:"name"`
	BIO             string        `gorm:"column:bio;type:varchar(1024);comment:biography" json:"bio"`
	Config          JSONMap       `gorm:"column:config;not null;comment:configuration" json:"config"`
	ClientConfig    JSONMap       `gorm:"column:client_config;not null;comment:client configuration" json:"client_config"`
	Scopes          JSONMap       `gorm:"column:scopes;comment:match scopes" json:"scopes"`
	IsDefault       bool          `gorm:"column:is_default;not null;default:false;comment:default scheduler cluster" json:"is_default"`
	CDNClusters     []CDNCluster  `gorm:"many2many:cdn_cluster_scheduler_cluster;" json:"cdn_clusters"`
	Schedulers      []Scheduler   `json:"-"`
	SecurityGroupID uint          `gorm:"comment:security group id" json:"security_group_id"`
	SecurityGroup   SecurityGroup `json:"-"`
}

type SecurityGroup

type SecurityGroup struct {
	Model
	Name              string             `gorm:"column:name;type:varchar(256);index:uk_security_group_name,unique;not null;comment:name" json:"name"`
	BIO               string             `gorm:"column:bio;type:varchar(1024);comment:biography" json:"bio"`
	Domain            string             `gorm:"column:domain;type:varchar(256);index:uk_security_group_domain,unique;not null;comment:domain" json:"domain"`
	ProxyDomain       string             `gorm:"column:proxy_domain;type:varchar(1024);comment:proxy domain" json:"proxy_domain"`
	SchedulerClusters []SchedulerCluster `json:"-"`
	CDNClusters       []CDNCluster       `json:"-"`
}

type User

type User struct {
	Model
	Email             string `gorm:"column:email;type:varchar(256);index:uk_user_email,unique;not null;comment:email address" json:"email"`
	Name              string `gorm:"column:name;type:varchar(256);index:uk_user_name,unique;not null;comment:name" json:"name"`
	EncryptedPassword string `gorm:"column:encrypted_password;size:1024;comment:encrypted password" json:"-"`
	Avatar            string `gorm:"column:avatar;type:varchar(256);comment:avatar address" json:"avatar"`
	Phone             string `gorm:"column:phone;type:varchar(256);comment:phone number" json:"phone"`
	PrivateToken      string `gorm:"column:private_token;type:varchar(256);comment:private token" json:"-"`
	State             string `gorm:"column:state;type:varchar(256);default:'enable';comment:state" json:"state"`
	Location          string `gorm:"column:location;type:varchar(256);comment:location" json:"location"`
	BIO               string `gorm:"column:bio;type:varchar(256);comment:biography" json:"bio"`
}

Jump to

Keyboard shortcuts

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