postgres

package
v0.0.0-...-f03bf9e Latest Latest
Warning

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

Go to latest
Published: May 29, 2024 License: Apache-2.0 Imports: 17 Imported by: 1

Documentation

Index

Constants

View Source
const (
	PgKVStoreName = "pg_table"
)

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 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 *models.Element) (*Index, error)

func (*Index) TableName

func (v *Index) TableName() string

func (*Index) To

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

func (*Index) ToDoc

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

func (*Index) Update

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

type KVIterator

type KVIterator struct {
	// contains filtered or unexported fields
}

func (*KVIterator) Close

func (i *KVIterator) Close() error

func (*KVIterator) Current

func (i *KVIterator) Current() ([]byte, []byte, bool)

func (*KVIterator) Key

func (i *KVIterator) Key() []byte

func (*KVIterator) Next

func (i *KVIterator) Next()

func (*KVIterator) Seek

func (i *KVIterator) Seek(key []byte)

func (*KVIterator) Valid

func (i *KVIterator) Valid() bool

func (*KVIterator) Value

func (i *KVIterator) Value() []byte

type PgKVReader

type PgKVReader struct {
	*PostgresClient
}

func NewPgKVReader

func NewPgKVReader(cli *PostgresClient) *PgKVReader

func (*PgKVReader) Close

func (p *PgKVReader) Close() error

func (*PgKVReader) Get

func (p *PgKVReader) Get(key []byte) ([]byte, error)

func (*PgKVReader) MultiGet

func (p *PgKVReader) MultiGet(keys [][]byte) ([][]byte, error)

func (*PgKVReader) PrefixIterator

func (p *PgKVReader) PrefixIterator(prefix []byte) store.KVIterator

func (*PgKVReader) RangeIterator

func (p *PgKVReader) RangeIterator(start, end []byte) store.KVIterator

type PgKVWriter

type PgKVWriter struct {
	*PostgresClient
	// contains filtered or unexported fields
}

func NewPgKVWriter

func NewPgKVWriter(cli *PostgresClient, mo store.MergeOperator) *PgKVWriter

func (*PgKVWriter) Close

func (p *PgKVWriter) Close() error

func (*PgKVWriter) ExecuteBatch

func (p *PgKVWriter) ExecuteBatch(batch store.KVBatch) error

func (*PgKVWriter) NewBatch

func (p *PgKVWriter) NewBatch() store.KVBatch

func (*PgKVWriter) NewBatchEx

func (p *PgKVWriter) NewBatchEx(options store.KVBatchOptions) ([]byte, store.KVBatch, error)

type PostgresClient

type PostgresClient struct {
	// contains filtered or unexported fields
}

func NewPostgresClient

func NewPostgresClient(log logger.Logger, postgresUrl string) (*PostgresClient, error)

func (*PostgresClient) Get

func (p *PostgresClient) Get(ctx context.Context, oid int64, name string, group int) (*models.Element, error)

func (*PostgresClient) Inited

func (p *PostgresClient) Inited(ctx context.Context) (bool, error)

func (*PostgresClient) Search

func (p *PostgresClient) Search(ctx context.Context, query models.DocQuery, vectors []float32, k int) ([]*models.Doc, error)

func (*PostgresClient) Store

func (p *PostgresClient) Store(ctx context.Context, element *models.Element, extra map[string]any) error

Jump to

Keyboard shortcuts

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