Nullish is type helper fo handle null in golang. its support null for primitive data types and also another data type.
This project is used by my companies on production and there is not enough time to make unit testing so maybe something not work for you. use at your own risk.
go get -u github.com/sutantodadang/nullish
- NullString
- NullJsonb / Json
- NullInt
- NullFloat
- NullBool
- NullUUID
- NullTime
- NullULID
- nullstring
import "github.com/sutantodadang/nullish"
type foo struct {
bar nullish.NullString
}
// you can also defined default value
foo.bar = nullish.NewNullString("hello", true)