Skip to content

Commit 967f653

Browse files
committed
Make SQLite json/jsonb values json.RawMessage instead of []byte
This in response to code review feedback, it's a little more correct to make json/jsonb values `json.RawMessage` instead of `[]byte`. The former is a form of the latter, but better represents that the value is meant to be JSON.
1 parent 3695ee3 commit 967f653

File tree

3 files changed

+14
-9
lines changed

3 files changed

+14
-9
lines changed

internal/codegen/golang/sqlite_type.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ func sqliteType(req *plugin.GenerateRequest, options *opts.Options, col *plugin.
5757
return "sql.NullTime"
5858

5959
case "json", "jsonb":
60-
return "[]byte"
60+
return "json.RawMessage"
6161

6262
case "any":
6363
return "interface{}"

internal/endtoend/testdata/jsonb/sqlite/go/models.go

Lines changed: 8 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/endtoend/testdata/jsonb/sqlite/go/query.sql.go

Lines changed: 5 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)