summaryrefslogtreecommitdiff
path: root/vendor/github.com/ncruces/go-sqlite3/internal/util/json.go
diff options
context:
space:
mode:
authorLibravatar Terin Stock <terinjokes@gmail.com>2025-03-09 17:47:56 +0100
committerLibravatar Terin Stock <terinjokes@gmail.com>2025-03-10 01:59:49 +0100
commit3ac1ee16f377d31a0fb80c8dae28b6239ac4229e (patch)
treef61faa581feaaeaba2542b9f2b8234a590684413 /vendor/github.com/ncruces/go-sqlite3/internal/util/json.go
parent[chore] update URLs to forked source (diff)
downloadgotosocial-3ac1ee16f377d31a0fb80c8dae28b6239ac4229e.tar.xz
[chore] remove vendor
Diffstat (limited to 'vendor/github.com/ncruces/go-sqlite3/internal/util/json.go')
-rw-r--r--vendor/github.com/ncruces/go-sqlite3/internal/util/json.go50
1 files changed, 0 insertions, 50 deletions
diff --git a/vendor/github.com/ncruces/go-sqlite3/internal/util/json.go b/vendor/github.com/ncruces/go-sqlite3/internal/util/json.go
deleted file mode 100644
index 846237405..000000000
--- a/vendor/github.com/ncruces/go-sqlite3/internal/util/json.go
+++ /dev/null
@@ -1,50 +0,0 @@
-package util
-
-import (
- "encoding/json"
- "math"
- "strconv"
- "time"
- "unsafe"
-)
-
-type JSON struct{ Value any }
-
-func (j JSON) Scan(value any) error {
- var buf []byte
-
- switch v := value.(type) {
- case []byte:
- buf = v
- case string:
- buf = unsafe.Slice(unsafe.StringData(v), len(v))
- case int64:
- buf = strconv.AppendInt(nil, v, 10)
- case float64:
- buf = AppendNumber(nil, v)
- case time.Time:
- buf = append(buf, '"')
- buf = v.AppendFormat(buf, time.RFC3339Nano)
- buf = append(buf, '"')
- case nil:
- buf = []byte("null")
- default:
- panic(AssertErr())
- }
-
- return json.Unmarshal(buf, j.Value)
-}
-
-func AppendNumber(dst []byte, f float64) []byte {
- switch {
- case math.IsNaN(f):
- dst = append(dst, "null"...)
- case math.IsInf(f, 1):
- dst = append(dst, "9.0e999"...)
- case math.IsInf(f, -1):
- dst = append(dst, "-9.0e999"...)
- default:
- return strconv.AppendFloat(dst, f, 'g', -1, 64)
- }
- return dst
-}