package operation
import "github.com/ydb-platform/ydb-go-sdk/v3/operation"
Example (ListOperations)¶
Code:
{
ctx := context.TODO()
db, err := ydb.Open(ctx, "grpc://localhost:2136/local")
if err != nil {
panic(err)
}
defer db.Close(ctx) // cleanup resources
var nextToken string
for i := 0; ; i++ {
operations, err := db.Operation().List(ctx, operation.KindScriptExec,
operation.WithPageSize(10),
operation.WithPageToken(nextToken),
)
if err != nil {
panic(err)
}
nextToken = operations.NextToken
fmt.Printf("page#%d. operations:\n", i)
for _, op := range operations.Operations {
fmt.Println(" -", op)
}
if len(operations.Operations) == 0 || nextToken == "" {
break
}
}
}
Index ¶
- Constants
- func WithPageSize(pageSize uint64) options.List
- func WithPageToken(pageToken string) options.List
- type Client
- func New(ctx context.Context, balancer grpc.ClientConnInterface) *Client
- func (c *Client) Cancel(ctx context.Context, opID string) error
- func (c *Client) Close(ctx context.Context) error
- func (c *Client) Forget(ctx context.Context, opID string) error
- func (c *Client) Get(ctx context.Context, opID string) (*Operation, error)
- func (c *Client) List(ctx context.Context, kind kind, opts ...options.List) (*ListOperations, error)
- type ListOperations
- type Operation
Examples ¶
Constants ¶
const ( KindScriptExec = kind("scriptexec") KindBuildIndex = kind("buildindex") KindImportS3 = kind("import/s3") KindExportS3 = kind("export/s3") KindExportYT = kind("export/yt") )
Functions ¶
func WithPageSize ¶
func WithPageToken ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is an operation service client for manage long operations in YDB
Experimental: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#experimental
func New ¶
func New(ctx context.Context, balancer grpc.ClientConnInterface) *Client
func (*Client) Cancel ¶
Cancel starts cancellation of a long-running operation.
Experimental: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#experimental
func (*Client) Close ¶
func (*Client) Forget ¶
Forget forgets long-running operation. It does not cancel the operation and returns an error if operation was not completed.
Experimental: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#experimental
func (*Client) Get ¶
Get returns operation status by ID
Experimental: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#experimental
func (*Client) List ¶
func (c *Client) List(ctx context.Context, kind kind, opts ...options.List) (*ListOperations, error)
List returns list of operations that match the specified filter in the request.
Experimental: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#experimental
type ListOperations ¶
type Operation ¶
Operation describes operation
Experimental: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#experimental
Source Files ¶
- Version
- v3.77.0-rc2
- Published
- Aug 20, 2024
- Platform
- js/wasm
- Imports
- 10 packages
- Last checked
- 13 minutes ago –
Tools for package owners.