vikingdb

package
v1.0.138 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Vector     = "vector"
	Int64      = "int64"
	ListInt64  = "list<int64>"
	String     = "string"
	ListString = "list<string>"
	Float32    = "float32"
	Bool       = "bool"
	Text       = "text"

	L2     = "l2"
	IP     = "ip"
	COSINE = "cosine"
	FLAT   = "flat"
	HNSW   = "hnsw"
	IVF    = "ivf"
	Float  = "float"
	Int8   = "int8"
	Fix16  = "fix16"
	PQ     = "pq"

	Asc  = "asc"
	Desc = "desc"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Collection

type Collection struct {
	CollectionName  string
	Fields          []Field
	VikingDBService *VikingDBService
	PrimaryKey      string
	Indexes         []*Index
	Description     string
	Stat            map[string]interface{}
	CreateTime      string
	UpdateTime      string
	UpdatePerson    string
}

func (*Collection) DeleteData

func (collection *Collection) DeleteData(id interface{}) error

func (*Collection) FetchData

func (collection *Collection) FetchData(id interface{}) ([]*Data, error)

func (*Collection) UpsertData

func (collection *Collection) UpsertData(data interface{}) error

type Data

type Data struct {
	Id        interface{}
	Fields    map[string]interface{}
	Timestamp interface{}
	TTL       int64
	Score     float64
	Text      string
}

type EmbModel

type EmbModel struct {
	ModelName string
	// contains filtered or unexported fields
}

type Field

type Field struct {
	FieldName    string
	FieldType    string
	DefaultVal   interface{}
	Dim          int64
	IsPrimaryKey bool
	PipelineName string
}

type Index

type Index struct {
	CollectionName  string
	IndexName       string
	Description     string
	VectorIndex     *VectorIndexParams
	ScalarIndex     interface{}
	Stat            string
	VikingDBService *VikingDBService
	CpuQuota        int64
	PartitionBy     string
	CreateTime      string
	UpdateTime      string
	UpdatePerson    string
	IndexCost       interface{}
	ShardCount      int64
	// contains filtered or unexported fields
}

func (*Index) FetchData

func (index *Index) FetchData(id interface{}, searchOptions *SearchOptions) ([]*Data, error)

func (*Index) Search

func (index *Index) Search(order interface{}, searchOptions *SearchOptions) ([]*Data, error)

func (*Index) SearchById

func (index *Index) SearchById(id interface{}, searchOptions *SearchOptions) ([]*Data, error)

func (*Index) SearchByText

func (index *Index) SearchByText(text TextObject, searchOptions *SearchOptions) ([]*Data, error)

func (*Index) SearchByVector

func (index *Index) SearchByVector(vector []float64, searchOptions *SearchOptions) ([]*Data, error)

type IndexOptions

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

func NewIndexOptions

func NewIndexOptions() *IndexOptions

func (*IndexOptions) SetCpuQuota

func (indexOptions *IndexOptions) SetCpuQuota(cpuQuota int64) *IndexOptions

func (*IndexOptions) SetDescription

func (indexOptions *IndexOptions) SetDescription(description string) *IndexOptions

func (*IndexOptions) SetPartitionBy

func (indexOptions *IndexOptions) SetPartitionBy(partitionBy string) *IndexOptions

func (*IndexOptions) SetScalarIndex

func (indexOptions *IndexOptions) SetScalarIndex(scalarIndex []string) *IndexOptions

func (*IndexOptions) SetShardCount added in v1.0.134

func (indexOptions *IndexOptions) SetShardCount(shardCount int64) *IndexOptions

func (*IndexOptions) SetVectorIndex

func (indexOptions *IndexOptions) SetVectorIndex(vectorIndex *VectorIndexParams) *IndexOptions

type RawData

type RawData struct {
	DataType string
	Text     string
}

type ScalarOrder

type ScalarOrder struct {
	FieldName string
	Order     string
}

type SearchOptions

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

func NewSearchOptions

func NewSearchOptions() *SearchOptions

func (*SearchOptions) SetFilter

func (searchOptions *SearchOptions) SetFilter(filter map[string]interface{}) *SearchOptions

func (*SearchOptions) SetLimit

func (searchOptions *SearchOptions) SetLimit(limit int64) *SearchOptions

func (*SearchOptions) SetOutputFields

func (searchOptions *SearchOptions) SetOutputFields(outputFields []string) *SearchOptions

func (*SearchOptions) SetPartition

func (searchOptions *SearchOptions) SetPartition(partition string) *SearchOptions

type TextObject

type TextObject struct {
	Text   string
	Url    string
	Base64 interface{}
}

type UpdateCollectionOptions

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

func NewUpdateCollectionOptions

func NewUpdateCollectionOptions() *UpdateCollectionOptions

func (*UpdateCollectionOptions) SetDescription

func (updateCollectionOptions *UpdateCollectionOptions) SetDescription(description string) *UpdateCollectionOptions

func (*UpdateCollectionOptions) SetFields

func (updateCollectionOptions *UpdateCollectionOptions) SetFields(fields []Field) *UpdateCollectionOptions

type UpdateIndexOptions added in v1.0.134

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

func NewUpdateIndexOptions added in v1.0.134

func NewUpdateIndexOptions() *UpdateIndexOptions

func (*UpdateIndexOptions) SetCpuQuota added in v1.0.134

func (updateIndexOptions *UpdateIndexOptions) SetCpuQuota(cpuQuota int64) *UpdateIndexOptions

func (*UpdateIndexOptions) SetDescription added in v1.0.134

func (updateIndexOptions *UpdateIndexOptions) SetDescription(description string) *UpdateIndexOptions

func (*UpdateIndexOptions) SetScalarIndex added in v1.0.134

func (updateIndexOptions *UpdateIndexOptions) SetScalarIndex(scalarIndex []string) *UpdateIndexOptions

type VectorIndexParams

type VectorIndexParams struct {
	IndexType string
	Distance  string
	Quant     string
	HnswM     int64
	HnswCef   int64
	HnswSef   int64
}

type VectorOrder

type VectorOrder struct {
	Vector interface{}
	Id     interface{}
}

type VikingDBService

type VikingDBService struct {
	Client *base.Client
}

func NewVikingDBService

func NewVikingDBService(host string, region string, ak string, sk string, scheme string) *VikingDBService

func (*VikingDBService) CreateCollection

func (vikingDBService *VikingDBService) CreateCollection(collectionName string, fields []Field, description string) (*Collection, error)

func (*VikingDBService) CreateIndex

func (vikingDBService *VikingDBService) CreateIndex(collectionName string, indexName string, indexOptions *IndexOptions) (*Index, error)

func (*VikingDBService) DoRequest

func (vikingDBService *VikingDBService) DoRequest(ctx context.Context, api string, query url.Values, body string) (map[string]interface{}, error)

func (*VikingDBService) DropCollection

func (vikingDBService *VikingDBService) DropCollection(collectionName string) error

func (*VikingDBService) DropIndex

func (vikingDBService *VikingDBService) DropIndex(collectionName string, indexName string) error

func (*VikingDBService) Embedding

func (vikingDBService *VikingDBService) Embedding(embModel EmbModel, rawData interface{}) ([][]float64, error)

func (*VikingDBService) GetCollection

func (vikingDBService *VikingDBService) GetCollection(collectionName string) (*Collection, error)

func (*VikingDBService) GetIndex

func (vikingDBService *VikingDBService) GetIndex(collectionName string, indexName string) (*Index, error)

func (*VikingDBService) ListCollections

func (vikingDBService *VikingDBService) ListCollections() ([]*Collection, error)

func (*VikingDBService) ListIndexes

func (vikingDBService *VikingDBService) ListIndexes(collectionName string) ([]*Index, error)

func (*VikingDBService) Rerank added in v1.0.138

func (vikingDBService *VikingDBService) Rerank(query string, content string, title string) (float64, error)

func (*VikingDBService) SetHeader added in v1.0.137

func (vikingDBService *VikingDBService) SetHeader(header map[string]string)

func (*VikingDBService) UpdateCollection

func (vikingDBService *VikingDBService) UpdateCollection(collectionName string, updateCollectionOptions *UpdateCollectionOptions) error

func (*VikingDBService) UpdateIndex added in v1.0.134

func (vikingDBService *VikingDBService) UpdateIndex(collectionName string, indexName string, updateIndexOptions *UpdateIndexOptions) error

Jump to

Keyboard shortcuts

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