nullz
Custom types, encoders, and decoders for integrating msgpack with generated sqlboiler models that have nullable fields.
Hell yea, nullz 🤘
Description
nullz is a lib of types, bundled with a cli converter tool. The types map to, and are to be used in place of, their respective sqlboiler types in your app's sqlboiler-generated model file(s). Each nullz type has an implemented msgpack.CustomEncoder and msgpack.CustomDecoder method, which are called implicitly by msgpack. Then the model file(s) are passed through the converter, invoked with nullz.
Before we get started
If $GOBIN is not set
$ export GOBIN=$GOPATH/bin
If $GO111MODULE is not set
$ export GO111MODULE=on
This package assumes your code is organized as a conventional golang workspace.
Usage
- bring in lib as dependency where necessary in your application.
- run the converter on the sqlboiler model file.
Bring in as dep
$ go get github.com/parkerduckworth/nullz
Import where necessary
import "github.com/parkerduckworth/nullz"
Install binary (from package directory in $GOPATH)
$ git clone https://github.com/parkerduckworth/nullz.git $GOPATH/src/github.com/parkerduckworth/nullz
$ go install $GOPATH/src/github.com/parkerduckworth/nullz/cmd/nullz/nullz.go
Test installation & Help
$ nullz --help
NAME:
nullz - convert nullable sqlboiler models for integration with msgpak
USAGE:
nullz [global options] command [command options] [arguments...]
VERSION:
<version>
AUTHOR:
parkerduckworth <duckw0rth@protonmail.com>
COMMANDS:
convert convert directory of model files provided as [PATH]
help, h Shows a list of commands or help for one command
GLOBAL OPTIONS:
--help, -h show help (default: false)
--version, -v print the version (default: false)
Convert model files
$ nullz convert models
Test that conversion was successful
$ go test ./models
License
This project is licensed under the MIT License