Skip to content

Commit

Permalink
Readme formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
radekg committed Jan 12, 2022
1 parent ad66b98 commit d88821a
Showing 1 changed file with 13 additions and 17 deletions.
30 changes: 13 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# YugabyteDB client for go

Work in progress. Current state: this can definitely work.
Work in progress. Current state: it does what it says it does.

## Go client

Expand All @@ -15,10 +15,10 @@ import (
"time"

"github.com/hashicorp/go-hclog"

"github.com/radekg/yugabyte-db-go-client/client"
"github.com/radekg/yugabyte-db-go-client/configs"
"github.com/radekg/yugabyte-db-go-client/errors"
"github.com/radekg/yugabyte-db-go-client/configs"
"github.com/radekg/yugabyte-db-go-client/errors"

ybApi "github.com/radekg/yugabyte-db-go-proto/v2/yb/api"
)
Expand All @@ -27,31 +27,27 @@ func main() {

// construct the configuration:
cfg := &configs.YBClientConfig{
MasterHostPort: []string{"127.0.0.1:7100", "127.0.0.1:17000", "127.0.0.1:27000"},
OpTimeout: time.Duration(time.Second * 5),
}
MasterHostPort: []string{"127.0.0.1:7100", "127.0.0.1:17000", "127.0.0.1:27000"},
OpTimeout: time.Duration(time.Second * 5),
}

customLogger := hclog.Default()

client := client.NewYBClient(cfg).
WithLogger(customLogger.Named("custom-client-logger"))

if err := client.Connect(); err != nil {
panic(err)
}

if err != nil {
panic(err)
}
}

request := &ybApi.ListMastersRequestPB{}
response := &ybApi.ListMastersResponsePB{}
err := client.Execute(request, response)
if err != nil {
response := &ybApi.ListMastersResponsePB{}
err := client.Execute(request, response)
if err != nil {
client.Close()
logger.Error("failed executing the request", "reason", err)
panic(err)
}
panic(err)
}

// some of the payloads provide their own error responses,
// handle it like this:
Expand Down

0 comments on commit d88821a

Please sign in to comment.