Documentation ¶
Index ¶
- Constants
- func Migrate(db *gorm.DB) error
- type BleveKV
- type Document
- type Index
- type KVIterator
- type PgKVReader
- type PgKVWriter
- type PostgresClient
- func (p *PostgresClient) CreateDocument(ctx context.Context, doc *doc.Document) error
- func (p *PostgresClient) DeleteDocument(ctx context.Context, entryId int64) error
- func (p *PostgresClient) FilterDocuments(ctx context.Context, filter *doc.DocumentFilter) ([]*doc.Document, error)
- func (p *PostgresClient) Get(ctx context.Context, oid int64, name string, group int) (*vector.Element, error)
- func (p *PostgresClient) GetDocument(ctx context.Context, entryId int64) (*doc.Document, error)
- func (p *PostgresClient) Inited(ctx context.Context) (bool, error)
- func (p *PostgresClient) Search(ctx context.Context, query vector.VectorDocQuery, vectors []float32, k int) ([]*vector.Doc, error)
- func (p *PostgresClient) Store(ctx context.Context, element *vector.Element, extra map[string]any) error
- func (p *PostgresClient) UpdateDocument(ctx context.Context, doc *doc.Document) error
- func (p *PostgresClient) WithNamespace(ctx context.Context) *gorm.DB
Constants ¶
View Source
const (
PgKVStoreName = "pg_table"
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BleveKV ¶
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"` Marked bool `gorm:"column:marked;index:doc_is_marked"` Unread bool `gorm:"column:unread;index:doc_is_unread"` CreatedAt time.Time `gorm:"column:created_at"` ChangedAt time.Time `gorm:"column:changed_at"` }
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"` }
type KVIterator ¶
type KVIterator struct {
// contains filtered or unexported fields
}
func (*KVIterator) Close ¶
func (i *KVIterator) Close() error
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) 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(postgresUrl string) (*PostgresClient, error)
func (*PostgresClient) CreateDocument ¶
func (*PostgresClient) DeleteDocument ¶
func (p *PostgresClient) DeleteDocument(ctx context.Context, entryId int64) error
func (*PostgresClient) FilterDocuments ¶
func (p *PostgresClient) FilterDocuments(ctx context.Context, filter *doc.DocumentFilter) ([]*doc.Document, error)
func (*PostgresClient) GetDocument ¶
func (*PostgresClient) Search ¶
func (p *PostgresClient) Search(ctx context.Context, query vector.VectorDocQuery, vectors []float32, k int) ([]*vector.Doc, error)
func (*PostgresClient) UpdateDocument ¶
func (*PostgresClient) WithNamespace ¶
func (p *PostgresClient) WithNamespace(ctx context.Context) *gorm.DB
Click to show internal directories.
Click to hide internal directories.