A dead simple one stop solution to pass your database types directly to your JSON REST-API.
This package provides wrapper types for all Null* types of the
database/sql
which implement the
Marshaler
and Unmarshaler
interface of the
encoding/json
package.
- Get the package
go get github.com/gkits/nullsql@latest
- Import the package
import "github.com/gkits/nullsql"
- Start coding...
Due to the internal implementation of the
encoding/json
package you can sadly
not omit the fields with value null
using the omitempty
tag.