Skip to content

Commit 6d8d003

Browse files
committed
added type operation.kind for operation.Client.List method
1 parent 3ebc717 commit 6d8d003

File tree

4 files changed

+15
-4
lines changed

4 files changed

+15
-4
lines changed

operation/client.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,10 @@ func list(
123123
// List returns list of operations that match the specified filter in the request.
124124
//
125125
// Experimental: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#experimental
126-
func (c *Client) List(ctx context.Context, kind string, opts ...options.List) (*ListOperations, error) {
126+
func (c *Client) List(ctx context.Context, kind kind, opts ...options.List) (*ListOperations, error) {
127127
request := &options.ListOperationsRequest{
128128
ListOperationsRequest: Ydb_Operations.ListOperationsRequest{
129-
Kind: kind,
129+
Kind: string(kind),
130130
},
131131
}
132132
for _, opt := range opts {

operation/example_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ func Example_listOperations() {
1717
defer db.Close(ctx) // cleanup resources
1818
var nextToken string
1919
for i := 0; ; i++ {
20-
operations, err := db.Operation().List(ctx, "buildindex",
20+
operations, err := db.Operation().List(ctx, operation.KindScriptExec,
2121
operation.WithPageSize(10),
2222
operation.WithPageToken(nextToken),
2323
)

operation/kind.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package operation
2+
3+
type kind string
4+
5+
const (
6+
KindScriptExec = kind("scriptexec")
7+
KindBuildIndex = kind("buildindex")
8+
KindImportS3 = kind("import/s3")
9+
KindExportS3 = kind("export/s3")
10+
KindExportYT = kind("export/yt")
11+
)

tests/integration/operation_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ func TestOperationList(t *testing.T) {
3939

4040
var nextToken string
4141
for {
42-
operations, err := db.Operation().List(ctx, "buildindex",
42+
operations, err := db.Operation().List(ctx, operation.KindBuildIndex,
4343
operation.WithPageSize(10),
4444
operation.WithPageToken(nextToken),
4545
)

0 commit comments

Comments
 (0)