GitHunt
RE

reiver/gogen-optiontype

Option types (also known as maybe types) for Go, via "go generate".

gogen-optiontype

Option types (also known as maybe types) for Go programming language, via go generate.

Usage

package itemid

//go:generate gogen-optiontype --pkg=itemid --type=int64
package thingid

//go:generate gogen-optiontype --pkg=thingid --type=string --one-file
package productid

//go:generate gogen-optiontype --pkg=thingid --type=string --one-file --no-tests

And then run:

go generate

or:

gb generate

(If you are using GB.)

Can then use with code similar to:

type Struct Product {
	ID     productid.Type
	Name   string
	ItemID itemid.NullableType
}

Languages

Go100.0%

Contributors

MIT License
Created May 10, 2017
Updated July 23, 2019