Skip to content

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

License

Notifications You must be signed in to change notification settings

rhaseven7h/sqljson

Repository files navigation

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:

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.