Documentation
¶
Index ¶
- Constants
- Variables
- func Byte2String(b []byte) string
- func CBCDecrypter(keys string, endata string, ivs string) ([]byte, error)
- func Chaos(fn string, f ...func())
- func ChaosDB()
- func Cputicks() (t uint64)
- func GenOrderNo(userId string) string
- func Get(address string, isKeep bool) ([]byte, error)
- func GetCurrentDirectory() string
- func GetLocalIP() string
- func GetPwd() string
- func GetUrlencoded(address string, isKeep bool, data map[string]string) ([]byte, error)
- func HTTPInstance() *http.Client
- func HTTPTLSInstance(certFile, keyFile string) *http.Client
- func HmacSha1(src, key string) string
- func Int64Range(min, max int64) int64
- func IsASCII(s string) bool
- func IsAllNotNilString(s ...string) bool
- func IsChinese(chars string, regex ...string) bool
- func IsEmail(mail string, regex ...string) bool
- func IsFileExist(f string) bool
- func IsIPv4(ip string, regex ...string) bool
- func IsInStringSlice(dst string, src []string) bool
- func IsMoney2Point(s string, regex ...string) bool
- func IsNick(nick string, regex ...string) bool
- func IsNilString(s string) bool
- func IsNotNilString(s string) bool
- func IsPassword(pwd string, regex ...string) bool
- func IsPhone(phone string, regex ...string) bool
- func IsUserName(userName string, regex ...string) bool
- func MD5(b []byte) string
- func MD5BySalt(src, salt string) string
- func MakeSpecId() string
- func Marshal2Bytes(data interface{}) (s []byte)
- func Marshal2String(data interface{}) (s string)
- func MgoChaos()
- func MgoExecute(colName string, q func(*mgo.Collection) error) error
- func MgoExecuteBulk(colName string, q func(*mgo.Bulk) error) error
- func MinQuantity(v uint32) uint32
- func MongodbInstance()
- func MustMarshal2String(v interface{}) string
- func MustXMll2Byte(v interface{}) []byte
- func MysqlChaos() *xorm.Engine
- func NewDLock(topic string, timeOut time.Duration) *lock.Locker
- func NewMgoSession() *mgo.Session
- func NextZeroDateWithSub() (time.Time, time.Time)
- func NormFloat64(num int, sq, ar float64) (f []float64)
- func PBMarshal2String(data proto.Message) (s string)
- func Post(address, contentType string, isKeep bool, data []byte) ([]byte, error)
- func PostRawJson(address string, isKeep bool, data []byte) ([]byte, error)
- func PostUrlencoded(address string, isKeep bool, data map[string]string) ([]byte, error)
- func RandId() string
- func RandIdInt64() int64
- func RandInt(min, max int) int
- func RandInt32(min, max int32) int32
- func RandNumber(length int, chars []byte) string
- func RandUInt32(min, max uint32) uint32
- func RandUInt64(min, max uint64) uint64
- func RandomLetters(n int, alphabets ...byte) string
- func RedisChaos()
- func RedisInstance()
- func RegisterContinueSignal(sig os.Signal, process func()) error
- func RegisterSignal(sig os.Signal, process func()) error
- func Round(f float64, n int) float64
- func SHA1(src string) string
- func SHA1BySalt(src, salt string) (string, error)
- func SetExpireAt(key string, value interface{}, t time.Time) error
- func Sha1(query string, pri_key string) string
- func SignalProcessed(sig os.Signal) bool
- func String2ASCII(s string) string
- func String2Byte(s string) []byte
- func Struct2Map(obj interface{}, tag string) map[string]string
- func Struct2MapInterface(in interface{}, tag string) map[string]interface{}
- type B64Encoding
- type ConcurrentMap
- type ConcurrentMapShared
- type Email
- type ForXmlMap
Constants ¶
View Source
const RedisDsyncLockKey = "dsynclock:topic:"
Variables ¶
View Source
var ( V_REGEXP_PHONE = "^(1(([35][0-9])|[8][0-9]|[7][0-9]|[4][579]))\\d{8}$" V_REGEXP_USERNAME = "^[a-zA-Z0-9_]{4,16}$" V_REGEXP_PASSWORD = "^(?=.*\\d)(?=.*[a-z])(?=.*[A-Z]).{6,10}$" V_REGEXP_NICK = "^[\u4E00-\u9FA5A-Za-z0-9_]{2,12}$" V_REGEXP_EMAIL = "[\\w!#$%&'*+/=?^_`{|}~-]+(?:\\.[\\w!#$%&'*+/=?^_`{|}~-]+)*@(?:[\\w](?:[\\w-]*[\\w])?\\.)+[\\w](?:[\\w-]*[\\w])?" V_REGEXP_CHINESE = "^[\\u4e00-\\u9fa5]{0,}$" V_REGEXP_MONEY = "^[0-9]+(.[0-9]{2})?$" V_REGEXP_IPv4 = "\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\b" )
View Source
var GMgoConnectionStringURI = ""
mgo.PrimaryPreferred 5 mode: primary Perform all read operations on the master node primaryPreferred Priority on the main node to read, if the primary node is not available, and then from the slave operation secondary All read operations are performed on the slave node secondaryPreferred Priority to read from the slave node, if all slave nodes are unavailable, and then from the master node operation。 nearest According to the network delay time, the nearest read operation, regardless of the node type。 default is strong mode its named primary. eg. gMgoSession.SetMode(mgo.Strong)
View Source
var GMgoDatabaseName = ""
View Source
var GMongo *mongo.Database
View Source
var GRedis *redis.Client
View Source
var GRedisRing *redis.Ring
View Source
var MysqlEngine *xorm.Engine
View Source
var RandNumTmps = []byte("0123456789")
0123456789 select 6 password number
View Source
var SigAlreadyRegisted = errors.New("sig already registed")
Functions ¶
func GenOrderNo ¶
func GetCurrentDirectory ¶
func GetCurrentDirectory() string
func GetLocalIP ¶
func GetLocalIP() string
func GetUrlencoded ¶
func HTTPInstance ¶
func HTTPTLSInstance ¶
func IsAllNotNilString ¶
func IsFileExist ¶
func IsInStringSlice ¶
func IsMoney2Point ¶
func IsNilString ¶
func IsNotNilString ¶
func IsPassword ¶
func IsUserName ¶
func MakeSpecId ¶
func MakeSpecId() string
func Marshal2Bytes ¶
func Marshal2Bytes(data interface{}) (s []byte)
func Marshal2String ¶
func Marshal2String(data interface{}) (s string)
func MgoExecute ¶
func MgoExecuteBulk ¶
func MongodbInstance ¶
func MongodbInstance()
func MustMarshal2String ¶
func MustMarshal2String(v interface{}) string
func MustXMll2Byte ¶
func MustXMll2Byte(v interface{}) []byte
func MysqlChaos ¶
func NewMgoSession ¶
func NewMgoSession() *mgo.Session
func NormFloat64 ¶
func PBMarshal2String ¶
func PostUrlencoded ¶
func RandIdInt64 ¶
func RandIdInt64() int64
func RandNumber ¶
func RandUInt32 ¶
func RandUInt64 ¶
func RandomLetters ¶
func RedisChaos ¶
func RedisChaos()
func RedisInstance ¶
func RedisInstance()
func RegisterContinueSignal ¶
func RegisterSignal ¶
func SHA1BySalt ¶
func SignalProcessed ¶
func String2Byte ¶
func Struct2Map ¶
func Struct2MapInterface ¶
Types ¶
type B64Encoding ¶
type B64Encoding struct {
// contains filtered or unexported fields
}
func B64NewEncoding ¶
func B64NewEncoding(s string) *B64Encoding
func (*B64Encoding) B64Decode ¶
func (b *B64Encoding) B64Decode(s string) string
func (*B64Encoding) B64Encode ¶
func (b *B64Encoding) B64Encode(s string) string
type ConcurrentMap ¶
type ConcurrentMap []*ConcurrentMapShared
func New ¶
func New() ConcurrentMap
func (ConcurrentMap) Get ¶
func (c ConcurrentMap) Get(key uint64) (interface{}, bool)
func (ConcurrentMap) Remove ¶
func (c ConcurrentMap) Remove(key uint64)
func (ConcurrentMap) Set ¶
func (c ConcurrentMap) Set(key uint64, value interface{})
type ConcurrentMapShared ¶
type ConcurrentMapShared struct { // contains filtered or unexported fields }
type Email ¶
type Email struct { UserName string Host string Port string Password string To []string ToString string EmailAlias string Subject string ContentType []byte // contains filtered or unexported fields }
func EmailInstance ¶
func EmailInstance() *Email
type ForXmlMap ¶
type ForXmlMap map[string]interface{}
func (ForXmlMap) MarshalXML ¶
func (*ForXmlMap) UnmarshalXML ¶
Click to show internal directories.
Click to hide internal directories.