Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InGithubCI ¶
func InGithubCI() bool
InGithubCI check github acitons envrionment https://help.github.com/en/actions/configuring-and-managing-workflows/using-environment-variables
func RedisMarshal ¶ added in v0.4.26
RedisMarshal use gob encode
Example ¶
package main import ( "fmt" "github.com/datewu/gtea/utils" ) type anCache []string // MarshalBinary implements the encoding.BinaryMarshaler interface. func (l anCache) MarshalBinary() ([]byte, error) { type a anCache a1 := a(l) return utils.RedisMarshal(a1) } // UnmarshalBinary implements the encoding.BinaryUnmarshaler interface. func (l *anCache) UnmarshalBinary(data []byte) error { type a anCache a1 := (*a)(l) return utils.RedisUnMarshal(data, a1) } func main() { data := anCache{"hello", "world"} bs, err := data.MarshalBinary() // before go1.21.0 // [15 255 129 2 1 1 1 97 1 255 130 0 1 12 0 0 16 255 130 0 2 5 104 101 108 108 111 5 119 111 114 108 100] if err != nil { panic(err) } fmt.Println(bs) }
Output: [14 127 2 1 1 1 97 1 255 128 0 1 12 0 0 16 255 128 0 2 5 104 101 108 108 111 5 119 111 114 108 100]
func RedisUnMarshal ¶ added in v0.4.26
RedisUnMarshal use gob decode
Types ¶
type Pagination ¶ added in v0.2.2
type Pagination struct {
// contains filtered or unexported fields
}
Pagination represents a pagination object.
func NewPagination ¶ added in v0.2.2
func NewPagination(page, perPage int) *Pagination
NewPagination returns a new Pagination object.
func ParsePagination ¶ added in v0.5.3
func ParsePagination(r *http.Request) *Pagination
ParsePagination parse page & per_page query returns a new Pagination object.
func (*Pagination) Limit ¶ added in v0.2.2
func (p *Pagination) Limit() int
func (*Pagination) Offset ¶ added in v0.2.2
func (p *Pagination) Offset() int
func (*Pagination) SetPage ¶ added in v0.2.2
func (p *Pagination) SetPage(page int)
Click to show internal directories.
Click to hide internal directories.