Documentation
¶
Index ¶
- func CosineSimilarity(a, b []float64) (float64, error)
- type Client
- func (c *Client) Close() error
- func (c *Client) DeleteOne(ctx context.Context, tableName string, keys Row) error
- func (c *Client) Find(ctx context.Context, tableName string, query Query, options ...FindOption) (MultiResult, error)
- func (c *Client) FindStream(ctx context.Context, tableName string, query Query, ch chan Row, ...) error
- func (c *Client) Get(ctx context.Context, tableName string, keys Row) (SingleResult, error)
- func (c *Client) GetTable(tableName string) (Table, error)
- func (c *Client) SetTable(table Table) error
- func (c *Client) Tables() (Tables, error)
- func (c *Client) UpsertOne(ctx context.Context, tableName string, row Row) error
- func (c *Client) VectorSearch(ctx context.Context, tableName string, query Query, options ...SearchOption) (MultiResult, error)
- type ClientOption
- type ClientOptions
- type Collector
- type EmbeddedQuery
- type FindOption
- type FindOptions
- type IndexFields
- type Metrics
- type MultiResult
- type Query
- type QuickMap
- type Row
- func (r *Row) FromBytes(data []byte) error
- func (r *Row) FromItem(item *badger.Item) error
- func (r *Row) GetVector() []float64
- func (r *Row) Matches(row Row) bool
- func (r *Row) Set(key string, value any)
- func (r *Row) SetSimilarityScore(score float64)
- func (r *Row) String() string
- func (r *Row) ToBytes() ([]byte, error)
- type RowOption
- type RowOptions
- type Rows
- type SearchOption
- type SearchOptions
- type SingleResult
- type Table
- type Tables
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CosineSimilarity ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(options ...ClientOption) (*Client, error)
func (*Client) Find ¶
func (c *Client) Find(ctx context.Context, tableName string, query Query, options ...FindOption) (MultiResult, error)
func (*Client) FindStream ¶
func (*Client) VectorSearch ¶
func (c *Client) VectorSearch(ctx context.Context, tableName string, query Query, options ...SearchOption) (MultiResult, error)
type ClientOption ¶
type ClientOption func(*ClientOptions)
func WithDBPath ¶
func WithDBPath(dbPath string) ClientOption
func WithLogger ¶
func WithLogger(logger *slog.Logger) ClientOption
type ClientOptions ¶
type ClientOptions struct {
// contains filtered or unexported fields
}
type Collector ¶
type Collector[T any] struct { // contains filtered or unexported fields }
func NewCollector ¶
type EmbeddedQuery ¶
type EmbeddedQuery struct {
// contains filtered or unexported fields
}
func (*EmbeddedQuery) GetPrimary ¶
func (q *EmbeddedQuery) GetPrimary() QuickMap
func (*EmbeddedQuery) GetVector ¶
func (q *EmbeddedQuery) GetVector() []float64
func (*EmbeddedQuery) Match ¶
func (q *EmbeddedQuery) Match(r Row) bool
func (*EmbeddedQuery) SetVector ¶
func (q *EmbeddedQuery) SetVector(vector []float64)
func (*EmbeddedQuery) String ¶
func (q *EmbeddedQuery) String() string
type FindOption ¶
type FindOption func(*FindOptions)
func WithFindLimit ¶
func WithFindLimit(limit int) FindOption
func WithFindOrder ¶
func WithFindOrder(order func(Row, Row) int) FindOption
func WithFindStartAtIndex ¶
func WithFindStartAtIndex(startAtIndex Row) FindOption
type FindOptions ¶
type IndexFields ¶
type IndexFields []string
func (IndexFields) PartialKey ¶
func (i IndexFields) PartialKey(prefix string, query Query) ([]byte, error)
type Metrics ¶
type MultiResult ¶
func NewMultiResult ¶
func NewMultiResult() MultiResult
func (*MultiResult) ToYAML ¶
func (i *MultiResult) ToYAML() []byte
type Query ¶
type Row ¶
type Row struct {
Index []byte `yaml:"-" json:"-"`
Data QuickMap `yaml:"data" json:"data"`
Vector []float64 `yaml:"-" json:"vector"`
SimilarityScore float64 `yaml:"similarityScore,omitempty" json:"similarityScore,omitempty"`
}
func (*Row) SetSimilarityScore ¶
type RowOptions ¶
type SearchOption ¶
type SearchOption func(*SearchOptions)
func WithSearchLimit ¶
func WithSearchLimit(limit int) SearchOption
func WithSearchSimilarityThreshold ¶
func WithSearchSimilarityThreshold(threshold float64) SearchOption
type SearchOptions ¶
type SingleResult ¶
func NewSingleResult ¶
func NewSingleResult() SingleResult
func (*SingleResult) ToYAML ¶
func (i *SingleResult) ToYAML() []byte
type Table ¶
type Table struct {
Name string `yaml:"name"`
PrimaryIndexFields IndexFields `yaml:"primaryIndexFields"`
}
Click to show internal directories.
Click to hide internal directories.