Documentation ¶
Index ¶
- Variables
- func Setup(s source.Source, fs ...func())
- type AliyunAudit
- type AliyunFile
- type AliyunSms
- type Amap
- type Amqp
- type Application
- type BlockChain
- type BrokerConnectOptions
- type Cache
- type Config
- type DBResolverConfig
- type Database
- type FileStore
- type Gen
- type HuaweiAudit
- type HuaweiFile
- type Jwt
- type Lbs
- type Locker
- type Logger
- type Mail
- type Moderation
- type NSQOptions
- type Payment
- type Queue
- type QueueMemory
- type QueueNSQ
- type QueueRedis
- type Rabbit
- type RedisConnectOptions
- type Rocket
- type Secret
- type Settings
- type Sms
- type SmtpConnectOptions
- type Ssl
- type TencentAudit
- type TencentFile
- type TencentSms
- type Tls
- type WeChat
- type WeChatOption
- type WeChatPayOption
Constants ¶
This section is empty.
Variables ¶
View Source
var AmqpConfig = new(Amqp)
View Source
var ApplicationConfig = new(Application)
View Source
var BlockChainConfig = new(BlockChain)
View Source
var CacheConfig = new(Cache)
CacheConfig cache配置
View Source
var (
ExtendConfig interface{}
)
View Source
var FileStoreConfig = new(FileStore)
View Source
var GenConfig = new(Gen)
View Source
var JwtConfig = new(Jwt)
View Source
var LbsConfig = new(Lbs)
View Source
var LockerConfig = new(Locker)
View Source
var LoggerConfig = new(Logger)
View Source
var MailConfig = new(Mail)
View Source
var ModerationConfig = new(Moderation)
View Source
var PaymentConfig = new(Payment)
View Source
var QueueConfig = new(Queue)
View Source
var SecretConfig = new(Secret)
View Source
var SmsConfig = new(Sms)
View Source
var SslConfig = new(Ssl)
View Source
var WeChatConfig = new(WeChat)
Functions ¶
Types ¶
type AliyunAudit ¶ added in v1.4.11
type AliyunFile ¶ added in v1.4.11
type Application ¶
type Application struct { Mode string `json:"mode,omitempty" yaml:"mode"` Name string `json:"name,omitempty" yaml:"name"` Host string `json:"host,omitempty" yaml:"host"` Port int `json:"port,omitempty" yaml:"port"` JwtSecret string `json:"jwt_secret,omitempty" yaml:"jwt_secret"` ReadTimeout int `json:"read_timeout,omitempty" yaml:"read_timeout"` WriterTimeout int `json:"writer_timeout,omitempty" yaml:"writer_timeout"` EnableDP bool `json:"enabled_data_permission,omitempty" yaml:"enabled_data_permission"` DemoMessage string `json:"demo_message,omitempty" yaml:"demo_message"` }
type BlockChain ¶ added in v1.3.30
type BlockChain struct {
Broker *BrokerConnectOptions
}
type BrokerConnectOptions ¶ added in v1.3.30
type Cache ¶
type Cache struct { Redis *RedisConnectOptions `json:"redis" yaml:"redis"` Memory interface{} }
func (Cache) Setup ¶
func (e Cache) Setup() storage.AdapterCache
Setup 构造cache 顺序 redis > 其他 > memory
type Config ¶
type Config struct { Application *Application `json:"application" yaml:"application"` Secret *Secret `json:"secret" yaml:"secret"` Ssl *Ssl `json:"ssl" yaml:"ssl"` Logger *Logger `json:"logger" yaml:"logger"` Jwt *Jwt `json:"jwt" yaml:"jwt"` Database *Database `json:"database" yaml:"database"` Databases *map[string]*Database `json:"databases" yaml:"databases"` Gen *Gen `json:"gen" yaml:"gen"` Cache *Cache `json:"cache" yaml:"cache"` Queue *Queue `json:"queue" yaml:"queue"` Locker *Locker `json:"locker" yaml:"locker"` Lbs *Lbs `json:"lbs,omitempty" yaml:"lbs"` FileStore *FileStore `json:"file_store,omitempty" yaml:"file_store"` Moderation *Moderation `json:"moderation,omitempty" yaml:"moderation"` Sms *Sms `json:"sms,omitempty" yaml:"sms"` Mail *Mail `json:"mail" yaml:"mail"` Amqp *Amqp `json:"mq,omitempty" yaml:"mq"` WeChat *WeChat `json:"wechat,omitempty" yaml:"wechat"` Payment *Payment `json:"payment,omitempty" yaml:"payment"` Extend interface{} `json:"extend" yaml:"extend"` }
Config 配置集合
type DBResolverConfig ¶
type Database ¶
type Database struct { Driver string `json:"driver,omitempty" yaml:"driver"` Source string `json:"source,omitempty" yaml:"source"` ConnMaxIdleTime int `json:"conn_max_idle_time,omitempty" yaml:"conn_max_idle_time"` ConnMaxLifetime int `json:"conn_max_lifetime,omitempty" yaml:"conn_max_lifetime"` MaxIdleConns int `json:"max_idle_conns,omitempty" yaml:"max_idle_conns"` MaxOpenConns int `json:"max_open_conns,omitempty" yaml:"max_open_conns"` Registers []DBResolverConfig `json:"registers,omitempty" yaml:"registers"` }
type FileStore ¶ added in v1.3.30
type FileStore struct { Tencent *TencentFile `json:"tencent" yaml:"tencent"` Aliyun *AliyunFile `json:"aliyun" yaml:"aliyun"` Huawei *HuaweiFile `json:"huawei" yaml:"huawei"` }
type HuaweiAudit ¶ added in v1.4.11
type HuaweiFile ¶ added in v1.4.11
type Locker ¶
type Locker struct {
Redis *RedisConnectOptions `json:"redis" yaml:"redis"`
}
type Logger ¶
type Logger struct { Type string `json:"type,omitempty" yaml:"type"` Path string `json:"path,omitempty" yaml:"path"` Level string `json:"level,omitempty" yaml:"level"` Stdout string `json:"stdout,omitempty" yaml:"stdout"` EnabledDB bool `json:"enabled_db,omitempty" yaml:"enabled_db"` Cap uint `json:"cap,omitempty" yaml:"cap"` }
type Mail ¶ added in v1.3.30
type Mail struct {
Smtp *SmtpConnectOptions `json:"smtp" yaml:"smtp"`
}
type Moderation ¶ added in v1.4.11
type Moderation struct { Tencent *TencentAudit `json:"tencent" yaml:"tencent"` Aliyun *AliyunAudit `json:"aliyun" yaml:"aliyun"` Huawei *HuaweiAudit `json:"huawei" yaml:"huawei"` }
type NSQOptions ¶
type NSQOptions struct { DialTimeout time.Duration `opt:"dial_timeout" default:"1s"` // Deadlines for network reads and writes ReadTimeout time.Duration `opt:"read_timeout" min:"100ms" max:"5m" default:"60s"` WriteTimeout time.Duration `opt:"write_timeout" min:"100ms" max:"5m" default:"1s"` // Addresses is the local address to use when dialing an nsqd. Addresses []string `opt:"addresses"` // Duration between polling lookupd for new producers, and fractional jitter to add to // the lookupd pool loop. this helps evenly distribute requests even if multiple consumers // restart at the same time // // NOTE: when not using nsqlookupd, LookupdPollInterval represents the duration of time between // reconnection attempts LookupdPollInterval time.Duration `opt:"lookupd_poll_interval" min:"10ms" max:"5m" default:"60s"` LookupdPollJitter float64 `opt:"lookupd_poll_jitter" min:"0" max:"1" default:"0.3"` // Maximum duration when REQueueing (for doubling of deferred requeue) MaxRequeueDelay time.Duration `opt:"max_requeue_delay" min:"0" max:"60m" default:"15m"` DefaultRequeueDelay time.Duration `opt:"default_requeue_delay" min:"0" max:"60m" default:"90s"` // Maximum amount of time to backoff when processing fails 0 == no backoff MaxBackoffDuration time.Duration `opt:"max_backoff_duration" min:"0" max:"60m" default:"2m"` // Unit of time for calculating consumer backoff BackoffMultiplier time.Duration `opt:"backoff_multiplier" min:"0" max:"60m" default:"1s"` // Maximum number of times this consumer will attempt to process a message before giving up MaxAttempts uint16 `opt:"max_attempts" min:"0" max:"65535" default:"5"` // Duration to wait for a message from an nsqd when in a state where RDY // counts are re-distributed (e.g. max_in_flight < num_producers) LowRdyIdleTimeout time.Duration `opt:"low_rdy_idle_timeout" min:"1s" max:"5m" default:"10s"` // Duration to wait until redistributing RDY for an nsqd regardless of LowRdyIdleTimeout LowRdyTimeout time.Duration `opt:"low_rdy_timeout" min:"1s" max:"5m" default:"30s"` // Duration between redistributing max-in-flight to connections RDYRedistributeInterval time.Duration `opt:"rdy_redistribute_interval" min:"1ms" max:"5s" default:"5s"` // Identifiers sent to nsqd representing this client // UserAgent is in the spirit of HTTP (default: "<client_library_name>/<version>") ClientID string `opt:"client_id"` // (defaults: short hostname) Hostname string `opt:"hostname"` UserAgent string `opt:"user_agent"` // Duration of time between heartbeats. This must be less than ReadTimeout HeartbeatInterval time.Duration `opt:"heartbeat_interval" default:"30s"` // Integer percentage to sample the channel (requires nsqd 0.2.25+) SampleRate int32 `opt:"sample_rate" min:"0" max:"99"` Tls *Tls `yaml:"tls" json:"tls"` // Compression Settings Deflate bool `opt:"deflate"` DeflateLevel int `opt:"deflate_level" min:"1" max:"9" default:"6"` Snappy bool `opt:"snappy"` // Size of the buffer (in bytes) used by nsqd for buffering writes to this connection OutputBufferSize int64 `opt:"output_buffer_size" default:"16384"` // Timeout used by nsqd before flushing buffered writes (set to 0 to disable). // // WARNING: configuring clients with an extremely low // (< 25ms) output_buffer_timeout has a significant effect // on nsqd CPU usage (particularly with > 50 clients connected). OutputBufferTimeout time.Duration `opt:"output_buffer_timeout" default:"250ms"` // Maximum number of messages to allow in flight (concurrency knob) MaxInFlight int `opt:"max_in_flight" min:"0" default:"1"` // The server-side message timeout for messages delivered to this client MsgTimeout time.Duration `opt:"msg_timeout" min:"0"` // secret for nsqd authentication (requires nsqd 0.2.29+) AuthSecret string `opt:"auth_secret"` }
func (NSQOptions) GetNSQOptions ¶
func (e NSQOptions) GetNSQOptions() (*nsq.Config, error)
type Payment ¶ added in v1.4.9
type Payment struct {
WeChatPay *WeChatPayOption `yaml:"wechat" json:"wechat"`
}
type Queue ¶
type Queue struct { Redis *QueueRedis `json:"redis" yaml:"redis"` Memory *QueueMemory `json:"memory" yaml:"memory"` NSQ *QueueNSQ `json:"nsq" yaml:"nsq"` }
type QueueMemory ¶
type QueueMemory struct {
PoolSize uint `json:"pool_size" yaml:"pool_size"`
}
type QueueNSQ ¶
type QueueNSQ struct { NSQOptions ChannelPrefix string `json:"channel_prefix" yaml:"channel_prefix"` }
type QueueRedis ¶
type QueueRedis struct { RedisConnectOptions Producer *redisqueue.ProducerOptions Consumer *redisqueue.ConsumerOptions }
type RedisConnectOptions ¶
type RedisConnectOptions struct { Network string `yaml:"network" json:"network"` Addr string `yaml:"addr" json:"addr"` Username string `yaml:"username" json:"username"` Password string `yaml:"password" json:"password"` DB int `yaml:"db" json:"db"` PoolSize int `yaml:"pool_size" json:"pool_size"` Tls *Tls `yaml:"tls" json:"tls"` MaxRetries int `yaml:"max_retries" json:"max_retries"` }
func (RedisConnectOptions) GetRedisOptions ¶
func (e RedisConnectOptions) GetRedisOptions() *redis.Options
type Rocket ¶ added in v1.3.30
type Rocket struct { Addr string `json:"addr" yaml:"addr"` AccessKey string `json:"access_key" yaml:"access_key"` SecretKey string `json:"secret_key" yaml:"secret_key"` Namespace string `json:"namespace" yaml:"namespace"` InstanceId string `json:"instance_id" yaml:"instance_id"` ProducerId string `json:"producer_id" yaml:"producer_id"` ConsumerId string `json:"consumer_id" yaml:"consumer_id"` }
type Secret ¶ added in v1.4.1
type Secret struct { AppId string `json:"app_id" yaml:"app_id"` AppSecret string `json:"app_secret" yaml:"app_secret"` AesSecret string `json:"aes_secret,omitempty" yaml:"aes_secret"` RsaPubKey string `json:"rsa_pub_key" yaml:"rsa_pub_key"` RsaPrivateKey string `json:"rsa_private_key" yaml:"rsa_private_key"` }
type Settings ¶
type Settings struct { Settings Config `yaml:"settings"` // contains filtered or unexported fields }
Settings 兼容原先的配置结构
type Sms ¶ added in v1.3.30
type Sms struct { Tencent *TencentSms `json:"tencent" yaml:"tencent"` Aliyun *AliyunSms `json:"aliyun" yaml:"aliyun"` }
type SmtpConnectOptions ¶ added in v1.3.30
type TencentAudit ¶ added in v1.4.11
type TencentAudit struct { AccessKey string `json:"access_key" yaml:"access_key"` SecretKey string `json:"secret_key" yaml:"secret_key"` Region string `json:"region" yaml:"region"` CosUrl string `json:"cos_url" yaml:"cos_url"` CiUrl string `json:"ci_url" yaml:"ci_url"` CallbackUrl string `json:"callback_url" yaml:"callback_url"` }
type TencentFile ¶ added in v1.4.11
type TencentSms ¶ added in v1.4.11
type TencentSms struct { SecretId string `json:"secret_id" yaml:"secret_id"` SecretKey string `json:"secret_key" yaml:"secret_key"` AppId string `json:"app_id" yaml:"app_id"` AppKey string `json:"app_key" yaml:"app_key"` Region string `json:"region" yaml:"region"` Addr string `json:"addr" yaml:"addr"` Alg string `json:"alg" yaml:"alg"` Signature string `json:"signature" yaml:"signature"` }
type WeChat ¶ added in v1.3.30
type WeChat struct { Open *WeChatOption `json:"open,omitempty" yaml:"open"` Mp *WeChatOption `json:"mp,omitempty" yaml:"mp"` }
type WeChatOption ¶ added in v1.3.30
type WeChatPayOption ¶ added in v1.4.9
type WeChatPayOption struct { MerchantId string `yaml:"merchant_id" json:"merchant_id"` AppId string `yaml:"app_id" json:"app_id"` PrivateKeyPath string `yaml:"private_key_path" json:"private_key_path"` SerialNumber string `yaml:"serial_no" json:"serial_no"` ApiV3Key string `yaml:"api_v3_key" json:"api_v3_key"` CallbackAddr string `yaml:"callback_addr" json:"callback_addr"` WeChatCertPath string `yaml:"wechat_cert_path" json:"wechat_cert_path"` }
Source Files ¶
- amqp.go
- amqp_rabbit.go
- amqp_rocket.go
- application.go
- block_chain.go
- block_chain_broker.go
- cache.go
- config.go
- database.go
- file_store.go
- file_store_aliyun.go
- file_store_huawei.go
- file_store_tencent.go
- gen.go
- jwt.go
- lbs.go
- lbs_amap.go
- locker.go
- logger.go
- mail.go
- mail_smtp.go
- moderation.go
- moderation_aliyun.go
- moderation_huawei.go
- moderation_tencent.go
- option_nsq.go
- option_redis.go
- payment.go
- payment_wechat.go
- queue.go
- secret.go
- sms.go
- sms_aliyun.go
- sms_tencent.go
- ssl.go
- wechat.go
Click to show internal directories.
Click to hide internal directories.