Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/danilobuerger/null
Nullable types for Go
https://github.com/danilobuerger/null
go golang json sql xml
Last synced: 21 days ago
JSON representation
Nullable types for Go
- Host: GitHub
- URL: https://github.com/danilobuerger/null
- Owner: danilobuerger
- License: mit
- Created: 2018-03-18T11:50:12.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-08-12T20:29:17.000Z (over 6 years ago)
- Last Synced: 2024-11-23T07:42:45.838Z (3 months ago)
- Topics: go, golang, json, sql, xml
- Language: Go
- Homepage: https://godoc.org/github.com/danilobuerger/null
- Size: 10.7 KB
- Stars: 2
- Watchers: 4
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![Build Status](https://travis-ci.org/danilobuerger/null.svg?branch=master)](https://travis-ci.org/danilobuerger/null) [![Coverage Status](https://coveralls.io/repos/github/danilobuerger/null/badge.svg?branch=master)](https://coveralls.io/github/danilobuerger/null?branch=master) [![Go Report Card](https://goreportcard.com/badge/github.com/danilobuerger/null)](https://goreportcard.com/report/github.com/danilobuerger/null)
# null
## Types
Nullable types for Go. All types implement:
* `sql.Scanner`
* `driver.Valuer`
* `json.Marshaler`
* `json.Unmarshaler`
* `encoding.TextMarshaler`
* `encoding.TextUnmarshaler`
* `xml.Marshaler`
* `xml.Unmarshaler`When marshaling xml, the attribute `xsi:nil="true"` will be added for null values.
When unmarshaling xml, the value will be null if `xsi:nil="true"` is set.### Float64
`null.Float64` is based on `sql.NullFloat64` and exports the fields `Float64` and `Valid`.
`Valid` is true if `Float64` is not null.### Int64
`null.Int64` is based on `sql.NullInt64` and exports the fields `Int64` and `Valid`.
`Valid` is true if `Int64` is not null.### String
`null.String` is based on `sql.NullString` and exports the fields `String` and `Valid`.
`Valid` is true if `String` is not null.When using `encoding.TextUnmarshaler`, an empty text will be valid.