db

package
v0.5.0-beta Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2023 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 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"`
	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"`
	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 DocumentFeed

type DocumentFeed struct {
	ID          string    `gorm:"column:id;primaryKey"`
	DisplayName string    `gorm:"column:display_name"`
	ParentID    *int64    `gorm:"column:parent_id;index:docfeed_parent_id"`
	Keywords    *string   `gorm:"column:keywords"`
	IndexQuery  *string   `gorm:"column:index_query"`
	CreatedAt   time.Time `gorm:"column:created_at"`
}

func (*DocumentFeed) TableName

func (d *DocumentFeed) TableName() string

type FridayAccount

type FridayAccount struct {
	ID             int64     `gorm:"column:id;primaryKey"`
	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"`
	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"`
	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"`
	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)

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"`
	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"`
	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 PluginData

type PluginData struct {
	ID         int64            `gorm:"column:id;autoIncrement"`
	PluginName string           `gorm:"column:plugin_name;index:plugin_name"`
	Version    string           `gorm:"column:version"`
	Type       types.PluginType `gorm:"column:type"`
	GroupId    string           `gorm:"column:group_id;index:group_id"`
	RecordId   string           `gorm:"column:record_id;index:record_id"`
	Content    string           `gorm:"column:content"`
}

func (PluginData) TableName

func (d PluginData) TableName() string

type ScheduledTask

type ScheduledTask struct {
	ID             int64     `gorm:"column:id;autoIncrement"`
	TaskID         string    `gorm:"column:task_id;index:st_task_id"`
	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 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"`
	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"`
	Executor      string    `gorm:"column:executor;index:job_executor"`
	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