Documentation
¶
Overview ¶
Package vectorsearch is an auto-generated package for the Vector Search API.
The Vector Search API provides a fully-managed, highly performant, and scalable vector database designed to power next-generation search, recommendation, and generative AI applications. It allows you to store, index, and query your data and its corresponding vector embeddings through a simple, intuitive interface. With Vector Search, you can define custom schemas for your data, insert objects with associated metadata, automatically generate embeddings from your data, and perform fast approximate nearest neighbor (ANN) searches to find semantically similar items at scale.
NOTE: This package is in beta. It is not stable, and may be subject to changes.
General documentation ¶
For information that is relevant for all client libraries please reference https://pkg.go.dev/cloud.google.com/go#pkg-overview. Some information on this page includes:
- Authentication and Authorization
- Timeouts and Cancellation
- Testing against Client Libraries
- Debugging Client Libraries
- Inspecting errors
Example usage ¶
To get started with this package, create a client.
// go get cloud.google.com/go/vectorsearch/apiv1beta@latest
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := vectorsearch.NewDataObjectSearchClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
The client will use your default application credentials. Clients should be reused instead of created as needed. The methods of Client are safe for concurrent use by multiple goroutines. The returned client must be Closed when it is done being used.
Using the Client ¶
The following is an example of making an API call with the newly created client, mentioned above.
req := &vectorsearchpb.AggregateDataObjectsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/vectorsearch/apiv1beta/vectorsearchpb#AggregateDataObjectsRequest.
}
resp, err := c.AggregateDataObjects(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
Use of Context ¶
The ctx passed to NewDataObjectSearchClient is used for authentication requests and for creating the underlying connection, but is not used for subsequent calls. Individual methods on the client use the ctx given to them.
To close the open connection, use the Close() method.
Index ¶
- func DefaultAuthScopes() []string
- type CallOptions
- type Client
- func (c *Client) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, ...) error
- func (c *Client) Close() error
- func (c *Client) Connection() *grpc.ClientConndeprecated
- func (c *Client) CreateCollection(ctx context.Context, req *vectorsearchpb.CreateCollectionRequest, ...) (*CreateCollectionOperation, error)
- func (c *Client) CreateCollectionOperation(name string) *CreateCollectionOperation
- func (c *Client) CreateIndex(ctx context.Context, req *vectorsearchpb.CreateIndexRequest, ...) (*CreateIndexOperation, error)
- func (c *Client) CreateIndexOperation(name string) *CreateIndexOperation
- func (c *Client) DeleteCollection(ctx context.Context, req *vectorsearchpb.DeleteCollectionRequest, ...) (*DeleteCollectionOperation, error)
- func (c *Client) DeleteCollectionOperation(name string) *DeleteCollectionOperation
- func (c *Client) DeleteIndex(ctx context.Context, req *vectorsearchpb.DeleteIndexRequest, ...) (*DeleteIndexOperation, error)
- func (c *Client) DeleteIndexOperation(name string) *DeleteIndexOperation
- func (c *Client) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, ...) error
- func (c *Client) ExportDataObjects(ctx context.Context, req *vectorsearchpb.ExportDataObjectsRequest, ...) (*ExportDataObjectsOperation, error)
- func (c *Client) ExportDataObjectsOperation(name string) *ExportDataObjectsOperation
- func (c *Client) GetCollection(ctx context.Context, req *vectorsearchpb.GetCollectionRequest, ...) (*vectorsearchpb.Collection, error)
- func (c *Client) GetIndex(ctx context.Context, req *vectorsearchpb.GetIndexRequest, ...) (*vectorsearchpb.Index, error)
- func (c *Client) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, ...) (*locationpb.Location, error)
- func (c *Client) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, ...) (*longrunningpb.Operation, error)
- func (c *Client) ImportDataObjects(ctx context.Context, req *vectorsearchpb.ImportDataObjectsRequest, ...) (*ImportDataObjectsOperation, error)
- func (c *Client) ImportDataObjectsOperation(name string) *ImportDataObjectsOperation
- func (c *Client) ListCollections(ctx context.Context, req *vectorsearchpb.ListCollectionsRequest, ...) *CollectionIterator
- func (c *Client) ListIndexes(ctx context.Context, req *vectorsearchpb.ListIndexesRequest, ...) *IndexIterator
- func (c *Client) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, ...) *LocationIterator
- func (c *Client) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, ...) *OperationIterator
- func (c *Client) UpdateCollection(ctx context.Context, req *vectorsearchpb.UpdateCollectionRequest, ...) (*UpdateCollectionOperation, error)
- func (c *Client) UpdateCollectionOperation(name string) *UpdateCollectionOperation
- type CollectionIterator
- type CreateCollectionOperation
- func (op *CreateCollectionOperation) Done() bool
- func (op *CreateCollectionOperation) Metadata() (*vectorsearchpb.OperationMetadata, error)
- func (op *CreateCollectionOperation) Name() string
- func (op *CreateCollectionOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*vectorsearchpb.Collection, error)
- func (op *CreateCollectionOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*vectorsearchpb.Collection, error)
- type CreateIndexOperation
- func (op *CreateIndexOperation) Done() bool
- func (op *CreateIndexOperation) Metadata() (*vectorsearchpb.OperationMetadata, error)
- func (op *CreateIndexOperation) Name() string
- func (op *CreateIndexOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*vectorsearchpb.Index, error)
- func (op *CreateIndexOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*vectorsearchpb.Index, error)
- type DataObjectCallOptions
- type DataObjectClient
- func (c *DataObjectClient) BatchCreateDataObjects(ctx context.Context, req *vectorsearchpb.BatchCreateDataObjectsRequest, ...) (*vectorsearchpb.BatchCreateDataObjectsResponse, error)
- func (c *DataObjectClient) BatchDeleteDataObjects(ctx context.Context, req *vectorsearchpb.BatchDeleteDataObjectsRequest, ...) error
- func (c *DataObjectClient) BatchUpdateDataObjects(ctx context.Context, req *vectorsearchpb.BatchUpdateDataObjectsRequest, ...) (*vectorsearchpb.BatchUpdateDataObjectsResponse, error)
- func (c *DataObjectClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, ...) error
- func (c *DataObjectClient) Close() error
- func (c *DataObjectClient) Connection() *grpc.ClientConndeprecated
- func (c *DataObjectClient) CreateDataObject(ctx context.Context, req *vectorsearchpb.CreateDataObjectRequest, ...) (*vectorsearchpb.DataObject, error)
- func (c *DataObjectClient) DeleteDataObject(ctx context.Context, req *vectorsearchpb.DeleteDataObjectRequest, ...) error
- func (c *DataObjectClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, ...) error
- func (c *DataObjectClient) GetDataObject(ctx context.Context, req *vectorsearchpb.GetDataObjectRequest, ...) (*vectorsearchpb.DataObject, error)
- func (c *DataObjectClient) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, ...) (*locationpb.Location, error)
- func (c *DataObjectClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, ...) (*longrunningpb.Operation, error)
- func (c *DataObjectClient) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, ...) *LocationIterator
- func (c *DataObjectClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, ...) *OperationIterator
- func (c *DataObjectClient) UpdateDataObject(ctx context.Context, req *vectorsearchpb.UpdateDataObjectRequest, ...) (*vectorsearchpb.DataObject, error)
- type DataObjectIterator
- type DataObjectSearchCallOptions
- type DataObjectSearchClient
- func (c *DataObjectSearchClient) AggregateDataObjects(ctx context.Context, req *vectorsearchpb.AggregateDataObjectsRequest, ...) (*vectorsearchpb.AggregateDataObjectsResponse, error)
- func (c *DataObjectSearchClient) BatchSearchDataObjects(ctx context.Context, req *vectorsearchpb.BatchSearchDataObjectsRequest, ...) (*vectorsearchpb.BatchSearchDataObjectsResponse, error)
- func (c *DataObjectSearchClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, ...) error
- func (c *DataObjectSearchClient) Close() error
- func (c *DataObjectSearchClient) Connection() *grpc.ClientConndeprecated
- func (c *DataObjectSearchClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, ...) error
- func (c *DataObjectSearchClient) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, ...) (*locationpb.Location, error)
- func (c *DataObjectSearchClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, ...) (*longrunningpb.Operation, error)
- func (c *DataObjectSearchClient) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, ...) *LocationIterator
- func (c *DataObjectSearchClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, ...) *OperationIterator
- func (c *DataObjectSearchClient) QueryDataObjects(ctx context.Context, req *vectorsearchpb.QueryDataObjectsRequest, ...) *DataObjectIterator
- func (c *DataObjectSearchClient) SearchDataObjects(ctx context.Context, req *vectorsearchpb.SearchDataObjectsRequest, ...) *SearchResultIterator
- type DeleteCollectionOperation
- func (op *DeleteCollectionOperation) Done() bool
- func (op *DeleteCollectionOperation) Metadata() (*vectorsearchpb.OperationMetadata, error)
- func (op *DeleteCollectionOperation) Name() string
- func (op *DeleteCollectionOperation) Poll(ctx context.Context, opts ...gax.CallOption) error
- func (op *DeleteCollectionOperation) Wait(ctx context.Context, opts ...gax.CallOption) error
- type DeleteIndexOperation
- func (op *DeleteIndexOperation) Done() bool
- func (op *DeleteIndexOperation) Metadata() (*vectorsearchpb.OperationMetadata, error)
- func (op *DeleteIndexOperation) Name() string
- func (op *DeleteIndexOperation) Poll(ctx context.Context, opts ...gax.CallOption) error
- func (op *DeleteIndexOperation) Wait(ctx context.Context, opts ...gax.CallOption) error
- type ExportDataObjectsOperation
- func (op *ExportDataObjectsOperation) Done() bool
- func (op *ExportDataObjectsOperation) Metadata() (*vectorsearchpb.ExportDataObjectsMetadata, error)
- func (op *ExportDataObjectsOperation) Name() string
- func (op *ExportDataObjectsOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*vectorsearchpb.ExportDataObjectsResponse, error)
- func (op *ExportDataObjectsOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*vectorsearchpb.ExportDataObjectsResponse, error)
- type ImportDataObjectsOperation
- func (op *ImportDataObjectsOperation) Done() bool
- func (op *ImportDataObjectsOperation) Metadata() (*vectorsearchpb.ImportDataObjectsMetadata, error)
- func (op *ImportDataObjectsOperation) Name() string
- func (op *ImportDataObjectsOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*vectorsearchpb.ImportDataObjectsResponse, error)
- func (op *ImportDataObjectsOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*vectorsearchpb.ImportDataObjectsResponse, error)
- type IndexIterator
- type LocationIterator
- type OperationIterator
- type SearchResultIterator
- type UpdateCollectionOperation
- func (op *UpdateCollectionOperation) Done() bool
- func (op *UpdateCollectionOperation) Metadata() (*vectorsearchpb.OperationMetadata, error)
- func (op *UpdateCollectionOperation) Name() string
- func (op *UpdateCollectionOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*vectorsearchpb.Collection, error)
- func (op *UpdateCollectionOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*vectorsearchpb.Collection, error)
Examples ¶
- Client.CancelOperation
- Client.CreateCollection
- Client.CreateIndex
- Client.DeleteCollection
- Client.DeleteIndex
- Client.DeleteOperation
- Client.ExportDataObjects
- Client.GetCollection
- Client.GetIndex
- Client.GetLocation
- Client.GetOperation
- Client.ImportDataObjects
- Client.ListCollections
- Client.ListCollections (All)
- Client.ListIndexes
- Client.ListIndexes (All)
- Client.ListLocations
- Client.ListLocations (All)
- Client.ListOperations
- Client.ListOperations (All)
- Client.UpdateCollection
- DataObjectClient.BatchCreateDataObjects
- DataObjectClient.BatchDeleteDataObjects
- DataObjectClient.BatchUpdateDataObjects
- DataObjectClient.CancelOperation
- DataObjectClient.CreateDataObject
- DataObjectClient.DeleteDataObject
- DataObjectClient.DeleteOperation
- DataObjectClient.GetDataObject
- DataObjectClient.GetLocation
- DataObjectClient.GetOperation
- DataObjectClient.ListLocations
- DataObjectClient.ListLocations (All)
- DataObjectClient.ListOperations
- DataObjectClient.ListOperations (All)
- DataObjectClient.UpdateDataObject
- DataObjectSearchClient.AggregateDataObjects
- DataObjectSearchClient.BatchSearchDataObjects
- DataObjectSearchClient.CancelOperation
- DataObjectSearchClient.DeleteOperation
- DataObjectSearchClient.GetLocation
- DataObjectSearchClient.GetOperation
- DataObjectSearchClient.ListLocations
- DataObjectSearchClient.ListLocations (All)
- DataObjectSearchClient.ListOperations
- DataObjectSearchClient.ListOperations (All)
- DataObjectSearchClient.QueryDataObjects
- DataObjectSearchClient.QueryDataObjects (All)
- DataObjectSearchClient.SearchDataObjects
- DataObjectSearchClient.SearchDataObjects (All)
- NewClient
- NewDataObjectClient
- NewDataObjectRESTClient
- NewDataObjectSearchClient
- NewDataObjectSearchRESTClient
- NewRESTClient
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultAuthScopes ¶
func DefaultAuthScopes() []string
DefaultAuthScopes reports the default set of authentication scopes to use with this package.
Types ¶
type CallOptions ¶
type CallOptions struct {
ListCollections []gax.CallOption
GetCollection []gax.CallOption
CreateCollection []gax.CallOption
UpdateCollection []gax.CallOption
DeleteCollection []gax.CallOption
ListIndexes []gax.CallOption
GetIndex []gax.CallOption
CreateIndex []gax.CallOption
DeleteIndex []gax.CallOption
ImportDataObjects []gax.CallOption
ExportDataObjects []gax.CallOption
GetLocation []gax.CallOption
ListLocations []gax.CallOption
CancelOperation []gax.CallOption
DeleteOperation []gax.CallOption
GetOperation []gax.CallOption
ListOperations []gax.CallOption
}
CallOptions contains the retry settings for each method of Client.
type Client ¶
type Client struct {
// The call options for this service.
CallOptions *CallOptions
// LROClient is used internally to handle long-running operations.
// It is exposed so that its CallOptions can be modified if required.
// Users should not Close this client.
LROClient *lroauto.OperationsClient
// contains filtered or unexported fields
}
Client is a client for interacting with Vector Search API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
VectorSearchService provides methods for managing Collection resources, and Collection Index resources. The primary resources offered by this service are Collections which are a container for a set of related JSON data objects, and Collection Indexes which enable efficient ANN search across data objects within a Collection.
func NewClient ¶
NewClient creates a new vector search service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
VectorSearchService provides methods for managing Collection resources, and Collection Index resources. The primary resources offered by this service are Collections which are a container for a set of related JSON data objects, and Collection Indexes which enable efficient ANN search across data objects within a Collection.
Example ¶
package main
import (
"context"
vectorsearch "cloud.google.com/go/vectorsearch/apiv1beta"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := vectorsearch.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func NewRESTClient ¶
NewRESTClient creates a new vector search service rest client.
VectorSearchService provides methods for managing Collection resources, and Collection Index resources. The primary resources offered by this service are Collections which are a container for a set of related JSON data objects, and Collection Indexes which enable efficient ANN search across data objects within a Collection.
Example ¶
package main
import (
"context"
vectorsearch "cloud.google.com/go/vectorsearch/apiv1beta"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := vectorsearch.NewRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func (*Client) CancelOperation ¶
func (c *Client) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error
CancelOperation is a utility method from google.longrunning.Operations.
Example ¶
package main
import (
"context"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
vectorsearch "cloud.google.com/go/vectorsearch/apiv1beta"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := vectorsearch.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.CancelOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest.
}
err = c.CancelOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*Client) Close ¶
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*Client) Connection
deprecated
func (c *Client) Connection() *grpc.ClientConn
Connection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not always return the same resource.
func (*Client) CreateCollection ¶
func (c *Client) CreateCollection(ctx context.Context, req *vectorsearchpb.CreateCollectionRequest, opts ...gax.CallOption) (*CreateCollectionOperation, error)
CreateCollection creates a new Collection in a given project and location.
Example ¶
package main
import (
"context"
vectorsearch "cloud.google.com/go/vectorsearch/apiv1beta"
vectorsearchpb "cloud.google.com/go/vectorsearch/apiv1beta/vectorsearchpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := vectorsearch.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &vectorsearchpb.CreateCollectionRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/vectorsearch/apiv1beta/vectorsearchpb#CreateCollectionRequest.
}
op, err := c.CreateCollection(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) CreateCollectionOperation ¶
func (c *Client) CreateCollectionOperation(name string) *CreateCollectionOperation
CreateCollectionOperation returns a new CreateCollectionOperation from a given name. The name must be that of a previously created CreateCollectionOperation, possibly from a different process.
func (*Client) CreateIndex ¶
func (c *Client) CreateIndex(ctx context.Context, req *vectorsearchpb.CreateIndexRequest, opts ...gax.CallOption) (*CreateIndexOperation, error)
CreateIndex creates a new Index in a given project and location.
Example ¶
package main
import (
"context"
vectorsearch "cloud.google.com/go/vectorsearch/apiv1beta"
vectorsearchpb "cloud.google.com/go/vectorsearch/apiv1beta/vectorsearchpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := vectorsearch.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &vectorsearchpb.CreateIndexRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/vectorsearch/apiv1beta/vectorsearchpb#CreateIndexRequest.
}
op, err := c.CreateIndex(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) CreateIndexOperation ¶
func (c *Client) CreateIndexOperation(name string) *CreateIndexOperation
CreateIndexOperation returns a new CreateIndexOperation from a given name. The name must be that of a previously created CreateIndexOperation, possibly from a different process.
func (*Client) DeleteCollection ¶
func (c *Client) DeleteCollection(ctx context.Context, req *vectorsearchpb.DeleteCollectionRequest, opts ...gax.CallOption) (*DeleteCollectionOperation, error)
DeleteCollection deletes a single Collection.
Example ¶
package main
import (
"context"
vectorsearch "cloud.google.com/go/vectorsearch/apiv1beta"
vectorsearchpb "cloud.google.com/go/vectorsearch/apiv1beta/vectorsearchpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := vectorsearch.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &vectorsearchpb.DeleteCollectionRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/vectorsearch/apiv1beta/vectorsearchpb#DeleteCollectionRequest.
}
op, err := c.DeleteCollection(ctx, req)
if err != nil {
// TODO: Handle error.
}
err = op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
}
func (*Client) DeleteCollectionOperation ¶
func (c *Client) DeleteCollectionOperation(name string) *DeleteCollectionOperation
DeleteCollectionOperation returns a new DeleteCollectionOperation from a given name. The name must be that of a previously created DeleteCollectionOperation, possibly from a different process.
func (*Client) DeleteIndex ¶
func (c *Client) DeleteIndex(ctx context.Context, req *vectorsearchpb.DeleteIndexRequest, opts ...gax.CallOption) (*DeleteIndexOperation, error)
DeleteIndex deletes a single Index.
Example ¶
package main
import (
"context"
vectorsearch "cloud.google.com/go/vectorsearch/apiv1beta"
vectorsearchpb "cloud.google.com/go/vectorsearch/apiv1beta/vectorsearchpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := vectorsearch.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &vectorsearchpb.DeleteIndexRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/vectorsearch/apiv1beta/vectorsearchpb#DeleteIndexRequest.
}
op, err := c.DeleteIndex(ctx, req)
if err != nil {
// TODO: Handle error.
}
err = op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
}
func (*Client) DeleteIndexOperation ¶
func (c *Client) DeleteIndexOperation(name string) *DeleteIndexOperation
DeleteIndexOperation returns a new DeleteIndexOperation from a given name. The name must be that of a previously created DeleteIndexOperation, possibly from a different process.
func (*Client) DeleteOperation ¶
func (c *Client) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error
DeleteOperation is a utility method from google.longrunning.Operations.
Example ¶
package main
import (
"context"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
vectorsearch "cloud.google.com/go/vectorsearch/apiv1beta"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := vectorsearch.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.DeleteOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#DeleteOperationRequest.
}
err = c.DeleteOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*Client) ExportDataObjects ¶ added in v0.2.0
func (c *Client) ExportDataObjects(ctx context.Context, req *vectorsearchpb.ExportDataObjectsRequest, opts ...gax.CallOption) (*ExportDataObjectsOperation, error)
ExportDataObjects initiates a Long-Running Operation to export DataObjects from a Collection.
Example ¶
package main
import (
"context"
vectorsearch "cloud.google.com/go/vectorsearch/apiv1beta"
vectorsearchpb "cloud.google.com/go/vectorsearch/apiv1beta/vectorsearchpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := vectorsearch.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &vectorsearchpb.ExportDataObjectsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/vectorsearch/apiv1beta/vectorsearchpb#ExportDataObjectsRequest.
}
op, err := c.ExportDataObjects(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) ExportDataObjectsOperation ¶ added in v0.2.0
func (c *Client) ExportDataObjectsOperation(name string) *ExportDataObjectsOperation
ExportDataObjectsOperation returns a new ExportDataObjectsOperation from a given name. The name must be that of a previously created ExportDataObjectsOperation, possibly from a different process.
func (*Client) GetCollection ¶
func (c *Client) GetCollection(ctx context.Context, req *vectorsearchpb.GetCollectionRequest, opts ...gax.CallOption) (*vectorsearchpb.Collection, error)
GetCollection gets details of a single Collection.
Example ¶
package main
import (
"context"
vectorsearch "cloud.google.com/go/vectorsearch/apiv1beta"
vectorsearchpb "cloud.google.com/go/vectorsearch/apiv1beta/vectorsearchpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := vectorsearch.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &vectorsearchpb.GetCollectionRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/vectorsearch/apiv1beta/vectorsearchpb#GetCollectionRequest.
}
resp, err := c.GetCollection(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) GetIndex ¶
func (c *Client) GetIndex(ctx context.Context, req *vectorsearchpb.GetIndexRequest, opts ...gax.CallOption) (*vectorsearchpb.Index, error)
GetIndex gets details of a single Index.
Example ¶
package main
import (
"context"
vectorsearch "cloud.google.com/go/vectorsearch/apiv1beta"
vectorsearchpb "cloud.google.com/go/vectorsearch/apiv1beta/vectorsearchpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := vectorsearch.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &vectorsearchpb.GetIndexRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/vectorsearch/apiv1beta/vectorsearchpb#GetIndexRequest.
}
resp, err := c.GetIndex(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) GetLocation ¶
func (c *Client) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error)
GetLocation gets information about a location.
Example ¶
package main
import (
"context"
vectorsearch "cloud.google.com/go/vectorsearch/apiv1beta"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := vectorsearch.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &locationpb.GetLocationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#GetLocationRequest.
}
resp, err := c.GetLocation(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) GetOperation ¶
func (c *Client) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
GetOperation is a utility method from google.longrunning.Operations.
Example ¶
package main
import (
"context"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
vectorsearch "cloud.google.com/go/vectorsearch/apiv1beta"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := vectorsearch.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.GetOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest.
}
resp, err := c.GetOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) ImportDataObjects ¶
func (c *Client) ImportDataObjects(ctx context.Context, req *vectorsearchpb.ImportDataObjectsRequest, opts ...gax.CallOption) (*ImportDataObjectsOperation, error)
ImportDataObjects initiates a Long-Running Operation to import DataObjects into a Collection.
Example ¶
package main
import (
"context"
vectorsearch "cloud.google.com/go/vectorsearch/apiv1beta"
vectorsearchpb "cloud.google.com/go/vectorsearch/apiv1beta/vectorsearchpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := vectorsearch.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &vectorsearchpb.ImportDataObjectsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/vectorsearch/apiv1beta/vectorsearchpb#ImportDataObjectsRequest.
}
op, err := c.ImportDataObjects(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) ImportDataObjectsOperation ¶
func (c *Client) ImportDataObjectsOperation(name string) *ImportDataObjectsOperation
ImportDataObjectsOperation returns a new ImportDataObjectsOperation from a given name. The name must be that of a previously created ImportDataObjectsOperation, possibly from a different process.
func (*Client) ListCollections ¶
func (c *Client) ListCollections(ctx context.Context, req *vectorsearchpb.ListCollectionsRequest, opts ...gax.CallOption) *CollectionIterator
ListCollections lists Collections in a given project and location.
Example ¶
package main
import (
"context"
vectorsearch "cloud.google.com/go/vectorsearch/apiv1beta"
vectorsearchpb "cloud.google.com/go/vectorsearch/apiv1beta/vectorsearchpb"
"google.golang.org/api/iterator"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := vectorsearch.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &vectorsearchpb.ListCollectionsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/vectorsearch/apiv1beta/vectorsearchpb#ListCollectionsRequest.
}
it := c.ListCollections(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*vectorsearchpb.ListCollectionsResponse)
}
}
Example (All) ¶
package main
import (
"context"
vectorsearch "cloud.google.com/go/vectorsearch/apiv1beta"
vectorsearchpb "cloud.google.com/go/vectorsearch/apiv1beta/vectorsearchpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := vectorsearch.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &vectorsearchpb.ListCollectionsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/vectorsearch/apiv1beta/vectorsearchpb#ListCollectionsRequest.
}
for resp, err := range c.ListCollections(ctx, req).All() {
if err != nil {
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_ = resp
}
}
func (*Client) ListIndexes ¶
func (c *Client) ListIndexes(ctx context.Context, req *vectorsearchpb.ListIndexesRequest, opts ...gax.CallOption) *IndexIterator
ListIndexes lists Indexes in a given project and location.
Example ¶
package main
import (
"context"
vectorsearch "cloud.google.com/go/vectorsearch/apiv1beta"
vectorsearchpb "cloud.google.com/go/vectorsearch/apiv1beta/vectorsearchpb"
"google.golang.org/api/iterator"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := vectorsearch.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &vectorsearchpb.ListIndexesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/vectorsearch/apiv1beta/vectorsearchpb#ListIndexesRequest.
}
it := c.ListIndexes(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*vectorsearchpb.ListIndexesResponse)
}
}
Example (All) ¶
package main
import (
"context"
vectorsearch "cloud.google.com/go/vectorsearch/apiv1beta"
vectorsearchpb "cloud.google.com/go/vectorsearch/apiv1beta/vectorsearchpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := vectorsearch.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &vectorsearchpb.ListIndexesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/vectorsearch/apiv1beta/vectorsearchpb#ListIndexesRequest.
}
for resp, err := range c.ListIndexes(ctx, req).All() {
if err != nil {
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_ = resp
}
}
func (*Client) ListLocations ¶
func (c *Client) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIterator
ListLocations lists information about the supported locations for this service. This method can be called in two ways:
List all public locations: Use the path GET /v1/locations.
List project-visible locations: Use the path
GET /v1/projects/{project_id}/locations. This may include public
locations as well as private or other locations specifically visible
to the project.
Example ¶
package main
import (
"context"
vectorsearch "cloud.google.com/go/vectorsearch/apiv1beta"
"google.golang.org/api/iterator"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := vectorsearch.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &locationpb.ListLocationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest.
}
it := c.ListLocations(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*locationpb.ListLocationsResponse)
}
}
Example (All) ¶
package main
import (
"context"
vectorsearch "cloud.google.com/go/vectorsearch/apiv1beta"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := vectorsearch.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &locationpb.ListLocationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest.
}
for resp, err := range c.ListLocations(ctx, req).All() {
if err != nil {
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_ = resp
}
}
func (*Client) ListOperations ¶
func (c *Client) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator
ListOperations is a utility method from google.longrunning.Operations.
Example ¶
package main
import (
"context"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
vectorsearch "cloud.google.com/go/vectorsearch/apiv1beta"
"google.golang.org/api/iterator"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := vectorsearch.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.ListOperationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
}
it := c.ListOperations(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*longrunningpb.ListOperationsResponse)
}
}
Example (All) ¶
package main
import (
"context"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
vectorsearch "cloud.google.com/go/vectorsearch/apiv1beta"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := vectorsearch.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.ListOperationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
}
for resp, err := range c.ListOperations(ctx, req).All() {
if err != nil {
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_ = resp
}
}
func (*Client) UpdateCollection ¶
func (c *Client) UpdateCollection(ctx context.Context, req *vectorsearchpb.UpdateCollectionRequest, opts ...gax.CallOption) (*UpdateCollectionOperation, error)
UpdateCollection updates the parameters of a single Collection.
Example ¶
package main
import (
"context"
vectorsearch "cloud.google.com/go/vectorsearch/apiv1beta"
vectorsearchpb "cloud.google.com/go/vectorsearch/apiv1beta/vectorsearchpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := vectorsearch.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &vectorsearchpb.UpdateCollectionRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/vectorsearch/apiv1beta/vectorsearchpb#UpdateCollectionRequest.
}
op, err := c.UpdateCollection(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) UpdateCollectionOperation ¶
func (c *Client) UpdateCollectionOperation(name string) *UpdateCollectionOperation
UpdateCollectionOperation returns a new UpdateCollectionOperation from a given name. The name must be that of a previously created UpdateCollectionOperation, possibly from a different process.
type CollectionIterator ¶
type CollectionIterator struct {
// Response is the raw response for the current page.
// It must be cast to the RPC response type.
// Calling Next() or InternalFetch() updates this value.
Response interface{}
// InternalFetch is for use by the Google Cloud Libraries only.
// It is not part of the stable interface of this package.
//
// InternalFetch returns results from a single call to the underlying RPC.
// The number of results is no greater than pageSize.
// If there are no more results, nextPageToken is empty and err is nil.
InternalFetch func(pageSize int, pageToken string) (results []*vectorsearchpb.Collection, nextPageToken string, err error)
// contains filtered or unexported fields
}
CollectionIterator manages a stream of *vectorsearchpb.Collection.
func (*CollectionIterator) All ¶
func (it *CollectionIterator) All() iter.Seq2[*vectorsearchpb.Collection, error]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*CollectionIterator) Next ¶
func (it *CollectionIterator) Next() (*vectorsearchpb.Collection, error)
Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.
func (*CollectionIterator) PageInfo ¶
func (it *CollectionIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type CreateCollectionOperation ¶
type CreateCollectionOperation struct {
// contains filtered or unexported fields
}
CreateCollectionOperation manages a long-running operation from CreateCollection.
func (*CreateCollectionOperation) Done ¶
func (op *CreateCollectionOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*CreateCollectionOperation) Metadata ¶
func (op *CreateCollectionOperation) Metadata() (*vectorsearchpb.OperationMetadata, error)
Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*CreateCollectionOperation) Name ¶
func (op *CreateCollectionOperation) Name() string
Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*CreateCollectionOperation) Poll ¶
func (op *CreateCollectionOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*vectorsearchpb.Collection, error)
Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*CreateCollectionOperation) Wait ¶
func (op *CreateCollectionOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*vectorsearchpb.Collection, error)
Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
type CreateIndexOperation ¶
type CreateIndexOperation struct {
// contains filtered or unexported fields
}
CreateIndexOperation manages a long-running operation from CreateIndex.
func (*CreateIndexOperation) Done ¶
func (op *CreateIndexOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*CreateIndexOperation) Metadata ¶
func (op *CreateIndexOperation) Metadata() (*vectorsearchpb.OperationMetadata, error)
Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*CreateIndexOperation) Name ¶
func (op *CreateIndexOperation) Name() string
Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*CreateIndexOperation) Poll ¶
func (op *CreateIndexOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*vectorsearchpb.Index, error)
Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*CreateIndexOperation) Wait ¶
func (op *CreateIndexOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*vectorsearchpb.Index, error)
Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
type DataObjectCallOptions ¶
type DataObjectCallOptions struct {
CreateDataObject []gax.CallOption
BatchCreateDataObjects []gax.CallOption
GetDataObject []gax.CallOption
UpdateDataObject []gax.CallOption
BatchUpdateDataObjects []gax.CallOption
DeleteDataObject []gax.CallOption
BatchDeleteDataObjects []gax.CallOption
GetLocation []gax.CallOption
ListLocations []gax.CallOption
CancelOperation []gax.CallOption
DeleteOperation []gax.CallOption
GetOperation []gax.CallOption
ListOperations []gax.CallOption
}
DataObjectCallOptions contains the retry settings for each method of DataObjectClient.
type DataObjectClient ¶
type DataObjectClient struct {
// The call options for this service.
CallOptions *DataObjectCallOptions
// contains filtered or unexported fields
}
DataObjectClient is a client for interacting with Vector Search API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
Service for creating and managing data objects.
func NewDataObjectClient ¶
func NewDataObjectClient(ctx context.Context, opts ...option.ClientOption) (*DataObjectClient, error)
NewDataObjectClient creates a new data object service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Service for creating and managing data objects.
Example ¶
package main
import (
"context"
vectorsearch "cloud.google.com/go/vectorsearch/apiv1beta"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := vectorsearch.NewDataObjectClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func NewDataObjectRESTClient ¶
func NewDataObjectRESTClient(ctx context.Context, opts ...option.ClientOption) (*DataObjectClient, error)
NewDataObjectRESTClient creates a new data object service rest client.
Service for creating and managing data objects.
Example ¶
package main
import (
"context"
vectorsearch "cloud.google.com/go/vectorsearch/apiv1beta"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := vectorsearch.NewDataObjectRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func (*DataObjectClient) BatchCreateDataObjects ¶
func (c *DataObjectClient) BatchCreateDataObjects(ctx context.Context, req *vectorsearchpb.BatchCreateDataObjectsRequest, opts ...gax.CallOption) (*vectorsearchpb.BatchCreateDataObjectsResponse, error)
BatchCreateDataObjects creates a batch of dataObjects.
Example ¶
package main
import (
"context"
vectorsearch "cloud.google.com/go/vectorsearch/apiv1beta"
vectorsearchpb "cloud.google.com/go/vectorsearch/apiv1beta/vectorsearchpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := vectorsearch.NewDataObjectClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &vectorsearchpb.BatchCreateDataObjectsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/vectorsearch/apiv1beta/vectorsearchpb#BatchCreateDataObjectsRequest.
}
resp, err := c.BatchCreateDataObjects(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*DataObjectClient) BatchDeleteDataObjects ¶
func (c *DataObjectClient) BatchDeleteDataObjects(ctx context.Context, req *vectorsearchpb.BatchDeleteDataObjectsRequest, opts ...gax.CallOption) error
BatchDeleteDataObjects deletes dataObjects in a batch.
Example ¶
package main
import (
"context"
vectorsearch "cloud.google.com/go/vectorsearch/apiv1beta"
vectorsearchpb "cloud.google.com/go/vectorsearch/apiv1beta/vectorsearchpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := vectorsearch.NewDataObjectClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &vectorsearchpb.BatchDeleteDataObjectsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/vectorsearch/apiv1beta/vectorsearchpb#BatchDeleteDataObjectsRequest.
}
err = c.BatchDeleteDataObjects(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*DataObjectClient) BatchUpdateDataObjects ¶
func (c *DataObjectClient) BatchUpdateDataObjects(ctx context.Context, req *vectorsearchpb.BatchUpdateDataObjectsRequest, opts ...gax.CallOption) (*vectorsearchpb.BatchUpdateDataObjectsResponse, error)
BatchUpdateDataObjects updates dataObjects in a batch.
Example ¶
package main
import (
"context"
vectorsearch "cloud.google.com/go/vectorsearch/apiv1beta"
vectorsearchpb "cloud.google.com/go/vectorsearch/apiv1beta/vectorsearchpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := vectorsearch.NewDataObjectClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &vectorsearchpb.BatchUpdateDataObjectsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/vectorsearch/apiv1beta/vectorsearchpb#BatchUpdateDataObjectsRequest.
}
resp, err := c.BatchUpdateDataObjects(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*DataObjectClient) CancelOperation ¶
func (c *DataObjectClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error
CancelOperation is a utility method from google.longrunning.Operations.
Example ¶
package main
import (
"context"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
vectorsearch "cloud.google.com/go/vectorsearch/apiv1beta"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := vectorsearch.NewDataObjectClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.CancelOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest.
}
err = c.CancelOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*DataObjectClient) Close ¶
func (c *DataObjectClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*DataObjectClient) Connection
deprecated
func (c *DataObjectClient) Connection() *grpc.ClientConn
Connection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not always return the same resource.
func (*DataObjectClient) CreateDataObject ¶
func (c *DataObjectClient) CreateDataObject(ctx context.Context, req *vectorsearchpb.CreateDataObjectRequest, opts ...gax.CallOption) (*vectorsearchpb.DataObject, error)
CreateDataObject creates a dataObject.
Example ¶
package main
import (
"context"
vectorsearch "cloud.google.com/go/vectorsearch/apiv1beta"
vectorsearchpb "cloud.google.com/go/vectorsearch/apiv1beta/vectorsearchpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := vectorsearch.NewDataObjectClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &vectorsearchpb.CreateDataObjectRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/vectorsearch/apiv1beta/vectorsearchpb#CreateDataObjectRequest.
}
resp, err := c.CreateDataObject(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*DataObjectClient) DeleteDataObject ¶
func (c *DataObjectClient) DeleteDataObject(ctx context.Context, req *vectorsearchpb.DeleteDataObjectRequest, opts ...gax.CallOption) error
DeleteDataObject deletes a dataObject.
Example ¶
package main
import (
"context"
vectorsearch "cloud.google.com/go/vectorsearch/apiv1beta"
vectorsearchpb "cloud.google.com/go/vectorsearch/apiv1beta/vectorsearchpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := vectorsearch.NewDataObjectClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &vectorsearchpb.DeleteDataObjectRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/vectorsearch/apiv1beta/vectorsearchpb#DeleteDataObjectRequest.
}
err = c.DeleteDataObject(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*DataObjectClient) DeleteOperation ¶
func (c *DataObjectClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error
DeleteOperation is a utility method from google.longrunning.Operations.
Example ¶
package main
import (
"context"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
vectorsearch "cloud.google.com/go/vectorsearch/apiv1beta"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := vectorsearch.NewDataObjectClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.DeleteOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#DeleteOperationRequest.
}
err = c.DeleteOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*DataObjectClient) GetDataObject ¶
func (c *DataObjectClient) GetDataObject(ctx context.Context, req *vectorsearchpb.GetDataObjectRequest, opts ...gax.CallOption) (*vectorsearchpb.DataObject, error)
GetDataObject gets a data object.
Example ¶
package main
import (
"context"
vectorsearch "cloud.google.com/go/vectorsearch/apiv1beta"
vectorsearchpb "cloud.google.com/go/vectorsearch/apiv1beta/vectorsearchpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := vectorsearch.NewDataObjectClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &vectorsearchpb.GetDataObjectRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/vectorsearch/apiv1beta/vectorsearchpb#GetDataObjectRequest.
}
resp, err := c.GetDataObject(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*DataObjectClient) GetLocation ¶
func (c *DataObjectClient) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error)
GetLocation gets information about a location.
Example ¶
package main
import (
"context"
vectorsearch "cloud.google.com/go/vectorsearch/apiv1beta"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := vectorsearch.NewDataObjectClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &locationpb.GetLocationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#GetLocationRequest.
}
resp, err := c.GetLocation(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*DataObjectClient) GetOperation ¶
func (c *DataObjectClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
GetOperation is a utility method from google.longrunning.Operations.
Example ¶
package main
import (
"context"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
vectorsearch "cloud.google.com/go/vectorsearch/apiv1beta"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := vectorsearch.NewDataObjectClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.GetOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest.
}
resp, err := c.GetOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*DataObjectClient) ListLocations ¶
func (c *DataObjectClient) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIterator
ListLocations lists information about the supported locations for this service. This method can be called in two ways:
List all public locations: Use the path GET /v1/locations.
List project-visible locations: Use the path
GET /v1/projects/{project_id}/locations. This may include public
locations as well as private or other locations specifically visible
to the project.
Example ¶
package main
import (
"context"
vectorsearch "cloud.google.com/go/vectorsearch/apiv1beta"
"google.golang.org/api/iterator"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := vectorsearch.NewDataObjectClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &locationpb.ListLocationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest.
}
it := c.ListLocations(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*locationpb.ListLocationsResponse)
}
}
Example (All) ¶
package main
import (
"context"
vectorsearch "cloud.google.com/go/vectorsearch/apiv1beta"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := vectorsearch.NewDataObjectClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &locationpb.ListLocationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest.
}
for resp, err := range c.ListLocations(ctx, req).All() {
if err != nil {
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_ = resp
}
}
func (*DataObjectClient) ListOperations ¶
func (c *DataObjectClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator
ListOperations is a utility method from google.longrunning.Operations.
Example ¶
package main
import (
"context"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
vectorsearch "cloud.google.com/go/vectorsearch/apiv1beta"
"google.golang.org/api/iterator"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := vectorsearch.NewDataObjectClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.ListOperationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
}
it := c.ListOperations(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*longrunningpb.ListOperationsResponse)
}
}
Example (All) ¶
package main
import (
"context"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
vectorsearch "cloud.google.com/go/vectorsearch/apiv1beta"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := vectorsearch.NewDataObjectClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.ListOperationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
}
for resp, err := range c.ListOperations(ctx, req).All() {
if err != nil {
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_ = resp
}
}
func (*DataObjectClient) UpdateDataObject ¶
func (c *DataObjectClient) UpdateDataObject(ctx context.Context, req *vectorsearchpb.UpdateDataObjectRequest, opts ...gax.CallOption) (*vectorsearchpb.DataObject, error)
UpdateDataObject updates a dataObject.
Example ¶
package main
import (
"context"
vectorsearch "cloud.google.com/go/vectorsearch/apiv1beta"
vectorsearchpb "cloud.google.com/go/vectorsearch/apiv1beta/vectorsearchpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := vectorsearch.NewDataObjectClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &vectorsearchpb.UpdateDataObjectRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/vectorsearch/apiv1beta/vectorsearchpb#UpdateDataObjectRequest.
}
resp, err := c.UpdateDataObject(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
type DataObjectIterator ¶
type DataObjectIterator struct {
// Response is the raw response for the current page.
// It must be cast to the RPC response type.
// Calling Next() or InternalFetch() updates this value.
Response interface{}
// InternalFetch is for use by the Google Cloud Libraries only.
// It is not part of the stable interface of this package.
//
// InternalFetch returns results from a single call to the underlying RPC.
// The number of results is no greater than pageSize.
// If there are no more results, nextPageToken is empty and err is nil.
InternalFetch func(pageSize int, pageToken string) (results []*vectorsearchpb.DataObject, nextPageToken string, err error)
// contains filtered or unexported fields
}
DataObjectIterator manages a stream of *vectorsearchpb.DataObject.
func (*DataObjectIterator) All ¶
func (it *DataObjectIterator) All() iter.Seq2[*vectorsearchpb.DataObject, error]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*DataObjectIterator) Next ¶
func (it *DataObjectIterator) Next() (*vectorsearchpb.DataObject, error)
Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.
func (*DataObjectIterator) PageInfo ¶
func (it *DataObjectIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type DataObjectSearchCallOptions ¶
type DataObjectSearchCallOptions struct {
SearchDataObjects []gax.CallOption
QueryDataObjects []gax.CallOption
AggregateDataObjects []gax.CallOption
BatchSearchDataObjects []gax.CallOption
GetLocation []gax.CallOption
ListLocations []gax.CallOption
CancelOperation []gax.CallOption
DeleteOperation []gax.CallOption
GetOperation []gax.CallOption
ListOperations []gax.CallOption
}
DataObjectSearchCallOptions contains the retry settings for each method of DataObjectSearchClient.
type DataObjectSearchClient ¶
type DataObjectSearchClient struct {
// The call options for this service.
CallOptions *DataObjectSearchCallOptions
// contains filtered or unexported fields
}
DataObjectSearchClient is a client for interacting with Vector Search API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
Service for searching data objects.
func NewDataObjectSearchClient ¶
func NewDataObjectSearchClient(ctx context.Context, opts ...option.ClientOption) (*DataObjectSearchClient, error)
NewDataObjectSearchClient creates a new data object search service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Service for searching data objects.
Example ¶
package main
import (
"context"
vectorsearch "cloud.google.com/go/vectorsearch/apiv1beta"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := vectorsearch.NewDataObjectSearchClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func NewDataObjectSearchRESTClient ¶
func NewDataObjectSearchRESTClient(ctx context.Context, opts ...option.ClientOption) (*DataObjectSearchClient, error)
NewDataObjectSearchRESTClient creates a new data object search service rest client.
Service for searching data objects.
Example ¶
package main
import (
"context"
vectorsearch "cloud.google.com/go/vectorsearch/apiv1beta"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := vectorsearch.NewDataObjectSearchRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func (*DataObjectSearchClient) AggregateDataObjects ¶
func (c *DataObjectSearchClient) AggregateDataObjects(ctx context.Context, req *vectorsearchpb.AggregateDataObjectsRequest, opts ...gax.CallOption) (*vectorsearchpb.AggregateDataObjectsResponse, error)
AggregateDataObjects aggregates data objects.
Example ¶
package main
import (
"context"
vectorsearch "cloud.google.com/go/vectorsearch/apiv1beta"
vectorsearchpb "cloud.google.com/go/vectorsearch/apiv1beta/vectorsearchpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := vectorsearch.NewDataObjectSearchClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &vectorsearchpb.AggregateDataObjectsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/vectorsearch/apiv1beta/vectorsearchpb#AggregateDataObjectsRequest.
}
resp, err := c.AggregateDataObjects(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*DataObjectSearchClient) BatchSearchDataObjects ¶
func (c *DataObjectSearchClient) BatchSearchDataObjects(ctx context.Context, req *vectorsearchpb.BatchSearchDataObjectsRequest, opts ...gax.CallOption) (*vectorsearchpb.BatchSearchDataObjectsResponse, error)
BatchSearchDataObjects batch searches data objects.
Example ¶
package main
import (
"context"
vectorsearch "cloud.google.com/go/vectorsearch/apiv1beta"
vectorsearchpb "cloud.google.com/go/vectorsearch/apiv1beta/vectorsearchpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := vectorsearch.NewDataObjectSearchClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &vectorsearchpb.BatchSearchDataObjectsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/vectorsearch/apiv1beta/vectorsearchpb#BatchSearchDataObjectsRequest.
}
resp, err := c.BatchSearchDataObjects(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*DataObjectSearchClient) CancelOperation ¶
func (c *DataObjectSearchClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error
CancelOperation is a utility method from google.longrunning.Operations.
Example ¶
package main
import (
"context"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
vectorsearch "cloud.google.com/go/vectorsearch/apiv1beta"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := vectorsearch.NewDataObjectSearchClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.CancelOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest.
}
err = c.CancelOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*DataObjectSearchClient) Close ¶
func (c *DataObjectSearchClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*DataObjectSearchClient) Connection
deprecated
func (c *DataObjectSearchClient) Connection() *grpc.ClientConn
Connection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not always return the same resource.
func (*DataObjectSearchClient) DeleteOperation ¶
func (c *DataObjectSearchClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error
DeleteOperation is a utility method from google.longrunning.Operations.
Example ¶
package main
import (
"context"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
vectorsearch "cloud.google.com/go/vectorsearch/apiv1beta"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := vectorsearch.NewDataObjectSearchClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.DeleteOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#DeleteOperationRequest.
}
err = c.DeleteOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*DataObjectSearchClient) GetLocation ¶
func (c *DataObjectSearchClient) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error)
GetLocation gets information about a location.
Example ¶
package main
import (
"context"
vectorsearch "cloud.google.com/go/vectorsearch/apiv1beta"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := vectorsearch.NewDataObjectSearchClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &locationpb.GetLocationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#GetLocationRequest.
}
resp, err := c.GetLocation(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*DataObjectSearchClient) GetOperation ¶
func (c *DataObjectSearchClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
GetOperation is a utility method from google.longrunning.Operations.
Example ¶
package main
import (
"context"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
vectorsearch "cloud.google.com/go/vectorsearch/apiv1beta"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := vectorsearch.NewDataObjectSearchClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.GetOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest.
}
resp, err := c.GetOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*DataObjectSearchClient) ListLocations ¶
func (c *DataObjectSearchClient) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIterator
ListLocations lists information about the supported locations for this service. This method can be called in two ways:
List all public locations: Use the path GET /v1/locations.
List project-visible locations: Use the path
GET /v1/projects/{project_id}/locations. This may include public
locations as well as private or other locations specifically visible
to the project.
Example ¶
package main
import (
"context"
vectorsearch "cloud.google.com/go/vectorsearch/apiv1beta"
"google.golang.org/api/iterator"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := vectorsearch.NewDataObjectSearchClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &locationpb.ListLocationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest.
}
it := c.ListLocations(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*locationpb.ListLocationsResponse)
}
}
Example (All) ¶
package main
import (
"context"
vectorsearch "cloud.google.com/go/vectorsearch/apiv1beta"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := vectorsearch.NewDataObjectSearchClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &locationpb.ListLocationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest.
}
for resp, err := range c.ListLocations(ctx, req).All() {
if err != nil {
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_ = resp
}
}
func (*DataObjectSearchClient) ListOperations ¶
func (c *DataObjectSearchClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator
ListOperations is a utility method from google.longrunning.Operations.
Example ¶
package main
import (
"context"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
vectorsearch "cloud.google.com/go/vectorsearch/apiv1beta"
"google.golang.org/api/iterator"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := vectorsearch.NewDataObjectSearchClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.ListOperationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
}
it := c.ListOperations(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*longrunningpb.ListOperationsResponse)
}
}
Example (All) ¶
package main
import (
"context"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
vectorsearch "cloud.google.com/go/vectorsearch/apiv1beta"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := vectorsearch.NewDataObjectSearchClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.ListOperationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
}
for resp, err := range c.ListOperations(ctx, req).All() {
if err != nil {
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_ = resp
}
}
func (*DataObjectSearchClient) QueryDataObjects ¶
func (c *DataObjectSearchClient) QueryDataObjects(ctx context.Context, req *vectorsearchpb.QueryDataObjectsRequest, opts ...gax.CallOption) *DataObjectIterator
QueryDataObjects queries data objects.
Example ¶
package main
import (
"context"
vectorsearch "cloud.google.com/go/vectorsearch/apiv1beta"
vectorsearchpb "cloud.google.com/go/vectorsearch/apiv1beta/vectorsearchpb"
"google.golang.org/api/iterator"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := vectorsearch.NewDataObjectSearchClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &vectorsearchpb.QueryDataObjectsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/vectorsearch/apiv1beta/vectorsearchpb#QueryDataObjectsRequest.
}
it := c.QueryDataObjects(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*vectorsearchpb.QueryDataObjectsResponse)
}
}
Example (All) ¶
package main
import (
"context"
vectorsearch "cloud.google.com/go/vectorsearch/apiv1beta"
vectorsearchpb "cloud.google.com/go/vectorsearch/apiv1beta/vectorsearchpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := vectorsearch.NewDataObjectSearchClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &vectorsearchpb.QueryDataObjectsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/vectorsearch/apiv1beta/vectorsearchpb#QueryDataObjectsRequest.
}
for resp, err := range c.QueryDataObjects(ctx, req).All() {
if err != nil {
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_ = resp
}
}
func (*DataObjectSearchClient) SearchDataObjects ¶
func (c *DataObjectSearchClient) SearchDataObjects(ctx context.Context, req *vectorsearchpb.SearchDataObjectsRequest, opts ...gax.CallOption) *SearchResultIterator
SearchDataObjects searches data objects.
Example ¶
package main
import (
"context"
vectorsearch "cloud.google.com/go/vectorsearch/apiv1beta"
vectorsearchpb "cloud.google.com/go/vectorsearch/apiv1beta/vectorsearchpb"
"google.golang.org/api/iterator"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := vectorsearch.NewDataObjectSearchClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &vectorsearchpb.SearchDataObjectsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/vectorsearch/apiv1beta/vectorsearchpb#SearchDataObjectsRequest.
}
it := c.SearchDataObjects(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*vectorsearchpb.SearchDataObjectsResponse)
}
}
Example (All) ¶
package main
import (
"context"
vectorsearch "cloud.google.com/go/vectorsearch/apiv1beta"
vectorsearchpb "cloud.google.com/go/vectorsearch/apiv1beta/vectorsearchpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := vectorsearch.NewDataObjectSearchClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &vectorsearchpb.SearchDataObjectsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/vectorsearch/apiv1beta/vectorsearchpb#SearchDataObjectsRequest.
}
for resp, err := range c.SearchDataObjects(ctx, req).All() {
if err != nil {
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_ = resp
}
}
type DeleteCollectionOperation ¶
type DeleteCollectionOperation struct {
// contains filtered or unexported fields
}
DeleteCollectionOperation manages a long-running operation from DeleteCollection.
func (*DeleteCollectionOperation) Done ¶
func (op *DeleteCollectionOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*DeleteCollectionOperation) Metadata ¶
func (op *DeleteCollectionOperation) Metadata() (*vectorsearchpb.OperationMetadata, error)
Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*DeleteCollectionOperation) Name ¶
func (op *DeleteCollectionOperation) Name() string
Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*DeleteCollectionOperation) Poll ¶
func (op *DeleteCollectionOperation) Poll(ctx context.Context, opts ...gax.CallOption) error
Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*DeleteCollectionOperation) Wait ¶
func (op *DeleteCollectionOperation) Wait(ctx context.Context, opts ...gax.CallOption) error
Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
type DeleteIndexOperation ¶
type DeleteIndexOperation struct {
// contains filtered or unexported fields
}
DeleteIndexOperation manages a long-running operation from DeleteIndex.
func (*DeleteIndexOperation) Done ¶
func (op *DeleteIndexOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*DeleteIndexOperation) Metadata ¶
func (op *DeleteIndexOperation) Metadata() (*vectorsearchpb.OperationMetadata, error)
Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*DeleteIndexOperation) Name ¶
func (op *DeleteIndexOperation) Name() string
Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*DeleteIndexOperation) Poll ¶
func (op *DeleteIndexOperation) Poll(ctx context.Context, opts ...gax.CallOption) error
Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*DeleteIndexOperation) Wait ¶
func (op *DeleteIndexOperation) Wait(ctx context.Context, opts ...gax.CallOption) error
Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
type ExportDataObjectsOperation ¶ added in v0.2.0
type ExportDataObjectsOperation struct {
// contains filtered or unexported fields
}
ExportDataObjectsOperation manages a long-running operation from ExportDataObjects.
func (*ExportDataObjectsOperation) Done ¶ added in v0.2.0
func (op *ExportDataObjectsOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*ExportDataObjectsOperation) Metadata ¶ added in v0.2.0
func (op *ExportDataObjectsOperation) Metadata() (*vectorsearchpb.ExportDataObjectsMetadata, error)
Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*ExportDataObjectsOperation) Name ¶ added in v0.2.0
func (op *ExportDataObjectsOperation) Name() string
Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*ExportDataObjectsOperation) Poll ¶ added in v0.2.0
func (op *ExportDataObjectsOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*vectorsearchpb.ExportDataObjectsResponse, error)
Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*ExportDataObjectsOperation) Wait ¶ added in v0.2.0
func (op *ExportDataObjectsOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*vectorsearchpb.ExportDataObjectsResponse, error)
Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
type ImportDataObjectsOperation ¶
type ImportDataObjectsOperation struct {
// contains filtered or unexported fields
}
ImportDataObjectsOperation manages a long-running operation from ImportDataObjects.
func (*ImportDataObjectsOperation) Done ¶
func (op *ImportDataObjectsOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*ImportDataObjectsOperation) Metadata ¶
func (op *ImportDataObjectsOperation) Metadata() (*vectorsearchpb.ImportDataObjectsMetadata, error)
Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*ImportDataObjectsOperation) Name ¶
func (op *ImportDataObjectsOperation) Name() string
Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*ImportDataObjectsOperation) Poll ¶
func (op *ImportDataObjectsOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*vectorsearchpb.ImportDataObjectsResponse, error)
Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*ImportDataObjectsOperation) Wait ¶
func (op *ImportDataObjectsOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*vectorsearchpb.ImportDataObjectsResponse, error)
Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
type IndexIterator ¶
type IndexIterator struct {
// Response is the raw response for the current page.
// It must be cast to the RPC response type.
// Calling Next() or InternalFetch() updates this value.
Response interface{}
// InternalFetch is for use by the Google Cloud Libraries only.
// It is not part of the stable interface of this package.
//
// InternalFetch returns results from a single call to the underlying RPC.
// The number of results is no greater than pageSize.
// If there are no more results, nextPageToken is empty and err is nil.
InternalFetch func(pageSize int, pageToken string) (results []*vectorsearchpb.Index, nextPageToken string, err error)
// contains filtered or unexported fields
}
IndexIterator manages a stream of *vectorsearchpb.Index.
func (*IndexIterator) All ¶
func (it *IndexIterator) All() iter.Seq2[*vectorsearchpb.Index, error]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*IndexIterator) Next ¶
func (it *IndexIterator) Next() (*vectorsearchpb.Index, error)
Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.
func (*IndexIterator) PageInfo ¶
func (it *IndexIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type LocationIterator ¶
type LocationIterator struct {
// Response is the raw response for the current page.
// It must be cast to the RPC response type.
// Calling Next() or InternalFetch() updates this value.
Response interface{}
// InternalFetch is for use by the Google Cloud Libraries only.
// It is not part of the stable interface of this package.
//
// InternalFetch returns results from a single call to the underlying RPC.
// The number of results is no greater than pageSize.
// If there are no more results, nextPageToken is empty and err is nil.
InternalFetch func(pageSize int, pageToken string) (results []*locationpb.Location, nextPageToken string, err error)
// contains filtered or unexported fields
}
LocationIterator manages a stream of *locationpb.Location.
func (*LocationIterator) All ¶
func (it *LocationIterator) All() iter.Seq2[*locationpb.Location, error]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*LocationIterator) Next ¶
func (it *LocationIterator) Next() (*locationpb.Location, error)
Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.
func (*LocationIterator) PageInfo ¶
func (it *LocationIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type OperationIterator ¶
type OperationIterator struct {
// Response is the raw response for the current page.
// It must be cast to the RPC response type.
// Calling Next() or InternalFetch() updates this value.
Response interface{}
// InternalFetch is for use by the Google Cloud Libraries only.
// It is not part of the stable interface of this package.
//
// InternalFetch returns results from a single call to the underlying RPC.
// The number of results is no greater than pageSize.
// If there are no more results, nextPageToken is empty and err is nil.
InternalFetch func(pageSize int, pageToken string) (results []*longrunningpb.Operation, nextPageToken string, err error)
// contains filtered or unexported fields
}
OperationIterator manages a stream of *longrunningpb.Operation.
func (*OperationIterator) All ¶
func (it *OperationIterator) All() iter.Seq2[*longrunningpb.Operation, error]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*OperationIterator) Next ¶
func (it *OperationIterator) Next() (*longrunningpb.Operation, error)
Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.
func (*OperationIterator) PageInfo ¶
func (it *OperationIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type SearchResultIterator ¶
type SearchResultIterator struct {
// Response is the raw response for the current page.
// It must be cast to the RPC response type.
// Calling Next() or InternalFetch() updates this value.
Response interface{}
// InternalFetch is for use by the Google Cloud Libraries only.
// It is not part of the stable interface of this package.
//
// InternalFetch returns results from a single call to the underlying RPC.
// The number of results is no greater than pageSize.
// If there are no more results, nextPageToken is empty and err is nil.
InternalFetch func(pageSize int, pageToken string) (results []*vectorsearchpb.SearchResult, nextPageToken string, err error)
// contains filtered or unexported fields
}
SearchResultIterator manages a stream of *vectorsearchpb.SearchResult.
func (*SearchResultIterator) All ¶
func (it *SearchResultIterator) All() iter.Seq2[*vectorsearchpb.SearchResult, error]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*SearchResultIterator) Next ¶
func (it *SearchResultIterator) Next() (*vectorsearchpb.SearchResult, error)
Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.
func (*SearchResultIterator) PageInfo ¶
func (it *SearchResultIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type UpdateCollectionOperation ¶
type UpdateCollectionOperation struct {
// contains filtered or unexported fields
}
UpdateCollectionOperation manages a long-running operation from UpdateCollection.
func (*UpdateCollectionOperation) Done ¶
func (op *UpdateCollectionOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*UpdateCollectionOperation) Metadata ¶
func (op *UpdateCollectionOperation) Metadata() (*vectorsearchpb.OperationMetadata, error)
Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*UpdateCollectionOperation) Name ¶
func (op *UpdateCollectionOperation) Name() string
Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*UpdateCollectionOperation) Poll ¶
func (op *UpdateCollectionOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*vectorsearchpb.Collection, error)
Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*UpdateCollectionOperation) Wait ¶
func (op *UpdateCollectionOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*vectorsearchpb.Collection, error)
Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.