Documentation ¶
Overview ¶
Package milvusclient implements the official Go Milvus client for v2.
Index ¶
- Constants
- Variables
- func NewColumnBasedInsertOption(collName string, columns ...column.Column) *columnBasedDataOption
- func NewCreateCollectionOption(name string, collectionSchema *entity.Schema) *createCollectionOption
- func NewCreateDatabaseOption(dbName string) *createDatabaseOption
- func NewCreateIndexOption(collectionName string, fieldName string, index index.Index) *createIndexOption
- func NewCreatePartitionOption(collectionName string, partitionName string) *createPartitionOpt
- func NewDeleteOption(collectionName string) *deleteOption
- func NewDescribeCollectionOption(name string) *describeCollectionOption
- func NewDescribeIndexOption(collectionName string, indexName string) *describeIndexOption
- func NewDropCollectionOption(name string) *dropCollectionOption
- func NewDropDatabaseOption(dbName string) *dropDatabaseOption
- func NewDropIndexOption(collectionName string, indexName string) *dropIndexOption
- func NewDropPartitionOption(collectionName string, partitionName string) *dropPartitionOpt
- func NewFlushOption(collName string) *flushOption
- func NewHasPartitionOption(collectionName string, partitionName string) *hasPartitionOpt
- func NewListCollectionOption() *listCollectionOption
- func NewListDatabaseOption() *listDatabaseOption
- func NewListIndexOption(collectionName string) *listIndexOption
- func NewListPartitionOption(collectionName string) *listPartitionsOpt
- func NewLoadCollectionOption(collectionName string) *loadCollectionOption
- func NewLoadPartitionsOption(collectionName string, partitionsNames []string) *loadPartitionsOption
- func NewQueryOption(collectionName string) *queryOption
- func NewReleaseCollectionOption(collectionName string) *releaseCollectionOption
- func NewReleasePartitionsOptions(collectionName string, partitionNames ...string) *releasePartitionsOption
- func NewRowBasedInsertOption(collName string, rows ...any) *rowBasedDataOption
- func NewSearchOption(collectionName string, limit int, vectors []entity.Vector) *searchOption
- func NewUsingDatabaseOption(dbName string) *usingDatabaseNameOpt
- func RetryOnRateLimitInterceptor(maxRetry uint, maxBackoff time.Duration, ...) grpc.UnaryClientInterceptor
- func SimpleCreateCollectionOptions(name string, dim int64) *createCollectionOption
- type Client
- func (c *Client) Close(ctx context.Context) error
- func (c *Client) CreateCollection(ctx context.Context, option CreateCollectionOption, ...) error
- func (c *Client) CreateDatabase(ctx context.Context, option CreateDatabaseOption, ...) error
- func (c *Client) CreateIndex(ctx context.Context, option CreateIndexOption, callOptions ...grpc.CallOption) (*CreateIndexTask, error)
- func (c *Client) CreatePartition(ctx context.Context, opt CreatePartitionOption, callOptions ...grpc.CallOption) error
- func (c *Client) Delete(ctx context.Context, option DeleteOption, callOptions ...grpc.CallOption) (DeleteResult, error)
- func (c *Client) DescribeCollection(ctx context.Context, option DescribeCollectionOption, ...) (collection *entity.Collection, err error)
- func (c *Client) DescribeIndex(ctx context.Context, opt DescribeIndexOption, callOptions ...grpc.CallOption) (IndexDescription, error)
- func (c *Client) DropCollection(ctx context.Context, option DropCollectionOption, ...) error
- func (c *Client) DropDatabase(ctx context.Context, option DropDatabaseOption, callOptions ...grpc.CallOption) error
- func (c *Client) DropIndex(ctx context.Context, opt DropIndexOption, callOptions ...grpc.CallOption) error
- func (c *Client) DropPartition(ctx context.Context, opt DropPartitionOption, callOptions ...grpc.CallOption) error
- func (c *Client) Flush(ctx context.Context, option FlushOption, callOptions ...grpc.CallOption) (*FlushTask, error)
- func (c *Client) HasCollection(ctx context.Context, option HasCollectionOption, ...) (has bool, err error)
- func (c *Client) HasPartition(ctx context.Context, opt HasPartitionOption, callOptions ...grpc.CallOption) (has bool, err error)
- func (c *Client) Insert(ctx context.Context, option InsertOption, callOptions ...grpc.CallOption) (InsertResult, error)
- func (c *Client) ListCollections(ctx context.Context, option ListCollectionOption, ...) (collectionNames []string, err error)
- func (c *Client) ListDatabase(ctx context.Context, option ListDatabaseOption, callOptions ...grpc.CallOption) (databaseNames []string, err error)
- func (c *Client) ListIndexes(ctx context.Context, opt ListIndexOption, callOptions ...grpc.CallOption) ([]string, error)
- func (c *Client) ListPartitions(ctx context.Context, opt ListPartitionsOption, callOptions ...grpc.CallOption) (partitionNames []string, err error)
- func (c *Client) LoadCollection(ctx context.Context, option LoadCollectionOption, ...) (LoadTask, error)
- func (c *Client) LoadPartitions(ctx context.Context, option LoadPartitionsOption, ...) (LoadTask, error)
- func (c *Client) MetadataUnaryInterceptor() grpc.UnaryClientInterceptor
- func (c *Client) Query(ctx context.Context, option QueryOption, callOptions ...grpc.CallOption) (ResultSet, error)
- func (c *Client) ReleaseCollection(ctx context.Context, option ReleaseCollectionOption, ...) error
- func (c *Client) ReleasePartitions(ctx context.Context, option ReleasePartitionsOption, ...) error
- func (c *Client) Search(ctx context.Context, option SearchOption, callOptions ...grpc.CallOption) ([]ResultSet, error)
- func (c *Client) Upsert(ctx context.Context, option UpsertOption, callOptions ...grpc.CallOption) (UpsertResult, error)
- func (c *Client) UsingDatabase(ctx context.Context, option UsingDatabaseOption) error
- type ClientConfig
- type CollectionCache
- type CreateCollectionOption
- type CreateDatabaseOption
- type CreateIndexOption
- type CreateIndexTask
- type CreatePartitionOption
- type DataSet
- type DeleteOption
- type DeleteResult
- type DescribeCollectionOption
- type DescribeIndexOption
- type DropCollectionOption
- type DropDatabaseOption
- type DropIndexOption
- type DropPartitionOption
- type FlushOption
- type FlushTask
- type HasCollectionOption
- type HasPartitionOption
- type IndexDescription
- type InsertOption
- type InsertResult
- type ListCollectionOption
- type ListDatabaseOption
- type ListIndexOption
- type ListPartitionsOption
- type LoadCollectionOption
- type LoadPartitionsOption
- type LoadTask
- type QueryOption
- type ReleaseCollectionOption
- type ReleasePartitionsOption
- type ResultSet
- type ResultSets
- type RetryRateLimitOption
- type SearchOption
- type UpsertOption
- type UpsertResult
- type UsingDatabaseOption
Constants ¶
const (
RetryOnRateLimit ctxKey = iota
)
Variables ¶
var DefaultGrpcOpts = []grpc.DialOption{ grpc.WithBlock(), grpc.WithKeepaliveParams(keepalive.ClientParameters{ Time: 5 * time.Second, Timeout: 10 * time.Second, PermitWithoutStream: true, }), grpc.WithConnectParams(grpc.ConnectParams{ Backoff: backoff.Config{ BaseDelay: 100 * time.Millisecond, Multiplier: 1.6, Jitter: 0.2, MaxDelay: 3 * time.Second, }, MinConnectTimeout: 3 * time.Second, }), }
DefaultGrpcOpts is GRPC options for milvus client.
Functions ¶
func NewCreateCollectionOption ¶
func NewCreateCollectionOption(name string, collectionSchema *entity.Schema) *createCollectionOption
NewCreateCollectionOption returns a CreateCollectionOption with customized collection schema
func NewCreateDatabaseOption ¶
func NewCreateDatabaseOption(dbName string) *createDatabaseOption
func NewCreateIndexOption ¶
func NewDeleteOption ¶
func NewDeleteOption(collectionName string) *deleteOption
func NewDescribeCollectionOption ¶
func NewDescribeCollectionOption(name string) *describeCollectionOption
NewDescribeCollectionOption composes a describeCollectionOption with provided collection name.
func NewDescribeIndexOption ¶
func NewDropCollectionOption ¶
func NewDropCollectionOption(name string) *dropCollectionOption
func NewDropDatabaseOption ¶
func NewDropDatabaseOption(dbName string) *dropDatabaseOption
func NewDropIndexOption ¶
func NewDropPartitionOption ¶
func NewFlushOption ¶
func NewFlushOption(collName string) *flushOption
func NewHasPartitionOption ¶
func NewListCollectionOption ¶
func NewListCollectionOption() *listCollectionOption
func NewListDatabaseOption ¶
func NewListDatabaseOption() *listDatabaseOption
func NewListIndexOption ¶
func NewListIndexOption(collectionName string) *listIndexOption
func NewListPartitionOption ¶
func NewListPartitionOption(collectionName string) *listPartitionsOpt
func NewLoadCollectionOption ¶
func NewLoadCollectionOption(collectionName string) *loadCollectionOption
func NewLoadPartitionsOption ¶
func NewQueryOption ¶
func NewQueryOption(collectionName string) *queryOption
func NewReleaseCollectionOption ¶
func NewReleaseCollectionOption(collectionName string) *releaseCollectionOption
func NewRowBasedInsertOption ¶
func NewSearchOption ¶
func NewUsingDatabaseOption ¶
func NewUsingDatabaseOption(dbName string) *usingDatabaseNameOpt
func RetryOnRateLimitInterceptor ¶
func RetryOnRateLimitInterceptor(maxRetry uint, maxBackoff time.Duration, backoffFunc grpc_retry.BackoffFuncContext) grpc.UnaryClientInterceptor
RetryOnRateLimitInterceptor returns a new retrying unary client interceptor.
func SimpleCreateCollectionOptions ¶
SimpleCreateCollectionOptions returns a CreateCollectionOption with default fast collection options.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) CreateCollection ¶
func (c *Client) CreateCollection(ctx context.Context, option CreateCollectionOption, callOptions ...grpc.CallOption) error
CreateCollection is the API for create a collection in Milvus.
func (*Client) CreateDatabase ¶
func (c *Client) CreateDatabase(ctx context.Context, option CreateDatabaseOption, callOptions ...grpc.CallOption) error
func (*Client) CreateIndex ¶
func (c *Client) CreateIndex(ctx context.Context, option CreateIndexOption, callOptions ...grpc.CallOption) (*CreateIndexTask, error)
func (*Client) CreatePartition ¶
func (c *Client) CreatePartition(ctx context.Context, opt CreatePartitionOption, callOptions ...grpc.CallOption) error
CreatePartition is the API for creating a partition for a collection.
func (*Client) Delete ¶
func (c *Client) Delete(ctx context.Context, option DeleteOption, callOptions ...grpc.CallOption) (DeleteResult, error)
func (*Client) DescribeCollection ¶
func (c *Client) DescribeCollection(ctx context.Context, option DescribeCollectionOption, callOptions ...grpc.CallOption) (collection *entity.Collection, err error)
func (*Client) DescribeIndex ¶
func (c *Client) DescribeIndex(ctx context.Context, opt DescribeIndexOption, callOptions ...grpc.CallOption) (IndexDescription, error)
func (*Client) DropCollection ¶
func (c *Client) DropCollection(ctx context.Context, option DropCollectionOption, callOptions ...grpc.CallOption) error
func (*Client) DropDatabase ¶
func (c *Client) DropDatabase(ctx context.Context, option DropDatabaseOption, callOptions ...grpc.CallOption) error
func (*Client) DropIndex ¶
func (c *Client) DropIndex(ctx context.Context, opt DropIndexOption, callOptions ...grpc.CallOption) error
func (*Client) DropPartition ¶
func (c *Client) DropPartition(ctx context.Context, opt DropPartitionOption, callOptions ...grpc.CallOption) error
func (*Client) Flush ¶
func (c *Client) Flush(ctx context.Context, option FlushOption, callOptions ...grpc.CallOption) (*FlushTask, error)
func (*Client) HasCollection ¶
func (c *Client) HasCollection(ctx context.Context, option HasCollectionOption, callOptions ...grpc.CallOption) (has bool, err error)
func (*Client) HasPartition ¶
func (c *Client) HasPartition(ctx context.Context, opt HasPartitionOption, callOptions ...grpc.CallOption) (has bool, err error)
func (*Client) Insert ¶
func (c *Client) Insert(ctx context.Context, option InsertOption, callOptions ...grpc.CallOption) (InsertResult, error)
func (*Client) ListCollections ¶
func (c *Client) ListCollections(ctx context.Context, option ListCollectionOption, callOptions ...grpc.CallOption) (collectionNames []string, err error)
func (*Client) ListDatabase ¶
func (c *Client) ListDatabase(ctx context.Context, option ListDatabaseOption, callOptions ...grpc.CallOption) (databaseNames []string, err error)
func (*Client) ListIndexes ¶
func (c *Client) ListIndexes(ctx context.Context, opt ListIndexOption, callOptions ...grpc.CallOption) ([]string, error)
func (*Client) ListPartitions ¶
func (c *Client) ListPartitions(ctx context.Context, opt ListPartitionsOption, callOptions ...grpc.CallOption) (partitionNames []string, err error)
func (*Client) LoadCollection ¶
func (c *Client) LoadCollection(ctx context.Context, option LoadCollectionOption, callOptions ...grpc.CallOption) (LoadTask, error)
func (*Client) LoadPartitions ¶
func (c *Client) LoadPartitions(ctx context.Context, option LoadPartitionsOption, callOptions ...grpc.CallOption) (LoadTask, error)
func (*Client) MetadataUnaryInterceptor ¶
func (c *Client) MetadataUnaryInterceptor() grpc.UnaryClientInterceptor
func (*Client) Query ¶
func (c *Client) Query(ctx context.Context, option QueryOption, callOptions ...grpc.CallOption) (ResultSet, error)
func (*Client) ReleaseCollection ¶
func (c *Client) ReleaseCollection(ctx context.Context, option ReleaseCollectionOption, callOptions ...grpc.CallOption) error
func (*Client) ReleasePartitions ¶
func (c *Client) ReleasePartitions(ctx context.Context, option ReleasePartitionsOption, callOptions ...grpc.CallOption) error
func (*Client) Search ¶
func (c *Client) Search(ctx context.Context, option SearchOption, callOptions ...grpc.CallOption) ([]ResultSet, error)
func (*Client) Upsert ¶
func (c *Client) Upsert(ctx context.Context, option UpsertOption, callOptions ...grpc.CallOption) (UpsertResult, error)
func (*Client) UsingDatabase ¶
func (c *Client) UsingDatabase(ctx context.Context, option UsingDatabaseOption) error
type ClientConfig ¶
type ClientConfig struct { Address string // Remote address, "localhost:19530". Username string // Username for auth. Password string // Password for auth. DBName string // DBName for this client. EnableTLSAuth bool // Enable TLS Auth for transport security. APIKey string // API key DialOptions []grpc.DialOption // Dial options for GRPC. RetryRateLimit *RetryRateLimitOption // option for retry on rate limit inteceptor DisableConn bool ServerVersion string // ServerVersion // contains filtered or unexported fields }
ClientConfig for milvus client.
type CollectionCache ¶
type CollectionCache struct {
// contains filtered or unexported fields
}
CollectionCache stores the cached collection schema information.
func NewCollectionCache ¶
func NewCollectionCache(fetcher func(context.Context, string) (*entity.Collection, error)) *CollectionCache
func (*CollectionCache) GetCollection ¶
func (c *CollectionCache) GetCollection(ctx context.Context, collName string) (*entity.Collection, error)
func (*CollectionCache) Reset ¶
func (c *CollectionCache) Reset()
Reset clears all cached info, used when client switching env.
type CreateCollectionOption ¶
type CreateCollectionOption interface { // Request is the method returns the composed request. Request() *milvuspb.CreateCollectionRequest // Indexes is the method returns IndexOption to create Indexes() []CreateIndexOption IsFast() bool }
CreateCollectionOption is the interface builds CreateCollectionRequest.
type CreateDatabaseOption ¶
type CreateDatabaseOption interface {
Request() *milvuspb.CreateDatabaseRequest
}
type CreateIndexOption ¶
type CreateIndexOption interface {
Request() *milvuspb.CreateIndexRequest
}
type CreateIndexTask ¶
type CreateIndexTask struct {
// contains filtered or unexported fields
}
type CreatePartitionOption ¶
type CreatePartitionOption interface { // Request is the method returns the composed request. Request() *milvuspb.CreatePartitionRequest }
CreatePartitionOption is the interface builds Create Partition request.
type DeleteOption ¶
type DeleteOption interface {
Request() *milvuspb.DeleteRequest
}
type DeleteResult ¶
type DeleteResult struct {
DeleteCount int64
}
type DescribeCollectionOption ¶
type DescribeCollectionOption interface { // Request is the method returns the composed request. Request() *milvuspb.DescribeCollectionRequest }
DescribeCollectionOption is the interface builds DescribeCollection request.
type DescribeIndexOption ¶
type DescribeIndexOption interface {
Request() *milvuspb.DescribeIndexRequest
}
type DropCollectionOption ¶
type DropCollectionOption interface {
Request() *milvuspb.DropCollectionRequest
}
The DropCollectionOption interface builds DropCollectionRequest.
type DropDatabaseOption ¶
type DropDatabaseOption interface {
Request() *milvuspb.DropDatabaseRequest
}
type DropIndexOption ¶
type DropIndexOption interface {
Request() *milvuspb.DropIndexRequest
}
type DropPartitionOption ¶
type DropPartitionOption interface { // Request is the method returns the composed request. Request() *milvuspb.DropPartitionRequest }
DropPartitionOption is the interface that builds Drop Partition request.
type FlushOption ¶
type FlushOption interface { Request() *milvuspb.FlushRequest CollectionName() string CheckInterval() time.Duration }
type HasCollectionOption ¶
type HasCollectionOption interface {
Request() *milvuspb.DescribeCollectionRequest
}
HasCollectionOption is the interface to build DescribeCollectionRequest.
func NewHasCollectionOption ¶
func NewHasCollectionOption(name string) HasCollectionOption
type HasPartitionOption ¶
type HasPartitionOption interface { // Request is the method returns the composed request. Request() *milvuspb.HasPartitionRequest }
HasPartitionOption is the interface builds HasPartition request.
type IndexDescription ¶
type InsertOption ¶
type InsertOption interface { InsertRequest(coll *entity.Collection) (*milvuspb.InsertRequest, error) CollectionName() string }
type InsertResult ¶
type ListCollectionOption ¶
type ListCollectionOption interface {
Request() *milvuspb.ShowCollectionsRequest
}
type ListDatabaseOption ¶
type ListDatabaseOption interface {
Request() *milvuspb.ListDatabasesRequest
}
ListDatabaseOption is a builder interface for ListDatabase request.
type ListIndexOption ¶
type ListIndexOption interface { Request() *milvuspb.DescribeIndexRequest Matches(*milvuspb.IndexDescription) bool }
type ListPartitionsOption ¶
type ListPartitionsOption interface { // Request is the method returns the composed request. Request() *milvuspb.ShowPartitionsRequest }
ListPartitionsOption is the interface builds List Partition request.
type LoadCollectionOption ¶
type LoadCollectionOption interface { Request() *milvuspb.LoadCollectionRequest CheckInterval() time.Duration }
type LoadPartitionsOption ¶
type LoadPartitionsOption interface { Request() *milvuspb.LoadPartitionsRequest CheckInterval() time.Duration }
type QueryOption ¶
type QueryOption interface {
Request() *milvuspb.QueryRequest
}
type ReleaseCollectionOption ¶
type ReleaseCollectionOption interface {
Request() *milvuspb.ReleaseCollectionRequest
}
type ReleasePartitionsOption ¶
type ReleasePartitionsOption interface {
Request() *milvuspb.ReleasePartitionsRequest
}
type ResultSet ¶
type ResultSet struct { ResultCount int // the returning entry count GroupByValue column.Column IDs column.Column // auto generated id, can be mapped to the columns from `Insert` API Fields DataSet // output field data Scores []float32 // distance to the target vector Err error // search error if any }
type ResultSets ¶
type ResultSets struct{}
type RetryRateLimitOption ¶
type SearchOption ¶
type SearchOption interface {
Request() *milvuspb.SearchRequest
}
type UpsertOption ¶
type UpsertOption interface { UpsertRequest(coll *entity.Collection) (*milvuspb.UpsertRequest, error) CollectionName() string }
type UpsertResult ¶
type UsingDatabaseOption ¶
type UsingDatabaseOption interface {
DbName() string
}