Skip to content

Commit

Permalink
Update README for recent changes
Browse files Browse the repository at this point in the history
  • Loading branch information
rmoff committed Oct 8, 2020
1 parent 6b26fb2 commit 636025b
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ See the link:test/environment.adoc[test environment here], and link:test/main.go
go run ./test/
----

Create a ksqlDB Client

[source,go]
----
client := ksqldb.NewClient("http://ksqldb:8088").Debug()
----

=== Pull query

[source,go]
Expand All @@ -49,7 +56,7 @@ ctx, ctxCancel := context.WithTimeout(context.Background(), 10 * time.Second)
defer ctxCancel()
k := "SELECT TIMESTAMPTOSTRING(WINDOWSTART,'yyyy-MM-dd HH:mm:ss','Europe/London') AS WINDOW_START, TIMESTAMPTOSTRING(WINDOWEND,'HH:mm:ss','Europe/London') AS WINDOW_END, DOG_SIZE, DOGS_CT FROM DOGS_BY_SIZE WHERE DOG_SIZE='" + s + "';"
_, r, e := ksqldb.Pull(ctx, ksqlDBServer, k)
_, r, e := client.Pull(ctx, k)
if e != nil {
// handle the error better here, e.g. check for no rows returned
Expand Down Expand Up @@ -96,7 +103,7 @@ go func() {
ctx, ctxCancel := context.WithTimeout(context.Background(), 10 * time.Second)
defer ctxCancel()
e := ksqldb.Push(ctx, ksqlDBServer, k, rc, hc)
e := client.Push(ctx, k, rc, hc)
if e != nil {
// handle the error better here, e.g. check for no rows returned
Expand All @@ -108,7 +115,7 @@ if e != nil {

[source,go]
----
if err := ksqldb.Execute(ctx, ksqlDBServer, `
if err := client.Execute(ctx, ksqlDBServer, `
CREATE STREAM DOGS (ID STRING KEY,
NAME STRING,
DOGSIZE STRING,
Expand Down

0 comments on commit 636025b

Please sign in to comment.