injectors

package
v0.0.0-...-2b0c82f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 5, 2023 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetApiSvcKey

func GetApiSvcKey(projectName, svcName, version string) string

func InitBinaryThriftGenericClients

func InitBinaryThriftGenericClients()

InitHttpThriftGenericClients client,server don't need thrift idl provider

func InitHttpThriftGenericClients

func InitHttpThriftGenericClients(opts *HttpThriftGenericClientOpts) map[string]genericclient.Client

InitHttpThriftGenericClients client need thrift idl provider just for out open api defined in idl, idl file ci git pull from common, config cd to run u can use generic + xds

func InitHttpThriftGenericEndpointsOpts

func InitHttpThriftGenericEndpointsOpts(opts *HttpThriftGenericClientOpts) map[string]*GenericEndpointsOpts

func InitMapThriftGenericClients

func InitMapThriftGenericClients()

InitHttpThriftGenericClients client,server need thrift idl provider

func InitMysqlDBClient

func InitMysqlDBClient(opts *MysqlDBClientOptions, kvLogger kitexGorm.IkvLogger) (dbClient *gorm.DB, err error)

func InitPaymentDaClient

func InitPaymentDaClient(opts *PaymentDaClientOptions) (paymentservice.Client, error)

func InitPaymentStationClient

func InitPaymentStationClient(opts *PaymentStationClientOptions) (paymentservice.Client, error)

func InitRedisClusterDefaultClient

func InitRedisClusterDefaultClient(opts *RedisClusterClientOptions) redis.UniversalClient

InitRedisClusterDefaultClient init default redis cluster instance

func InitRedisDefaultClient

func InitRedisDefaultClient(opts *RedisClientOptions, limiter redis.Limiter) redis.UniversalClient

InitRedisDefaultClient init default redis instance

func InitRedsync

func InitRedsync(clients ...redis.UniversalClient) *redsync.Redsync

InitRedsync Create an instance of redisync to be used to obtain a mutual exclusion for distlock ref: https://redis.io/topics/distlock/

func InitRmqTransactionProducerClient

func InitRmqTransactionProducerClient(opts *RmqProducerClientOptions, listener primitive.TransactionListener) (p rocketmq.TransactionProducer, err error)

Types

type GenericEndpointMethodsOpts

type GenericEndpointMethodsOpts struct {
	SvcMethod  string `mapstructure:"svcMethod"`
	HttpMethod string `mapstructure:"httpMethod"`
}

type GenericEndpointsOpts

type GenericEndpointsOpts struct {
	ProjectName   string                       `mapstructure:"projectName"`
	SvcName       string                       `mapstructure:"svcName"`
	Version       string                       `mapstructure:"version"`
	HeaderKeys    []string                     `mapstructure:"headerKeys"`
	HostPorts     []string                     `mapstructure:"hostPorts"`
	ClosedMethods []GenericEndpointMethodsOpts `mapstructure:"closedMethods"`

	EnableXDS bool   `mapstructure:"enableXDS"`
	XDSAddr   string `mapstructure:"xdsAddr"`
	Endpoint  string `mapstructure:"endpoint"`
}

type HttpThriftGenericClientOpts

type HttpThriftGenericClientOpts struct {
	IdlDirPath string                  `mapstructure:"idlDirPath"`
	Endpoints  []*GenericEndpointsOpts `mapstructure:"endpoints"`
}

func DefaultHttpThriftGenericClientOpts

func DefaultHttpThriftGenericClientOpts() *HttpThriftGenericClientOpts

type MysqlDBClientOptions

type MysqlDBClientOptions struct {
	Name                 string         `mapstructure:"name"`
	DbEngine             string         `mapstructure:"dbEngine"`
	DSN                  string         `mapstructure:"dsn"`
	MaxIdleConns         int            `mapstructure:"maxIdleConns"`
	MaxOpenConns         int            `mapstructure:"maxOpenConns"`
	ConnMaxLifeTime      time.Duration  `mapstructure:"connMaxLifeTime"`
	SlowSqlTimeThreshold time.Duration  `mapstructure:"slowSqlTimeThreshold"`
	TraceLogLevel        logutils.Level `mapstructure:"traceLogLevel"`
}

func DefaultMysqlDBClientOptions

func DefaultMysqlDBClientOptions() *MysqlDBClientOptions

type PaymentDaClientOptions

type PaymentDaClientOptions struct {
	Endpoint  string   `mapstructure:"endpoint"`
	EnableXDS bool     `mapstructure:"enableXDS"`
	XDSAddr   string   `mapstructure:"xdsAddr"`
	HostPorts []string `mapstructure:"hostPorts"`
}

func DefaultPaymentDaClientOptions

func DefaultPaymentDaClientOptions() *PaymentDaClientOptions

type PaymentStationClientOptions

type PaymentStationClientOptions struct {
	Endpoint  string   `mapstructure:"endpoint"`
	EnableXDS bool     `mapstructure:"enableXDS"`
	XDSAddr   string   `mapstructure:"xdsAddr"`
	HostPorts []string `mapstructure:"hostPorts"`
}

func DefaultPaymentStationClientOptions

func DefaultPaymentStationClientOptions() *PaymentStationClientOptions

type RedisClientCommonOptions

type RedisClientCommonOptions struct {
	Password string `mapstructure:"password"`
	Username string `mapstructure:"username"`

	MaxRetries      int           `mapstructure:"maxRetries"`
	MinRetryBackoff time.Duration `mapstructure:"minRetryBackoff"`
	MaxRetryBackoff time.Duration `mapstructure:"maxRetryBackoff"`
	DialTimeout     time.Duration `mapstructure:"dialTimeout"`
	ReadTimeout     time.Duration `mapstructure:"readTimeout"`
	WriteTimeout    time.Duration `mapstructure:"writeTimeout"`

	// connect pool
	PoolSize           int           `mapstructure:"poolSize"`
	MinIdleConns       int           `mapstructure:"minIdleConns"`
	MaxConnAge         time.Duration `mapstructure:"maxConnAge"`
	PoolTimeout        time.Duration `mapstructure:"poolTimeout"`
	IdleTimeout        time.Duration `mapstructure:"idleTimeout"`
	IdleCheckFrequency time.Duration `mapstructure:"idleCheckFrequency"`
}

type RedisClientOptions

type RedisClientOptions struct {
	Addr string `mapstructure:"addr"`
	Db   int    `mapstructure:"db"`

	RedisClientCommonOptions
}

func DefaultRedisClientOptions

func DefaultRedisClientOptions() *RedisClientOptions

type RedisClusterClientOptions

type RedisClusterClientOptions struct {
	Addrs []string `mapstructure:"addrs"`

	RedisClientCommonOptions

	// To route commands by latency or randomly, enable one of the following.
	Route string `mapstructure:"route"`
}

func DefaultRedisClusterClientOptions

func DefaultRedisClusterClientOptions() *RedisClusterClientOptions

type RmqProducerClientOptions

type RmqProducerClientOptions struct {
	Name      string   `mapstructure:"name"`
	NameSrvs  []string `mapstructure:"nameSrvs"`
	GroupName string   `mapstructure:"groupName"`
	RetryCn   int      `mapstructure:"retryCn"`
}

func DefaultRmqProducerClientOptions

func DefaultRmqProducerClientOptions() *RmqProducerClientOptions

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL