nullz

package module
v0.1.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 9, 2020 License: MIT Imports: 2 Imported by: 0

README

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

  1. bring in lib as dependency where necessary in your application.
  2. 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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bool

type Bool struct{ null.Bool }

func (*Bool) DecodeMsgpack

func (b *Bool) DecodeMsgpack(dec *msgpack.Decoder) error

func (*Bool) EncodeMsgpack

func (b *Bool) EncodeMsgpack(enc *msgpack.Encoder) error

type Byte

type Byte struct{ null.Byte }

func (*Byte) DecodeMsgpack

func (b *Byte) DecodeMsgpack(dec *msgpack.Decoder) error

func (*Byte) EncodeMsgpack

func (b *Byte) EncodeMsgpack(enc *msgpack.Encoder) error

type Bytes

type Bytes struct{ null.Bytes }

func (*Bytes) DecodeMsgpack

func (b *Bytes) DecodeMsgpack(dec *msgpack.Decoder) error

func (*Bytes) EncodeMsgpack

func (b *Bytes) EncodeMsgpack(enc *msgpack.Encoder) error

type Float32

type Float32 struct{ null.Float32 }

func (*Float32) DecodeMsgpack

func (f *Float32) DecodeMsgpack(dec *msgpack.Decoder) error

func (*Float32) EncodeMsgpack

func (f *Float32) EncodeMsgpack(enc *msgpack.Encoder) error

type Float64

type Float64 struct{ null.Float64 }

func (*Float64) DecodeMsgpack

func (f *Float64) DecodeMsgpack(dec *msgpack.Decoder) error

func (*Float64) EncodeMsgpack

func (f *Float64) EncodeMsgpack(enc *msgpack.Encoder) error

type Int

type Int struct{ null.Int }

func (*Int) DecodeMsgpack

func (i *Int) DecodeMsgpack(dec *msgpack.Decoder) error

func (*Int) EncodeMsgpack

func (i *Int) EncodeMsgpack(enc *msgpack.Encoder) error

type Int8

type Int8 struct{ null.Int8 }

func (*Int8) DecodeMsgpack

func (i *Int8) DecodeMsgpack(dec *msgpack.Decoder) error

func (*Int8) EncodeMsgpack

func (i *Int8) EncodeMsgpack(enc *msgpack.Encoder) error

type Int16

type Int16 struct{ null.Int16 }

func (*Int16) DecodeMsgpack

func (i *Int16) DecodeMsgpack(dec *msgpack.Decoder) error

func (*Int16) EncodeMsgpack

func (i *Int16) EncodeMsgpack(enc *msgpack.Encoder) error

type Int32

type Int32 struct{ null.Int32 }

func (*Int32) DecodeMsgpack

func (i *Int32) DecodeMsgpack(dec *msgpack.Decoder) error

func (*Int32) EncodeMsgpack

func (i *Int32) EncodeMsgpack(enc *msgpack.Encoder) error

type Int64

type Int64 struct{ null.Int64 }

func (*Int64) DecodeMsgpack

func (i *Int64) DecodeMsgpack(dec *msgpack.Decoder) error

func (*Int64) EncodeMsgpack

func (i *Int64) EncodeMsgpack(enc *msgpack.Encoder) error

type JSON

type JSON struct{ null.JSON }

func (*JSON) DecodeMsgpack

func (j *JSON) DecodeMsgpack(dec *msgpack.Decoder) error

func (*JSON) EncodeMsgpack

func (j *JSON) EncodeMsgpack(enc *msgpack.Encoder) error

type String

type String struct{ null.String }

func (*String) DecodeMsgpack

func (s *String) DecodeMsgpack(dec *msgpack.Decoder) error

func (*String) EncodeMsgpack

func (s *String) EncodeMsgpack(enc *msgpack.Encoder) error

type Time

type Time struct{ null.Time }

func (*Time) DecodeMsgpack

func (t *Time) DecodeMsgpack(dec *msgpack.Decoder) error

func (*Time) EncodeMsgpack

func (t *Time) EncodeMsgpack(enc *msgpack.Encoder) error

type Uint

type Uint struct{ null.Uint }

func (*Uint) DecodeMsgpack

func (u *Uint) DecodeMsgpack(dec *msgpack.Decoder) error

func (*Uint) EncodeMsgpack

func (u *Uint) EncodeMsgpack(enc *msgpack.Encoder) error

type Uint8

type Uint8 struct{ null.Uint8 }

func (*Uint8) DecodeMsgpack

func (u *Uint8) DecodeMsgpack(dec *msgpack.Decoder) error

func (*Uint8) EncodeMsgpack

func (u *Uint8) EncodeMsgpack(enc *msgpack.Encoder) error

type Uint16

type Uint16 struct{ null.Uint16 }

func (*Uint16) DecodeMsgpack

func (u *Uint16) DecodeMsgpack(dec *msgpack.Decoder) error

func (*Uint16) EncodeMsgpack

func (u *Uint16) EncodeMsgpack(enc *msgpack.Encoder) error

type Uint32

type Uint32 struct{ null.Uint32 }

func (*Uint32) DecodeMsgpack

func (u *Uint32) DecodeMsgpack(dec *msgpack.Decoder) error

func (*Uint32) EncodeMsgpack

func (u *Uint32) EncodeMsgpack(enc *msgpack.Encoder) error

type Uint64

type Uint64 struct{ null.Uint64 }

func (*Uint64) DecodeMsgpack

func (u *Uint64) DecodeMsgpack(dec *msgpack.Decoder) error

func (*Uint64) EncodeMsgpack

func (u *Uint64) EncodeMsgpack(enc *msgpack.Encoder) error

Directories

Path Synopsis
cmd
nullz command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址