lib

package
v0.0.0-...-305b679 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2017 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const ADSPACE_STATUS_RUNNING = 0
View Source
const ADSPACE_STATUS_STOP = 1
View Source
const CREATIVE_TYPE_HTML = 3
View Source
const ERROR_AD_EXPIRED = 420
View Source
const ERROR_BD_FAILED_RES = 802
View Source
const ERROR_BD_MARSHAL_REQ = 800
View Source
const ERROR_BD_MARSHAL_RES = 803
View Source
const ERROR_BD_SERVER = 801
View Source
const ERROR_CAMPAIGN_DB_ERROR = 604
View Source
const ERROR_ILLEGAL_ADSPACE = 401
View Source
const ERROR_ILLEGAL_SERVER_IP = 407
View Source
const ERROR_INITIAL_FAILED = 603
View Source
const ERROR_MAP_ERROR = 703
View Source
const ERROR_MHSERVER_ERROR = 702
View Source
const ERROR_MSGPACK_IMP = 602
View Source
const ERROR_NOAD = 405
View Source
const ERROR_NO_AD = 400
View Source
const ERROR_NO_AD_FROM_QUEUE = 707
View Source
const ERROR_NO_DEMAND_ERROR = 705
View Source
const ERROR_NO_PMP_ADSPACE_ERROR = 706
View Source
const ERROR_NO_TEMPLATE = 421
View Source
const ERROR_PARSE_REQUEST = 601
View Source
const ERROR_REQUIRED_FIELD_MISSING = 406
View Source
const ERROR_TIMEOUT_ERROR = 704
View Source
const ERROR_UNKNON_ERROR = 701
View Source
const STATUS_SUCCESS = 200

Variables

View Source
var (
	ErrParamsNotAdapted = errors.New("The number of params is not adapted.")
)
View Source
var PoolCache *redis.Pool
View Source
var PoolQueue *redis.Pool

Functions

func ChooseItem

func ChooseItem(items []*WeightItem) (selectedIndex int)

func ConvertFloatToString

func ConvertFloatToString(f float32) string

func ConvertIntToString

func ConvertIntToString(i int) string

func ConvertStrToInt

func ConvertStrToInt(s string) int

func DivisionInt

func DivisionInt(first int, second int) float32

func EscapeCtrl

func EscapeCtrl(ctrl []byte) (esc []byte)

func GenerateBid

func GenerateBid(prefix string) string

func GenerateOTP

func GenerateOTP() string

生成OTP

func GenerateOrderNumber

func GenerateOrderNumber(purchaseType string) string

生成订单号 REQ: 询价单 RES: 报价单 TRX: 订单

func GenerateSecurityToken

func GenerateSecurityToken(mobileNumber string) string

生成Security token

func GenerateSequenceNumberForOTP

func GenerateSequenceNumberForOTP(otp string) string

生成OTP Sequence Number

func GetBytes

func GetBytes(key interface{}) ([]byte, error)

func GetCachePool

func GetCachePool() *redis.Pool

func GetCurrentTime

func GetCurrentTime() string

得到当前时间

func GetMd5String

func GetMd5String(s string) string

生成32位md5字串

func GetQueuePool

func GetQueuePool() *redis.Pool

func GetRandomNumber

func GetRandomNumber(min, max int) int

func NewPool

func NewPool(server, password string) *redis.Pool

func Pwdhash

func Pwdhash(str string) string

password hash function

func SetCachePool

func SetCachePool(pool *redis.Pool)

func SetQueuePool

func SetQueuePool(pool *redis.Pool)

func StringsToJson

func StringsToJson(str string) string

func Strtomd5

func Strtomd5(s string) string

create md5 string

func SubString

func SubString(str string, begin, length int) (substr string)

截取中文字符串

Types

type Funcs

type Funcs map[string]reflect.Value

func NewFuncs

func NewFuncs(size int) Funcs

func (Funcs) Bind

func (f Funcs) Bind(name string, fn interface{}) (err error)

func (Funcs) Call

func (f Funcs) Call(name string, params ...interface{}) (result []reflect.Value, err error)

type HashSet

type HashSet struct {
	// contains filtered or unexported fields
}

func NewHashSet

func NewHashSet() *HashSet

func (*HashSet) Add

func (set *HashSet) Add(i string) bool

func (*HashSet) Get

func (set *HashSet) Get(i string) bool

func (*HashSet) Remove

func (set *HashSet) Remove(i string)

type SysError

type SysError struct {
	ErrorCode    int
	ErrorMessage string
	Err          error
}

func (*SysError) Error

func (e *SysError) Error() string

type WeightItem

type WeightItem struct {
	Index       int
	StartNumber int
	EndNumber   int
	Weight      int
}

Jump to

Keyboard shortcuts

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