Documentation ¶
Index ¶
- Variables
- func NewJsonDecoder() *jsonDecoder
- func ParseBody(r *http.Request, model interface{}) error
- type List
- func (j *List) AsList() ([]string, error)
- func (j *List) AsListOrEmpty() []string
- func (j List) MarshalJSON() ([]byte, error)
- func (j *List) Scan(src interface{}) error
- func (j List) String() string
- func (j *List) Unmarshal(v interface{}) error
- func (j *List) UnmarshalJSON(data []byte) error
- func (j List) Value() (driver.Value, error)
- type Object
- func FromMap(m map[string]interface{}) (Object, error)
- func FromMapOrEmpty(m map[string]interface{}) Object
- func FromStringMap(m map[string]string) (Object, error)
- func FromStringMapOrEmpty(m map[string]string) Object
- func StructToJsonObject(v interface{}) (Object, error)
- func StructToJsonObjectOrEmpty(v interface{}) Object
- func (j *Object) AsMap() (map[string]interface{}, error)
- func (j *Object) AsMapOrEmpty() map[string]interface{}
- func (j *Object) AsStringMap() (map[string]string, error)
- func (j *Object) AsStringMapOrEmpty() map[string]string
- func (j Object) MarshalJSON() ([]byte, error)
- func (j *Object) Scan(src interface{}) error
- func (j Object) String() string
- func (j *Object) Unmarshal(v interface{}) error
- func (j *Object) UnmarshalJSON(data []byte) error
- func (j Object) Value() (driver.Value, error)
Constants ¶
This section is empty.
Variables ¶
var EmptyJSONList = List("[]")
var EmptyJSONObject = Object("{}")
Functions ¶
func NewJsonDecoder ¶
func NewJsonDecoder() *jsonDecoder
Types ¶
type List ¶
type List json.RawMessage
JSONText is a json.RawMessage, which is a []byte underneath. Value() validates the json format in the source, and returns an error if the json is not valid. Scan does no validation. JSONText additionally implements `Unmarshal`, which unmarshals the json within to an interface{}
func FromListOrEmpty ¶
func StructToJsonList ¶
func StructToJsonListOrEmpty ¶
func StructToJsonListOrEmpty(v interface{}) List
func (*List) AsListOrEmpty ¶
func (List) MarshalJSON ¶
MarshalJSON returns the *j as the JSON encoding of j.
func (*List) UnmarshalJSON ¶
UnmarshalJSON sets *j to a copy of Repo
type Object ¶
type Object json.RawMessage
JSONText is a json.RawMessage, which is a []byte underneath. Value() validates the json format in the source, and returns an error if the json is not valid. Scan does no validation. JSONText additionally implements `Unmarshal`, which unmarshals the json within to an interface{}
func FromMapOrEmpty ¶
func FromStringMapOrEmpty ¶
func StructToJsonObject ¶
func StructToJsonObjectOrEmpty ¶
func StructToJsonObjectOrEmpty(v interface{}) Object
func (*Object) AsMapOrEmpty ¶
AsMapOrEmpty returns a map or if it can't unmarshal it, it returns an empty map
func (*Object) AsStringMapOrEmpty ¶
func (Object) MarshalJSON ¶
MarshalJSON returns the *j as the JSON encoding of j.
func (*Object) UnmarshalJSON ¶
UnmarshalJSON sets *j to a copy of Repo