Documentation ¶
Index ¶
- Constants
- Variables
- func AddSupportEnvs(env EnvType, name string) bool
- func Auth()
- func BuilderRedisConnectionLink(properties RedisProperties) string
- func CreateRedisClient(name string) Base.IRedisClient
- func CreateToken(data Jwt.Claims, signKeys ...string) string
- func CreateTokenDataMap(data map[string]interface{}, Standards ...Jwt.StandardClaims) Jwt.Claims
- func CrossDomain(ctx iris.Context)
- func DecodeToken(t string, v interface{}, signKey ...string) bool
- func EqualPassword(userPassword string, hashed string) bool
- func GetSupportEnvMap() map[string]string
- func IsInSupport(env EnvType) bool
- func NewConfigure(instance ...kvs.ConfigSource) Base.IConfiguration
- func NewCustomError(msg string, code int, tyName string, parent ...error) Base.ErrorInstance
- func NewError(code int, msg string, parent ...error) Base.ErrorInstance
- func RedisDial(properties RedisProperties) (redis.Conn, error)
- func ServerHttpHeader(ctx iris.Context)
- type ConfigureWrapper
- func (c *ConfigureWrapper) Create() interface{}
- func (c *ConfigureWrapper) Durations(key string) []time.Duration
- func (c *ConfigureWrapper) Float64s(key string) []float64
- func (c *ConfigureWrapper) Get(key string) (string, error)
- func (c *ConfigureWrapper) GetBool(key string) (bool, error)
- func (c *ConfigureWrapper) GetBoolDefault(key string, defaultValue bool) bool
- func (c *ConfigureWrapper) GetDefault(key string, defaultValue string) string
- func (c *ConfigureWrapper) GetDuration(key string) (time.Duration, error)
- func (c *ConfigureWrapper) GetDurationDefault(key string, defaultValue time.Duration) time.Duration
- func (c *ConfigureWrapper) GetFloat64(key string) (float64, error)
- func (c *ConfigureWrapper) GetFloat64Default(key string, defaultValue float64) float64
- func (c *ConfigureWrapper) GetInt(key string) (int, error)
- func (c *ConfigureWrapper) GetIntDefault(key string, defaultValue int) int
- func (c *ConfigureWrapper) Ints(key string) []int
- func (c *ConfigureWrapper) Keys() []string
- func (c *ConfigureWrapper) Prefix(prefix string, withOutPrefix ...bool) Base.ConfigureFace
- func (c *ConfigureWrapper) Set(key string, value string)
- func (c *ConfigureWrapper) SetAll(data map[string]string)
- func (c *ConfigureWrapper) Strings(key string) []string
- func (c *ConfigureWrapper) Unmarshal(t interface{}) error
- type CustomError
- func (c *CustomError) Code() int
- func (c *CustomError) Error() string
- func (c *CustomError) ErrorType() string
- func (c *CustomError) Message() string
- func (c *CustomError) New(msg string, code int, parent ...error) error
- func (c *CustomError) Set(key string, value interface{}) Base.ErrorInstance
- func (c *CustomError) TraceString() string
- func (c *CustomError) Traces() []string
- type EnvType
- type IDataModel
- type OriginDomainFilterHandler
- type OriginDomainHandler
- type PasswordByte
- type PasswordStr
- func (str PasswordStr) Equal(stPass PasswordStr) bool
- func (str PasswordStr) Equals(stPass string) bool
- func (str PasswordStr) New(pass string, cost ...int) (PasswordStr, bool)
- func (str PasswordStr) ToByte() []byte
- func (str PasswordStr) ToPasswordByte() PasswordByte
- func (str PasswordStr) ToString() string
- type RedisClient
- func (client *RedisClient) Close()
- func (client *RedisClient) Command(command string, args ...interface{}) (interface{}, error)
- func (client *RedisClient) Del(key string)
- func (client *RedisClient) Exists(key string) bool
- func (client *RedisClient) Get(key string) (string, error)
- func (client *RedisClient) GetConn() redis.Conn
- func (client *RedisClient) GetInt(key string) (int, error)
- func (client *RedisClient) HGet(key string, field string) (string, error)
- func (client *RedisClient) HGetAll(key string) (map[string]string, error)
- func (client *RedisClient) HSet(key string, hash map[string]string)
- func (client *RedisClient) Set(key string, value string)
- func (client *RedisClient) SetConn(conn redis.Conn) *RedisClient
- func (client *RedisClient) Setex(key string, value string, expire time.Duration)
- type RedisProperties
- type RedisProps
- func (props *RedisProps) GetAddr() net.Addr
- func (props *RedisProps) GetDataBase() int
- func (props *RedisProps) GetDial() func(network, addr string) (net.Conn, error)
- func (props *RedisProps) GetDialer() *net.Dialer
- func (props *RedisProps) GetPassword() string
- func (props *RedisProps) GetReadTimeOut() time.Duration
- func (props *RedisProps) GetSkipVerify() bool
- func (props *RedisProps) GetTlsConf() *tls.Config
- func (props *RedisProps) GetTlsOn() bool
- func (props *RedisProps) GetWriteTimeOut() time.Duration
- func (props *RedisProps) Options() []redis.DialOption
- func (props *RedisProps) SetAddr(network string, addr string, port ...int) RedisProperties
- func (props *RedisProps) SetDial(handler func(network, addr string) (net.Conn, error)) RedisProperties
- func (props *RedisProps) SetDialer(dialer *net.Dialer) RedisProperties
- func (props *RedisProps) SetPassword(pass string) RedisProperties
- func (props *RedisProps) SetReadTimeOut(rd time.Duration) RedisProperties
- func (props *RedisProps) SetSkipVerify(on bool) RedisProperties
- func (props *RedisProps) SetTlsConf(config *tls.Config) RedisProperties
- func (props *RedisProps) SetTlsOn(on bool) RedisProperties
- func (props *RedisProps) SetWriteTimeOut(wd time.Duration) RedisProperties
- func (props *RedisProps) UseDataBase(number int) RedisProperties
Constants ¶
View Source
const ( All = `*` True = `true` Dot = "," Nil = "" HeaderHost = "Host" LocalHost = "localhost" // 跨域 头部 HeaderAllowedOriginsKey = "AllowedOrigins" HeaderAllowedHeadersKey = "AllowedHeaders" HeaderAllowedMethodsKey = "AllowedMethods" HeaderAllowCredentialsKey = "AllowCredentials" // 跨域 默认值 DefaultAllowOrigins = All DefaultAllowCredentials = True DefaultAllowHeaders = All DefaultAllMethods = `HEAD, GET, POST, PUT, PATCH, DELETE` // 跨域 可配置 key CrossDomainAllowedIpConfKey = "system.http.crossDomain.allowedIp" CrossDomainAllowedOriginsConfKey = "system.http.crossDomain.allowedOrigins" CrossDomainAllowedHeadersConfKey = "system.http.crossDomain.allowedHeaders" CrossDomainAllowedMethodsConfKey = "system.http.crossDomain.allowedMethods" CrossDomainAllowCredentialsConfKey = "system.http.crossDomain.allowCredentials" // 自定义的处理器 CrossDomainAllowedIpFilterIdConfKey = "system.http.crossDomain.allowedIpFilter" CrossDomainAllowedOriginsFilterIdConfKey = "system.http.crossDomain.allowedOriginsFilter" CrossDomainAllowedMethodsFilterIdConfKey = "system.http.crossDomain.allowedMethodsFilter" CrossDomainAllowedHeadersFilterIdConfKey = "system.http.crossDomain.allowedHeadersFilter" )
View Source
const ( ServerNameKey = "server" ServerVersionKey = "server-version" DefSystemServerVersion = "1.0.0" DefSystemServerHost = "golang-iris" SystemServerHostConfKey = "system.server.host" SystemServerVersionConfKey = "system.server.version" )
View Source
const RedisConfPrefixKey = "redis"
View Source
const RedisDefaultConnKey = "redis.default"
View Source
const RedisDefaultTcpNetWork = "tcp"
View Source
const RedisNetWorkConfKey = "network"
Variables ¶
View Source
var NilPassByte = ByteToPassword([]byte(""))
View Source
var NilPassStr = StrToPassword("")
Functions ¶
func BuilderRedisConnectionLink ¶
func BuilderRedisConnectionLink(properties RedisProperties) string
func CreateRedisClient ¶
func CreateRedisClient(name string) Base.IRedisClient
func CreateTokenDataMap ¶
func CreateTokenDataMap(data map[string]interface{}, Standards ...Jwt.StandardClaims) Jwt.Claims
func DecodeToken ¶
func NewConfigure ¶
func NewConfigure(instance ...kvs.ConfigSource) Base.IConfiguration
func NewCustomError ¶
func ServerHttpHeader ¶
func ServerHttpHeader(ctx iris.Context)
Types ¶
type ConfigureWrapper ¶
type ConfigureWrapper struct {
// contains filtered or unexported fields
}
func (*ConfigureWrapper) Create ¶
func (c *ConfigureWrapper) Create() interface{}
func (*ConfigureWrapper) Durations ¶
func (c *ConfigureWrapper) Durations(key string) []time.Duration
func (*ConfigureWrapper) Float64s ¶
func (c *ConfigureWrapper) Float64s(key string) []float64
func (*ConfigureWrapper) GetBoolDefault ¶
func (c *ConfigureWrapper) GetBoolDefault(key string, defaultValue bool) bool
func (*ConfigureWrapper) GetDefault ¶
func (c *ConfigureWrapper) GetDefault(key string, defaultValue string) string
func (*ConfigureWrapper) GetDuration ¶
func (c *ConfigureWrapper) GetDuration(key string) (time.Duration, error)
func (*ConfigureWrapper) GetDurationDefault ¶
func (*ConfigureWrapper) GetFloat64 ¶
func (c *ConfigureWrapper) GetFloat64(key string) (float64, error)
func (*ConfigureWrapper) GetFloat64Default ¶
func (c *ConfigureWrapper) GetFloat64Default(key string, defaultValue float64) float64
func (*ConfigureWrapper) GetIntDefault ¶
func (c *ConfigureWrapper) GetIntDefault(key string, defaultValue int) int
func (*ConfigureWrapper) Ints ¶
func (c *ConfigureWrapper) Ints(key string) []int
func (*ConfigureWrapper) Keys ¶
func (c *ConfigureWrapper) Keys() []string
func (*ConfigureWrapper) Prefix ¶
func (c *ConfigureWrapper) Prefix(prefix string, withOutPrefix ...bool) Base.ConfigureFace
func (*ConfigureWrapper) Set ¶
func (c *ConfigureWrapper) Set(key string, value string)
func (*ConfigureWrapper) SetAll ¶
func (c *ConfigureWrapper) SetAll(data map[string]string)
func (*ConfigureWrapper) Strings ¶
func (c *ConfigureWrapper) Strings(key string) []string
func (*ConfigureWrapper) Unmarshal ¶
func (c *ConfigureWrapper) Unmarshal(t interface{}) error
type CustomError ¶
自定义
func (*CustomError) Code ¶
func (c *CustomError) Code() int
func (*CustomError) Error ¶
func (c *CustomError) Error() string
func (*CustomError) ErrorType ¶
func (c *CustomError) ErrorType() string
func (*CustomError) Message ¶
func (c *CustomError) Message() string
func (*CustomError) Set ¶
func (c *CustomError) Set(key string, value interface{}) Base.ErrorInstance
func (*CustomError) TraceString ¶
func (c *CustomError) TraceString() string
func (*CustomError) Traces ¶
func (c *CustomError) Traces() []string
type IDataModel ¶
type IDataModel interface {
Connection(name ...string) starters.IDataBaseConnector
}
type PasswordByte ¶
type PasswordByte []byte
func ByteToPassword ¶
func ByteToPassword(by []byte) PasswordByte
func Password ¶
func Password(userPassword string, cost ...int) (PasswordByte, bool)
GeneratePassword 给密码就行加密操作
func (PasswordByte) Equal ¶
func (b PasswordByte) Equal(stPass PasswordByte) bool
func (PasswordByte) Equals ¶
func (b PasswordByte) Equals(stPass string) bool
func (PasswordByte) New ¶
func (b PasswordByte) New(pass []byte, cost ...int) (PasswordByte, bool)
func (PasswordByte) ToPasswordStr ¶
func (b PasswordByte) ToPasswordStr() PasswordStr
func (PasswordByte) ToString ¶
func (b PasswordByte) ToString() string
type PasswordStr ¶
type PasswordStr string
func StrToPassword ¶
func StrToPassword(str string) PasswordStr
func (PasswordStr) Equal ¶
func (str PasswordStr) Equal(stPass PasswordStr) bool
func (PasswordStr) Equals ¶
func (str PasswordStr) Equals(stPass string) bool
func (PasswordStr) New ¶
func (str PasswordStr) New(pass string, cost ...int) (PasswordStr, bool)
func (PasswordStr) ToByte ¶
func (str PasswordStr) ToByte() []byte
func (PasswordStr) ToPasswordByte ¶
func (str PasswordStr) ToPasswordByte() PasswordByte
func (PasswordStr) ToString ¶
func (str PasswordStr) ToString() string
type RedisClient ¶
type RedisClient struct { Properties RedisProperties // contains filtered or unexported fields }
func NewRedisClient ¶
func NewRedisClient(conn redis.Conn, properties RedisProperties) *RedisClient
func (*RedisClient) Close ¶
func (client *RedisClient) Close()
func (*RedisClient) Command ¶
func (client *RedisClient) Command(command string, args ...interface{}) (interface{}, error)
func (*RedisClient) Del ¶
func (client *RedisClient) Del(key string)
func (*RedisClient) Exists ¶
func (client *RedisClient) Exists(key string) bool
func (*RedisClient) GetConn ¶
func (client *RedisClient) GetConn() redis.Conn
func (*RedisClient) HGet ¶
func (client *RedisClient) HGet(key string, field string) (string, error)
func (*RedisClient) HGetAll ¶
func (client *RedisClient) HGetAll(key string) (map[string]string, error)
func (*RedisClient) Set ¶
func (client *RedisClient) Set(key string, value string)
func (*RedisClient) SetConn ¶
func (client *RedisClient) SetConn(conn redis.Conn) *RedisClient
type RedisProperties ¶
type RedisProperties interface { GetAddr() net.Addr GetTlsOn() bool SetTlsOn(bool) RedisProperties GetTlsConf() *tls.Config SetTlsConf(config *tls.Config) RedisProperties GetDataBase() int UseDataBase(number int) RedisProperties GetDialer() *net.Dialer SetDialer(dialer *net.Dialer) RedisProperties SetReadTimeOut(rd time.Duration) RedisProperties GetReadTimeOut() time.Duration SetWriteTimeOut(wd time.Duration) RedisProperties GetWriteTimeOut() time.Duration GetPassword() string SetPassword(string) RedisProperties GetSkipVerify() bool SetSkipVerify(bool) RedisProperties GetDial() func(network, addr string) (net.Conn, error) SetAddr(network string, addr string, port ...int) RedisProperties Options() []redis.DialOption SetDial(handler func(network, addr string) (net.Conn, error)) RedisProperties }
func BuilderRedisProperties ¶
func BuilderRedisProperties(conf Base.IConfiguration) RedisProperties
type RedisProps ¶
type RedisProps struct {
// contains filtered or unexported fields
}
func (*RedisProps) GetAddr ¶
func (props *RedisProps) GetAddr() net.Addr
func (*RedisProps) GetDataBase ¶
func (props *RedisProps) GetDataBase() int
func (*RedisProps) GetDial ¶
func (props *RedisProps) GetDial() func(network, addr string) (net.Conn, error)
func (*RedisProps) GetDialer ¶
func (props *RedisProps) GetDialer() *net.Dialer
func (*RedisProps) GetPassword ¶
func (props *RedisProps) GetPassword() string
func (*RedisProps) GetReadTimeOut ¶
func (props *RedisProps) GetReadTimeOut() time.Duration
func (*RedisProps) GetSkipVerify ¶
func (props *RedisProps) GetSkipVerify() bool
func (*RedisProps) GetTlsConf ¶
func (props *RedisProps) GetTlsConf() *tls.Config
func (*RedisProps) GetTlsOn ¶
func (props *RedisProps) GetTlsOn() bool
func (*RedisProps) GetWriteTimeOut ¶
func (props *RedisProps) GetWriteTimeOut() time.Duration
func (*RedisProps) Options ¶
func (props *RedisProps) Options() []redis.DialOption
func (*RedisProps) SetAddr ¶
func (props *RedisProps) SetAddr(network string, addr string, port ...int) RedisProperties
func (*RedisProps) SetDial ¶
func (props *RedisProps) SetDial(handler func(network, addr string) (net.Conn, error)) RedisProperties
func (*RedisProps) SetDialer ¶
func (props *RedisProps) SetDialer(dialer *net.Dialer) RedisProperties
func (*RedisProps) SetPassword ¶
func (props *RedisProps) SetPassword(pass string) RedisProperties
func (*RedisProps) SetReadTimeOut ¶
func (props *RedisProps) SetReadTimeOut(rd time.Duration) RedisProperties
func (*RedisProps) SetSkipVerify ¶
func (props *RedisProps) SetSkipVerify(on bool) RedisProperties
func (*RedisProps) SetTlsConf ¶
func (props *RedisProps) SetTlsConf(config *tls.Config) RedisProperties
func (*RedisProps) SetTlsOn ¶
func (props *RedisProps) SetTlsOn(on bool) RedisProperties
func (*RedisProps) SetWriteTimeOut ¶
func (props *RedisProps) SetWriteTimeOut(wd time.Duration) RedisProperties
func (*RedisProps) UseDataBase ¶
func (props *RedisProps) UseDataBase(number int) RedisProperties
Click to show internal directories.
Click to hide internal directories.