db

package
v0.0.0-...-e686d8b Latest Latest
Warning

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

Go to latest
Published: Dec 26, 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

Types

type BleveKV

type BleveKV struct {
	ID    string `gorm:"column:id;primaryKey"`
	Key   []byte `gorm:"column:key"`
	Value []byte `gorm:"column:value"`
}

func (*BleveKV) TableName

func (v *BleveKV) 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"`
	HeaderImage   string    `gorm:"column:header_image"`
	SubContent    string    `gorm:"column:sub_content"`
	PureContent   string    `gorm:"column:pure_content"`
	Marked        bool      `gorm:"column:marked;index:doc_is_marked"`
	Unread        bool      `gorm:"column:unread;index:doc_is_unread"`
	Token         TsVector  `gorm:"column:token;type:tsvector"`
	CreatedAt     time.Time `gorm:"column:created_at"`
	ChangedAt     time.Time `gorm:"column:changed_at"`
}

func (*Document) From

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

func (*Document) TableName

func (d *Document) TableName() string

func (*Document) To

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

func (*Document) Tokens

func (d *Document) Tokens(document *doc.Document) *Document

func (*Document) UpdateFrom

func (d *Document) UpdateFrom(document *doc.Document) *Document

type Entity

type Entity struct {
	*gorm.DB
}

func NewDbEntity

func NewDbEntity(db *gorm.DB, migrate func(db *gorm.DB) error) (*Entity, error)

func (*Entity) WithNamespace

func (e *Entity) WithNamespace(ctx context.Context) *gorm.DB

type Index

type Index struct {
	ID        string `gorm:"column:id;type:varchar(256);primaryKey"`
	Name      string `gorm:"column:name;index:index_name"`
	Namespace string `gorm:"column:namespace;index:index_namespace"`
	OID       int64  `gorm:"column:oid;index:index_oid"`
	Group     int    `gorm:"column:idx_group;index:index_group"`
	ParentID  int64  `gorm:"column:parent_entry_id;index:index_parent_id"`
	Content   string `gorm:"column:content"`
	Vector    string `gorm:"column:vector;type:json"`
	Extra     string `gorm:"column:extra"`
	CreatedAt int64  `gorm:"column:created_at"`
	ChangedAt int64  `gorm:"column:changed_at"`
}

func (*Index) From

func (v *Index) From(element *vector.Element) (*Index, error)

func (*Index) TableName

func (v *Index) TableName() string

func (*Index) To

func (v *Index) To() (*vector.Element, error)

func (*Index) ToDoc

func (v *Index) ToDoc() *vector.Doc

func (*Index) Update

func (v *Index) Update(vector *Index)

type TsVector

type TsVector string

func (*TsVector) Scan

func (t *TsVector) Scan(value interface{}) error

func (*TsVector) Value

func (t *TsVector) Value() (driver.Value, error)

Jump to

Keyboard shortcuts

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