github.com/ydb-platform/ydb-go-sdk/v3@v3.89.2/operation/example_test.go (about) 1 package operation_test 2 3 import ( 4 "context" 5 "fmt" 6 7 "github.com/ydb-platform/ydb-go-sdk/v3" 8 ) 9 10 func Example_listOperations() { 11 ctx := context.TODO() 12 db, err := ydb.Open(ctx, "grpc://localhost:2136/local") 13 if err != nil { 14 panic(err) 15 } 16 defer db.Close(ctx) // cleanup resources 17 operations, err := db.Operation().ListBuildIndex(ctx) 18 if err != nil { 19 panic(err) 20 } 21 fmt.Printf("operations:\n") 22 for _, op := range operations.Operations { 23 fmt.Printf(" - %+v\n", op) 24 } 25 }