From 398f7f43d71cb03cd72160fef5e5d55c2fb5b936 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Garcia?= Date: Tue, 6 Apr 2021 10:21:07 -0300 Subject: [PATCH] Update README code example to use the new constructor --- README.md | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 5448682..ec351fd 100644 --- a/README.md +++ b/README.md @@ -91,15 +91,17 @@ import ( "github.com/vingarcia/ksql/nullable" ) +// User ... type User struct { - ID int `ksql:"id"` - Name string `ksql:"name"` - Age int `ksql:"age"` + ID int `ksql:"id"` + Name string `ksql:"name"` + Age int `ksql:"age"` // This field will be saved as JSON in the database Address Address `ksql:"address,json"` } +// PartialUpdateUser ... type PartialUpdateUser struct { ID int `ksql:"id"` Name *string `ksql:"name"` @@ -107,6 +109,7 @@ type PartialUpdateUser struct { Address *Address `ksql:"address,json"` } +// Address ... type Address struct { State string `json:"state"` City string `json:"city"` @@ -114,7 +117,10 @@ type Address struct { func main() { ctx := context.Background() - db, err := ksql.New("sqlite3", "/tmp/hello.sqlite", 1, "users") + db, err := ksql.New("sqlite3", "/tmp/hello.sqlite", ksql.Config{ + MaxOpenConns: 1, + TableName: "users", + }) if err != nil { panic(err.Error()) }