db

package
v0.6.0-beta Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Migrate

func Migrate(db *gorm.DB) error

func SqlError2Error

func SqlError2Error(err error) error

Types

type AccessToken

type AccessToken struct {
	TokenKey       string    `gorm:"column:token_key;primaryKey"`
	SecretToken    string    `gorm:"column:secret_token"`
	UID            int64     `gorm:"column:uid;index:tk_uid"`
	GID            int64     `gorm:"column:gid"`
	ClientCrt      string    `gorm:"column:client_crt"`
	ClientKey      string    `gorm:"column:client_key"`
	CertExpiration time.Time `gorm:"column:cert_expiration"`
	LastSeenAt     time.Time `gorm:"column:last_seen_at"`
	Namespace      string    `gorm:"column:namespace;index:tk_ns"`
}

func (*AccessToken) TableName

func (o *AccessToken) TableName() string

type Document

type Document struct {
	ID            int64     `gorm:"column:id;primaryKey"`
	OID           int64     `gorm:"column:oid;index:doc_oid"`
	Name          string    `gorm:"column:name;index:doc_name"`
	Namespace     string    `gorm:"column:namespace;index:doc_ns"`
	Source        string    `gorm:"column:source;index:doc_source"`
	ParentEntryID *int64    `gorm:"column:parent_entry_id;index:doc_parent_entry_id"`
	Keywords      string    `gorm:"column:keywords"`
	Content       string    `gorm:"column:content"`
	Summary       string    `gorm:"column:summary"`
	Marked        bool      `gorm:"column:marked;index:doc_is_marked"`
	Unread        bool      `gorm:"column:unread;index:doc_is_unread"`
	Desync        bool      `gorm:"column:desync"`
	CreatedAt     time.Time `gorm:"column:created_at"`
	ChangedAt     time.Time `gorm:"column:changed_at"`
}

func (*Document) From

func (d *Document) From(document *types.Document) *Document

func (*Document) TableName

func (d *Document) TableName() string

func (*Document) To

func (d *Document) To() *types.Document

type Event

type Event struct {
	ID              string    `gorm:"column:id;primaryKey"`
	Type            string    `gorm:"column:type;index:evt_type"`
	Source          string    `gorm:"column:source"`
	SpecVersion     string    `gorm:"column:specversion"`
	RefID           int64     `gorm:"column:ref_id;index:evt_refid"`
	RefType         string    `gorm:"column:ref_type;index:evt_reftype"`
	DataContentType string    `gorm:"column:datacontenttype"`
	Data            string    `gorm:"column:data"`
	Sequence        int64     `gorm:"column:sequence;index:evt_seq"`
	Namespace       string    `gorm:"column:namespace;index:evt_ns"`
	Time            time.Time `gorm:"column:time;index:evt_time"`
}

func (*Event) From

func (o *Event) From(event types.Event)

func (*Event) TableName

func (o *Event) TableName() string

func (*Event) To

func (o *Event) To() (event types.Event, err error)

type FridayAccount

type FridayAccount struct {
	ID             int64     `gorm:"column:id;primaryKey"`
	Namespace      string    `gorm:"column:namespace;index:fridayaccount_namespace"`
	RefId          int64     `gorm:"column:ref_id;index:fridayaccount_ref_id"`
	RefType        string    `gorm:"column:ref_type;index:fridayaccount_ref_type"`
	Type           string    `gorm:"column:type;index:fridayaccount_type"`
	CompleteTokens int       `gorm:"column:complete_tokens"`
	PromptTokens   int       `gorm:"column:prompt_tokens"`
	TotalTokens    int       `gorm:"column:total_tokens"`
	CreatedAt      time.Time `gorm:"column:created_at"`
}

func (*FridayAccount) From

func (a *FridayAccount) From(account *types.FridayAccount) *FridayAccount

func (*FridayAccount) TableName

func (a *FridayAccount) TableName() string

func (*FridayAccount) To

type Label

type Label struct {
	ID        int64  `gorm:"column:id;autoIncrement"`
	RefID     int64  `gorm:"column:ref_id;index:label_refid"`
	RefType   string `gorm:"column:ref_type;index:label_reftype"`
	Namespace string `gorm:"column:namespace;index:label_ns"`
	Key       string `gorm:"column:key"`
	Value     string `gorm:"column:value"`
	SearchKey string `gorm:"column:search_key;index:label_search_key"`
}

func (Label) TableName

func (o Label) TableName() string

type Logger

type Logger struct {
	*zap.SugaredLogger
}

func NewDbLogger

func NewDbLogger() *Logger

func (*Logger) Error

func (l *Logger) Error(ctx context.Context, s string, i ...interface{})

func (*Logger) Info

func (l *Logger) Info(ctx context.Context, s string, i ...interface{})

func (*Logger) LogMode

func (l *Logger) LogMode(level glogger.LogLevel) glogger.Interface

func (*Logger) Trace

func (l *Logger) Trace(ctx context.Context, begin time.Time, fc func() (sql string, rowsAffected int64), err error)

func (*Logger) Warn

func (l *Logger) Warn(ctx context.Context, s string, i ...interface{})

type Notification

type Notification struct {
	ID        string    `gorm:"column:id;primaryKey"`
	Title     string    `gorm:"column:title"`
	Message   string    `gorm:"column:message"`
	Namespace string    `gorm:"column:namespace;index:notif_ns"`
	Type      string    `gorm:"column:type"`
	Source    string    `gorm:"column:source"`
	Action    string    `gorm:"column:action"`
	Status    string    `gorm:"column:status"`
	Time      time.Time `gorm:"column:time;index:notif_time"`
}

func (*Notification) TableName

func (o *Notification) TableName() string

type Object

type Object struct {
	ID         int64   `gorm:"column:id;primaryKey"`
	Name       string  `gorm:"column:name;index:obj_name"`
	Aliases    *string `gorm:"column:aliases"`
	ParentID   *int64  `gorm:"column:parent_id;index:parent_id"`
	RefID      *int64  `gorm:"column:ref_id;index:ref_id"`
	RefCount   *int    `gorm:"column:ref_count"`
	Kind       string  `gorm:"column:kind"`
	KindMap    *int64  `gorm:"column:kind_map"`
	IsGroup    bool    `gorm:"column:is_group;index:obj_isgrp"`
	Size       *int64  `gorm:"column:size"`
	Version    int64   `gorm:"column:version;index:obj_version"`
	Dev        int64   `gorm:"column:dev"`
	Owner      *int64  `gorm:"column:owner"`
	GroupOwner *int64  `gorm:"column:group_owner"`
	Permission *int64  `gorm:"column:permission"`
	Storage    string  `gorm:"column:storage"`
	Namespace  string  `gorm:"column:namespace;index:obj_ns"`
	CreatedAt  int64   `gorm:"column:created_at"`
	ChangedAt  int64   `gorm:"column:changed_at"`
	ModifiedAt int64   `gorm:"column:modified_at"`
	AccessAt   int64   `gorm:"column:access_at"`
}

func (*Object) FromEntry

func (o *Object) FromEntry(en *types.Metadata) *Object

func (*Object) TableName

func (o *Object) TableName() string

func (*Object) ToEntry

func (o *Object) ToEntry() *types.Metadata

type ObjectChunk

type ObjectChunk struct {
	ID       int64 `gorm:"column:id;primaryKey"`
	OID      int64 `gorm:"column:oid;index:ck_oid"`
	ChunkID  int64 `gorm:"column:chunk_id;index:ck_id"`
	Off      int64 `gorm:"column:off"`
	Len      int64 `gorm:"column:len"`
	State    int16 `gorm:"column:state"`
	AppendAt int64 `gorm:"column:append_at;index:ck_append_at"`
}

func (ObjectChunk) TableName

func (o ObjectChunk) TableName() string

type ObjectExtend

type ObjectExtend struct {
	ID          int64  `gorm:"column:id;primaryKey"`
	Symlink     string `gorm:"column:symlink"`
	GroupFilter []byte `gorm:"column:group_filter"`
	PlugScope   []byte `gorm:"column:plug_scope"`
}

func (*ObjectExtend) From

func (o *ObjectExtend) From(ed *types.ExtendData) *ObjectExtend

func (*ObjectExtend) TableName

func (o *ObjectExtend) TableName() string

func (*ObjectExtend) ToExtData

func (o *ObjectExtend) ToExtData() types.ExtendData

type ObjectProperty

type ObjectProperty struct {
	ID        int64  `gorm:"column:id;autoIncrement"`
	OID       int64  `gorm:"column:oid;index:prop_oid"`
	Name      string `gorm:"column:key;index:prop_name"`
	Namespace string `gorm:"column:namespace;index:prop_ns"`
	Value     string `gorm:"column:value"`
	Encoded   bool   `gorm:"column:encoded"`
}

func (ObjectProperty) TableName

func (o ObjectProperty) TableName() string

type ObjectURI

type ObjectURI struct {
	OID       int64  `gorm:"column:oid;primaryKey"`
	Uri       string `gorm:"column:uri;index:obj_uri"`
	Namespace string `gorm:"column:namespace;index:obj_uri_ns"`
	Invalid   bool   `gorm:"column:invalid"`
}

func (*ObjectURI) FromEntryUri

func (o *ObjectURI) FromEntryUri(entryUri *types.EntryUri) *ObjectURI

func (*ObjectURI) TableName

func (o *ObjectURI) TableName() string

func (*ObjectURI) ToEntryUri

func (o *ObjectURI) ToEntryUri() *types.EntryUri

type RegisteredDevice

type RegisteredDevice struct {
	ID             string    `gorm:"column:id;primaryKey"`
	SyncedSequence int64     `gorm:"column:synced_sequence"`
	LastSeenAt     time.Time `gorm:"column:last_seen_at"`
	Namespace      string    `gorm:"column:namespace;index:device_ns"`
}

func (*RegisteredDevice) TableName

func (o *RegisteredDevice) TableName() string

type Room

type Room struct {
	ID        int64     `gorm:"column:id;primaryKey"`
	Namespace string    `gorm:"column:namespace;index:room_namespace"`
	Title     string    `gorm:"column:title"`
	EntryId   int64     `gorm:"column:entry_id;index:room_entry_id"`
	Prompt    string    `gorm:"column:prompt"`
	History   string    `gorm:"column:history"`
	CreatedAt time.Time `gorm:"column:created_at"`
}

func (*Room) From

func (r *Room) From(room *types.Room) (*Room, error)

func (*Room) TableName

func (r *Room) TableName() string

func (*Room) To

func (r *Room) To() (room *types.Room, err error)

type RoomMessage

type RoomMessage struct {
	ID        int64     `gorm:"column:id;primaryKey"`
	Namespace string    `gorm:"column:namespace;index:message_namespace"`
	RoomID    int64     `gorm:"column:room_id;index:message_room_id"`
	Sender    string    `gorm:"column:sender"`
	Message   string    `gorm:"column:message"`
	SendAt    time.Time `gorm:"column:send_at"`
	CreatedAt time.Time `gorm:"column:created_at"`
}

func (*RoomMessage) From

func (r *RoomMessage) From(roomMessage *types.RoomMessage) *RoomMessage

func (*RoomMessage) TableName

func (r *RoomMessage) TableName() string

func (*RoomMessage) To

func (r *RoomMessage) To() (roomMessage *types.RoomMessage)

type ScheduledTask

type ScheduledTask struct {
	ID             int64     `gorm:"column:id;autoIncrement"`
	TaskID         string    `gorm:"column:task_id;index:st_task_id"`
	Namespace      string    `gorm:"column:namespace;index:st_task_ns"`
	RefType        string    `gorm:"column:ref_type;index:sche_task_reftype"`
	RefID          int64     `gorm:"column:ref_id;index:sche_task_refid"`
	Status         string    `gorm:"column:status;index:st_task_status"`
	Result         string    `gorm:"column:result"`
	CreatedTime    time.Time `gorm:"column:created_time"`
	ExecutionTime  time.Time `gorm:"column:execution_time"`
	ExpirationTime time.Time `gorm:"column:expiration_time"`
	Event          string    `gorm:"column:event"`
}

func (ScheduledTask) TableName

func (d ScheduledTask) TableName() string

type SystemConfig

type SystemConfig struct {
	ID        int64     `gorm:"column:id;primaryKey"`
	Group     string    `gorm:"column:cfg_group;index:cfg_group"`
	Name      string    `gorm:"column:cfg_name;index:cfg_name"`
	Value     string    `gorm:"column:cfg_value"`
	Namespace string    `gorm:"column:namespace;index:cfg_namespace"`
	ChangedAt time.Time `gorm:"column:changed_at"`
}

func (SystemConfig) TableName

func (i SystemConfig) TableName() string

type SystemInfo

type SystemInfo struct {
	FsID     string `gorm:"column:fs_id;primaryKey"`
	ChunkSeg int64  `gorm:"column:chunk_seg"`
}

func (SystemInfo) TableName

func (i SystemInfo) TableName() string

type Workflow

type Workflow struct {
	ID              string    `gorm:"column:id;primaryKey"`
	Name            string    `gorm:"column:name"`
	Rule            string    `gorm:"column:rule"`
	Cron            string    `gorm:"column:cron"`
	Steps           string    `gorm:"column:steps"`
	Enable          bool      `gorm:"column:enable;index:wf_enable"`
	QueueName       string    `gorm:"column:queue_name"`
	Executor        string    `gorm:"column:executor"`
	Namespace       string    `gorm:"column:namespace;index:wf_ns"`
	CreatedAt       time.Time `gorm:"column:created_at;index:wf_creat"`
	UpdatedAt       time.Time `gorm:"column:updated_at"`
	LastTriggeredAt time.Time `gorm:"column:last_triggered_at"`
}

func (*Workflow) From

func (o *Workflow) From(wf *types.WorkflowSpec) (*Workflow, error)

func (*Workflow) TableName

func (o *Workflow) TableName() string

func (*Workflow) To

func (o *Workflow) To() (*types.WorkflowSpec, error)

type WorkflowJob

type WorkflowJob struct {
	ID            string    `gorm:"column:id;autoIncrement"`
	Workflow      string    `gorm:"column:workflow;index:job_wf_id"`
	TriggerReason string    `gorm:"column:trigger_reason"`
	TargetEntry   int64     `gorm:"column:target_entry;index:job_tgt_en"`
	Target        string    `gorm:"column:target"`
	Steps         string    `gorm:"column:steps"`
	Status        string    `gorm:"column:status;index:job_status"`
	Message       string    `gorm:"column:message"`
	QueueName     string    `gorm:"column:queue_name;index:job_queue"`
	Executor      string    `gorm:"column:executor;index:job_executor"`
	Namespace     string    `gorm:"column:namespace;index:job_ns"`
	StartAt       time.Time `gorm:"column:start_at"`
	FinishAt      time.Time `gorm:"column:finish_at"`
	CreatedAt     time.Time `gorm:"column:created_at;index:job_created_at"`
	UpdatedAt     time.Time `gorm:"column:updated_at"`
}

func (*WorkflowJob) From

func (o *WorkflowJob) From(job *types.WorkflowJob) (*WorkflowJob, error)

func (*WorkflowJob) TableName

func (o *WorkflowJob) TableName() string

func (*WorkflowJob) To

func (o *WorkflowJob) To() (*types.WorkflowJob, error)

Jump to

Keyboard shortcuts

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