Documentation
¶
Index ¶
- Constants
- Variables
- func DELETE(ctx context.Context, url, token string, body interface{}, ...) ([]byte, error)
- func GET(ctx context.Context, url, token string, body interface{}, ...) ([]byte, error)
- func POST(ctx context.Context, url, token string, body interface{}, ...) ([]byte, error)
- func PUT(ctx context.Context, url, token string, body interface{}, ...) ([]byte, error)
- func Sign(secret string, timestamp int64) (string, error)
- type Config
- type Content
- type EtcdConfig
- type Hash
- type LarkBot
- type MySQLConfig
- type RedisConfig
- type ReporterConfig
- type Response
- type RestyClient
- func (r *RestyClient) DELETE(ctx context.Context, url, token string, body interface{}, ...) ([]byte, error)
- func (r *RestyClient) GET(ctx context.Context, url, token string, body interface{}, ...) ([]byte, error)
- func (r *RestyClient) POST(ctx context.Context, url, token string, body interface{}, ...) ([]byte, error)
- func (r *RestyClient) PUT(ctx context.Context, url, token string, body interface{}, ...) ([]byte, error)
- type ServerConfig
- type StorageConfig
- type StorageType
- type TextMessage
Constants ¶
View Source
const ( MinUserId = int64(0) MaxUserId = int64(math.MaxInt32) DoNotChangeHash = 512 DoNotChangeStep = 10 * 10000 RegSectNum = 5 RoutingSectNum = 6 )
View Source
const ( MaxRetryNum = 3 RetryInterval = time.Millisecond * 250 )
Variables ¶
View Source
var ( ErrInvalidParameter = errors.New("invalid parameter") ErrNoRoutingFound = errors.New("no routing found") ErrSectionNotReady = errors.New("section not ready") ErrAllocExists = errors.New("alloc exists") ErrUnexpectedRules = errors.New("unexpected rules") ErrAllocNotReady = errors.New("alloc not ready") )
Functions ¶
Types ¶
type Config ¶
type Config struct {
Server *ServerConfig `json:"server,omitempty" yaml:"server"`
Storage *StorageConfig `json:"storage,omitempty" yaml:"storage"`
Reporter *ReporterConfig `json:"reporter,omitempty" yaml:"reporter"`
}
func NewTestConfig ¶
func NewTestConfig() *Config
func (*Config) GetMySQLSource ¶
func (*Config) GetType ¶
func (c *Config) GetType() StorageType
type EtcdConfig ¶
type LarkBot ¶
type LarkBot struct {
*RestyClient
// contains filtered or unexported fields
}
type MySQLConfig ¶
type MySQLConfig struct {
Host string `json:"host,omitempty" yaml:"host"`
Port int `json:"port,omitempty" yaml:"port"`
Protocol string `json:"protocol,omitempty" yaml:"protocol"`
Database string `json:"database,omitempty" yaml:"database"`
Username string `json:"username,omitempty" yaml:"username"`
Password string `json:"password,omitempty" yaml:"password"`
Charset string `json:"charset,omitempty" yaml:"charset"`
PingInterval int `json:"ping_interval,omitempty" yaml:"ping_interval"`
MaxIdleConn int `json:"max_idle_conn,omitempty" yaml:"max_idle_conn"`
MaxOpenConn int `json:"max_open_conn,omitempty" yaml:"max_open_conn"`
}
type RedisConfig ¶
type RedisConfig struct {
Network string `json:"network,omitempty" yaml:"network"`
Addr string `json:"addr,omitempty" yaml:"addr"`
Username string `json:"username,omitempty" yaml:"username"`
Password string `json:"password,omitempty" yaml:"password"`
Database int `json:"database,omitempty" yaml:"database"`
KeyPrefix string `json:"key_prefix,omitempty" yaml:"key_prefix"`
}
type ReporterConfig ¶
type RestyClient ¶
type RestyClient struct {
// contains filtered or unexported fields
}
func NewRestyClient ¶
func NewRestyClient(hc *http.Client) (*RestyClient, error)
type ServerConfig ¶
type StorageConfig ¶
type StorageConfig struct {
Type StorageType `json:"type,omitempty" yaml:"type"`
Redis *RedisConfig `json:"redis,omitempty" yaml:"redis"`
MySQL *MySQLConfig `json:"mysql,omitempty" yaml:"mysql"`
Etcd *EtcdConfig `json:"etcd,omitempty" yaml:"etcd"`
}
type StorageType ¶
type StorageType int
const ( TypeRedis StorageType = 1 TypeMysql StorageType = 2 )
Click to show internal directories.
Click to hide internal directories.