Documentation ¶
Overview ¶
公共组件提供的服务列表 1. 把interface{}转化为map[string]string 2. 把string转化为int型 3. 模糊查找服务列表 4. 获取随机大小的字符串 5. 获取子串 6. 两个整数列表,求并集 7. 根据url,获取正则表达式字符串 例如: input: /v1/accounts/:id/invalid output: <2, :id> 8. 两个整数列表,求差积
Index ¶
- func CheckEmailPattern(str string) bool
- func CheckMobilePattern(str string) bool
- func ConvertInterfaceToMap(src interface{}) (dest map[string]interface{}, isMap bool)
- func ConvertStrToInt(str string) (result int)
- func FindServer(server string, servers []string) (name string, exist bool)
- func GetCompanyIdFromHeader(input *http.Request) (companyId int, retCode int, err error)
- func GetCompanyNameFromHeader(input *http.Request) (companyName string, retCode int, err error)
- func GetDiffsInt(src []int, minuend []int) (dest []int)
- func GetEarliestDate(now *time.Time) (ret time.Time, err error)
- func GetRandomString(size int) string
- func GetRegexpPairByUrl(url string) (position int, regTarget string)
- func GetUnionByInts(slice1 []int, slice2 []int) (dest []int)
- func GetUserCodeFromHeader(input *http.Request) (userCode string, retCode int, err error)
- func GetUserIdFromHeader(input *http.Request) (userId int, retCode int, err error)
- func GetUserIdFromSessionStore(userIdKey string, sess *session.Store) (userId int, retCode int, err error)
- func GetUserMobileFromHeader(input *http.Request) (userMobile string, retCode int, err error)
- func GetUserNameFromHeader(input *http.Request) (userName string, retCode int, err error)
- func Md5String(str string) (md5Str string)
- func SubString(str string, begin, length int) (substr string)
- type HeaderParamInfo
- type HeaderUser
- type HeaderUserConf
- type HeaderUserPosition
- type RedisV5Client
- func (s *RedisV5Client) Conn() (err error)
- func (s *RedisV5Client) Del(key string) (err error)
- func (s *RedisV5Client) DelKeys(keys []string) (err error)
- func (s *RedisV5Client) Get(key string) (value string, err error)
- func (s *RedisV5Client) Keys(pattern string) (keys []string, err error)
- func (s *RedisV5Client) SAdd(key string, members ...interface{}) (err error)
- func (s *RedisV5Client) SIsMember(key string, member interface{}) (boolCmd *redis.BoolCmd)
- func (s *RedisV5Client) SRem(key string, members ...interface{}) (err error)
- func (s *RedisV5Client) Set(key string, value interface{}, expiration time.Duration) (err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckEmailPattern ¶
func CheckMobilePattern ¶
func ConvertInterfaceToMap ¶
interface{} 转化为 map
func ConvertStrToInt ¶
func FindServer ¶
readme 通用处理方法列表 * 1. 获取Http请求头header部分的user_id和company_id * 2 读取服务
func GetCompanyIdFromHeader ¶
func GetDiffsInt ¶
8. 两个整数列表,求差积 param src=减数 param minuend=被减数
func GetRegexpPairByUrl ¶
7. 根据url,获取正则表达式字符串 例如: input: /v1/accounts/:id/invalid output: <2, :id>
func GetUserCodeFromHeader ¶
func GetUserIdFromHeader ¶
func GetUserMobileFromHeader ¶
func GetUserNameFromHeader ¶
Types ¶
type HeaderParamInfo ¶
func GetHeaderParams ¶
func GetHeaderParams(input *http.Request) (headerParamInfo *HeaderParamInfo, retcode int, err error)
type HeaderUser ¶
type HeaderUser struct { UserId int UserName string UserCode string UserMobile string CompanyId int CompanyName string Positions []*HeaderUserPosition // string format: id1,code1,name1;id2,code2,name2;id3,code3,name3 }
func GetUserFromHeader ¶
func GetUserFromHeader(input *http.Request) (headerUser HeaderUser, retCode int, err error)
type HeaderUserConf ¶
type HeaderUserPosition ¶
func GetPositionsFromHeader ¶
func GetPositionsFromHeader(input *http.Request) (positions []*HeaderUserPosition, retCode int, err error)
type RedisV5Client ¶
func (*RedisV5Client) Conn ¶
func (s *RedisV5Client) Conn() (err error)
func (*RedisV5Client) Del ¶
func (s *RedisV5Client) Del(key string) (err error)
func (*RedisV5Client) DelKeys ¶
func (s *RedisV5Client) DelKeys(keys []string) (err error)
func (*RedisV5Client) Keys ¶
func (s *RedisV5Client) Keys(pattern string) (keys []string, err error)
func (*RedisV5Client) SAdd ¶
func (s *RedisV5Client) SAdd(key string, members ...interface{}) (err error)
func (*RedisV5Client) SIsMember ¶
func (s *RedisV5Client) SIsMember(key string, member interface{}) (boolCmd *redis.BoolCmd)
func (*RedisV5Client) SRem ¶
func (s *RedisV5Client) SRem(key string, members ...interface{}) (err error)
Click to show internal directories.
Click to hide internal directories.