package discovery
import "github.com/ydb-platform/ydb-go-sdk/v3/discovery"
Example (DiscoverCluster)¶
Code:
{
ctx := context.TODO()
db, err := ydb.Open(ctx, "grpc://localhost:2136/local")
if err != nil {
fmt.Printf("failed to connect: %v", err)
return
}
defer db.Close(ctx) // cleanup resources
endpoints, err := db.Discovery().Discover(ctx)
if err != nil {
fmt.Printf("discover failed: %v", err)
return
}
fmt.Printf("%s endpoints:\n", db.Name())
for i, e := range endpoints {
fmt.Printf("%d) %s\n", i, e.String())
}
}
Example (WhoAmI)¶
Code:
{
ctx := context.TODO()
db, err := ydb.Open(ctx, "grpc://localhost:2136/local")
if err != nil {
fmt.Printf("failed to connect: %v", err)
return
}
defer db.Close(ctx) // cleanup resources
whoAmI, err := db.Discovery().WhoAmI(ctx)
if err != nil {
fmt.Printf("discover failed: %v", err)
return
}
fmt.Printf("%s whoAmI: %s\n", db.Name(), whoAmI.String())
}
Index ¶
Examples ¶
Types ¶
type Client ¶
type Client interface { Discover(ctx context.Context) ([]endpoint.Endpoint, error) WhoAmI(ctx context.Context) (*WhoAmI, error) }
type WhoAmI ¶
func (WhoAmI) String ¶
Source Files ¶
- Version
- v3.57.2
- Published
- Mar 12, 2024
- Platform
- js/wasm
- Imports
- 4 packages
- Last checked
- 21 seconds ago –
Tools for package owners.