models

package
v0.0.0-...-e89c34c Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NamespaceMetadata string = "metadata" // 元数据
	NamespaceBucket   string = "bucket"   // bucket信息
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Application

type Application struct {
	ID            string               `gorm:"column:id;type:varchar(128) not null primary key;comment:主键"`
	Name          string               `gorm:"column:name;type:varchar(64) not null;default:'';index:,unique;comment:名称"`
	Description   string               `gorm:"column:description;type:varchar(256) not null;default:'';comment:描述"`
	Secret        string               `gorm:"column:secret;type:varchar(256) not null;default:'';comment:秘钥"`
	Authorization bool                 `gorm:"column:authorization;type:tinyint not null;default:1;comment:是否认证:0:不认证;1:认证"`
	Status        v1.ApplicationStatus `gorm:"column:status;type:smallint not null;default:0;comment:应用状态0:未知:1:禁用;2:启用"`
	CreatedAt     time.Time            `gorm:"column:created_at;type:timestamp not null;default:current_timestamp();comment:创建时间"`
	UpdatedAt     time.Time            `` /* 139-byte string literal not displayed */
	DeletedAt     gorm.DeletedAt       `gorm:"column:deleted_at;index;comment:是否删除"`
}

func (Application) TableName

func (Application) TableName() string

type Global

type Global struct {
	ID        int64     `gorm:"column:id;type:bigint unsigned not null primary key auto_increment;comment:主键"`
	Namespace string    `gorm:"column:namespace;type:varchar(64) not null;default:'';index:idx_namespace_name,unique;comment:namespace"`
	Name      string    `gorm:"column:name;type:varchar(64) not null;default:'';index:idx_namespace_name,unique;comment:key名称"`
	Value     string    `gorm:"column:value;type:text;comment:value"`
	CreatedAt time.Time `gorm:"column:created_at;type:timestamp not null;default:current_timestamp();comment:创建时间"`
	UpdatedAt time.Time `` /* 139-byte string literal not displayed */
}

func (Global) TableName

func (Global) TableName() string

type MetadataBucket

type MetadataBucket struct {
	NumberOfBuckets int64    `json:"number_of_buckets"` // bucket的数量
	Buckets         []string `json:"buckets"`           // bucket列表
}

func (*MetadataBucket) FromString

func (m *MetadataBucket) FromString(in string) error

func (*MetadataBucket) String

func (m *MetadataBucket) String() string

type Task

type Task struct {
	ID           int64         `gorm:"column:id;type:bigint unsigned not null primary key auto_increment;comment:主键"`
	TimerId      string        `gorm:"column:timer_id;type:varchar(128) not null default '';index:idx_timer_id_run_time;comment:定时器ID"`
	RunTime      time.Time     `gorm:"column:run_time;type:timestamp not null;default:current_timestamp();index:idx_timer_id_run_time;comment:执行时间"`
	Request      string        `gorm:"column:request;type:text;comment:回调内容"`
	Response     string        `gorm:"column:response;type:text;comment:回调返回内容"`
	Status       v1.TaskStatus `` /* 135-byte string literal not displayed */
	Retry        int64         `gorm:"column:retry;type:int not null default '0';comment:失败重试次数"`
	FailedReason string        `gorm:"column:failed_reason;type:text;comment:失败原因"`
	CreatedAt    time.Time     `` /* 132-byte string literal not displayed */
	UpdatedAt    time.Time     `gorm:"column:updated_at;type:timestamp not null;default:current_timestamp();comment:最后一次更新时间"`
}

func (Task) TableName

func (Task) TableName() string

type Timer

type Timer struct {
	ID              string          `gorm:"column:id;type:varchar(128) not null primary key;comment:主键"`
	AppId           string          `gorm:"column:app_id;type:varchar(64) not null;default:'';index:;comment:应用ID"`
	Name            string          `gorm:"column:name;type:varchar(64) not null;default:'';comment:定时器名称"`
	Type            v1.TimerType    `gorm:"column:type;type:tinyint not null;default:0;comment:定时器类型:0:未知;1:一次性定时器;2:cronjob类型"`
	CallbackType    v1.CallbackType `gorm:"column:callback_type;type:tinyint not null;default:0;comment:回调类型0:未知:1:http;2:mq"`
	CallbackAddress string          `gorm:"column:callback_address;type:varchar(128) not null;default:'';comment:回调地址"`
	CronExpr        string          `gorm:"column:cron_expr;type:varchar(128) not null;default:'';comment:cronjob类型定时器cron"`
	ExpireAt        int64           `gorm:"column:expire_at;type:bigint not null;default:0;comment:定时器时间"`
	Attach          string          `gorm:"column:attach;type:text;comment:附件内容"`
	Status          v1.TimerStatus  `gorm:"column:status;type:tinyint not null;default:0;comment:状态:0:未知;1:未激活;2:已激活"`
	Fail            int64           `gorm:"column:fail;type:int not null;default:0;comment:失败次数"`
	Success         int64           `gorm:"column:success;type:int not null;default:0;comment:成功次数"`
	Extra           *TimerExtra     `gorm:"column:extra;type:text;comment:json格式扩展字段"`
	CreatedAt       time.Time       `gorm:"column:created_at;type:timestamp not null;default:current_timestamp();comment:创建时间"`
	UpdatedAt       time.Time       `` /* 139-byte string literal not displayed */
	DeletedAt       gorm.DeletedAt  `gorm:"column:deleted_at;index;comment:是否删除"`
}

func (Timer) TableName

func (Timer) TableName() string

type TimerExtra

type TimerExtra struct {
	Params     []*v1.Params `json:"params"`
	FailReason []string     `json:"fail_reason"`
}

func (*TimerExtra) Scan

func (j *TimerExtra) Scan(value interface{}) error

func (*TimerExtra) Value

func (j *TimerExtra) Value() (driver.Value, error)

type Token

type Token struct {
	ID               int64     `gorm:"column:id;type:bigint unsigned not null primary key auto_increment;comment:主键"`
	UserId           string    `gorm:"column:user_id;type:varchar(128) not null;default:'';index:;comment:用户ID"`
	AccessToken      string    `gorm:"column:access_token;type:varchar(512) not null;default:'';index:,unique;comment:用户token"`
	ExpiresIn        int64     `gorm:"column:expires_in;type:bigint unsigned not null;default:0;comment:token过期时间,单位秒"`
	RefreshToken     string    `gorm:"column:refresh_token;type:varchar(256) not null;default:'';index:,unique;comment:刷新token"`
	RefreshExpiresIn int64     `gorm:"column:refresh_expires_in;type:bigint unsigned not null;default:0;comment:刷新token过期时间,单位秒"`
	CreatedAt        time.Time `gorm:"column:created_at;type:timestamp not null;default:current_timestamp();comment:创建时间"`
	UpdatedAt        time.Time `` /* 139-byte string literal not displayed */
}

func (Token) TableName

func (Token) TableName() string

type User

type User struct {
	ID             string        `gorm:"column:id;type:varchar(128) not null primary key;comment:主键"`
	Name           string        `gorm:"column:name;type:varchar(64) not null;default:'';index:,unique;comment:名称"`
	Password       string        `gorm:"column:password;type:varchar(256) not null;default:'';comment:密码"`
	Status         v1.UserStatus `gorm:"column:status;type:smallint not null;default:0;comment:应用状态:0:未知;1:禁用;2:启用"`
	Role           v1.UserRole   `gorm:"column:role;type:smallint not null;default:0;comment:用户角色:0:未知;1:管理员;2:读写;3:只读"`
	ChangePassword bool          `gorm:"column:change_password;type:smallint not null;default:0;comment:是否更改密码"`
	CreatedAt      time.Time     `gorm:"column:created_at;type:timestamp not null;default:current_timestamp();comment:创建时间"`
	UpdatedAt      time.Time     `` /* 139-byte string literal not displayed */
}

func (User) TableName

func (User) TableName() string

Jump to

Keyboard shortcuts

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