Versions in this module Expand all Collapse all v0 v0.1.1 Nov 14, 2021 Changes in this version + const ACTION_SUFFIX + const CACHE_TYPE_LOCAL + const CACHE_TYPE_REDIS + const CLEAN_INTERVAL + const DEFAULT_ACTION + const DEFAULT_CONTROLLER + const DEFAULT_TTL + const LevelAccess + const LevelAll + const LevelDebug + const LevelError + const LevelInfo + const LevelNone + const LevelWarn + const RAND_KIND_ALL + const RAND_KIND_LOWER + const RAND_KIND_NUM + const RAND_KIND_UPPER + var Conf = &Config + var DEFAULT_LANG = "CN" + var ERR_FREQ = &Error + var ERR_METHOD_INVALID = &Error + var ERR_OTHER = &Error + var ERR_RPCAUTH = &Error + var ERR_SUC = &Error + var ERR_SYSTEM = &Error + var LocalCache = &localCache + var Logger = &FileLogger + var Mysql = &MysqlProxy + var Redis = &RedisProxy + var TIME_ZONE = "Local" + func AsBool(b interface{}, def ...bool) bool + func AsInt(num interface{}, def ...int) int + func AsString(str interface{}, def ...string) string + func Concat(str ...string) string + func Cost(start_time time.Time) int + func Crc32(str string) int + func Date(times ...int) string + func DateTime(times ...int) string + func GetCookie(r *http.Request, key string) string + func GetIp(r *http.Request) string + func GetLocalIp() string + func GetMapNode(m interface{}, keys ...string) (value interface{}, find bool) + func InArray(search interface{}, arr interface{}, stricts ...bool) bool + func Interceptor(guard bool, errmsg *Error, fmts ...interface{}) + func Ip2long(ipstr string) (ip int) + func Join(strs interface{}, seps ...string) string + func JsonDecode(data string) interface + func JsonEncode(data interface{}) string + func Long2ip(ip int) string + func MD5(str string) string + func MkTime(t ...int) int + func Now() int + func Rand(size int, kind int) []byte + func RandStr(size int, kind ...int) string + func SetCookie(rw http.ResponseWriter, key, val string, lifetime int, options ...interface{}) + func Sha1(str string) string + func StrToTime(datetime string) int + func ToFloat(num string, size ...int) float64 + func ToInt(num string) int + func ToIntArray(nums []string) []int + func ToString(num int) string + func ToStringArray(nums []int) []string + func VersionCompare(ver, oldver string) bool + type CliServer struct + func NewCliServer() *CliServer + func (this *CliServer) AddController(c interface{}) + func (this *CliServer) Run() + type Config struct + func (this *Config) Get(keys ...string) string + func (this *Config) GetAll(section string) map[string]string + func (this *Config) GetBool(keys ...string) bool + func (this *Config) GetInt(keys ...string) int + func (this *Config) GetInt64(keys ...string) int64 + func (this *Config) GetJson(keys ...string) interface{} + func (this *Config) GetJsonBool(keys ...string) bool + func (this *Config) GetJsonInt(keys ...string) int + func (this *Config) GetJsonMap(keys ...string) map[string]string + func (this *Config) GetJsonMapInt(keys ...string) map[string]int + func (this *Config) GetJsonSlice(keys ...string) []string + func (this *Config) GetJsonSliceInt(keys ...string) []int + func (this *Config) GetJsonSliceMap(keys ...string) []map[string]string + func (this *Config) GetJsonString(keys ...string) string + func (this *Config) GetSlice(keys ...string) []string + func (this *Config) GetSliceInt(keys ...string) []int + func (this *Config) Init(configFile string) error + func (this *Config) Load(configFile string) error + type Error struct + Code int + Msg interface{} + func (this *Error) Error() string + func (this *Error) GetCode() int + func (this *Error) GetMessage() string + type Errorf struct + Code int + Msg interface{} + func (this *Errorf) Error() string + func (this *Errorf) GetCode() int + func (this *Errorf) GetData() map[string]interface{} + func (this *Errorf) GetMessage(langs ...string) string + type Executor interface + Exec func(query string, args ...interface{}) (sql.Result, error) + Query func(query string, args ...interface{}) (*sql.Rows, error) + QueryRow func(query string, args ...interface{}) *sql.Row + type FileLogger struct + func NewLogger(logpath, name string, level int) *FileLogger + func (this *FileLogger) Access(v ...interface{}) + func (this *FileLogger) Debug(v ...interface{}) + func (this *FileLogger) Error(v ...interface{}) + func (this *FileLogger) Info(v ...interface{}) + func (this *FileLogger) Init(logpath, logname string, loglevel int) + func (this *FileLogger) Other(logname string, v ...interface{}) + func (this *FileLogger) Warn(v ...interface{}) + type HttpClient struct + func NewHttpClient(timeouts ...int) *HttpClient + func (this *HttpClient) Get(requrl string, headers ...http.Header) (*httpResponse, error) + func (this *HttpClient) Post(requrl string, post_data interface{}, headers ...http.Header) (*httpResponse, error) + func (this *HttpClient) Request(method, requrl string, post_data interface{}, headers ...http.Header) (*httpResponse, error) + type HttpServer struct + HttpAddr string + HttpPort int + Timeout int + func NewHttpServer(addr string, port int, timout int, pprof bool) *HttpServer + func (this *HttpServer) AddController(c interface{}, group ...string) + func (this *HttpServer) Run() + type MAP = map[string]interface + type MysqlClient struct + Charset string + Database string + Debug bool + Host string + ID string + MaxIdleConns int + MaxOpenConns int + Password string + User string + func (this *MysqlClient) Begin(is_readonly bool) *MysqlClient + func (this *MysqlClient) Commit() + func (this *MysqlClient) Execute(_sql string, val ...interface{}) int + func (this *MysqlClient) FuncParam(param interface{}) string + func (this *MysqlClient) GetAll(_sql string, val ...interface{}) []map[string]interface{} + func (this *MysqlClient) GetOne(_sql string, val ...interface{}) interface{} + func (this *MysqlClient) GetRow(_sql string, val ...interface{}) map[string]interface{} + func (this *MysqlClient) Init() + func (this *MysqlClient) Insert(table string, vals map[string]interface{}) int + func (this *MysqlClient) Replace(table string, vals map[string]interface{}) int + func (this *MysqlClient) Rollback() + func (this *MysqlClient) SetDebug(open bool) + func (this *MysqlClient) Update(table string, vals map[string]interface{}, where string, val ...interface{}) int + type MysqlExplain struct + func (this *MysqlExplain) DrawConsole() + type MysqlProxy struct + func (this *MysqlProxy) Add(conf_name string) + func (this *MysqlProxy) Get(conf_name string) *MysqlClient + type RedisClient struct + Host string + Password string + Poolsize int + Timeout int + func NewRedis(conf_name string) (*RedisClient, error) + func NewRedisClient(config map[string]string) (*RedisClient, error) + func (this *RedisClient) Blpop(key string, timeout int) (val []string, err error) + func (this *RedisClient) Brpop(key string, timeout int) (val []string, err error) + func (this *RedisClient) Call(cmd string, args ...interface{}) (resp *redis.Resp, err error) + func (this *RedisClient) Decr(key string) (val int, err error) + func (this *RedisClient) Decrby(key string, increment int) (val int, err error) + func (this *RedisClient) Del(key string) (err error) + func (this *RedisClient) DelAll(keys []string) (err error) + func (this *RedisClient) Exists(key string) (bool, error) + func (this *RedisClient) Expire(key string, expire int) error + func (this *RedisClient) ExpireAt(key string, timestamp int) + func (this *RedisClient) Get(key string) (val string, err error) + func (this *RedisClient) Hdel(key, field interface{}) error + func (this *RedisClient) HdelAll(key string) + func (this *RedisClient) Hexists(key string) (bool, error) + func (this *RedisClient) Hget(key string, field interface{}) (val string, err error) + func (this *RedisClient) HgetAll(key string) (val map[string]string, err error) + func (this *RedisClient) Hincrby(key string, field interface{}, increment int) (val int, err error) + func (this *RedisClient) HincrbyFloat(key string, field interface{}, increment interface{}) (val float64, err error) + func (this *RedisClient) Hkeys(key string) (val []string, err error) + func (this *RedisClient) Hmget(key string, fields interface{}) (val []string, err error) + func (this *RedisClient) Hmset(key string, val interface{}) (err error) + func (this *RedisClient) Hscan(key string, cursor, pattern, count interface{}) (val []string, err error) + func (this *RedisClient) Hset(key string, field interface{}, val interface{}) error + func (this *RedisClient) Hsetnx(key string, field interface{}, val interface{}) (err error) + func (this *RedisClient) Incr(key string) (val int, err error) + func (this *RedisClient) Incrby(key string, increment int) (val int, err error) + func (this *RedisClient) IncrbyFloat(key string, increment interface{}) (val float64, err error) + func (this *RedisClient) Init() error + func (this *RedisClient) Keys(key string) (val []string, err error) + func (this *RedisClient) Llen(key string) (val int, err error) + func (this *RedisClient) Lpop(key string) (val string, err error) + func (this *RedisClient) Lpush(key string, val interface{}) error + func (this *RedisClient) Lrange(key string, start, stop int) (val []string, err error) + func (this *RedisClient) Mget(keys []string) (val []string, err error) + func (this *RedisClient) Rpop(key string) (val string, err error) + func (this *RedisClient) Rpush(key string, val interface{}) error + func (this *RedisClient) Sadd(key string, val interface{}) error + func (this *RedisClient) Scan(cursor, pattern, count string) (val []string, err error) + func (this *RedisClient) Scard(key string) (val int, err error) + func (this *RedisClient) Set(key string, val interface{}) error + func (this *RedisClient) Setex(key string, secs int, val interface{}) error + func (this *RedisClient) SisMember(key string, member interface{}) (bool, error) + func (this *RedisClient) Smembers(key string) (val []string, err error) + func (this *RedisClient) Spop(key, count int) (val []string, err error) + func (this *RedisClient) SrandMember(key, count int) (val []string, err error) + func (this *RedisClient) Srem(key string, member interface{}) (val int, err error) + func (this *RedisClient) Sscan(key string, cursor, pattern, count interface{}) (val []string, err error) + func (this *RedisClient) Ttl(key string) (int, error) + func (this *RedisClient) Zadd(key string, score int, val interface{}) error + func (this *RedisClient) Zcard(key string) (val int, err error) + func (this *RedisClient) Zincrby(key string, increment int, val interface{}) error + func (this *RedisClient) Zrange(key string, start, stop int, withscores bool) (val []string, err error) + func (this *RedisClient) ZrangeByScore(key string, min, max, start, step int, withscores bool) (val []string, err error) + func (this *RedisClient) ZrangeBytes(key string, start, stop int, withscores bool) (val [][]byte, err error) + func (this *RedisClient) Zrank(key string, member interface{}) (val int, err error) + func (this *RedisClient) Zrem(key string, member interface{}) (val int, err error) + func (this *RedisClient) ZremrangeByScore(key string, min, max int) (err error) + func (this *RedisClient) Zrevrange(key string, start, stop int, withscores bool) (val []string, err error) + func (this *RedisClient) ZrevrangeByScore(key string, start, step int, withscores bool) (val []string, err error) + func (this *RedisClient) ZrevrangeBytes(key string, start, stop int, withscores bool) (val [][]byte, err error) + func (this *RedisClient) Zrevrank(key string, member interface{}) (val int, err error) + func (this *RedisClient) Zscore(key string, member interface{}) (val int, err error) + type RedisProxy struct + type Restrict struct + Blacklist []string + CacheType int + Freq int + Interval int + RedisConf string + Rule string + Whitelist []string + func NewRestrict(rule string, freq, interval int) *Restrict + func (this *Restrict) Add(uniqid string) bool + func (this *Restrict) AddBlacklist(uniqid []string) + func (this *Restrict) AddWhitelist(uniqid []string) + func (this *Restrict) Check(uniqid string, update bool) bool + func (this *Restrict) Delete(uniqid string) + func (this *Restrict) Surplus(uniqid string) int + func (this *Restrict) UseRedis(conf_name string) + type RpcServer struct + Port int + Timeout int + func NewRpcServer(port int, timout int, pprof bool) *RpcServer + func (this *RpcServer) AddController(c interface{}) + func (this *RpcServer) Run()