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.
- Host: GitHub
- URL: https://github.com/rhaseven7h/sqljson
- Owner: rhaseven7h
- License: other
- Created: 2017-05-02T01:14:26.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2017-05-02T07:37:36.000Z (about 8 years ago)
- Last Synced: 2025-01-21T12:22:20.278Z (4 months ago)
- Topics: field, go, golang, json, json-serialization, marhsaller, marshalling, null, sql, struct, structs, unmarshaller, unmarshalling, validate, validator, validators
- Language: Go
- Size: 316 KB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
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.NullFloat64Adds 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.