Documentation
¶
Index ¶
- Constants
- func CreateSelfSignedCert(certPath, keyPath string)
- type APIClientV2
- func (client *APIClientV2) Close() error
- func (client *APIClientV2) CountCollections(ctx context.Context, opts ...CountCollectionsOption) (int, error)
- func (client *APIClientV2) CreateCollection(ctx context.Context, name string, options ...CreateCollectionOption) (Collection, error)
- func (client *APIClientV2) CreateDatabase(ctx context.Context, db Database) (Database, error)
- func (client *APIClientV2) CreateTenant(ctx context.Context, tenant Tenant) (Tenant, error)
- func (client *APIClientV2) CurrentDatabase() Database
- func (client *APIClientV2) CurrentTenant() Tenant
- func (client *APIClientV2) DeleteCollection(ctx context.Context, name string, options ...DeleteCollectionOption) error
- func (client *APIClientV2) DeleteDatabase(ctx context.Context, db Database) error
- func (client *APIClientV2) GetCollection(ctx context.Context, name string, opts ...GetCollectionOption) (Collection, error)
- func (client *APIClientV2) GetDatabase(ctx context.Context, db Database) (Database, error)
- func (client *APIClientV2) GetIdentity(ctx context.Context) (Identity, error)
- func (client *APIClientV2) GetOrCreateCollection(ctx context.Context, name string, options ...CreateCollectionOption) (Collection, error)
- func (client *APIClientV2) GetPreFlightConditionsRaw() map[string]interface{}
- func (client *APIClientV2) GetTenant(ctx context.Context, tenant Tenant) (Tenant, error)
- func (client *APIClientV2) GetVersion(ctx context.Context) (string, error)
- func (client *APIClientV2) Heartbeat(ctx context.Context) error
- func (client *APIClientV2) ListCollections(ctx context.Context, opts ...ListCollectionsOption) ([]Collection, error)
- func (client *APIClientV2) ListDatabases(ctx context.Context, tenant Tenant) ([]Database, error)
- func (client *APIClientV2) PreFlight(ctx context.Context) error
- func (client *APIClientV2) Reset(ctx context.Context) error
- func (client *APIClientV2) Satisfies(resourceOperation ResourceOperation, metric interface{}, metricName string) error
- func (client *APIClientV2) UseDatabase(ctx context.Context, database Database) error
- func (client *APIClientV2) UseTenant(ctx context.Context, tenant Tenant) error
- type BaseAPIClient
- func (bc *BaseAPIClient) BaseURL() string
- func (bc *BaseAPIClient) Database() Database
- func (bc *BaseAPIClient) DefaultHeaders() map[string]string
- func (bc *BaseAPIClient) ExecuteRequest(ctx context.Context, method string, path string, request interface{}) ([]byte, error)
- func (bc *BaseAPIClient) HTTPClient() *http.Client
- func (bc *BaseAPIClient) SendRequest(httpReq *http.Request) (*http.Response, error)
- func (bc *BaseAPIClient) SetBaseURL(baseURL string)
- func (bc *BaseAPIClient) SetDatabase(database Database)
- func (bc *BaseAPIClient) SetDefaultHeaders(headers map[string]string)
- func (bc *BaseAPIClient) SetPreFlightConfig(config map[string]interface{})
- func (bc *BaseAPIClient) SetTenant(tenant Tenant)
- func (bc *BaseAPIClient) Tenant() Tenant
- func (bc *BaseAPIClient) Timeout() time.Duration
- type BasicAuthCredentialsProvider
- type Client
- type ClientOption
- func WithAuth(authProvider CredentialsProvider) ClientOption
- func WithBaseURL(baseURL string) ClientOption
- func WithCloudAPIKey(apiKey string) ClientOption
- func WithDatabaseAndTenant(database string, tenant string) ClientOption
- func WithDebug() ClientOption
- func WithDefaultHeaders(headers map[string]string) ClientOption
- func WithHTTPClient(httpClient *http.Client) ClientOption
- func WithInsecure() ClientOption
- func WithSSLCert(certPath string) ClientOption
- func WithTenant(tenant string) ClientOption
- func WithTimeout(timeout time.Duration) ClientOption
- func WithTransport(transport *http.Transport) ClientOption
- type CloudAPIClient
- type CloudClientOption
- type Collection
- type CollectionAddOp
- func (c *CollectionAddOp) EmbedData(ctx context.Context, ef embeddings.EmbeddingFunction) error
- func (c *CollectionAddOp) GenerateIDs() error
- func (c *CollectionAddOp) MarshalJSON() ([]byte, error)
- func (c *CollectionAddOp) Operation() OperationType
- func (c *CollectionAddOp) PrepareAndValidate() error
- func (c *CollectionAddOp) Resource() Resource
- func (c *CollectionAddOp) UnmarshalJSON(b []byte) error
- type CollectionAddOption
- func WithEmbeddings(embeddings ...embeddings.Embedding) CollectionAddOption
- func WithIDGenerator(idGenerator IDGenerator) CollectionAddOption
- func WithIDs(ids ...DocumentID) CollectionAddOption
- func WithMetadatas(metadatas ...DocumentMetadata) CollectionAddOption
- func WithTexts(documents ...string) CollectionAddOption
- type CollectionConfiguration
- type CollectionDeleteOp
- type CollectionDeleteOption
- type CollectionGetOp
- type CollectionGetOption
- func WithIDsGet(ids ...DocumentID) CollectionGetOption
- func WithIncludeGet(include ...Include) CollectionGetOption
- func WithLimitGet(limit int) CollectionGetOption
- func WithOffsetGet(offset int) CollectionGetOption
- func WithWhereDocumentGet(whereDocument WhereDocumentFilter) CollectionGetOption
- func WithWhereGet(where WhereFilter) CollectionGetOption
- type CollectionImpl
- func (c *CollectionImpl) Add(ctx context.Context, opts ...CollectionAddOption) error
- func (c *CollectionImpl) Close() error
- func (c *CollectionImpl) Configuration() CollectionConfiguration
- func (c *CollectionImpl) Count(ctx context.Context) (int, error)
- func (c *CollectionImpl) Database() Database
- func (c *CollectionImpl) Delete(ctx context.Context, opts ...CollectionDeleteOption) error
- func (c *CollectionImpl) Dimension() int
- func (c *CollectionImpl) Fork(ctx context.Context, newName string) (Collection, error)
- func (c *CollectionImpl) Get(ctx context.Context, opts ...CollectionGetOption) (GetResult, error)
- func (c *CollectionImpl) ID() string
- func (c *CollectionImpl) Metadata() CollectionMetadata
- func (c *CollectionImpl) ModifyConfiguration(ctx context.Context, newConfig CollectionConfiguration) error
- func (c *CollectionImpl) ModifyMetadata(ctx context.Context, newMetadata CollectionMetadata) error
- func (c *CollectionImpl) ModifyName(ctx context.Context, newName string) error
- func (c *CollectionImpl) Name() string
- func (c *CollectionImpl) Query(ctx context.Context, opts ...CollectionQueryOption) (QueryResult, error)
- func (c *CollectionImpl) Tenant() Tenant
- func (c *CollectionImpl) Update(ctx context.Context, opts ...CollectionUpdateOption) error
- func (c *CollectionImpl) Upsert(ctx context.Context, opts ...CollectionAddOption) error
- type CollectionLifecycleOp
- type CollectionMetadata
- type CollectionMetadataImpl
- func (cm *CollectionMetadataImpl) GetBool(key string) (value bool, ok bool)
- func (cm *CollectionMetadataImpl) GetFloat(key string) (value float64, ok bool)
- func (cm *CollectionMetadataImpl) GetInt(key string) (value int64, ok bool)
- func (cm *CollectionMetadataImpl) GetRaw(key string) (value interface{}, ok bool)
- func (cm *CollectionMetadataImpl) GetString(key string) (value string, ok bool)
- func (cm *CollectionMetadataImpl) Keys() []string
- func (cm *CollectionMetadataImpl) MarshalJSON() ([]byte, error)
- func (cm *CollectionMetadataImpl) SetBool(key string, value bool)
- func (cm *CollectionMetadataImpl) SetFloat(key string, value float64)
- func (cm *CollectionMetadataImpl) SetInt(key string, value int64)
- func (cm *CollectionMetadataImpl) SetRaw(key string, value interface{})
- func (cm *CollectionMetadataImpl) SetString(key, value string)
- func (cm *CollectionMetadataImpl) UnmarshalJSON(b []byte) error
- type CollectionModel
- type CollectionOp
- type CollectionQueryOp
- func (c *CollectionQueryOp) EmbedData(ctx context.Context, ef embeddings.EmbeddingFunction) error
- func (c *CollectionQueryOp) MarshalJSON() ([]byte, error)
- func (c *CollectionQueryOp) Operation() OperationType
- func (c *CollectionQueryOp) PrepareAndValidate() error
- func (c *CollectionQueryOp) Resource() Resource
- func (c *CollectionQueryOp) UnmarshalJSON(b []byte) error
- type CollectionQueryOption
- func WithIDsQuery(ids ...DocumentID) CollectionQueryOption
- func WithIncludeQuery(include ...Include) CollectionQueryOption
- func WithNResults(nResults int) CollectionQueryOption
- func WithQueryEmbeddings(queryEmbeddings ...embeddings.Embedding) CollectionQueryOption
- func WithQueryTexts(queryTexts ...string) CollectionQueryOption
- func WithWhereDocumentQuery(whereDocument WhereDocumentFilter) CollectionQueryOption
- func WithWhereQuery(where WhereFilter) CollectionQueryOption
- type CollectionUpdateOp
- func (c *CollectionUpdateOp) EmbedData(ctx context.Context, ef embeddings.EmbeddingFunction) error
- func (c *CollectionUpdateOp) MarshalJSON() ([]byte, error)
- func (c *CollectionUpdateOp) Operation() OperationType
- func (c *CollectionUpdateOp) PrepareAndValidate() error
- func (c *CollectionUpdateOp) Resource() Resource
- func (c *CollectionUpdateOp) UnmarshalJSON(b []byte) error
- type CollectionUpdateOption
- type CountCollectionsOp
- type CountCollectionsOption
- type CreateCollectionOp
- func (op *CreateCollectionOp) MarshalJSON() ([]byte, error)
- func (op *CreateCollectionOp) Operation() OperationType
- func (op *CreateCollectionOp) PrepareAndValidateCollectionRequest() error
- func (op *CreateCollectionOp) Resource() Resource
- func (op *CreateCollectionOp) String() string
- func (op *CreateCollectionOp) UnmarshalJSON(b []byte) error
- type CreateCollectionOption
- func WithCollectionMetadataCreate(metadata CollectionMetadata) CreateCollectionOption
- func WithDatabaseCreate(database Database) CreateCollectionOption
- func WithEmbeddingFunctionCreate(embeddingFunction embeddings.EmbeddingFunction) CreateCollectionOption
- func WithHNSWBatchSizeCreate(batchSize int) CreateCollectionOption
- func WithHNSWConstructionEfCreate(efConstruction int) CreateCollectionOption
- func WithHNSWMCreate(m int) CreateCollectionOption
- func WithHNSWNumThreadsCreate(numThreads int) CreateCollectionOption
- func WithHNSWResizeFactorCreate(resizeFactor float64) CreateCollectionOption
- func WithHNSWSearchEfCreate(efSearch int) CreateCollectionOption
- func WithHNSWSpaceCreate(metric embeddings.DistanceMetric) CreateCollectionOption
- func WithHNSWSyncThresholdCreate(syncThreshold int) CreateCollectionOption
- func WithIfNotExistsCreate() CreateCollectionOption
- type CredentialsProvider
- type Database
- type DatabaseBase
- type DeleteCollectionOp
- type DeleteCollectionOption
- type Document
- type DocumentID
- type DocumentIDs
- type DocumentMetadata
- type DocumentMetadataImpl
- func (cm *DocumentMetadataImpl) GetBool(key string) (value bool, ok bool)
- func (cm *DocumentMetadataImpl) GetFloat(key string) (value float64, ok bool)
- func (cm *DocumentMetadataImpl) GetInt(key string) (value int64, ok bool)
- func (cm *DocumentMetadataImpl) GetRaw(key string) (value interface{}, ok bool)
- func (cm *DocumentMetadataImpl) GetString(key string) (value string, ok bool)
- func (cm *DocumentMetadataImpl) Keys() []string
- func (cm *DocumentMetadataImpl) MarshalJSON() ([]byte, error)
- func (cm *DocumentMetadataImpl) SetBool(key string, value bool)
- func (cm *DocumentMetadataImpl) SetFloat(key string, value float64)
- func (cm *DocumentMetadataImpl) SetInt(key string, value int64)
- func (cm *DocumentMetadataImpl) SetRaw(key string, value interface{})
- func (cm *DocumentMetadataImpl) SetString(key, value string)
- func (cm *DocumentMetadataImpl) UnmarshalJSON(b []byte) error
- type DocumentMetadatas
- type Documents
- type FilterEmbeddingsOp
- type FilterIDOp
- type FilterOp
- type FilterTextsOp
- type GenerateOptions
- type GetCollectionOp
- type GetCollectionOption
- type GetResult
- type GetResultImpl
- func (r *GetResultImpl) Count() int
- func (r *GetResultImpl) GetDocuments() Documents
- func (r *GetResultImpl) GetEmbeddings() embeddings.Embeddings
- func (r *GetResultImpl) GetIDs() DocumentIDs
- func (r *GetResultImpl) GetMetadatas() DocumentMetadatas
- func (r *GetResultImpl) Next() (GetResult, error)
- func (r *GetResultImpl) String() string
- func (r *GetResultImpl) ToRecords() Records
- func (r *GetResultImpl) UnmarshalJSON(data []byte) error
- type IDGenerator
- type IDGeneratorOption
- type Identity
- type Include
- type LimitAndOffsetOp
- type LimitResultOp
- type ListCollectionOp
- type ListCollectionsOption
- type MetaAttribute
- type MetadataValue
- func (mv *MetadataValue) Equal(other *MetadataValue) bool
- func (mv *MetadataValue) GetBool() (bool, bool)
- func (mv *MetadataValue) GetFloat() (float64, bool)
- func (mv *MetadataValue) GetInt() (int64, bool)
- func (mv *MetadataValue) GetRaw() (interface{}, bool)
- func (mv *MetadataValue) GetString() (string, bool)
- func (mv *MetadataValue) MarshalJSON() ([]byte, error)
- func (mv *MetadataValue) String() string
- func (mv *MetadataValue) UnmarshalJSON(b []byte) error
- type OperationType
- type Option
- type PreFlightConditioner
- type ProjectOp
- type QueryResult
- type QueryResultImpl
- func (r *QueryResultImpl) CountGroups() int
- func (r *QueryResultImpl) GetDistancesGroups() []embeddings.Distances
- func (r *QueryResultImpl) GetDocumentsGroups() []Documents
- func (r *QueryResultImpl) GetEmbeddingsGroups() []embeddings.Embeddings
- func (r *QueryResultImpl) GetIDGroups() []DocumentIDs
- func (r *QueryResultImpl) GetMetadatasGroups() []DocumentMetadatas
- func (r *QueryResultImpl) String() string
- func (r *QueryResultImpl) ToRecordsGroups() []Records
- func (r *QueryResultImpl) UnmarshalJSON(data []byte) error
- type Record
- type RecordOption
- type Records
- type Resource
- type ResourceOperation
- type SHA256Generator
- type SimpleRecord
- func (r *SimpleRecord) Document() Document
- func (r *SimpleRecord) Embedding() embeddings.Embedding
- func (r *SimpleRecord) ID() DocumentID
- func (r *SimpleRecord) Metadata() DocumentMetadata
- func (r *SimpleRecord) URI() string
- func (r *SimpleRecord) Unwrap() (DocumentID, Document, embeddings.Embedding, DocumentMetadata)
- func (r *SimpleRecord) Validate() error
- type SortOp
- type Tenant
- type TenantBase
- type TextDocument
- type TextDocuments
- type TokenAuthCredentialsProvider
- type TokenTransportHeader
- type ULIDGenerator
- type UUIDGenerator
- type WhereClause
- func And(clauses ...WhereClause) WhereClause
- func EqBool(field string, value bool) WhereClause
- func EqFloat(field string, value float32) WhereClause
- func EqInt(field string, value int) WhereClause
- func EqString(field, value string) WhereClause
- func GtFloat(field string, value float32) WhereClause
- func GtInt(field string, value int) WhereClause
- func GteFloat(field string, value float32) WhereClause
- func GteInt(field string, value int) WhereClause
- func InBool(field string, values ...bool) WhereClause
- func InFloat(field string, values ...float32) WhereClause
- func InInt(field string, values ...int) WhereClause
- func InString(field string, values ...string) WhereClause
- func LtFloat(field string, value float32) WhereClause
- func LtInt(field string, value int) WhereClause
- func LteFloat(field string, value float32) WhereClause
- func LteInt(field string, value int) WhereClause
- func NinBool(field string, values ...bool) WhereClause
- func NinFloat(field string, values ...float32) WhereClause
- func NinInt(field string, values ...int) WhereClause
- func NinString(field string, values ...string) WhereClause
- func NotEqBool(field string, value bool) WhereClause
- func NotEqFloat(field string, value float32) WhereClause
- func NotEqInt(field string, value int) WhereClause
- func NotEqString(field, value string) WhereClause
- func Or(clauses ...WhereClause) WhereClause
- type WhereClauseBase
- type WhereClauseBool
- type WhereClauseBools
- type WhereClauseFloat
- type WhereClauseFloats
- type WhereClauseInt
- type WhereClauseInts
- type WhereClauseString
- type WhereClauseStrings
- type WhereClauseWhereClauses
- type WhereDocumentClauseAnd
- type WhereDocumentClauseContainsOrNotContains
- type WhereDocumentClauseOr
- type WhereDocumentClauseRegexNotRegex
- type WhereDocumentFilter
- func AndDocument(clauses ...WhereDocumentFilter) WhereDocumentFilter
- func Contains(content string) WhereDocumentFilter
- func NotContains(content string) WhereDocumentFilter
- func NotRegex(content string) WhereDocumentFilter
- func OrDocument(clauses ...WhereDocumentFilter) WhereDocumentFilter
- func Regex(content string) WhereDocumentFilter
- type WhereDocumentFilterBase
- func (w *WhereDocumentFilterBase) MarshalJSON() ([]byte, error)
- func (w *WhereDocumentFilterBase) Operand() interface{}
- func (w *WhereDocumentFilterBase) Operator() WhereDocumentFilterOperator
- func (w *WhereDocumentFilterBase) String() string
- func (w *WhereDocumentFilterBase) UnmarshalJSON(b []byte) error
- func (w *WhereDocumentFilterBase) Validate() error
- type WhereDocumentFilterOperator
- type WhereFilter
- type WhereFilterOperator
Constants ¶
const ( OperationCreate OperationType = "create" OperationGet OperationType = "read" OperationQuery OperationType = "query" OperationUpdate OperationType = "update" OperationDelete OperationType = "delete" ResourceTenant Resource = "tenant" ResourceDatabase Resource = "database" ResourceCollection Resource = "collection" ResourceInstance Resource = "instance" )
const ( DefaultTenant = "default_tenant" DefaultDatabase = "default_database" HNSWSpace = "hnsw:space" HNSWConstructionEF = "hnsw:construction_ef" HNSWBatchSize = "hnsw:batch_size" HNSWSyncThreshold = "hnsw:sync_threshold" HNSWM = "hnsw:M" HNSWSearchEF = "hnsw:search_ef" HNSWNumThreads = "hnsw:num_threads" HNSWResizeFactor = "hnsw:resize_factor" )
Variables ¶
This section is empty.
Functions ¶
func CreateSelfSignedCert ¶
func CreateSelfSignedCert(certPath, keyPath string)
Types ¶
type APIClientV2 ¶
type APIClientV2 struct {
BaseAPIClient
// contains filtered or unexported fields
}
func (*APIClientV2) Close ¶
func (client *APIClientV2) Close() error
func (*APIClientV2) CountCollections ¶
func (client *APIClientV2) CountCollections(ctx context.Context, opts ...CountCollectionsOption) (int, error)
func (*APIClientV2) CreateCollection ¶
func (client *APIClientV2) CreateCollection(ctx context.Context, name string, options ...CreateCollectionOption) (Collection, error)
func (*APIClientV2) CreateDatabase ¶
func (*APIClientV2) CreateTenant ¶
func (*APIClientV2) CurrentDatabase ¶
func (client *APIClientV2) CurrentDatabase() Database
func (*APIClientV2) CurrentTenant ¶
func (client *APIClientV2) CurrentTenant() Tenant
func (*APIClientV2) DeleteCollection ¶
func (client *APIClientV2) DeleteCollection(ctx context.Context, name string, options ...DeleteCollectionOption) error
func (*APIClientV2) DeleteDatabase ¶
func (client *APIClientV2) DeleteDatabase(ctx context.Context, db Database) error
func (*APIClientV2) GetCollection ¶
func (client *APIClientV2) GetCollection(ctx context.Context, name string, opts ...GetCollectionOption) (Collection, error)
func (*APIClientV2) GetDatabase ¶
func (*APIClientV2) GetIdentity ¶
func (client *APIClientV2) GetIdentity(ctx context.Context) (Identity, error)
func (*APIClientV2) GetOrCreateCollection ¶
func (client *APIClientV2) GetOrCreateCollection(ctx context.Context, name string, options ...CreateCollectionOption) (Collection, error)
func (*APIClientV2) GetPreFlightConditionsRaw ¶
func (client *APIClientV2) GetPreFlightConditionsRaw() map[string]interface{}
func (*APIClientV2) GetVersion ¶
func (client *APIClientV2) GetVersion(ctx context.Context) (string, error)
func (*APIClientV2) ListCollections ¶
func (client *APIClientV2) ListCollections(ctx context.Context, opts ...ListCollectionsOption) ([]Collection, error)
func (*APIClientV2) ListDatabases ¶
func (*APIClientV2) Satisfies ¶
func (client *APIClientV2) Satisfies(resourceOperation ResourceOperation, metric interface{}, metricName string) error
func (*APIClientV2) UseDatabase ¶
func (client *APIClientV2) UseDatabase(ctx context.Context, database Database) error
type BaseAPIClient ¶
type BaseAPIClient struct {
// contains filtered or unexported fields
}
func (*BaseAPIClient) BaseURL ¶
func (bc *BaseAPIClient) BaseURL() string
func (*BaseAPIClient) Database ¶
func (bc *BaseAPIClient) Database() Database
func (*BaseAPIClient) DefaultHeaders ¶
func (bc *BaseAPIClient) DefaultHeaders() map[string]string
func (*BaseAPIClient) ExecuteRequest ¶
func (*BaseAPIClient) HTTPClient ¶
func (bc *BaseAPIClient) HTTPClient() *http.Client
func (*BaseAPIClient) SendRequest ¶
func (*BaseAPIClient) SetBaseURL ¶
func (bc *BaseAPIClient) SetBaseURL(baseURL string)
func (*BaseAPIClient) SetDatabase ¶
func (bc *BaseAPIClient) SetDatabase(database Database)
func (*BaseAPIClient) SetDefaultHeaders ¶
func (bc *BaseAPIClient) SetDefaultHeaders(headers map[string]string)
func (*BaseAPIClient) SetPreFlightConfig ¶
func (bc *BaseAPIClient) SetPreFlightConfig(config map[string]interface{})
func (*BaseAPIClient) SetTenant ¶
func (bc *BaseAPIClient) SetTenant(tenant Tenant)
func (*BaseAPIClient) Tenant ¶
func (bc *BaseAPIClient) Tenant() Tenant
func (*BaseAPIClient) Timeout ¶
func (bc *BaseAPIClient) Timeout() time.Duration
type BasicAuthCredentialsProvider ¶
func NewBasicAuthCredentialsProvider ¶
func NewBasicAuthCredentialsProvider(username, password string) *BasicAuthCredentialsProvider
func (*BasicAuthCredentialsProvider) Authenticate ¶
func (b *BasicAuthCredentialsProvider) Authenticate(client *BaseAPIClient) error
func (*BasicAuthCredentialsProvider) String ¶
func (b *BasicAuthCredentialsProvider) String() string
type Client ¶
type Client interface {
PreFlight(ctx context.Context) error
// Heartbeat checks if the chroma instance is alive.
Heartbeat(ctx context.Context) error
// GetVersion returns the version of the chroma instance.
GetVersion(ctx context.Context) (string, error)
// GetIdentity returns the identity of the chroma instance. This is noop for v1 API.
GetIdentity(ctx context.Context) (Identity, error)
// GetTenant gets a tenant with the given name.
GetTenant(ctx context.Context, tenant Tenant) (Tenant, error)
// UseTenant sets the current tenant to the given name.
UseTenant(ctx context.Context, tenant Tenant) error
// UseDatabase sets a database to use for all collection operations.
UseDatabase(ctx context.Context, database Database) error
// CreateTenant creates a new tenant with the given name.
CreateTenant(ctx context.Context, tenant Tenant) (Tenant, error)
// ListDatabases returns a list of databases in the given tenant.
ListDatabases(ctx context.Context, tenant Tenant) ([]Database, error)
// GetDatabase gets a database with the given name from the given tenant.
GetDatabase(ctx context.Context, db Database) (Database, error)
// CreateDatabase creates a new database with the given name in the given tenant.
CreateDatabase(ctx context.Context, db Database) (Database, error)
// DeleteDatabase deletes a database with the given name from the given tenant.
DeleteDatabase(ctx context.Context, db Database) error
// CurrentTenant returns the current tenant.
CurrentTenant() Tenant
// CurrentDatabase returns the current database.
CurrentDatabase() Database
// Reset resets the chroma instance by all data. Use with caution.
// Returns an error if ALLOW_RESET is not set to true.
Reset(ctx context.Context) error
// CreateCollection creates a new collection with the given name and options.
CreateCollection(ctx context.Context, name string, options ...CreateCollectionOption) (Collection, error)
// GetOrCreateCollection gets a collection with the given name. If the collection does not exist, it creates a new collection with the given options.
// If the collection exists but the metadata does not match the options, it returns an error. Use Collection.ModifyMetadata to update the metadata.
GetOrCreateCollection(ctx context.Context, name string, options ...CreateCollectionOption) (Collection, error)
// DeleteCollection deletes the collection with the given name.
DeleteCollection(ctx context.Context, name string, options ...DeleteCollectionOption) error
// GetCollection gets a collection with the given name.
GetCollection(ctx context.Context, name string, opts ...GetCollectionOption) (Collection, error)
// CountCollections returns the number of collections in the current tenant and database.
CountCollections(ctx context.Context, opts ...CountCollectionsOption) (int, error)
// ListCollections returns a list of collections in the current tenant and database.
ListCollections(ctx context.Context, opts ...ListCollectionsOption) ([]Collection, error)
// Close closes the client and releases any resources.
Close() error
}
func NewHTTPClient ¶
func NewHTTPClient(opts ...ClientOption) (Client, error)
type ClientOption ¶
type ClientOption func(client *BaseAPIClient) error
func WithAuth ¶
func WithAuth(authProvider CredentialsProvider) ClientOption
func WithBaseURL ¶
func WithBaseURL(baseURL string) ClientOption
func WithCloudAPIKey ¶
func WithCloudAPIKey(apiKey string) ClientOption
func WithDatabaseAndTenant ¶
func WithDatabaseAndTenant(database string, tenant string) ClientOption
func WithDebug ¶
func WithDebug() ClientOption
func WithDefaultHeaders ¶
func WithDefaultHeaders(headers map[string]string) ClientOption
func WithHTTPClient ¶
func WithHTTPClient(httpClient *http.Client) ClientOption
func WithInsecure ¶
func WithInsecure() ClientOption
WithInsecure skips SSL verification. The option is mutually exclusive with WithHttpClient. DO NOT USE IN PRODUCTION.
func WithSSLCert ¶
func WithSSLCert(certPath string) ClientOption
WithSSLCert adds a custom SSL certificate to the client. The certificate must be in PEM format. The Option can be added multiple times to add multiple certificates. The option is mutually exclusive with WithHttpClient.
func WithTenant ¶
func WithTenant(tenant string) ClientOption
func WithTimeout ¶
func WithTimeout(timeout time.Duration) ClientOption
func WithTransport ¶
func WithTransport(transport *http.Transport) ClientOption
type CloudAPIClient ¶
type CloudAPIClient struct {
*APIClientV2
}
func NewCloudAPIClient ¶
func NewCloudAPIClient(options ...ClientOption) (*CloudAPIClient, error)
type CloudClientOption ¶
type CloudClientOption func(client *CloudAPIClient) error
type Collection ¶
type Collection interface {
// Name returns the name of the collection
Name() string
// ID returns the id of the collection
ID() string
// Tenant returns the tenant of the collection
Tenant() Tenant
// Database returns the database of the collection
Database() Database
// Metadata returns the metadata of the collection
Metadata() CollectionMetadata
// Dimension returns the dimension of the embeddings in the collection
Dimension() int
// Configuration returns the configuration of the collection
Configuration() CollectionConfiguration
// Add adds a document to the collection
Add(ctx context.Context, opts ...CollectionAddOption) error
// Upsert updates or adds a document to the collection
Upsert(ctx context.Context, opts ...CollectionAddOption) error
// Update updates a document in the collection
Update(ctx context.Context, opts ...CollectionUpdateOption) error
// Delete deletes documents from the collection
Delete(ctx context.Context, opts ...CollectionDeleteOption) error
// Count returns the number of documents in the collection
Count(ctx context.Context) (int, error)
// ModifyName modifies the name of the collection
ModifyName(ctx context.Context, newName string) error
// ModifyMetadata modifies the metadata of the collection
ModifyMetadata(ctx context.Context, newMetadata CollectionMetadata) error
// ModifyConfiguration modifies the configuration of the collection
ModifyConfiguration(ctx context.Context, newConfig CollectionConfiguration) error // not supported yet
// Get gets documents from the collection
Get(ctx context.Context, opts ...CollectionGetOption) (GetResult, error)
// Query queries the collection
Query(ctx context.Context, opts ...CollectionQueryOption) (QueryResult, error)
// Fork creates a fork of the collection
Fork(ctx context.Context, newName string) (Collection, error)
// Close closes the collection and releases any resources
Close() error
}
type CollectionAddOp ¶
type CollectionAddOp struct {
Ids []DocumentID `json:"ids"`
Documents []Document `json:"documents,omitempty"`
Metadatas []DocumentMetadata `json:"metadatas,omitempty"`
Embeddings []any `json:"embeddings"`
Records []Record `json:"-"`
IDGenerator IDGenerator `json:"-"`
}
func NewCollectionAddOp ¶
func NewCollectionAddOp(opts ...CollectionAddOption) (*CollectionAddOp, error)
func (*CollectionAddOp) EmbedData ¶
func (c *CollectionAddOp) EmbedData(ctx context.Context, ef embeddings.EmbeddingFunction) error
func (*CollectionAddOp) GenerateIDs ¶
func (c *CollectionAddOp) GenerateIDs() error
func (*CollectionAddOp) MarshalJSON ¶
func (c *CollectionAddOp) MarshalJSON() ([]byte, error)
func (*CollectionAddOp) Operation ¶
func (c *CollectionAddOp) Operation() OperationType
func (*CollectionAddOp) PrepareAndValidate ¶
func (c *CollectionAddOp) PrepareAndValidate() error
func (*CollectionAddOp) Resource ¶
func (c *CollectionAddOp) Resource() Resource
func (*CollectionAddOp) UnmarshalJSON ¶
func (c *CollectionAddOp) UnmarshalJSON(b []byte) error
type CollectionAddOption ¶
type CollectionAddOption func(update *CollectionAddOp) error
func WithEmbeddings ¶
func WithEmbeddings(embeddings ...embeddings.Embedding) CollectionAddOption
func WithIDGenerator ¶
func WithIDGenerator(idGenerator IDGenerator) CollectionAddOption
func WithIDs ¶
func WithIDs(ids ...DocumentID) CollectionAddOption
func WithMetadatas ¶
func WithMetadatas(metadatas ...DocumentMetadata) CollectionAddOption
func WithTexts ¶
func WithTexts(documents ...string) CollectionAddOption
type CollectionConfiguration ¶
type CollectionDeleteOp ¶
type CollectionDeleteOp struct {
FilterOp
FilterIDOp
}
func NewCollectionDeleteOp ¶
func NewCollectionDeleteOp(opts ...CollectionDeleteOption) (*CollectionDeleteOp, error)
func (*CollectionDeleteOp) MarshalJSON ¶
func (c *CollectionDeleteOp) MarshalJSON() ([]byte, error)
func (*CollectionDeleteOp) Operation ¶
func (c *CollectionDeleteOp) Operation() OperationType
func (*CollectionDeleteOp) PrepareAndValidate ¶
func (c *CollectionDeleteOp) PrepareAndValidate() error
func (*CollectionDeleteOp) Resource ¶
func (c *CollectionDeleteOp) Resource() Resource
func (*CollectionDeleteOp) UnmarshalJSON ¶
func (c *CollectionDeleteOp) UnmarshalJSON(b []byte) error
type CollectionDeleteOption ¶
type CollectionDeleteOption func(update *CollectionDeleteOp) error
func WithIDsDelete ¶
func WithIDsDelete(ids ...DocumentID) CollectionDeleteOption
func WithWhereDelete ¶
func WithWhereDelete(where WhereFilter) CollectionDeleteOption
func WithWhereDocumentDelete ¶
func WithWhereDocumentDelete(whereDocument WhereDocumentFilter) CollectionDeleteOption
type CollectionGetOp ¶
type CollectionGetOp struct {
FilterOp // ability to filter by where and whereDocument
FilterIDOp // ability to filter by id
ProjectOp // include metadatas, documents, embeddings, uris, ids
LimitAndOffsetOp // limit and offset
SortOp // sort
ResourceOperation `json:"-"`
}
func NewCollectionGetOp ¶
func NewCollectionGetOp(opts ...CollectionGetOption) (*CollectionGetOp, error)
func (*CollectionGetOp) MarshalJSON ¶
func (c *CollectionGetOp) MarshalJSON() ([]byte, error)
func (*CollectionGetOp) Operation ¶
func (c *CollectionGetOp) Operation() OperationType
func (*CollectionGetOp) PrepareAndValidate ¶
func (c *CollectionGetOp) PrepareAndValidate() error
func (*CollectionGetOp) Resource ¶
func (c *CollectionGetOp) Resource() Resource
func (*CollectionGetOp) UnmarshalJSON ¶
func (c *CollectionGetOp) UnmarshalJSON(b []byte) error
type CollectionGetOption ¶
type CollectionGetOption func(get *CollectionGetOp) error
func WithIDsGet ¶
func WithIDsGet(ids ...DocumentID) CollectionGetOption
func WithIncludeGet ¶
func WithIncludeGet(include ...Include) CollectionGetOption
func WithLimitGet ¶
func WithLimitGet(limit int) CollectionGetOption
func WithOffsetGet ¶
func WithOffsetGet(offset int) CollectionGetOption
func WithWhereDocumentGet ¶
func WithWhereDocumentGet(whereDocument WhereDocumentFilter) CollectionGetOption
func WithWhereGet ¶
func WithWhereGet(where WhereFilter) CollectionGetOption
type CollectionImpl ¶
type CollectionImpl struct {
// contains filtered or unexported fields
}
func (*CollectionImpl) Add ¶
func (c *CollectionImpl) Add(ctx context.Context, opts ...CollectionAddOption) error
func (*CollectionImpl) Close ¶
func (c *CollectionImpl) Close() error
func (*CollectionImpl) Configuration ¶
func (c *CollectionImpl) Configuration() CollectionConfiguration
func (*CollectionImpl) Database ¶
func (c *CollectionImpl) Database() Database
func (*CollectionImpl) Delete ¶
func (c *CollectionImpl) Delete(ctx context.Context, opts ...CollectionDeleteOption) error
func (*CollectionImpl) Dimension ¶
func (c *CollectionImpl) Dimension() int
func (*CollectionImpl) Fork ¶
func (c *CollectionImpl) Fork(ctx context.Context, newName string) (Collection, error)
func (*CollectionImpl) Get ¶
func (c *CollectionImpl) Get(ctx context.Context, opts ...CollectionGetOption) (GetResult, error)
func (*CollectionImpl) ID ¶
func (c *CollectionImpl) ID() string
func (*CollectionImpl) Metadata ¶
func (c *CollectionImpl) Metadata() CollectionMetadata
func (*CollectionImpl) ModifyConfiguration ¶
func (c *CollectionImpl) ModifyConfiguration(ctx context.Context, newConfig CollectionConfiguration) error
func (*CollectionImpl) ModifyMetadata ¶
func (c *CollectionImpl) ModifyMetadata(ctx context.Context, newMetadata CollectionMetadata) error
func (*CollectionImpl) ModifyName ¶
func (c *CollectionImpl) ModifyName(ctx context.Context, newName string) error
func (*CollectionImpl) Name ¶
func (c *CollectionImpl) Name() string
func (*CollectionImpl) Query ¶
func (c *CollectionImpl) Query(ctx context.Context, opts ...CollectionQueryOption) (QueryResult, error)
func (*CollectionImpl) Tenant ¶
func (c *CollectionImpl) Tenant() Tenant
func (*CollectionImpl) Update ¶
func (c *CollectionImpl) Update(ctx context.Context, opts ...CollectionUpdateOption) error
func (*CollectionImpl) Upsert ¶
func (c *CollectionImpl) Upsert(ctx context.Context, opts ...CollectionAddOption) error
type CollectionLifecycleOp ¶
type CollectionLifecycleOp interface {
PrepareAndValidateCollectionRequest() error
}
type CollectionMetadata ¶
type CollectionMetadata interface {
Keys() []string
GetRaw(key string) (interface{}, bool)
GetString(key string) (string, bool)
GetInt(key string) (int64, bool)
GetFloat(key string) (float64, bool)
GetBool(key string) (bool, bool)
SetRaw(key string, value interface{})
SetString(key, value string)
SetInt(key string, value int64)
SetFloat(key string, value float64)
SetBool(key string, value bool)
MarshalJSON() ([]byte, error)
UnmarshalJSON(b []byte) error
}
func NewEmptyMetadata ¶
func NewEmptyMetadata() CollectionMetadata
func NewMetadata ¶
func NewMetadata(attributes ...*MetaAttribute) CollectionMetadata
func NewMetadataFromMap ¶
func NewMetadataFromMap(metadata map[string]interface{}) CollectionMetadata
type CollectionMetadataImpl ¶
type CollectionMetadataImpl struct {
// contains filtered or unexported fields
}
Collection metadata
func (*CollectionMetadataImpl) GetBool ¶
func (cm *CollectionMetadataImpl) GetBool(key string) (value bool, ok bool)
func (*CollectionMetadataImpl) GetFloat ¶
func (cm *CollectionMetadataImpl) GetFloat(key string) (value float64, ok bool)
func (*CollectionMetadataImpl) GetInt ¶
func (cm *CollectionMetadataImpl) GetInt(key string) (value int64, ok bool)
func (*CollectionMetadataImpl) GetRaw ¶
func (cm *CollectionMetadataImpl) GetRaw(key string) (value interface{}, ok bool)
func (*CollectionMetadataImpl) GetString ¶
func (cm *CollectionMetadataImpl) GetString(key string) (value string, ok bool)
func (*CollectionMetadataImpl) Keys ¶
func (cm *CollectionMetadataImpl) Keys() []string
func (*CollectionMetadataImpl) MarshalJSON ¶
func (cm *CollectionMetadataImpl) MarshalJSON() ([]byte, error)
func (*CollectionMetadataImpl) SetBool ¶
func (cm *CollectionMetadataImpl) SetBool(key string, value bool)
func (*CollectionMetadataImpl) SetFloat ¶
func (cm *CollectionMetadataImpl) SetFloat(key string, value float64)
func (*CollectionMetadataImpl) SetInt ¶
func (cm *CollectionMetadataImpl) SetInt(key string, value int64)
func (*CollectionMetadataImpl) SetRaw ¶
func (cm *CollectionMetadataImpl) SetRaw(key string, value interface{})
func (*CollectionMetadataImpl) SetString ¶
func (cm *CollectionMetadataImpl) SetString(key, value string)
func (*CollectionMetadataImpl) UnmarshalJSON ¶
func (cm *CollectionMetadataImpl) UnmarshalJSON(b []byte) error
type CollectionModel ¶
type CollectionModel struct {
ID string `json:"id"`
Name string `json:"name"`
ConfigurationJSON map[string]interface{} `json:"configuration_json,omitempty"`
Metadata CollectionMetadata `json:"metadata,omitempty"`
Dimension int `json:"dimension,omitempty"`
Tenant string `json:"tenant,omitempty"`
Database string `json:"database,omitempty"`
Version int `json:"version,omitempty"`
LogPosition int `json:"log_position,omitempty"`
}
func (*CollectionModel) MarshalJSON ¶
func (op *CollectionModel) MarshalJSON() ([]byte, error)
func (*CollectionModel) UnmarshalJSON ¶
func (op *CollectionModel) UnmarshalJSON(b []byte) error
type CollectionOp ¶
type CollectionOp interface {
// PrepareAndValidate validates the operation. Each operation must implement this method to ensure the operation is valid and can be sent over the wire
PrepareAndValidate() error
EmbedData(ctx context.Context, ef embeddings.EmbeddingFunction) error
// MarshalJSON marshals the operation to JSON
MarshalJSON() ([]byte, error)
// UnmarshalJSON unmarshals the operation from JSON
UnmarshalJSON(b []byte) error
}
type CollectionQueryOp ¶
type CollectionQueryOp struct {
FilterOp
FilterEmbeddingsOp
FilterTextsOp
LimitResultOp
ProjectOp // include metadatas, documents, embeddings, uris
FilterIDOp
}
func NewCollectionQueryOp ¶
func NewCollectionQueryOp(opts ...CollectionQueryOption) (*CollectionQueryOp, error)
func (*CollectionQueryOp) EmbedData ¶
func (c *CollectionQueryOp) EmbedData(ctx context.Context, ef embeddings.EmbeddingFunction) error
func (*CollectionQueryOp) MarshalJSON ¶
func (c *CollectionQueryOp) MarshalJSON() ([]byte, error)
func (*CollectionQueryOp) Operation ¶
func (c *CollectionQueryOp) Operation() OperationType
func (*CollectionQueryOp) PrepareAndValidate ¶
func (c *CollectionQueryOp) PrepareAndValidate() error
func (*CollectionQueryOp) Resource ¶
func (c *CollectionQueryOp) Resource() Resource
func (*CollectionQueryOp) UnmarshalJSON ¶
func (c *CollectionQueryOp) UnmarshalJSON(b []byte) error
type CollectionQueryOption ¶
type CollectionQueryOption func(query *CollectionQueryOp) error
func WithIDsQuery ¶
func WithIDsQuery(ids ...DocumentID) CollectionQueryOption
WithIDsQuery is used to filter the query by IDs. This is only available for Chroma version 1.0.3 and above.
func WithIncludeQuery ¶
func WithIncludeQuery(include ...Include) CollectionQueryOption
WithIncludeQuery is used to include metadatas, documents, embeddings, uris in the query response.
func WithNResults ¶
func WithNResults(nResults int) CollectionQueryOption
func WithQueryEmbeddings ¶
func WithQueryEmbeddings(queryEmbeddings ...embeddings.Embedding) CollectionQueryOption
func WithQueryTexts ¶
func WithQueryTexts(queryTexts ...string) CollectionQueryOption
func WithWhereDocumentQuery ¶
func WithWhereDocumentQuery(whereDocument WhereDocumentFilter) CollectionQueryOption
func WithWhereQuery ¶
func WithWhereQuery(where WhereFilter) CollectionQueryOption
type CollectionUpdateOp ¶
type CollectionUpdateOp struct {
Ids []DocumentID `json:"ids"`
Documents []Document `json:"documents,omitempty"`
Metadatas []DocumentMetadata `json:"metadatas,omitempty"`
Embeddings []any `json:"embeddings"`
Records []Record `json:"-"`
}
func NewCollectionUpdateOp ¶
func NewCollectionUpdateOp(opts ...CollectionUpdateOption) (*CollectionUpdateOp, error)
func (*CollectionUpdateOp) EmbedData ¶
func (c *CollectionUpdateOp) EmbedData(ctx context.Context, ef embeddings.EmbeddingFunction) error
func (*CollectionUpdateOp) MarshalJSON ¶
func (c *CollectionUpdateOp) MarshalJSON() ([]byte, error)
func (*CollectionUpdateOp) Operation ¶
func (c *CollectionUpdateOp) Operation() OperationType
func (*CollectionUpdateOp) PrepareAndValidate ¶
func (c *CollectionUpdateOp) PrepareAndValidate() error
func (*CollectionUpdateOp) Resource ¶
func (c *CollectionUpdateOp) Resource() Resource
func (*CollectionUpdateOp) UnmarshalJSON ¶
func (c *CollectionUpdateOp) UnmarshalJSON(b []byte) error
type CollectionUpdateOption ¶
type CollectionUpdateOption func(update *CollectionUpdateOp) error
func WithEmbeddingsUpdate ¶
func WithEmbeddingsUpdate(embeddings ...embeddings.Embedding) CollectionUpdateOption
func WithIDsUpdate ¶
func WithIDsUpdate(ids ...DocumentID) CollectionUpdateOption
func WithMetadatasUpdate ¶
func WithMetadatasUpdate(metadatas ...DocumentMetadata) CollectionUpdateOption
func WithTextsUpdate ¶
func WithTextsUpdate(documents ...string) CollectionUpdateOption
type CountCollectionsOp ¶
type CountCollectionsOp struct {
Database Database `json:"-"`
}
func NewCountCollectionsOp ¶
func NewCountCollectionsOp(opts ...CountCollectionsOption) (*CountCollectionsOp, error)
func (*CountCollectionsOp) Operation ¶
func (op *CountCollectionsOp) Operation() OperationType
func (*CountCollectionsOp) PrepareAndValidateCollectionRequest ¶
func (op *CountCollectionsOp) PrepareAndValidateCollectionRequest() error
func (*CountCollectionsOp) Resource ¶
func (op *CountCollectionsOp) Resource() Resource
type CountCollectionsOption ¶
type CountCollectionsOption func(*CountCollectionsOp) error
func WithDatabaseCount ¶
func WithDatabaseCount(database Database) CountCollectionsOption
type CreateCollectionOp ¶
type CreateCollectionOp struct {
Name string `json:"name"`
CreateIfNotExists bool `json:"get_or_create,omitempty"`
Metadata CollectionMetadata `json:"metadata,omitempty"`
Database Database `json:"-"`
// contains filtered or unexported fields
}
func NewCreateCollectionOp ¶
func NewCreateCollectionOp(name string, opts ...CreateCollectionOption) (*CreateCollectionOp, error)
func (*CreateCollectionOp) MarshalJSON ¶
func (op *CreateCollectionOp) MarshalJSON() ([]byte, error)
func (*CreateCollectionOp) Operation ¶
func (op *CreateCollectionOp) Operation() OperationType
func (*CreateCollectionOp) PrepareAndValidateCollectionRequest ¶
func (op *CreateCollectionOp) PrepareAndValidateCollectionRequest() error
func (*CreateCollectionOp) Resource ¶
func (op *CreateCollectionOp) Resource() Resource
func (*CreateCollectionOp) String ¶
func (op *CreateCollectionOp) String() string
func (*CreateCollectionOp) UnmarshalJSON ¶
func (op *CreateCollectionOp) UnmarshalJSON(b []byte) error
type CreateCollectionOption ¶
type CreateCollectionOption func(*CreateCollectionOp) error
func WithCollectionMetadataCreate ¶
func WithCollectionMetadataCreate(metadata CollectionMetadata) CreateCollectionOption
func WithDatabaseCreate ¶
func WithDatabaseCreate(database Database) CreateCollectionOption
func WithEmbeddingFunctionCreate ¶
func WithEmbeddingFunctionCreate(embeddingFunction embeddings.EmbeddingFunction) CreateCollectionOption
func WithHNSWBatchSizeCreate ¶
func WithHNSWBatchSizeCreate(batchSize int) CreateCollectionOption
func WithHNSWConstructionEfCreate ¶
func WithHNSWConstructionEfCreate(efConstruction int) CreateCollectionOption
func WithHNSWMCreate ¶
func WithHNSWMCreate(m int) CreateCollectionOption
func WithHNSWNumThreadsCreate ¶
func WithHNSWNumThreadsCreate(numThreads int) CreateCollectionOption
func WithHNSWResizeFactorCreate ¶
func WithHNSWResizeFactorCreate(resizeFactor float64) CreateCollectionOption
func WithHNSWSearchEfCreate ¶
func WithHNSWSearchEfCreate(efSearch int) CreateCollectionOption
func WithHNSWSpaceCreate ¶
func WithHNSWSpaceCreate(metric embeddings.DistanceMetric) CreateCollectionOption
func WithHNSWSyncThresholdCreate ¶
func WithHNSWSyncThresholdCreate(syncThreshold int) CreateCollectionOption
func WithIfNotExistsCreate ¶
func WithIfNotExistsCreate() CreateCollectionOption
type CredentialsProvider ¶
type CredentialsProvider interface {
Authenticate(apiClient *BaseAPIClient) error
}
type Database ¶
type Database interface {
ID() string
Name() string
Tenant() Tenant
String() string
Validate() error
}
func NewDatabase ¶
func NewDatabaseFromJSON ¶
func NewDatabaseFromMap ¶
func NewDefaultDatabase ¶
func NewDefaultDatabase() Database
type DatabaseBase ¶
type DatabaseBase struct {
DBName string `json:"name" mapstructure:"name"`
DBID string `json:"id,omitempty" mapstructure:"id"`
TenantName string `json:"tenant,omitempty" mapstructure:"tenant"`
// contains filtered or unexported fields
}
func (DatabaseBase) ID ¶
func (d DatabaseBase) ID() string
func (DatabaseBase) Name ¶
func (d DatabaseBase) Name() string
func (DatabaseBase) String ¶
func (d DatabaseBase) String() string
func (DatabaseBase) Tenant ¶
func (d DatabaseBase) Tenant() Tenant
func (DatabaseBase) Validate ¶
func (d DatabaseBase) Validate() error
type DeleteCollectionOp ¶
type DeleteCollectionOp struct {
Database Database `json:"-"`
}
func NewDeleteCollectionOp ¶
func NewDeleteCollectionOp(opts ...DeleteCollectionOption) (*DeleteCollectionOp, error)
func (*DeleteCollectionOp) Operation ¶
func (op *DeleteCollectionOp) Operation() OperationType
func (*DeleteCollectionOp) PrepareAndValidateCollectionRequest ¶
func (op *DeleteCollectionOp) PrepareAndValidateCollectionRequest() error
func (*DeleteCollectionOp) Resource ¶
func (op *DeleteCollectionOp) Resource() Resource
type DeleteCollectionOption ¶
type DeleteCollectionOption func(*DeleteCollectionOp) error
func WithDatabaseDelete ¶
func WithDatabaseDelete(database Database) DeleteCollectionOption
type DocumentID ¶
type DocumentID string
type DocumentIDs ¶
type DocumentIDs []DocumentID
type DocumentMetadata ¶
type DocumentMetadata interface {
GetRaw(key string) (interface{}, bool)
GetString(key string) (string, bool)
GetInt(key string) (int64, bool)
GetFloat(key string) (float64, bool)
GetBool(key string) (bool, bool)
SetRaw(key string, value interface{})
SetString(key, value string)
SetInt(key string, value int64)
SetFloat(key string, value float64)
SetBool(key string, value bool)
}
func NewDocumentMetadata ¶
func NewDocumentMetadata(attributes ...*MetaAttribute) DocumentMetadata
func NewDocumentMetadataFromMap ¶
func NewDocumentMetadataFromMap(metadata map[string]interface{}) (DocumentMetadata, error)
type DocumentMetadataImpl ¶
type DocumentMetadataImpl struct {
// contains filtered or unexported fields
}
func (*DocumentMetadataImpl) GetBool ¶
func (cm *DocumentMetadataImpl) GetBool(key string) (value bool, ok bool)
func (*DocumentMetadataImpl) GetFloat ¶
func (cm *DocumentMetadataImpl) GetFloat(key string) (value float64, ok bool)
func (*DocumentMetadataImpl) GetInt ¶
func (cm *DocumentMetadataImpl) GetInt(key string) (value int64, ok bool)
func (*DocumentMetadataImpl) GetRaw ¶
func (cm *DocumentMetadataImpl) GetRaw(key string) (value interface{}, ok bool)
func (*DocumentMetadataImpl) GetString ¶
func (cm *DocumentMetadataImpl) GetString(key string) (value string, ok bool)
func (*DocumentMetadataImpl) Keys ¶
func (cm *DocumentMetadataImpl) Keys() []string
func (*DocumentMetadataImpl) MarshalJSON ¶
func (cm *DocumentMetadataImpl) MarshalJSON() ([]byte, error)
func (*DocumentMetadataImpl) SetBool ¶
func (cm *DocumentMetadataImpl) SetBool(key string, value bool)
func (*DocumentMetadataImpl) SetFloat ¶
func (cm *DocumentMetadataImpl) SetFloat(key string, value float64)
func (*DocumentMetadataImpl) SetInt ¶
func (cm *DocumentMetadataImpl) SetInt(key string, value int64)
func (*DocumentMetadataImpl) SetRaw ¶
func (cm *DocumentMetadataImpl) SetRaw(key string, value interface{})
func (*DocumentMetadataImpl) SetString ¶
func (cm *DocumentMetadataImpl) SetString(key, value string)
func (*DocumentMetadataImpl) UnmarshalJSON ¶
func (cm *DocumentMetadataImpl) UnmarshalJSON(b []byte) error
type DocumentMetadatas ¶
type DocumentMetadatas []DocumentMetadata
type FilterEmbeddingsOp ¶
type FilterEmbeddingsOp struct {
QueryEmbeddings []embeddings.Embedding `json:"query_embeddings"`
}
type FilterIDOp ¶
type FilterIDOp struct {
Ids []DocumentID `json:"ids,omitempty"`
}
type FilterOp ¶
type FilterOp struct {
Where WhereFilter `json:"where,omitempty"`
WhereDocument WhereDocumentFilter `json:"where_document,omitempty"`
}
type FilterTextsOp ¶
type FilterTextsOp struct {
QueryTexts []string `json:"-"`
}
type GenerateOptions ¶
type GenerateOptions struct {
Document string
}
type GetCollectionOp ¶
type GetCollectionOp struct {
Database Database `json:"-"`
// contains filtered or unexported fields
}
func NewGetCollectionOp ¶
func NewGetCollectionOp(opts ...GetCollectionOption) (*GetCollectionOp, error)
func (*GetCollectionOp) Operation ¶
func (op *GetCollectionOp) Operation() OperationType
func (*GetCollectionOp) PrepareAndValidateCollectionRequest ¶
func (op *GetCollectionOp) PrepareAndValidateCollectionRequest() error
func (*GetCollectionOp) Resource ¶
func (op *GetCollectionOp) Resource() Resource
type GetCollectionOption ¶
type GetCollectionOption func(*GetCollectionOp) error
func WithCollectionNameGet ¶
func WithCollectionNameGet(name string) GetCollectionOption
func WithDatabaseGet ¶
func WithDatabaseGet(database Database) GetCollectionOption
func WithEmbeddingFunctionGet ¶
func WithEmbeddingFunctionGet(embeddingFunction embeddings.EmbeddingFunction) GetCollectionOption
type GetResult ¶
type GetResult interface {
// GetIDs returns the IDs of the documents in the result.
GetIDs() DocumentIDs
// GetDocuments returns the documents in the result.
GetDocuments() Documents
// GetMetadatas returns the metadatas of the documents in the result.
GetMetadatas() DocumentMetadatas
// GetEmbeddings returns the embeddings of the documents in the result.
GetEmbeddings() embeddings.Embeddings
// ToRecords converts the result to a Records object.
ToRecords() Records
// Count returns the number of documents in the result.
Count() int
// Next when using limint and offset, this will return the next page of results
Next() (GetResult, error)
}
type GetResultImpl ¶
type GetResultImpl struct {
Ids DocumentIDs `json:"ids,omitempty"`
Documents Documents `json:"documents,omitempty"`
Metadatas DocumentMetadatas `json:"metadatas,omitempty"`
Embeddings embeddings.Embeddings `json:"embeddings,omitempty"`
Include []Include `json:"include,omitempty"`
}
func (*GetResultImpl) Count ¶
func (r *GetResultImpl) Count() int
func (*GetResultImpl) GetDocuments ¶
func (r *GetResultImpl) GetDocuments() Documents
func (*GetResultImpl) GetEmbeddings ¶
func (r *GetResultImpl) GetEmbeddings() embeddings.Embeddings
func (*GetResultImpl) GetIDs ¶
func (r *GetResultImpl) GetIDs() DocumentIDs
func (*GetResultImpl) GetMetadatas ¶
func (r *GetResultImpl) GetMetadatas() DocumentMetadatas
func (*GetResultImpl) Next ¶
func (r *GetResultImpl) Next() (GetResult, error)
func (*GetResultImpl) String ¶
func (r *GetResultImpl) String() string
func (*GetResultImpl) ToRecords ¶
func (r *GetResultImpl) ToRecords() Records
func (*GetResultImpl) UnmarshalJSON ¶
func (r *GetResultImpl) UnmarshalJSON(data []byte) error
type IDGenerator ¶
type IDGenerator interface {
Generate(opts ...IDGeneratorOption) string
}
type IDGeneratorOption ¶
type IDGeneratorOption func(opts *GenerateOptions)
func WithDocument ¶
func WithDocument(document string) IDGeneratorOption
type LimitAndOffsetOp ¶
type LimitResultOp ¶
type LimitResultOp struct {
NResults int `json:"n_results"`
}
type ListCollectionOp ¶
type ListCollectionOp struct {
Database Database `json:"-"`
// contains filtered or unexported fields
}
func NewListCollectionsOp ¶
func NewListCollectionsOp(opts ...ListCollectionsOption) (*ListCollectionOp, error)
func (*ListCollectionOp) Limit ¶
func (op *ListCollectionOp) Limit() int
func (*ListCollectionOp) Offset ¶
func (op *ListCollectionOp) Offset() int
func (*ListCollectionOp) Operation ¶
func (op *ListCollectionOp) Operation() OperationType
func (*ListCollectionOp) PrepareAndValidateCollectionRequest ¶
func (op *ListCollectionOp) PrepareAndValidateCollectionRequest() error
func (*ListCollectionOp) Resource ¶
func (op *ListCollectionOp) Resource() Resource
type ListCollectionsOption ¶
type ListCollectionsOption func(*ListCollectionOp) error
func ListWithLimit ¶
func ListWithLimit(limit int) ListCollectionsOption
func ListWithOffset ¶
func ListWithOffset(offset int) ListCollectionsOption
func WithDatabaseList ¶
func WithDatabaseList(database Database) ListCollectionsOption
type MetaAttribute ¶
type MetaAttribute struct {
// contains filtered or unexported fields
}
func NewBoolAttribute ¶
func NewBoolAttribute(key string, value bool) *MetaAttribute
func NewFloatAttribute ¶
func NewFloatAttribute(key string, value float64) *MetaAttribute
func NewIntAttribute ¶
func NewIntAttribute(key string, value int64) *MetaAttribute
func NewStringAttribute ¶
func NewStringAttribute(key string, value string) *MetaAttribute
type MetadataValue ¶
type MetadataValue struct {
Bool *bool `json:"-"`
Float64 *float64 `json:"-"`
Int *int64 `json:"-"`
StringValue *string `json:"-"`
}
func (*MetadataValue) Equal ¶
func (mv *MetadataValue) Equal(other *MetadataValue) bool
func (*MetadataValue) GetBool ¶
func (mv *MetadataValue) GetBool() (bool, bool)
func (*MetadataValue) GetFloat ¶
func (mv *MetadataValue) GetFloat() (float64, bool)
func (*MetadataValue) GetInt ¶
func (mv *MetadataValue) GetInt() (int64, bool)
func (*MetadataValue) GetRaw ¶
func (mv *MetadataValue) GetRaw() (interface{}, bool)
func (*MetadataValue) GetString ¶
func (mv *MetadataValue) GetString() (string, bool)
func (*MetadataValue) MarshalJSON ¶
func (mv *MetadataValue) MarshalJSON() ([]byte, error)
MarshalJSON ensures only the correct type is serialized.
func (*MetadataValue) String ¶
func (mv *MetadataValue) String() string
func (*MetadataValue) UnmarshalJSON ¶
func (mv *MetadataValue) UnmarshalJSON(b []byte) error
UnmarshalJSON properly detects and assigns the correct type.
type OperationType ¶
type OperationType string
type Option ¶
type Option func(*CollectionImpl) error
type PreFlightConditioner ¶
type PreFlightConditioner interface {
// GetPreFlightConditionsRaw returns the raw preflight response.
GetPreFlightConditionsRaw() map[string]interface{}
// Satisfies evaluates the resource type and a given metric to determine if the preflight condition applies.
Satisfies(resourceOperation ResourceOperation, metric interface{}, metricName string) error
}
type QueryResult ¶
type QueryResult interface {
GetIDGroups() []DocumentIDs
GetDocumentsGroups() []Documents
GetMetadatasGroups() []DocumentMetadatas
GetEmbeddingsGroups() []embeddings.Embeddings
GetDistancesGroups() []embeddings.Distances
ToRecordsGroups() []Records
CountGroups() int
}
type QueryResultImpl ¶
type QueryResultImpl struct {
IDLists []DocumentIDs `json:"ids"`
DocumentsLists []Documents `json:"documents,omitempty"`
MetadatasLists []DocumentMetadatas `json:"metadatas,omitempty"`
EmbeddingsLists []embeddings.Embeddings `json:"embeddings,omitempty"`
DistancesLists []embeddings.Distances `json:"distances,omitempty"`
Include []Include `json:"include,omitempty"`
}
func (*QueryResultImpl) CountGroups ¶
func (r *QueryResultImpl) CountGroups() int
func (*QueryResultImpl) GetDistancesGroups ¶
func (r *QueryResultImpl) GetDistancesGroups() []embeddings.Distances
func (*QueryResultImpl) GetDocumentsGroups ¶
func (r *QueryResultImpl) GetDocumentsGroups() []Documents
func (*QueryResultImpl) GetEmbeddingsGroups ¶
func (r *QueryResultImpl) GetEmbeddingsGroups() []embeddings.Embeddings
func (*QueryResultImpl) GetIDGroups ¶
func (r *QueryResultImpl) GetIDGroups() []DocumentIDs
func (*QueryResultImpl) GetMetadatasGroups ¶
func (r *QueryResultImpl) GetMetadatasGroups() []DocumentMetadatas
func (*QueryResultImpl) String ¶
func (r *QueryResultImpl) String() string
func (*QueryResultImpl) ToRecordsGroups ¶
func (r *QueryResultImpl) ToRecordsGroups() []Records
func (*QueryResultImpl) UnmarshalJSON ¶
func (r *QueryResultImpl) UnmarshalJSON(data []byte) error
type Record ¶
type Record interface {
ID() DocumentID
Document() Document // should work for both text and URI based documents
Embedding() embeddings.Embedding
Metadata() DocumentMetadata
Validate() error
Unwrap() (DocumentID, Document, embeddings.Embedding, DocumentMetadata)
}
type RecordOption ¶
type RecordOption func(record *SimpleRecord) error
func WithRecordEmbedding ¶
func WithRecordEmbedding(embedding embeddings.Embedding) RecordOption
func WithRecordID ¶
func WithRecordID(id string) RecordOption
func WithRecordMetadatas ¶
func WithRecordMetadatas(metadata DocumentMetadata) RecordOption
type ResourceOperation ¶
type ResourceOperation interface {
Resource() Resource
Operation() OperationType
}
type SHA256Generator ¶
type SHA256Generator struct{}
func NewSHA256Generator ¶
func NewSHA256Generator() *SHA256Generator
func (*SHA256Generator) Generate ¶
func (s *SHA256Generator) Generate(opts ...IDGeneratorOption) string
type SimpleRecord ¶
type SimpleRecord struct {
// contains filtered or unexported fields
}
func NewSimpleRecord ¶
func NewSimpleRecord(opts ...RecordOption) (*SimpleRecord, error)
func (*SimpleRecord) Document ¶
func (r *SimpleRecord) Document() Document
func (*SimpleRecord) Embedding ¶
func (r *SimpleRecord) Embedding() embeddings.Embedding
func (*SimpleRecord) ID ¶
func (r *SimpleRecord) ID() DocumentID
func (*SimpleRecord) Metadata ¶
func (r *SimpleRecord) Metadata() DocumentMetadata
func (*SimpleRecord) URI ¶
func (r *SimpleRecord) URI() string
func (*SimpleRecord) Unwrap ¶
func (r *SimpleRecord) Unwrap() (DocumentID, Document, embeddings.Embedding, DocumentMetadata)
func (*SimpleRecord) Validate ¶
func (r *SimpleRecord) Validate() error
type Tenant ¶
type Tenant interface {
Name() string
String() string
Database(dbName string) Database
Validate() error
}
func NewDefaultTenant ¶
func NewDefaultTenant() Tenant
func NewTenantFromJSON ¶
type TenantBase ¶
type TenantBase struct {
TenantName string `json:"name"`
}
func (*TenantBase) Database ¶
func (t *TenantBase) Database(dbName string) Database
Database returns a new Database object that can be used for creating collections
func (*TenantBase) Name ¶
func (t *TenantBase) Name() string
func (*TenantBase) String ¶
func (t *TenantBase) String() string
func (*TenantBase) Validate ¶
func (t *TenantBase) Validate() error
type TextDocument ¶
type TextDocument struct {
Content string
}
func NewTextDocument ¶
func NewTextDocument(content string) *TextDocument
func (*TextDocument) ContentRaw ¶
func (d *TextDocument) ContentRaw() []byte
func (*TextDocument) ContentString ¶
func (d *TextDocument) ContentString() string
func (*TextDocument) MarshalJSON ¶
func (d *TextDocument) MarshalJSON() ([]byte, error)
func (*TextDocument) String ¶
func (d *TextDocument) String() string
func (*TextDocument) UnmarshalJSON ¶
func (d *TextDocument) UnmarshalJSON(data []byte) error
type TextDocuments ¶
type TextDocuments []TextDocument
func NewTextDocumentsFromInterface ¶
func NewTextDocumentsFromInterface(docs []interface{}) (TextDocuments, error)
type TokenAuthCredentialsProvider ¶
type TokenAuthCredentialsProvider struct {
Token string
Header TokenTransportHeader
}
func NewTokenAuthCredentialsProvider ¶
func NewTokenAuthCredentialsProvider(token string, header TokenTransportHeader) *TokenAuthCredentialsProvider
func (*TokenAuthCredentialsProvider) Authenticate ¶
func (t *TokenAuthCredentialsProvider) Authenticate(client *BaseAPIClient) error
func (*TokenAuthCredentialsProvider) String ¶
func (t *TokenAuthCredentialsProvider) String() string
type TokenTransportHeader ¶
type TokenTransportHeader string
const ( AuthorizationTokenHeader TokenTransportHeader = "Authorization" XChromaTokenHeader TokenTransportHeader = "X-Chroma-Token" )
type ULIDGenerator ¶
type ULIDGenerator struct{}
func NewULIDGenerator ¶
func NewULIDGenerator() *ULIDGenerator
func (*ULIDGenerator) Generate ¶
func (u *ULIDGenerator) Generate(opts ...IDGeneratorOption) string
type UUIDGenerator ¶
type UUIDGenerator struct{}
func NewUUIDGenerator ¶
func NewUUIDGenerator() *UUIDGenerator
func (*UUIDGenerator) Generate ¶
func (u *UUIDGenerator) Generate(opts ...IDGeneratorOption) string
type WhereClause ¶
type WhereClause interface {
Operator() WhereFilterOperator
Key() string
Operand() interface{}
String() string
Validate() error
MarshalJSON() ([]byte, error)
UnmarshalJSON(b []byte) error
}
func And ¶
func And(clauses ...WhereClause) WhereClause
func EqBool ¶
func EqBool(field string, value bool) WhereClause
func EqFloat ¶
func EqFloat(field string, value float32) WhereClause
func EqInt ¶
func EqInt(field string, value int) WhereClause
func EqString ¶
func EqString(field, value string) WhereClause
func GtFloat ¶
func GtFloat(field string, value float32) WhereClause
func GtInt ¶
func GtInt(field string, value int) WhereClause
func GteFloat ¶
func GteFloat(field string, value float32) WhereClause
func GteInt ¶
func GteInt(field string, value int) WhereClause
func InBool ¶
func InBool(field string, values ...bool) WhereClause
func InFloat ¶
func InFloat(field string, values ...float32) WhereClause
func InInt ¶
func InInt(field string, values ...int) WhereClause
func InString ¶
func InString(field string, values ...string) WhereClause
func LtFloat ¶
func LtFloat(field string, value float32) WhereClause
func LtInt ¶
func LtInt(field string, value int) WhereClause
func LteFloat ¶
func LteFloat(field string, value float32) WhereClause
func LteInt ¶
func LteInt(field string, value int) WhereClause
func NinBool ¶
func NinBool(field string, values ...bool) WhereClause
func NinFloat ¶
func NinFloat(field string, values ...float32) WhereClause
func NinInt ¶
func NinInt(field string, values ...int) WhereClause
func NinString ¶
func NinString(field string, values ...string) WhereClause
func NotEqBool ¶
func NotEqBool(field string, value bool) WhereClause
func NotEqFloat ¶
func NotEqFloat(field string, value float32) WhereClause
func NotEqInt ¶
func NotEqInt(field string, value int) WhereClause
func NotEqString ¶
func NotEqString(field, value string) WhereClause
func Or ¶
func Or(clauses ...WhereClause) WhereClause
type WhereClauseBase ¶
type WhereClauseBase struct {
// contains filtered or unexported fields
}
func (*WhereClauseBase) Key ¶
func (w *WhereClauseBase) Key() string
func (*WhereClauseBase) Operator ¶
func (w *WhereClauseBase) Operator() WhereFilterOperator
func (*WhereClauseBase) String ¶
func (w *WhereClauseBase) String() string
type WhereClauseBool ¶
type WhereClauseBool struct {
WhereClauseBase
// contains filtered or unexported fields
}
func (*WhereClauseBool) MarshalJSON ¶
func (w *WhereClauseBool) MarshalJSON() ([]byte, error)
func (*WhereClauseBool) Operand ¶
func (w *WhereClauseBool) Operand() interface{}
func (*WhereClauseBool) UnmarshalJSON ¶
func (w *WhereClauseBool) UnmarshalJSON(b []byte) error
func (*WhereClauseBool) Validate ¶
func (w *WhereClauseBool) Validate() error
type WhereClauseBools ¶
type WhereClauseBools struct {
WhereClauseBase
// contains filtered or unexported fields
}
func (*WhereClauseBools) MarshalJSON ¶
func (w *WhereClauseBools) MarshalJSON() ([]byte, error)
func (*WhereClauseBools) Operand ¶
func (w *WhereClauseBools) Operand() interface{}
func (*WhereClauseBools) UnmarshalJSON ¶
func (w *WhereClauseBools) UnmarshalJSON(b []byte) error
func (*WhereClauseBools) Validate ¶
func (w *WhereClauseBools) Validate() error
type WhereClauseFloat ¶
type WhereClauseFloat struct {
WhereClauseBase
// contains filtered or unexported fields
}
func (*WhereClauseFloat) MarshalJSON ¶
func (w *WhereClauseFloat) MarshalJSON() ([]byte, error)
func (*WhereClauseFloat) Operand ¶
func (w *WhereClauseFloat) Operand() interface{}
func (*WhereClauseFloat) UnmarshalJSON ¶
func (w *WhereClauseFloat) UnmarshalJSON(b []byte) error
func (*WhereClauseFloat) Validate ¶
func (w *WhereClauseFloat) Validate() error
type WhereClauseFloats ¶
type WhereClauseFloats struct {
WhereClauseBase
// contains filtered or unexported fields
}
func (*WhereClauseFloats) MarshalJSON ¶
func (w *WhereClauseFloats) MarshalJSON() ([]byte, error)
func (*WhereClauseFloats) Operand ¶
func (w *WhereClauseFloats) Operand() interface{}
func (*WhereClauseFloats) UnmarshalJSON ¶
func (w *WhereClauseFloats) UnmarshalJSON(b []byte) error
func (*WhereClauseFloats) Validate ¶
func (w *WhereClauseFloats) Validate() error
type WhereClauseInt ¶
type WhereClauseInt struct {
WhereClauseBase
// contains filtered or unexported fields
}
func (*WhereClauseInt) MarshalJSON ¶
func (w *WhereClauseInt) MarshalJSON() ([]byte, error)
func (*WhereClauseInt) Operand ¶
func (w *WhereClauseInt) Operand() interface{}
func (*WhereClauseInt) UnmarshalJSON ¶
func (w *WhereClauseInt) UnmarshalJSON(b []byte) error
func (*WhereClauseInt) Validate ¶
func (w *WhereClauseInt) Validate() error
type WhereClauseInts ¶
type WhereClauseInts struct {
WhereClauseBase
// contains filtered or unexported fields
}
func (*WhereClauseInts) MarshalJSON ¶
func (w *WhereClauseInts) MarshalJSON() ([]byte, error)
func (*WhereClauseInts) Operand ¶
func (w *WhereClauseInts) Operand() interface{}
func (*WhereClauseInts) UnmarshalJSON ¶
func (w *WhereClauseInts) UnmarshalJSON(b []byte) error
func (*WhereClauseInts) Validate ¶
func (w *WhereClauseInts) Validate() error
type WhereClauseString ¶
type WhereClauseString struct {
WhereClauseBase
// contains filtered or unexported fields
}
func (*WhereClauseString) MarshalJSON ¶
func (w *WhereClauseString) MarshalJSON() ([]byte, error)
func (*WhereClauseString) Operand ¶
func (w *WhereClauseString) Operand() interface{}
func (*WhereClauseString) UnmarshalJSON ¶
func (w *WhereClauseString) UnmarshalJSON(b []byte) error
func (*WhereClauseString) Validate ¶
func (w *WhereClauseString) Validate() error
type WhereClauseStrings ¶
type WhereClauseStrings struct {
WhereClauseBase
// contains filtered or unexported fields
}
func (*WhereClauseStrings) MarshalJSON ¶
func (w *WhereClauseStrings) MarshalJSON() ([]byte, error)
func (*WhereClauseStrings) Operand ¶
func (w *WhereClauseStrings) Operand() interface{}
func (*WhereClauseStrings) UnmarshalJSON ¶
func (w *WhereClauseStrings) UnmarshalJSON(b []byte) error
func (*WhereClauseStrings) Validate ¶
func (w *WhereClauseStrings) Validate() error
type WhereClauseWhereClauses ¶
type WhereClauseWhereClauses struct {
WhereClauseBase
// contains filtered or unexported fields
}
func (*WhereClauseWhereClauses) MarshalJSON ¶
func (w *WhereClauseWhereClauses) MarshalJSON() ([]byte, error)
func (*WhereClauseWhereClauses) Operand ¶
func (w *WhereClauseWhereClauses) Operand() interface{}
func (*WhereClauseWhereClauses) UnmarshalJSON ¶
func (w *WhereClauseWhereClauses) UnmarshalJSON(b []byte) error
func (*WhereClauseWhereClauses) Validate ¶
func (w *WhereClauseWhereClauses) Validate() error
type WhereDocumentClauseAnd ¶
type WhereDocumentClauseAnd struct {
WhereDocumentFilterBase
// contains filtered or unexported fields
}
func (*WhereDocumentClauseAnd) MarshalJSON ¶
func (w *WhereDocumentClauseAnd) MarshalJSON() ([]byte, error)
func (*WhereDocumentClauseAnd) String ¶
func (w *WhereDocumentClauseAnd) String() string
func (*WhereDocumentClauseAnd) UnmarshalJSON ¶
func (w *WhereDocumentClauseAnd) UnmarshalJSON(b []byte) error
func (*WhereDocumentClauseAnd) Validate ¶
func (w *WhereDocumentClauseAnd) Validate() error
type WhereDocumentClauseContainsOrNotContains ¶
type WhereDocumentClauseContainsOrNotContains struct {
WhereDocumentFilterBase
// contains filtered or unexported fields
}
func (*WhereDocumentClauseContainsOrNotContains) MarshalJSON ¶
func (w *WhereDocumentClauseContainsOrNotContains) MarshalJSON() ([]byte, error)
func (*WhereDocumentClauseContainsOrNotContains) String ¶
func (w *WhereDocumentClauseContainsOrNotContains) String() string
func (*WhereDocumentClauseContainsOrNotContains) UnmarshalJSON ¶
func (w *WhereDocumentClauseContainsOrNotContains) UnmarshalJSON(b []byte) error
func (*WhereDocumentClauseContainsOrNotContains) Validate ¶
func (w *WhereDocumentClauseContainsOrNotContains) Validate() error
type WhereDocumentClauseOr ¶
type WhereDocumentClauseOr struct {
WhereDocumentFilterBase
// contains filtered or unexported fields
}
func (*WhereDocumentClauseOr) MarshalJSON ¶
func (w *WhereDocumentClauseOr) MarshalJSON() ([]byte, error)
func (*WhereDocumentClauseOr) String ¶
func (w *WhereDocumentClauseOr) String() string
func (*WhereDocumentClauseOr) UnmarshalJSON ¶
func (w *WhereDocumentClauseOr) UnmarshalJSON(b []byte) error
func (*WhereDocumentClauseOr) Validate ¶
func (w *WhereDocumentClauseOr) Validate() error
type WhereDocumentClauseRegexNotRegex ¶
type WhereDocumentClauseRegexNotRegex struct {
WhereDocumentFilterBase
// contains filtered or unexported fields
}
func (*WhereDocumentClauseRegexNotRegex) MarshalJSON ¶
func (w *WhereDocumentClauseRegexNotRegex) MarshalJSON() ([]byte, error)
func (*WhereDocumentClauseRegexNotRegex) String ¶
func (w *WhereDocumentClauseRegexNotRegex) String() string
func (*WhereDocumentClauseRegexNotRegex) UnmarshalJSON ¶
func (w *WhereDocumentClauseRegexNotRegex) UnmarshalJSON(b []byte) error
func (*WhereDocumentClauseRegexNotRegex) Validate ¶
func (w *WhereDocumentClauseRegexNotRegex) Validate() error
type WhereDocumentFilter ¶
type WhereDocumentFilter interface {
Operator() WhereDocumentFilterOperator
Operand() interface{}
Validate() error
String() string
MarshalJSON() ([]byte, error)
UnmarshalJSON(b []byte) error
}
func AndDocument ¶
func AndDocument(clauses ...WhereDocumentFilter) WhereDocumentFilter
func Contains ¶
func Contains(content string) WhereDocumentFilter
func NotContains ¶
func NotContains(content string) WhereDocumentFilter
func NotRegex ¶
func NotRegex(content string) WhereDocumentFilter
func OrDocument ¶
func OrDocument(clauses ...WhereDocumentFilter) WhereDocumentFilter
func Regex ¶
func Regex(content string) WhereDocumentFilter
type WhereDocumentFilterBase ¶
type WhereDocumentFilterBase struct {
// contains filtered or unexported fields
}
func (*WhereDocumentFilterBase) MarshalJSON ¶
func (w *WhereDocumentFilterBase) MarshalJSON() ([]byte, error)
func (*WhereDocumentFilterBase) Operand ¶
func (w *WhereDocumentFilterBase) Operand() interface{}
func (*WhereDocumentFilterBase) Operator ¶
func (w *WhereDocumentFilterBase) Operator() WhereDocumentFilterOperator
func (*WhereDocumentFilterBase) String ¶
func (w *WhereDocumentFilterBase) String() string
func (*WhereDocumentFilterBase) UnmarshalJSON ¶
func (w *WhereDocumentFilterBase) UnmarshalJSON(b []byte) error
func (*WhereDocumentFilterBase) Validate ¶
func (w *WhereDocumentFilterBase) Validate() error
type WhereDocumentFilterOperator ¶
type WhereDocumentFilterOperator string
const ( ContainsOperator WhereDocumentFilterOperator = "$contains" NotContainsOperator WhereDocumentFilterOperator = "$not_contains" RegexOperator WhereDocumentFilterOperator = "$regex" NotRegexOperator WhereDocumentFilterOperator = "$not_regex" OrDocumentOperator WhereDocumentFilterOperator = "$or" AndDocumentOperator WhereDocumentFilterOperator = "$and" )
type WhereFilter ¶
type WhereFilterOperator ¶
type WhereFilterOperator string
const ( EqualOperator WhereFilterOperator = "$eq" NotEqualOperator WhereFilterOperator = "$ne" GreaterThanOperator WhereFilterOperator = "$gt" GreaterThanOrEqualOperator WhereFilterOperator = "$gte" LessThanOperator WhereFilterOperator = "$lt" LessThanOrEqualOperator WhereFilterOperator = "$lte" InOperator WhereFilterOperator = "$in" NotInOperator WhereFilterOperator = "$nin" AndOperator WhereFilterOperator = "$and" OrOperator WhereFilterOperator = "$or" )