-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
29 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,29 @@ | ||
# sqlnull | ||
Go sql.Null-Types that implement Un/MarshalJSON | ||
# SQLNull | ||
|
||
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`](https://pkg.go.dev/database/sql) which implement the | ||
`Marshaler` and `Unmarshaler` interface of the | ||
[`encoding/json`](https://pkg.go.dev/encoding/json) package. | ||
|
||
## Usage | ||
|
||
1. Get the package | ||
```bash | ||
go get github.com/gkits/nullsql@latest | ||
``` | ||
|
||
2. Import the package | ||
```go | ||
import "github.com/gkits/nullsql" | ||
``` | ||
|
||
3. Start coding... | ||
|
||
## Limitations | ||
|
||
Due to the internal implementation of the | ||
[`encoding/json`](https://pkg.go.dev/encoding/json) package you can sadly | ||
not omit the fields with value `null` using the `omitempty` tag. |