Documentation ¶
Index ¶
- type Document
- func (d *Document) Copy() *Document
- func (d Document) ETag() (ETag, error)
- func (d Document) Equal(other Document) bool
- func (d Document) GAPIError(uri string) *ErrGAPI
- func (d Document) GetPath(parts ...string) (interface{}, bool)
- func (d Document) Keys() []string
- func (d Document) KeysSorted() []string
- func (d Document) MarshalBinary() ([]byte, error)
- func (d Document) MarshalJSON() ([]byte, error)
- func (d Document) String() string
- func (d Document) TraverseCall(f TraverseFunc)
- func (d *Document) UnmarshalBinary(data []byte) error
- func (d *Document) UnmarshalJSON(data []byte) error
- func (d Document) WriteOutJSON(w io.Writer) error
- type ETag
- type ErrGAPI
- type TraverseFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Document ¶
type Document map[string]interface{}
Document represents a single G API resource. Internally its contents would be represented by Go primitives.
bool for booleans float64 for numbers string for strings []interface{} for arrays Document for nested objects nil for nulls
func (Document) GAPIError ¶
GAPIError returns *ErrGAPI if the document is a GAPI error, nil otherwise
func (Document) GetPath ¶
GetPath recursively searches for value at provided path
e.g. GetPath("staff_profile", "id") would return "value" under the
'/staff_profile/id' path in the Document: { "staff_profile": { "id": "value" } }
func (Document) Keys ¶ added in v0.2.0
Keys is a convenience method to return the keys in this Document
func (Document) KeysSorted ¶ added in v0.2.0
KeysSorted is a convenience method to return the keys in this Document, in sorted order
func (Document) MarshalBinary ¶
MarshalBinary allows documents to be stored in cache
func (Document) MarshalJSON ¶
MarshalJSON implements json marshaling of Document
func (Document) TraverseCall ¶
func (d Document) TraverseCall(f TraverseFunc)
TraverseCall will visit every item in Document and call the provided TraverseFunc on each item
func (*Document) UnmarshalBinary ¶
UnmarshalBinary implements binary decoding
func (*Document) UnmarshalJSON ¶
UnmarshalJSON implements json unmarshaling of Document
type ETag ¶
type ETag uint64
ETag is type for storing the calculated etag/checksum of a Document
type ErrGAPI ¶
ErrGAPI type represents error response returned by GAPI
See: https://developers.gadventures.com/docs/rest.html#errors
type TraverseFunc ¶
TraverseFunc is an alias for a function that will be executed for every item in the Document