Documentation ¶
Overview ¶
NOTE: This package is in alpha. It is not stable, and is likely to change.
Use of Context ¶
The ctx passed to NewClient 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.
For information about setting deadlines, reusing contexts, and more please visit pkg.go.dev/cloud.google.com/go.
Index ¶
- func DefaultAuthScopes() []string
- type CallOptions
- type Client
- func (c *Client) BatchCreateRows(ctx context.Context, req *tablespb.BatchCreateRowsRequest, ...) (*tablespb.BatchCreateRowsResponse, error)
- func (c *Client) BatchUpdateRows(ctx context.Context, req *tablespb.BatchUpdateRowsRequest, ...) (*tablespb.BatchUpdateRowsResponse, error)
- func (c *Client) Close() error
- func (c *Client) Connection() *grpc.ClientConn
- func (c *Client) CreateRow(ctx context.Context, req *tablespb.CreateRowRequest, opts ...gax.CallOption) (*tablespb.Row, error)
- func (c *Client) DeleteRow(ctx context.Context, req *tablespb.DeleteRowRequest, opts ...gax.CallOption) error
- func (c *Client) GetRow(ctx context.Context, req *tablespb.GetRowRequest, opts ...gax.CallOption) (*tablespb.Row, error)
- func (c *Client) GetTable(ctx context.Context, req *tablespb.GetTableRequest, opts ...gax.CallOption) (*tablespb.Table, error)
- func (c *Client) ListRows(ctx context.Context, req *tablespb.ListRowsRequest, opts ...gax.CallOption) *RowIterator
- func (c *Client) ListTables(ctx context.Context, req *tablespb.ListTablesRequest, opts ...gax.CallOption) *TableIterator
- func (c *Client) UpdateRow(ctx context.Context, req *tablespb.UpdateRowRequest, opts ...gax.CallOption) (*tablespb.Row, error)
- type RowIterator
- type TableIterator
Examples ¶
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 { GetTable []gax.CallOption ListTables []gax.CallOption GetRow []gax.CallOption ListRows []gax.CallOption CreateRow []gax.CallOption BatchCreateRows []gax.CallOption UpdateRow []gax.CallOption BatchUpdateRows []gax.CallOption DeleteRow []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 // contains filtered or unexported fields }
Client is a client for interacting with .
Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
func NewClient ¶
NewClient creates a new tables service client.
The Tables Service provides an API for reading and updating tables. It defines the following resource model:
The API has a collection of [Table][google.area120.tables.v1alpha1.Table] resources, named tables/* Each Table has a collection of [Row][google.area120.tables.v1alpha1.Row] resources, named tables/*/rows/*
Example ¶
package main import ( "context" tables "cloud.google.com/go/area120/tables/apiv1alpha1" ) func main() { ctx := context.Background() c, err := tables.NewClient(ctx) if err != nil { // TODO: Handle error. } // TODO: Use client. _ = c }
Output:
func (*Client) BatchCreateRows ¶
func (c *Client) BatchCreateRows(ctx context.Context, req *tablespb.BatchCreateRowsRequest, opts ...gax.CallOption) (*tablespb.BatchCreateRowsResponse, error)
BatchCreateRows creates multiple rows.
Example ¶
package main import ( "context" tables "cloud.google.com/go/area120/tables/apiv1alpha1" tablespb "google.golang.org/genproto/googleapis/area120/tables/v1alpha1" ) func main() { // import tablespb "google.golang.org/genproto/googleapis/area120/tables/v1alpha1" ctx := context.Background() c, err := tables.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &tablespb.BatchCreateRowsRequest{ // TODO: Fill request struct fields. } resp, err := c.BatchCreateRows(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*Client) BatchUpdateRows ¶
func (c *Client) BatchUpdateRows(ctx context.Context, req *tablespb.BatchUpdateRowsRequest, opts ...gax.CallOption) (*tablespb.BatchUpdateRowsResponse, error)
BatchUpdateRows updates multiple rows.
Example ¶
package main import ( "context" tables "cloud.google.com/go/area120/tables/apiv1alpha1" tablespb "google.golang.org/genproto/googleapis/area120/tables/v1alpha1" ) func main() { // import tablespb "google.golang.org/genproto/googleapis/area120/tables/v1alpha1" ctx := context.Background() c, err := tables.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &tablespb.BatchUpdateRowsRequest{ // TODO: Fill request struct fields. } resp, err := c.BatchUpdateRows(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
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 ¶
func (c *Client) Connection() *grpc.ClientConn
Connection returns a connection to the API service.
Deprecated.
func (*Client) CreateRow ¶
func (c *Client) CreateRow(ctx context.Context, req *tablespb.CreateRowRequest, opts ...gax.CallOption) (*tablespb.Row, error)
CreateRow creates a row.
Example ¶
package main import ( "context" tables "cloud.google.com/go/area120/tables/apiv1alpha1" tablespb "google.golang.org/genproto/googleapis/area120/tables/v1alpha1" ) func main() { // import tablespb "google.golang.org/genproto/googleapis/area120/tables/v1alpha1" ctx := context.Background() c, err := tables.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &tablespb.CreateRowRequest{ // TODO: Fill request struct fields. } resp, err := c.CreateRow(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*Client) DeleteRow ¶
func (c *Client) DeleteRow(ctx context.Context, req *tablespb.DeleteRowRequest, opts ...gax.CallOption) error
DeleteRow deletes a row.
Example ¶
package main import ( "context" tables "cloud.google.com/go/area120/tables/apiv1alpha1" tablespb "google.golang.org/genproto/googleapis/area120/tables/v1alpha1" ) func main() { ctx := context.Background() c, err := tables.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &tablespb.DeleteRowRequest{ // TODO: Fill request struct fields. } err = c.DeleteRow(ctx, req) if err != nil { // TODO: Handle error. } }
Output:
func (*Client) GetRow ¶
func (c *Client) GetRow(ctx context.Context, req *tablespb.GetRowRequest, opts ...gax.CallOption) (*tablespb.Row, error)
GetRow gets a row. Returns NOT_FOUND if the row does not exist in the table.
Example ¶
package main import ( "context" tables "cloud.google.com/go/area120/tables/apiv1alpha1" tablespb "google.golang.org/genproto/googleapis/area120/tables/v1alpha1" ) func main() { // import tablespb "google.golang.org/genproto/googleapis/area120/tables/v1alpha1" ctx := context.Background() c, err := tables.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &tablespb.GetRowRequest{ // TODO: Fill request struct fields. } resp, err := c.GetRow(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*Client) GetTable ¶
func (c *Client) GetTable(ctx context.Context, req *tablespb.GetTableRequest, opts ...gax.CallOption) (*tablespb.Table, error)
GetTable gets a table. Returns NOT_FOUND if the table does not exist.
Example ¶
package main import ( "context" tables "cloud.google.com/go/area120/tables/apiv1alpha1" tablespb "google.golang.org/genproto/googleapis/area120/tables/v1alpha1" ) func main() { // import tablespb "google.golang.org/genproto/googleapis/area120/tables/v1alpha1" ctx := context.Background() c, err := tables.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &tablespb.GetTableRequest{ // TODO: Fill request struct fields. } resp, err := c.GetTable(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*Client) ListRows ¶
func (c *Client) ListRows(ctx context.Context, req *tablespb.ListRowsRequest, opts ...gax.CallOption) *RowIterator
ListRows lists rows in a table. Returns NOT_FOUND if the table does not exist.
Example ¶
package main import ( "context" tables "cloud.google.com/go/area120/tables/apiv1alpha1" "google.golang.org/api/iterator" tablespb "google.golang.org/genproto/googleapis/area120/tables/v1alpha1" ) func main() { // import tablespb "google.golang.org/genproto/googleapis/area120/tables/v1alpha1" // import "google.golang.org/api/iterator" ctx := context.Background() c, err := tables.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &tablespb.ListRowsRequest{ // TODO: Fill request struct fields. } it := c.ListRows(ctx, req) for { resp, err := it.Next() if err == iterator.Done { break } if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } }
Output:
func (*Client) ListTables ¶
func (c *Client) ListTables(ctx context.Context, req *tablespb.ListTablesRequest, opts ...gax.CallOption) *TableIterator
ListTables lists tables for the user.
Example ¶
package main import ( "context" tables "cloud.google.com/go/area120/tables/apiv1alpha1" "google.golang.org/api/iterator" tablespb "google.golang.org/genproto/googleapis/area120/tables/v1alpha1" ) func main() { // import tablespb "google.golang.org/genproto/googleapis/area120/tables/v1alpha1" // import "google.golang.org/api/iterator" ctx := context.Background() c, err := tables.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &tablespb.ListTablesRequest{ // TODO: Fill request struct fields. } it := c.ListTables(ctx, req) for { resp, err := it.Next() if err == iterator.Done { break } if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } }
Output:
func (*Client) UpdateRow ¶
func (c *Client) UpdateRow(ctx context.Context, req *tablespb.UpdateRowRequest, opts ...gax.CallOption) (*tablespb.Row, error)
UpdateRow updates a row.
Example ¶
package main import ( "context" tables "cloud.google.com/go/area120/tables/apiv1alpha1" tablespb "google.golang.org/genproto/googleapis/area120/tables/v1alpha1" ) func main() { // import tablespb "google.golang.org/genproto/googleapis/area120/tables/v1alpha1" ctx := context.Background() c, err := tables.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &tablespb.UpdateRowRequest{ // TODO: Fill request struct fields. } resp, err := c.UpdateRow(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
type RowIterator ¶
type RowIterator 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 []*tablespb.Row, nextPageToken string, err error) // contains filtered or unexported fields }
RowIterator manages a stream of *tablespb.Row.
func (*RowIterator) Next ¶
func (it *RowIterator) Next() (*tablespb.Row, 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 (*RowIterator) PageInfo ¶
func (it *RowIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type TableIterator ¶
type TableIterator 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 []*tablespb.Table, nextPageToken string, err error) // contains filtered or unexported fields }
TableIterator manages a stream of *tablespb.Table.
func (*TableIterator) Next ¶
func (it *TableIterator) Next() (*tablespb.Table, 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 (*TableIterator) PageInfo ¶
func (it *TableIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.