Package provides set of types that helps to build complex protobuf messages that contains optional properties. API can be considered as stable.
- ntypes.Bytes
- ntypes.String
- ntypes.Bool
- ntypes.Int32
- ntypes.Int64
- ntypes.Uint32
- ntypes.Uint64
- ntypes.Float32
- ntypes.Float64
- ntypes.BytesArray
- ntypes.StringArray
- ntypes.BoolArray
- ntypes.Int32Array
- ntypes.Int64Array
- ntypes.Uint32Array
- ntypes.Uint64Array
- ntypes.Float32Array
- ntypes.Float64Array
Arrays support is not an SQL standard. Extra import needs to be added to make it working with postgres driver:
import _ "github.com/piotrkowalczuk/ntypes/ntypespq"
Some type implements set of interfaces:
- driver.Valuer excluding Uint64 and some arrays
- proto.Message
- sql.Scanner excluding Uint64 and some arrays
- json.Marshaler
- json.Unmarshaler
Besides that each type implements func <Type>Or(<builtin>) <builtin> {}
method.
It returns given argument if receiver is not valid or is nil.
For example:
ntypes.Bool.BoolOr.