summaryrefslogtreecommitdiff
path: root/vendor/github.com/ncruces/go-sqlite3/context.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/ncruces/go-sqlite3/context.go')
-rw-r--r--vendor/github.com/ncruces/go-sqlite3/context.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/vendor/github.com/ncruces/go-sqlite3/context.go b/vendor/github.com/ncruces/go-sqlite3/context.go
index abee4ec1e..7caf58626 100644
--- a/vendor/github.com/ncruces/go-sqlite3/context.go
+++ b/vendor/github.com/ncruces/go-sqlite3/context.go
@@ -177,12 +177,15 @@ func (ctx Context) ResultPointer(ptr any) {
//
// https://sqlite.org/c3ref/result_blob.html
func (ctx Context) ResultJSON(value any) {
- data, err := json.Marshal(value)
+ err := json.NewEncoder(callbackWriter(func(p []byte) (int, error) {
+ ctx.ResultRawText(p[:len(p)-1]) // remove the newline
+ return 0, nil
+ })).Encode(value)
+
if err != nil {
ctx.ResultError(err)
return // notest
}
- ctx.ResultRawText(data)
}
// ResultValue sets the result of the function to a copy of [Value].