wechat

package
v0.0.0-...-c6e4f4a Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2023 License: MulanPSL-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache interface {
	cache.Cache
}

type DistributedAccessTokenHandle

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

DistributedAccessTokenHandle AccessToken 获取 @Description 重写credential.DefaultAccessToken,实现分布式锁,支持多实例部署

func NewDistributedAccessTokenHandle

func NewDistributedAccessTokenHandle(
	appID, appSecret, cacheKeyPrefix string, cache Cache, distributedLock lock.Locker,
) *DistributedAccessTokenHandle

NewDistributedAccessTokenHandle new DistributedAccessTokenHandle

func (*DistributedAccessTokenHandle) GetAccessToken

func (ak *DistributedAccessTokenHandle) GetAccessToken() (accessToken string, err error)

GetAccessToken 获取access_token,先从cache中获取,没有则从服务端获取

func (*DistributedAccessTokenHandle) GetAccessTokenContext

func (ak *DistributedAccessTokenHandle) GetAccessTokenContext(ctx context.Context) (accessToken string, err error)

GetAccessTokenContext 获取access_token,先从cache中获取,没有则从服务端获取

func (*DistributedAccessTokenHandle) RefreshAccessToken

func (ak *DistributedAccessTokenHandle) RefreshAccessToken() (err error)

RefreshAccessToken 刷新access_token

type OfficialAccount

type OfficialAccount struct {
	officialaccount.OfficialAccount
	// contains filtered or unexported fields
}

func NewOfficialAccount

func NewOfficialAccount(config *OfficialAccountConfig, cache Cache, distributedLock lock.Locker) *OfficialAccount

func NewOfficialAccountByMemory

func NewOfficialAccountByMemory(config *OfficialAccountConfig) *OfficialAccount

func NewOfficialAccountByRedis

func NewOfficialAccountByRedis(config *OfficialAccountConfig, redisClient redis.UniversalClient) *OfficialAccount

func (*OfficialAccount) StartTokenChecking

func (oa *OfficialAccount) StartTokenChecking()

type OfficialAccountConfig

type OfficialAccountConfig struct {
	AppID          string `json:"app_id"`
	AppSecret      string `json:"app_secret"`
	Token          string `json:"token"`
	EncodingAESKey string `json:"encoding_aes_key"`
}

type Redis

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

Redis .redis cache @description: 实现cache.Cache的Redis类

func NewRedis

func NewRedis(ctx context.Context, conn redis.UniversalClient) *Redis

NewRedis 实例化

func (*Redis) Delete

func (r *Redis) Delete(key string) error

Delete 删除

func (*Redis) Get

func (r *Redis) Get(key string) interface{}

Get 获取一个值

func (*Redis) IsExist

func (r *Redis) IsExist(key string) bool

IsExist 判断key是否存在

func (*Redis) Set

func (r *Redis) Set(key string, val interface{}, timeout time.Duration) error

Set 设置一个值

Jump to

Keyboard shortcuts

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