models

package
v2.1.66 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// PeerStateActive represents the peer whose state is active.
	PeerStateActive = "active"

	// PeerStateInactive represents the peer whose state is inactive.
	PeerStateInactive = "inactive"
)
View Source
const (
	// PersonalAccessTokenStateActive represents the personal access token whose state is active.
	PersonalAccessTokenStateActive = "active"

	// PersonalAccessTokenStateInactive represents the personal access token whose state is inactive.
	PersonalAccessTokenStateInactive = "inactive"
)
View Source
const (
	// SchedulerStateActive represents the scheduler whose state is active.
	SchedulerStateActive = "active"

	// SchedulerStateInactive represents the scheduler whose state is inactive.
	SchedulerStateInactive = "inactive"
)
View Source
const (
	// SeedPeerStateActive represents the seed peer whose state is active.
	SeedPeerStateActive = "active"

	// SeedPeerStateInactive represents the seed peer whose state is inactive.
	SeedPeerStateInactive = "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 Application

type Application struct {
	BaseModel
	Name     string  `gorm:"column:name;type:varchar(256);index:uk_application_name,unique;not null;comment:name" json:"name"`
	URL      string  `gorm:"column:url;not null;comment:url" json:"url"`
	BIO      string  `gorm:"column:bio;type:varchar(1024);comment:biography" json:"bio"`
	Priority JSONMap `gorm:"column:priority;not null;comment:download priority" json:"priority"`
	UserID   uint    `gorm:"comment:user id" json:"user_id"`
	User     User    `json:"user"`
}

type Array

type Array []string

func (Array) GormDBDataType

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

func (Array) GormDataType

func (Array) GormDataType() string

func (Array) MarshalJSON

func (a Array) MarshalJSON() ([]byte, error)

func (*Array) Scan

func (a *Array) Scan(val any) error

func (*Array) UnmarshalJSON

func (a *Array) UnmarshalJSON(b []byte) error

func (Array) Value

func (a Array) Value() (driver.Value, error)

type BaseModel

type BaseModel struct {
	ID        uint                  `gorm:"primarykey;comment:id" json:"id"`
	CreatedAt time.Time             `gorm:"column:created_at;type:timestamp;default:current_timestamp" json:"created_at"`
	UpdatedAt time.Time             `gorm:"column:updated_at;type:timestamp;default:current_timestamp" json:"updated_at"`
	IsDel     soft_delete.DeletedAt `gorm:"softDelete:flag;comment:soft delete flag" json:"is_del"`
}

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 Config

type Config struct {
	BaseModel
	Name   string `gorm:"column:name;type:varchar(256);index:uk_config_name,unique;not null;comment:config name" json:"name"`
	Value  string `gorm:"column:value;type:varchar(1024);not null;comment:config value" json:"value"`
	BIO    string `gorm:"column:bio;type:varchar(1024);comment:biography" json:"bio"`
	UserID uint   `gorm:"comment:user id" json:"user_id"`
	User   User   `json:"user"`
}

type JSONMap

type JSONMap map[string]any

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 any) error

func (*JSONMap) UnmarshalJSON

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

func (JSONMap) Value

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

type Job

type Job struct {
	BaseModel
	TaskID            string             `gorm:"column:task_id;type:varchar(256);not null;comment:task id" json:"task_id"`
	BIO               string             `gorm:"column:bio;type:varchar(1024);comment:biography" json:"bio"`
	Type              string             `gorm:"column:type;type:varchar(256);comment:type" json:"type"`
	State             string             `gorm:"column:state;type:varchar(256);not null;default:'PENDING';comment:service state" json:"state"`
	Args              JSONMap            `gorm:"column:args;not null;comment:task request args" json:"args"`
	Result            JSONMap            `gorm:"column:result;comment:task result" json:"result"`
	UserID            uint               `gorm:"column:user_id;comment:user id" json:"user_id"`
	User              User               `json:"user"`
	SeedPeerClusters  []SeedPeerCluster  `gorm:"many2many:job_seed_peer_cluster;" json:"seed_peer_clusters"`
	SchedulerClusters []SchedulerCluster `gorm:"many2many:job_scheduler_cluster;" json:"scheduler_clusters"`
}

type Oauth

type Oauth struct {
	BaseModel
	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 Peer added in v2.0.30

type Peer struct {
	BaseModel
	Hostname           string           `gorm:"column:host_name;type:varchar(256);index:uk_peer,unique;not null;comment:hostname" json:"host_name"`
	Type               string           `gorm:"column:type;type:varchar(256);index:idx_peer_type;comment:type" json:"type"`
	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);index:uk_peer,unique;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"`
	ObjectStoragePort  int32            `gorm:"column:object_storage_port;comment:object storage service listening port" json:"object_storage_port"`
	State              string           `gorm:"column:state;type:varchar(256);default:'inactive';comment:service state" json:"state"`
	OS                 string           `gorm:"column:os;type:varchar(256);comment:os" json:"os"`
	Platform           string           `gorm:"column:platform;type:varchar(256);comment:platform" json:"platform"`
	PlatformFamily     string           `gorm:"column:platform_family;type:varchar(256);comment:platform family" json:"platform_family"`
	PlatformVersion    string           `gorm:"column:platform_version;type:varchar(256);comment:platform version" json:"platform_version"`
	KernelVersion      string           `gorm:"column:kernel_version;type:varchar(256);comment:kernel version" json:"kernel_version"`
	GitVersion         string           `gorm:"column:git_version;type:varchar(256);index:idx_peer_git_version;comment:git version" json:"git_version"`
	GitCommit          string           `gorm:"column:git_commit;type:varchar(256);index:idx_peer_git_commit;comment:git commit" json:"git_commit"`
	BuildPlatform      string           `gorm:"column:build_platform;type:varchar(256);comment:build platform" json:"build_platform"`
	SchedulerClusterID uint             `gorm:"index:uk_peer,unique;not null;comment:scheduler cluster id" json:"scheduler_cluster_id"`
	SchedulerCluster   SchedulerCluster `json:"scheduler_cluster"`
}

type PersonalAccessToken added in v2.0.30

type PersonalAccessToken struct {
	BaseModel
	Name      string    `gorm:"column:name;type:varchar(256);index:uk_personal_access_token_name,unique;not null;comment:name" json:"name"`
	BIO       string    `gorm:"column:bio;type:varchar(1024);comment:biography" json:"bio"`
	Token     string    `gorm:"column:token;type:varchar(256);index:uk_personal_access_token,unique;not null;comment:access token" json:"token"`
	Scopes    Array     `gorm:"column:scopes;not null;comment:scopes flags" json:"scopes"`
	State     string    `gorm:"column:state;type:varchar(256);default:'inactive';comment:service state" json:"state"`
	ExpiredAt time.Time `gorm:"column:expired_at;type:timestamp;default:current_timestamp;not null;comment:expired at" json:"expired_at"`
	UserID    uint      `gorm:"column:user_id;comment:user id" json:"user_id"`
	User      User      `json:"user"`
}

type Scheduler

type Scheduler struct {
	BaseModel
	Hostname           string           `gorm:"column:host_name;type:varchar(256);index:uk_scheduler,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);index:uk_scheduler,unique;not null;comment:ip address" json:"ip"`
	Port               int32            `gorm:"column:port;not null;comment:grpc service listening port" json:"port"`
	State              string           `gorm:"column:state;type:varchar(256);default:'inactive';comment:service state" json:"state"`
	Features           Array            `gorm:"column:features;comment:feature flags" json:"features"`
	SchedulerClusterID uint             `gorm:"index:uk_scheduler,unique;not null;comment:scheduler cluster id"  json:"scheduler_cluster_id"`
	SchedulerCluster   SchedulerCluster `json:"scheduler_cluster"`
}

type SchedulerCluster

type SchedulerCluster struct {
	BaseModel
	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"`
	SeedPeerClusters []SeedPeerCluster `gorm:"many2many:seed_peer_cluster_scheduler_cluster;" json:"seed_peer_clusters"`
	Schedulers       []Scheduler       `json:"schedulers"`
	Peers            []Peer            `json:"peers"`
	Jobs             []Job             `gorm:"many2many:job_scheduler_cluster;" json:"jobs"`
}

type SeedPeer

type SeedPeer struct {
	BaseModel
	Hostname          string          `gorm:"column:host_name;type:varchar(256);index:uk_seed_peer,unique;not null;comment:hostname" json:"host_name"`
	Type              string          `gorm:"column:type;type:varchar(256);comment:type" json:"type"`
	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);index:uk_seed_peer,unique;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"`
	ObjectStoragePort int32           `gorm:"column:object_storage_port;comment:object storage service listening port" json:"object_storage_port"`
	State             string          `gorm:"column:state;type:varchar(256);default:'inactive';comment:service state" json:"state"`
	SeedPeerClusterID uint            `gorm:"index:uk_seed_peer,unique;not null;comment:seed peer cluster id" json:"seed_peer_cluster_id"`
	SeedPeerCluster   SeedPeerCluster `json:"seed_peer_cluster"`
}

type SeedPeerCluster

type SeedPeerCluster struct {
	BaseModel
	Name              string             `gorm:"column:name;type:varchar(256);index:uk_seed_peer_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:seed_peer_cluster_scheduler_cluster;" json:"scheduler_clusters"`
	SeedPeers         []SeedPeer         `json:"seed_peer"`
	Jobs              []Job              `gorm:"many2many:job_seed_peer_cluster;" json:"jobs"`
}

type User

type User struct {
	BaseModel
	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"`
	Configs           []Config `json:"configs"`
}

Jump to

Keyboard shortcuts

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