Documentation
¶
Overview ¶
Package types provides a set of common data types that implement the relevant interfaces for use within gondulapi.
In general, that means implementing JSON marshaling/unmarshaling and database/sql's Scanner and driver.Value interface for SQL operations.
Any data type that implement JSON marshaling and can be handled by SQL can be used without any further scaffolding. So these data types are just a bit outside of the norm.
Index ¶
- type Box
- type IP
- type Jsonb
- func (j *Jsonb) MarshalJSON() ([]byte, error)
- func (j Jsonb) MarshalText() ([]byte, error)
- func (j *Jsonb) Scan(src interface{}) error
- func (j Jsonb) String() string
- func (j *Jsonb) UnmarshalJSON(b []byte) error
- func (j *Jsonb) UnmarshalText(b []byte) error
- func (j Jsonb) Value() (driver.Value, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Box ¶ added in v0.0.7
Box contains the two opposing corners of a geometric box, matching Postgres' box type.
Please note that Postgresql will always place the upper right corner first - so X1/Y1 might be X2/Y2 when you read it back out - but the semantics are correct.
type IP ¶
IP represent an IP and an optional netmask/size. It is provided because while net/IP provides much of what is needed for marshalling to/from text and json, it doesn't provide a convenient netmask. And it doesn't implement database/sql's Scanner either. This type implements both MarshalText/UnmarshalText and Scan(), and to top it off: String(). this should ensure maximum usability.
func (IP) MarshalText ¶
MarshalText returns a text version of an ip using String, it is used by various encoders, including the JSON encoder.
func (*IP) String ¶
String returns a ip address in string format, with an optional /mask if the IP has a non-zero mask.
func (*IP) UnmarshalText ¶
UnmarshalText parses a byte string onto an IP structure. It is used by various encoders, including the JSON encoder.
type Jsonb ¶ added in v0.0.8
type Jsonb struct {
Data interface{}
}
Jsonb is a wrapper around an empty interface to enable adding methods to it. The wrapping is hidden both from SQL and JSON through a ton of dummy-methods.
func (*Jsonb) MarshalJSON ¶ added in v0.0.8
MarshalJSON qwrasfaksfjasklfjasf
func (Jsonb) MarshalText ¶ added in v0.0.8
MarshalText returns a byte-string of the string representation of the object and this documentation, I'm sure, is very helpful.
func (*Jsonb) UnmarshalJSON ¶ added in v0.0.8
UnmarshalJSON is here just to make lint-software think this is a sensible way of writing documentation.
func (*Jsonb) UnmarshalText ¶ added in v0.0.8
UnmarshalText un marshals the text. Weird.