lego

package module
v0.0.0-...-4b7c13d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 23, 2014 License: MIT Imports: 17 Imported by: 0

README

lego

use golang build base module

Documentation

Index

Constants

View Source
const TimeLimitCodeLength = 12 + 6 + 40

Variables

This section is empty.

Functions

func CreateTimeLimitCode

func CreateTimeLimitCode(data string, minutes int, startInf interface{}) string

create a time limit code code format: 12 length date time string + 6 minutes string + 40 sha1 encoded string

func EncodeHmac

func EncodeHmac(secret, value string, params ...func() hash.Hash) string

func EncodeMd5

func EncodeMd5(str string) string

Encode string to md5 hex value

func EncodePassword

func EncodePassword(rawPwd string, salt string) string

use pbkdf2 encode password

func GetRandomString

func GetRandomString(n int) string

Random generate string

func NumberDecode

func NumberDecode(token string, alphabet []byte) string

func NumberEncode

func NumberEncode(number string, alphabet []byte) string

func PBKDF2

func PBKDF2(password, salt []byte, iter, keyLen int, h func() hash.Hash) []byte

http://code.google.com/p/go/source/browse/pbkdf2/pbkdf2.go?repo=crypto

func ToInt64

func ToInt64(value interface{}) (d int64, err error)

convert any numeric value to int64

func ToStr

func ToStr(value interface{}, args ...int) (s string)

convert any type to string

func VerifyTimeLimitCode

func VerifyTimeLimitCode(data string, minutes int, code string) bool

verify time limit code

Types

type Paginator

type Paginator struct {
	Request     *http.Request
	PerPageNums int
	MaxPages    int
	// contains filtered or unexported fields
}

func NewPaginator

func NewPaginator(req *http.Request, per int, nums interface{}) *Paginator

func (*Paginator) HasNext

func (p *Paginator) HasNext() bool

func (*Paginator) HasPages

func (p *Paginator) HasPages() bool

func (*Paginator) HasPrev

func (p *Paginator) HasPrev() bool

func (*Paginator) IsActive

func (p *Paginator) IsActive(page int) bool

func (*Paginator) Nums

func (p *Paginator) Nums() int64

func (*Paginator) Offset

func (p *Paginator) Offset() int

func (*Paginator) Page

func (p *Paginator) Page() int
func (p *Paginator) PageLink(page int) string

func (*Paginator) PageLinkFirst

func (p *Paginator) PageLinkFirst() (link string)

func (*Paginator) PageLinkLast

func (p *Paginator) PageLinkLast() (link string)

func (*Paginator) PageLinkNext

func (p *Paginator) PageLinkNext() (link string)

func (*Paginator) PageLinkPrev

func (p *Paginator) PageLinkPrev() (link string)

func (*Paginator) PageNums

func (p *Paginator) PageNums() int

func (*Paginator) Pages

func (p *Paginator) Pages() []int

func (*Paginator) SetNums

func (p *Paginator) SetNums(nums interface{})

type StrTo

type StrTo string

func (StrTo) Bool

func (f StrTo) Bool() (bool, error)

func (*StrTo) Clear

func (f *StrTo) Clear()

func (StrTo) Exist

func (f StrTo) Exist() bool

func (StrTo) Float32

func (f StrTo) Float32() (float32, error)

func (StrTo) Float64

func (f StrTo) Float64() (float64, error)

func (StrTo) Int

func (f StrTo) Int() (int, error)

func (StrTo) Int16

func (f StrTo) Int16() (int16, error)

func (StrTo) Int32

func (f StrTo) Int32() (int32, error)

func (StrTo) Int64

func (f StrTo) Int64() (int64, error)

func (StrTo) Int8

func (f StrTo) Int8() (int8, error)

func (*StrTo) Set

func (f *StrTo) Set(v string)

func (StrTo) String

func (f StrTo) String() string

func (StrTo) Uint

func (f StrTo) Uint() (uint, error)

func (StrTo) Uint16

func (f StrTo) Uint16() (uint16, error)

func (StrTo) Uint32

func (f StrTo) Uint32() (uint32, error)

func (StrTo) Uint64

func (f StrTo) Uint64() (uint64, error)

func (StrTo) Uint8

func (f StrTo) Uint8() (uint8, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL