Documentation ¶
Overview ¶
Package codec holds encoding decoding reading writing stuff
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrEndOfResults = errors.New("No results are left to read")
ErrEndOfResults denotes absence of results
Functions ¶
func EncodeReqBody ¶
EncodeReqBody encodes data into the req as a json object
func EncodeReqFormData ¶
func EncodeReqFormData(data interface{}) (io.ReadCloser, string, error)
EncodeReqFormData encodes data passed as a form data. NOTE: data must be a pointer to a struct type.
func EncodeReqQuery ¶
EncodeReqQuery encodes data passed as an http.Request query string. NOTE: data must be a pointer to a struct type.
Types ¶
type NextRawResulter ¶
NextRawResulter abstracts reading raw results from paginated api response
type Raw ¶
type Raw []byte
Raw represents raw bytes data
func (*Raw) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler
type ResultBuf ¶
type ResultBuf struct { Ctx context.Context ReqMethod string Client ucare.Client sync.Mutex // guards everything below NextPage *string `json:"next"` Vals []Raw `json:"results"` // contains filtered or unexported fields }
ResultBuf implements NextRawResulter
func (*ResultBuf) ReadRawResult ¶
ReadRawResult reads returns next Raw result. It makes paginated requests when all results from the current page have been read.