Documentation
¶
Index ¶
- Constants
- func Bool(b bool) *bool
- func Float32(f float32) *float32
- func Float64(f float64) *float64
- func Int(i int) *int
- func Int64(i int64) *int64
- func Pointer[T any](v T) *T
- func String(s string) *string
- type BulkUpsertInput
- type Client
- type Collection
- func (c *Collection) Delete(ctx context.Context, opts ...operations.Option) (*operations.DeleteCollectionResponse, error)
- func (c *Collection) Docs() *CollectionDocs
- func (c *Collection) Get(ctx context.Context, opts ...operations.Option) (*components.CollectionResponse, error)
- func (c *Collection) Query(ctx context.Context, input QueryInput, opts ...operations.Option) (*QueryResult, error)
- func (c *Collection) Update(ctx context.Context, body UpdateCollectionOptions, opts ...operations.Option) (*components.CollectionResponse, error)
- type CollectionDocs
- func (d *CollectionDocs) BulkUpsert(ctx context.Context, body BulkUpsertInput, opts ...operations.Option) (*operations.BulkUpsertDocsResponse, error)
- func (d *CollectionDocs) BulkUpsertDocuments(ctx context.Context, body UpsertDocsInput, opts ...operations.Option) (*operations.BulkUpsertDocsResponse, error)
- func (d *CollectionDocs) Delete(ctx context.Context, body DeleteDocsInput, opts ...operations.Option) (*operations.DeleteDocsResponse, error)
- func (d *CollectionDocs) Fetch(ctx context.Context, body FetchDocsInput, opts ...operations.Option) (*FetchResult, error)
- func (d *CollectionDocs) GetBulkUpsertInfo(ctx context.Context, opts ...operations.Option) (*GetBulkUpsertInfoResult, error)
- func (d *CollectionDocs) List(ctx context.Context, listOpts *ListDocsOpts, opts ...operations.Option) (*ListDocsResult, error)
- func (d *CollectionDocs) ListAll(ctx context.Context, listOpts *ListDocsOpts, opts ...operations.Option) ([]map[string]any, error)
- func (d *CollectionDocs) ListIterator(ctx context.Context, listOpts *ListDocsOpts, opts ...operations.Option) *DocListIterator
- func (d *CollectionDocs) Update(ctx context.Context, body UpdateDocsInput, opts ...operations.Option) (*operations.UpdateDocsResponse, error)
- func (d *CollectionDocs) Upsert(ctx context.Context, body UpsertDocsInput, opts ...operations.Option) (*operations.UpsertDocsResponse, error)
- type CollectionListIterator
- type Collections
- func (s *Collections) Create(ctx context.Context, request operations.CreateCollectionRequest, ...) (*operations.CreateCollectionResponse, error)
- func (s *Collections) Delete(ctx context.Context, collectionName string, opts ...operations.Option) (*operations.DeleteCollectionResponse, error)
- func (s *Collections) Get(ctx context.Context, collectionName string, opts ...operations.Option) (*operations.GetCollectionResponse, error)
- func (s *Collections) List(ctx context.Context, listOpts *ListCollectionsOpts, opts ...operations.Option) (*operations.ListCollectionsResponse, error)
- func (s *Collections) Query(ctx context.Context, collectionName string, ...) (*operations.QueryCollectionResponse, error)
- func (s *Collections) Update(ctx context.Context, collectionName string, ...) (*operations.UpdateCollectionResponse, error)
- type CreateCollectionOptions
- type DeleteDocsInput
- type DocListIterator
- type Docs
- func (s *Docs) BulkUpsert(ctx context.Context, collectionName string, ...) (*operations.BulkUpsertDocsResponse, error)
- func (s *Docs) Delete(ctx context.Context, collectionName string, ...) (*operations.DeleteDocsResponse, error)
- func (s *Docs) Fetch(ctx context.Context, collectionName string, ...) (*operations.FetchDocsResponse, error)
- func (s *Docs) GetBulkUpsertInfo(ctx context.Context, collectionName string, opts ...operations.Option) (*operations.GetBulkUpsertDocsResponse, error)
- func (s *Docs) List(ctx context.Context, collectionName string, size *int64, pageToken *string, ...) (*operations.ListDocsResponse, error)
- func (s *Docs) Update(ctx context.Context, collectionName string, ...) (*operations.UpdateDocsResponse, error)
- func (s *Docs) Upsert(ctx context.Context, collectionName string, ...) (*operations.UpsertDocsResponse, error)
- type FetchDocsInput
- type FetchResult
- type GetBulkUpsertInfoResult
- type HTTPClient
- type ListCollectionsOpts
- type ListCollectionsResult
- type ListDocsOpts
- type ListDocsResult
- type ProjectCollections
- func (p *ProjectCollections) Create(ctx context.Context, request CreateCollectionOptions, ...) (*components.CollectionResponse, error)
- func (p *ProjectCollections) List(ctx context.Context, listOpts *ListCollectionsOpts, opts ...operations.Option) (*ListCollectionsResult, error)
- func (p *ProjectCollections) ListAll(ctx context.Context, listOpts *ListCollectionsOpts, opts ...operations.Option) ([]components.CollectionResponse, error)
- func (p *ProjectCollections) ListIterator(ctx context.Context, listOpts *ListCollectionsOpts, opts ...operations.Option) *CollectionListIterator
- type QueryInput
- type QueryResult
- type SDKOption
- func WithAPIKey(apiKey string) SDKOption
- func WithBaseURL(baseURL string) SDKOption
- func WithClient(client HTTPClient) SDKOption
- func WithProjectName(projectName string) SDKOption
- func WithRetryConfig(retryConfig retry.Config) SDKOption
- func WithSecuritySource(security func(context.Context) (components.Security, error)) SDKOption
- func WithTimeout(timeout time.Duration) SDKOption
- type UpdateCollectionOptions
- type UpdateDocsInput
- type UpsertDocsInput
Constants ¶
const MaxBulkUpsertPayloadBytes = 200 * 1024 * 1024
MaxBulkUpsertPayloadBytes is the typical LambdaDB bulk upsert payload limit (200MB). The actual limit is returned by GetBulkUpsertInfo (sizeLimitBytes); use this constant only for reference or when validating before calling the API.
const Version = "0.3.0"
Version is the SDK version. Use it for SDKVersion and User-Agent.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BulkUpsertInput ¶ added in v0.2.0
type BulkUpsertInput = operations.BulkUpsertDocsRequestBody
BulkUpsertInput is the body for bulk upsert (alias of operations.BulkUpsertDocsRequestBody).
type Client ¶ added in v0.2.0
type Client struct {
SDKVersion string
// Collections provides project-level collection operations (list and create).
Collections *ProjectCollections
// contains filtered or unexported fields
}
Client is the LambdaDB API client.
func (*Client) Collection ¶ added in v0.2.0
func (c *Client) Collection(name string) *Collection
Collection returns a handle for the named collection. Use it for collection-level operations and document operations without passing the collection name each time.
type Collection ¶ added in v0.2.0
type Collection struct {
// contains filtered or unexported fields
}
Collection is a handle for a single collection (by name). Use it for collection-level operations and document operations without passing the collection name each time.
func (*Collection) Delete ¶ added in v0.2.0
func (c *Collection) Delete(ctx context.Context, opts ...operations.Option) (*operations.DeleteCollectionResponse, error)
Delete deletes the collection.
func (*Collection) Docs ¶ added in v0.2.0
func (c *Collection) Docs() *CollectionDocs
Docs returns a handle for document operations on this collection.
func (*Collection) Get ¶ added in v0.2.0
func (c *Collection) Get(ctx context.Context, opts ...operations.Option) (*components.CollectionResponse, error)
Get returns metadata for the collection.
func (*Collection) Query ¶ added in v0.2.0
func (c *Collection) Query(ctx context.Context, input QueryInput, opts ...operations.Option) (*QueryResult, error)
Query runs a search query on the collection. When the API returns isDocsInline=false and docsUrl, the SDK fetches docs from the presigned URL automatically so result.Docs is always populated.
func (*Collection) Update ¶ added in v0.2.0
func (c *Collection) Update(ctx context.Context, body UpdateCollectionOptions, opts ...operations.Option) (*components.CollectionResponse, error)
Update updates the collection configuration and returns the updated collection metadata.
type CollectionDocs ¶ added in v0.2.0
type CollectionDocs struct {
// contains filtered or unexported fields
}
CollectionDocs provides document operations for a single collection.
func (*CollectionDocs) BulkUpsert ¶ added in v0.2.0
func (d *CollectionDocs) BulkUpsert(ctx context.Context, body BulkUpsertInput, opts ...operations.Option) (*operations.BulkUpsertDocsResponse, error)
BulkUpsert bulk upserts documents into the collection. The uploaded object (via presigned URL) must not exceed the size limit returned by GetBulkUpsertInfo (e.g. 200MB).
func (*CollectionDocs) BulkUpsertDocuments ¶ added in v0.2.0
func (d *CollectionDocs) BulkUpsertDocuments(ctx context.Context, body UpsertDocsInput, opts ...operations.Option) (*operations.BulkUpsertDocsResponse, error)
BulkUpsertDocuments runs the full bulk upsert flow: obtains a presigned URL, uploads the documents as JSON, and completes the bulk upsert. It is a convenience over calling GetBulkUpsertInfo, uploading to the presigned URL, and BulkUpsert separately. The body format is the same as Upsert (docs array). When the API returns sizeLimitBytes in GetBulkUpsertInfo, payload size is validated against it before uploading.
func (*CollectionDocs) Delete ¶ added in v0.2.0
func (d *CollectionDocs) Delete(ctx context.Context, body DeleteDocsInput, opts ...operations.Option) (*operations.DeleteDocsResponse, error)
Delete deletes documents from the collection.
func (*CollectionDocs) Fetch ¶ added in v0.2.0
func (d *CollectionDocs) Fetch(ctx context.Context, body FetchDocsInput, opts ...operations.Option) (*FetchResult, error)
Fetch fetches documents by IDs from the collection. When the API returns isDocsInline=false and docsUrl, the SDK fetches docs from the presigned URL automatically so result.Docs is always populated.
func (*CollectionDocs) GetBulkUpsertInfo ¶ added in v0.2.0
func (d *CollectionDocs) GetBulkUpsertInfo(ctx context.Context, opts ...operations.Option) (*GetBulkUpsertInfoResult, error)
GetBulkUpsertInfo returns info required for bulk upload (presigned URL, object key, and optionally sizeLimitBytes). When sizeLimitBytes is present, the upload payload must not exceed it (e.g. LambdaDB uses 200MB).
func (*CollectionDocs) List ¶ added in v0.2.0
func (d *CollectionDocs) List(ctx context.Context, listOpts *ListDocsOpts, opts ...operations.Option) (*ListDocsResult, error)
List lists documents in the collection (one page). Pass nil for listOpts to use defaults (no size limit, no page token).
func (*CollectionDocs) ListAll ¶ added in v0.2.0
func (d *CollectionDocs) ListAll(ctx context.Context, listOpts *ListDocsOpts, opts ...operations.Option) ([]map[string]any, error)
ListAll fetches all document pages and returns a single slice of docs. Use with care on large collections. listOpts.Size is recommended (e.g. 100) to control page size; nil listOpts uses API defaults. The API may return fewer docs per page than requested (e.g. due to payload limits); iteration continues until the API reports no more pages via nextPageToken.
func (*CollectionDocs) ListIterator ¶ added in v0.2.0
func (d *CollectionDocs) ListIterator(ctx context.Context, listOpts *ListDocsOpts, opts ...operations.Option) *DocListIterator
ListIterator returns an iterator that fetches document list pages. Pass nil for listOpts to use defaults. Call Next(ctx) in a loop; when it returns (nil, nil), there are no more pages.
func (*CollectionDocs) Update ¶ added in v0.2.0
func (d *CollectionDocs) Update(ctx context.Context, body UpdateDocsInput, opts ...operations.Option) (*operations.UpdateDocsResponse, error)
Update updates documents in the collection.
func (*CollectionDocs) Upsert ¶ added in v0.2.0
func (d *CollectionDocs) Upsert(ctx context.Context, body UpsertDocsInput, opts ...operations.Option) (*operations.UpsertDocsResponse, error)
Upsert upserts documents into the collection.
type CollectionListIterator ¶ added in v0.2.0
type CollectionListIterator struct {
// contains filtered or unexported fields
}
CollectionListIterator iterates over collection list pages without managing page tokens manually. Create it with ListIterator; then call Next until it returns (nil, nil).
func (*CollectionListIterator) Next ¶ added in v0.2.0
func (it *CollectionListIterator) Next(ctx context.Context) (*ListCollectionsResult, error)
Next fetches the next page. It returns (result, nil), (nil, error), or (nil, nil) when there are no more pages.
type Collections ¶
type Collections struct {
// contains filtered or unexported fields
}
func (*Collections) Create ¶
func (s *Collections) Create(ctx context.Context, request operations.CreateCollectionRequest, opts ...operations.Option) (*operations.CreateCollectionResponse, error)
Create a collection.
func (*Collections) Delete ¶
func (s *Collections) Delete(ctx context.Context, collectionName string, opts ...operations.Option) (*operations.DeleteCollectionResponse, error)
Delete an existing collection.
func (*Collections) Get ¶
func (s *Collections) Get(ctx context.Context, collectionName string, opts ...operations.Option) (*operations.GetCollectionResponse, error)
Get metadata of an existing collection.
func (*Collections) List ¶
func (s *Collections) List(ctx context.Context, listOpts *ListCollectionsOpts, opts ...operations.Option) (*operations.ListCollectionsResponse, error)
List all collections in an existing project. Pass nil for listOpts to use defaults (no size/page token).
func (*Collections) Query ¶
func (s *Collections) Query(ctx context.Context, collectionName string, body operations.QueryCollectionRequestBody, opts ...operations.Option) (*operations.QueryCollectionResponse, error)
Query - Search a collection with a query and return the most similar documents.
func (*Collections) Update ¶
func (s *Collections) Update(ctx context.Context, collectionName string, body operations.UpdateCollectionRequestBody, opts ...operations.Option) (*operations.UpdateCollectionResponse, error)
Update - Configure a collection.
type CreateCollectionOptions ¶ added in v0.2.0
type CreateCollectionOptions = operations.CreateCollectionRequest
CreateCollectionOptions configures a new collection (alias of operations.CreateCollectionRequest).
type DeleteDocsInput ¶ added in v0.2.0
type DeleteDocsInput = operations.DeleteDocsRequestBody
DeleteDocsInput is the body for deleting documents (alias of operations.DeleteDocsRequestBody).
type DocListIterator ¶ added in v0.2.0
type DocListIterator struct {
// contains filtered or unexported fields
}
DocListIterator iterates over document list pages without managing page tokens manually. Create it with ListIterator; then call Next until it returns (nil, nil). Whether there are more pages is determined only by the API's nextPageToken—the number of documents per page may be less than the requested size (e.g. due to payload size limits).
func (*DocListIterator) Next ¶ added in v0.2.0
func (it *DocListIterator) Next(ctx context.Context) (*ListDocsResult, error)
Next fetches the next page. It returns (result, nil), (nil, error), or (nil, nil) when there are no more pages.
type Docs ¶
type Docs struct {
// contains filtered or unexported fields
}
func (*Docs) BulkUpsert ¶
func (s *Docs) BulkUpsert(ctx context.Context, collectionName string, body operations.BulkUpsertDocsRequestBody, opts ...operations.Option) (*operations.BulkUpsertDocsResponse, error)
BulkUpsert - Bulk upsert documents into a collection. Note that the maximum supported object size is 200MB.
func (*Docs) Delete ¶
func (s *Docs) Delete(ctx context.Context, collectionName string, body operations.DeleteDocsRequestBody, opts ...operations.Option) (*operations.DeleteDocsResponse, error)
Delete documents by document IDs or query filter from a collection.
func (*Docs) Fetch ¶
func (s *Docs) Fetch(ctx context.Context, collectionName string, body operations.FetchDocsRequestBody, opts ...operations.Option) (*operations.FetchDocsResponse, error)
Fetch - Lookup and return documents by document IDs from a collection.
func (*Docs) GetBulkUpsertInfo ¶
func (s *Docs) GetBulkUpsertInfo(ctx context.Context, collectionName string, opts ...operations.Option) (*operations.GetBulkUpsertDocsResponse, error)
GetBulkUpsertInfo - Request required info to upload documents.
func (*Docs) List ¶
func (s *Docs) List(ctx context.Context, collectionName string, size *int64, pageToken *string, opts ...operations.Option) (*operations.ListDocsResponse, error)
List documents in a collection.
func (*Docs) Update ¶
func (s *Docs) Update(ctx context.Context, collectionName string, body operations.UpdateDocsRequestBody, opts ...operations.Option) (*operations.UpdateDocsResponse, error)
Update documents in a collection. Note that the maximum supported payload size is 6MB.
func (*Docs) Upsert ¶
func (s *Docs) Upsert(ctx context.Context, collectionName string, body operations.UpsertDocsRequestBody, opts ...operations.Option) (*operations.UpsertDocsResponse, error)
Upsert documents into a collection. Note that the maximum supported payload size is 6MB.
type FetchDocsInput ¶ added in v0.2.0
type FetchDocsInput = operations.FetchDocsRequestBody
FetchDocsInput is the body for fetching documents by ID (alias of operations.FetchDocsRequestBody).
type FetchResult ¶ added in v0.2.0
type FetchResult struct {
Docs []operations.FetchDocsDoc
Total int64
Took int64
}
FetchResult is the flattened result of fetching documents by ID.
type GetBulkUpsertInfoResult ¶ added in v0.2.0
type GetBulkUpsertInfoResult struct {
URL string
ObjectKey string
Type *operations.Type
HTTPMethod *operations.HTTPMethod
SizeLimitBytes *int64
}
GetBulkUpsertInfoResult is the flattened result of getting bulk upsert upload info.
type HTTPClient ¶
HTTPClient provides an interface for supplying the SDK with a custom HTTP client.
type ListCollectionsOpts ¶ added in v0.2.0
type ListCollectionsOpts struct {
// Max number of collections to return at once.
Size *int64
// Next page token for pagination.
PageToken *string
}
ListCollectionsOpts holds optional parameters for listing collections. Pass nil to use defaults.
type ListCollectionsResult ¶ added in v0.2.0
type ListCollectionsResult struct {
Collections []components.CollectionResponse
NextPageToken *string
}
ListCollectionsResult is the flattened result of listing collections (one page).
type ListDocsOpts ¶ added in v0.2.0
type ListDocsOpts struct {
// Max number of documents to return at once.
Size *int64
// Next page token for pagination.
PageToken *string
}
ListDocsOpts holds optional parameters for listing documents (request only). Pass nil to use defaults. Note: isDocsInline and docsUrl are response-only fields from the API; they are not request options. When the API returns isDocsInline=false and docsUrl, the SDK automatically fetches the document list from that URL.
type ListDocsResult ¶ added in v0.2.0
type ListDocsResult struct {
Docs []operations.ListDocsDoc
Total int64
NextPageToken *string
}
ListDocsResult is the flattened result of listing documents (one page).
type ProjectCollections ¶ added in v0.2.0
type ProjectCollections struct {
// contains filtered or unexported fields
}
ProjectCollections provides project-level collection operations.
func (*ProjectCollections) Create ¶ added in v0.2.0
func (p *ProjectCollections) Create(ctx context.Context, request CreateCollectionOptions, callOpts ...operations.Option) (*components.CollectionResponse, error)
Create creates a new collection and returns the created collection metadata.
func (*ProjectCollections) List ¶ added in v0.2.0
func (p *ProjectCollections) List(ctx context.Context, listOpts *ListCollectionsOpts, opts ...operations.Option) (*ListCollectionsResult, error)
List returns a page of collections in the project. Pass nil for listOpts to use defaults (no size/page token).
func (*ProjectCollections) ListAll ¶ added in v0.2.0
func (p *ProjectCollections) ListAll(ctx context.Context, listOpts *ListCollectionsOpts, opts ...operations.Option) ([]components.CollectionResponse, error)
ListAll fetches all collection pages and returns a single slice. Use with care on projects with many collections.
func (*ProjectCollections) ListIterator ¶ added in v0.2.0
func (p *ProjectCollections) ListIterator(ctx context.Context, listOpts *ListCollectionsOpts, opts ...operations.Option) *CollectionListIterator
ListIterator returns an iterator that fetches collection list pages. Pass nil for listOpts to use defaults. Call Next(ctx) in a loop; when it returns (nil, nil), there are no more pages.
type QueryInput ¶ added in v0.2.0
type QueryInput = operations.QueryCollectionRequestBody
QueryInput is the query body for collection search (alias of operations.QueryCollectionRequestBody).
type QueryResult ¶ added in v0.2.0
type QueryResult struct {
Docs []operations.QueryCollectionDoc
Took int64
Total int64
MaxScore *float64
}
QueryResult is the flattened result of a collection query.
type SDKOption ¶
type SDKOption func(*Client)
SDKOption configures the client.
func WithAPIKey ¶ added in v0.2.0
WithAPIKey sets the project API key for authentication.
func WithBaseURL ¶ added in v0.2.0
WithBaseURL sets the API base URL (scheme + host, e.g. https://api.lambdadb.ai). Default is https://api.lambdadb.ai per OpenAPI spec.
func WithClient ¶
func WithClient(client HTTPClient) SDKOption
WithClient sets the HTTP client used by the SDK.
func WithProjectName ¶ added in v0.2.0
WithProjectName sets the project name (path segment, e.g. playground). Default is "playground" per OpenAPI spec.
func WithRetryConfig ¶
WithRetryConfig sets the default retry configuration.
func WithSecuritySource ¶
WithSecuritySource sets a function that provides security on each request.
func WithTimeout ¶
WithTimeout sets the default request timeout.
type UpdateCollectionOptions ¶ added in v0.2.0
type UpdateCollectionOptions = operations.UpdateCollectionRequestBody
UpdateCollectionOptions configures a collection update (alias of operations.UpdateCollectionRequestBody).
type UpdateDocsInput ¶ added in v0.2.0
type UpdateDocsInput = operations.UpdateDocsRequestBody
UpdateDocsInput is the body for updating documents (alias of operations.UpdateDocsRequestBody).
type UpsertDocsInput ¶ added in v0.2.0
type UpsertDocsInput = operations.UpsertDocsRequestBody
UpsertDocsInput is the body for upserting documents (alias of operations.UpsertDocsRequestBody).