clients

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ESClient

type ESClient struct {
	Client *elastic.Client
	// contains filtered or unexported fields
}

func NewESClient

func NewESClient(ctx context.Context, conf ESConf) (*ESClient, error)

type ESConf

type ESConf struct {
	Host     string `json:"host" mapstructure:"host"`
	Port     int    `json:"port" mapstructure:"port"`
	User     string `json:"user" mapstructure:"user"`
	Password string `json:"password" mapstructure:"password"`
}

type EmailClient

type EmailClient struct {
	// contains filtered or unexported fields
}

func NewEmailClient

func NewEmailClient(ctx context.Context, conf EmailConf) *EmailClient

func (*EmailClient) Send

func (ec *EmailClient) Send(desEmails []string, subject string, content []byte) error

type EmailConf

type EmailConf struct {
	FromEmail      string `json:"fromEmail" mapstructure:"fromEmail"`
	SMTPServer     string `json:"smtpServer" mapstructure:"smtpServer"`
	SMTPPort       int    `json:"smtpPort" mapstructure:"smtpPort"`
	SMTPVerifyCode string `json:"smtpVerifyCode" mapstructure:"smtpVerifyCode"`
}

type Memory

type Memory struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Memory mem cache struct

func NewMemory

func NewMemory() *Memory

NewMemory create new mem cache

func (*Memory) Delete

func (mem *Memory) Delete(key string) error

Delete delete value in mem cache.

func (*Memory) Get

func (mem *Memory) Get(key string) interface{}

Get return cached value

func (*Memory) IsExist

func (mem *Memory) IsExist(key string) bool

IsExist check value exists in mem cache.

func (*Memory) Set

func (mem *Memory) Set(key string, val interface{}, timeout *time.Duration)

Set cached value with key and expire time.

type MongoClient

type MongoClient struct {
	DB *mongo.Database
	// contains filtered or unexported fields
}

func NewMongoClient

func NewMongoClient(ctx context.Context, conf MongoConf) (*MongoClient, error)

type MongoConf

type MongoConf struct {
	Host           string `json:"host" mapstructure:"host"`
	Database       string `json:"database" mapstructure:"database"`
	Username       string `json:"username" mapstructure:"username"`
	Password       string `json:"password" mapstructure:"password"`
	ConnectTimeout int    `json:"connectTimeout" mapstructure:"connectTimeout"`
	ReplSetName    string `json:"replSetName" mapstructure:"replSetName"`
}

type RedisClient

type RedisClient struct {
	Client *redis.Client
	// contains filtered or unexported fields
}

func NewRedisClient

func NewRedisClient(ctx context.Context, conf RedisConf) (*RedisClient, error)

func (*RedisClient) Del

func (rd *RedisClient) Del(key string) (int64, error)

func (*RedisClient) DelAll

func (rd *RedisClient) DelAll(keys ...string) (int64, error)

func (*RedisClient) Get

func (rd *RedisClient) Get(key string) (string, error)

func (*RedisClient) HDel

func (rd *RedisClient) HDel(key, field string) (int64, error)

func (*RedisClient) HDelAll

func (rd *RedisClient) HDelAll(key string, fields ...string) (int64, error)

func (*RedisClient) HGet

func (rd *RedisClient) HGet(key, field string) (string, error)

func (*RedisClient) HSet

func (rd *RedisClient) HSet(key string, values ...interface{}) error

func (*RedisClient) Set

func (rd *RedisClient) Set(key string, val interface{}, expire int) error

type RedisConf

type RedisConf struct {
	Addr         string `json:"addr" mapstructure:"addr"`
	Password     string `json:"password" mapstructure:"password"`
	DB           int    `json:"db" mapstructure:"db"`
	DialTimeout  int    `json:"dialTimeout" mapstructure:"dialTimeout"`
	WriteTimeout int    `json:"writeTimeout" mapstructure:"writeTimeout"`
	ReadTimeout  int    `json:"readTimeout" mapstructure:"readTimeout"`
	PoolTimeout  int    `json:"poolTimeout" mapstructure:"poolTimeout"`
}

type TXSMSClient

type TXSMSClient struct {
	Client     *sms.Client `json:"clients"`
	SignName   string      `json:"signName"`
	TemplateID string      `json:"templateID"`
	SdkAppID   string      `json:"sdkAppID"`
}

func NewTXSMSClient

func NewTXSMSClient(conf TencentSMSConf) (*TXSMSClient, error)

func (*TXSMSClient) SendShortMessage

func (sc *TXSMSClient) SendShortMessage(contentArr, phoneNums []string) (bool, error)

type TencentSMSConf

type TencentSMSConf struct {
	SecretID      string        `json:"secretID" mapstructure:"secretID"`
	SecretKey     string        `json:"secretKey" mapstructure:"secretKey"`
	SdkAppID      string        `json:"sdkAppID" mapstructure:"sdkAppID"`
	Host          string        `json:"host" mapstructure:"host"`
	Region        string        `json:"region" mapstructure:"region"`
	SmsVerifyCode smsVerifyCode `json:"smsVerifyCode" mapstructure:"smsVerifyCode"`
}

Jump to

Keyboard shortcuts

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