package tables

import "cloud.google.com/go/area120/tables/apiv1alpha1"

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

Examples

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

func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error)

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

Code:play 

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
}

func (*Client) BatchCreateRows

BatchCreateRows creates multiple rows.

Example

Code:play 

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
}

func (*Client) BatchUpdateRows

BatchUpdateRows updates multiple rows.

Example

Code:play 

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
}

func (*Client) Close

func (c *Client) Close() error

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

Code:play 

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
}

func (*Client) DeleteRow

func (c *Client) DeleteRow(ctx context.Context, req *tablespb.DeleteRowRequest, opts ...gax.CallOption) error

DeleteRow deletes a row.

Example

Code:play 

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.
	}
}

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

Code:play 

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
}

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

Code:play 

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
}

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

Code:play 

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
	}
}

func (*Client) ListTables

func (c *Client) ListTables(ctx context.Context, req *tablespb.ListTablesRequest, opts ...gax.CallOption) *TableIterator

ListTables lists tables for the user.

Example

Code:play 

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
	}
}

func (*Client) UpdateRow

func (c *Client) UpdateRow(ctx context.Context, req *tablespb.UpdateRowRequest, opts ...gax.CallOption) (*tablespb.Row, error)

UpdateRow updates a row.

Example

Code:play 

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
}

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.

Source Files

doc.go tables_client.go

Version
v0.73.0
Published
Dec 4, 2020
Platform
darwin/amd64
Imports
19 packages
Last checked
1 hour ago

Tools for package owners.