Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseJSON ¶
func ParseJSON(data io.ReadCloser, v interface{}) error
ParseJSON parses input data to struct
func RandomBase64 ¶
RandomBase64 returns a base64 url encoded, unpadded string of random bytes. len is the length of bytes. It should be the multiple of 3 to get a string without padding: len * 8 / 6. 3 bytes -- 4 chars 6 bytes -- 8 chars 9 bytes -- 12 chars Wechat OAuth code has 32 characters, which is 24 bytes long; Wechat Access Token has 110 chars, which is 82.5 bytes? Wechat Refresh Token has 110 chars. OpenID has 28 chars, which is 21 bytes UnionID has 28 chars.
Types ¶
type Pagination ¶ added in v0.0.13
type Pagination struct { Limit int64 // How many items per page. // contains filtered or unexported fields }
Pagination is used to calculate limit and offset parameter used int sql statement.
func GetPagination ¶ added in v0.0.13
func GetPagination(req *http.Request) Pagination
GetPagination extracts pagination information from query parameter
func NewPagination ¶ added in v0.0.13
func NewPagination(p, limit int64) Pagination
NewPagination creates a new Pagination instance. p is the page number, r is the rows to retrieve.
func (Pagination) Offset ¶ added in v0.0.13
func (p Pagination) Offset() int64
Offset calculate the offset for SQL.
type Param ¶
type Param struct {
// contains filtered or unexported fields
}
Param represents a pair of query parameter from URL.
func GetQueryParam ¶
GetQueryParam get a pair of query parameter from URL.