An open API service indexing awesome lists of open source software.

https://github.com/rhaseven7h/sqljson

SQL+JSON+Validator Support for sql.NullString, sql.NullBool, sql.NullInt64 and sql.NullFloat64.
https://github.com/rhaseven7h/sqljson

field go golang json json-serialization marhsaller marshalling null sql struct structs unmarshaller unmarshalling validate validator validators

Last synced: 2 months ago
JSON representation

SQL+JSON+Validator Support for sql.NullString, sql.NullBool, sql.NullInt64 and sql.NullFloat64.

Awesome Lists containing this project

README

        

# Golang (Go) SQL+JSON+Validator Support for Null Database/SQL Types

## SQL Null Field Types

- sql.NullString
- sql.NullBool
- sql.NullInt64
- sql.NullFloat64

Adds support to Null* field types for database/sql.

Validator library is:

- [Go Playground Validator: gopkg.in/go-playground/validator.v9](gopkg.in/go-playground/validator.v9)

Allows simultaneous use of validator validations, null sql values in struct fields for database/sql, and still support JSON Marshal and Unmarshal for those Null* fields.

## Usage

Please see integration test files, in particular those for validation.

You need to register custom types for validator. See how it is done in integration tests too.