jsonslice
A JSON-backed slice that round-trips through SQL columns and gqlgen scalars.
go get github.com/ubgo/jsonslice
- Language
- Go
- Go version
- 1.24
- Core deps
- 0 direct
- Latest tag
- v0.1.0
- License
- Apache-2.0
- Go modules
- 1
Code from the README
import "github.com/ubgo/jsonslice"
type Event struct {
ID string
Tags jsonslice.JsonSlice // ["urgent", "billing", 42]
}
// Save → JSON column
db.Exec(`INSERT INTO events(id, tags) VALUES (?, ?)`, e.ID, e.Tags)
// Load
var loaded Event
db.QueryRow(`SELECT id, tags FROM events WHERE id = ?`, "x").
Scan(&loaded.ID, &loaded.Tags)From the jsonslice README.