redis

package
v1.17.58 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2023 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const Nil = redis.Nil

Variables

View Source
var AppCode = AppCodeHelper{
	// contains filtered or unexported fields
}
View Source
var Client *redis.Client

Functions

func NewRecordedToken added in v1.17.36

func NewRecordedToken() tokenStore.TokenStore[types.Nil]

func NewU2F

func NewU2F() tokenStore.TokenStore[types.Nil]

func PublishSshDev added in v1.16.14

func PublishSshDev(messages []sshDevModel.SshAccountMsg) error

func SubScribeSshDev added in v1.16.14

func SubScribeSshDev() *redis.PubSub

Types

type AppCodeHelper

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

func (AppCodeHelper) Add

func (a AppCodeHelper) Add(data ...string) error

Add Deprecated: use service.App.AddAppCodeToRedis instead

func (AppCodeHelper) Del

func (a AppCodeHelper) Del(data ...string) error

func (AppCodeHelper) Exist

func (a AppCodeHelper) Exist(data string) (bool, error)

Exist Deprecated: use service.App.AppCodeExist instead

func (AppCodeHelper) IsEmpty

func (a AppCodeHelper) IsEmpty() (bool, error)

func (AppCodeHelper) Load

func (a AppCodeHelper) Load() ([]string, error)

type AppKeyPair added in v1.17.9

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

func NewAppKeyPair added in v1.17.9

func NewAppKeyPair(appCode string) AppKeyPair

func (AppKeyPair) Cache added in v1.17.9

func (a AppKeyPair) Cache(ctx context.Context, appSecret string) error

func (AppKeyPair) Read added in v1.17.9

func (a AppKeyPair) Read(ctx context.Context) (string, error)

type MfaEnable

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

func NewMfaEnable

func NewMfaEnable(uid uint) MfaEnable

func (MfaEnable) Del

func (a MfaEnable) Del() error

func (MfaEnable) Get

func (a MfaEnable) Get() (string, error)

func (MfaEnable) Set

func (a MfaEnable) Set(secret string, valid time.Duration) error

type Passkey

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

func NewPasskey

func NewPasskey(ip string) Passkey

func (Passkey) NewUser

func (p Passkey) NewUser(id uint) UserPasskey

func (Passkey) ReadSession

func (p Passkey) ReadSession(ctx context.Context, session any) error

ReadSession 读取后自动销毁

func (Passkey) StoreSession

func (p Passkey) StoreSession(ctx context.Context, session any, expire time.Duration) error

type Sms

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

func NewSms

func NewSms(phone string) Sms

func (Sms) IsLocked

func (a Sms) IsLocked() (bool, error)

func (Sms) TryLock

func (a Sms) TryLock() (bool, error)

func (Sms) UnLock

func (a Sms) UnLock() error

type SyncStat

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

func NewSyncStat

func NewSyncStat(name string) SyncStat

func (*SyncStat) Inject

func (a *SyncStat) Inject(schedule cron.Schedule, f func() error) func() error

Inject 注入 backoff 内容函数,使其支持分布式锁与成功跳过

func (*SyncStat) SetSuccess

func (a *SyncStat) SetSuccess(ctx context.Context, expire time.Duration) error

func (*SyncStat) ShouldLock

func (a *SyncStat) ShouldLock(ctx context.Context, expire time.Duration) (bool, error)

func (*SyncStat) Succeed

func (a *SyncStat) Succeed(ctx context.Context) (bool, error)

func (*SyncStat) TryLock

func (a *SyncStat) TryLock(ctx context.Context, expire time.Duration) (bool, error)

func (*SyncStat) Unlock

func (a *SyncStat) Unlock(ctx context.Context) error

type UserIdentityCode

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

func NewUserIdentityCode

func NewUserIdentityCode(uid uint) UserIdentityCode

func (UserIdentityCode) Destroy

func (a UserIdentityCode) Destroy() error

func (UserIdentityCode) New

func (a UserIdentityCode) New() (string, error)

New 新建身份校验码,五分钟有效,每用户仅存在一个

func (UserIdentityCode) VerifyAndDestroy

func (a UserIdentityCode) VerifyAndDestroy(code string) (bool, error)

VerifyAndDestroy 校验并销毁 code

type UserJwt

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

func NewUserJwt

func NewUserJwt() UserJwt

NewUserJwt user jwt Operate ID hash 表

func (UserJwt) Empty added in v1.17.7

func (u UserJwt) Empty(ctx context.Context) (bool, error)

func (UserJwt) NewOperator added in v1.17.7

func (u UserJwt) NewOperator(uid uint) UserJwtOperator

type UserJwtOperator added in v1.17.7

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

func (UserJwtOperator) ChangeOperateID added in v1.17.7

func (u UserJwtOperator) ChangeOperateID(ctx context.Context) (uint64, error)

func (UserJwtOperator) CheckOperateID added in v1.17.7

func (u UserJwtOperator) CheckOperateID(ctx context.Context, oid uint64) (bool, error)

func (UserJwtOperator) Create added in v1.17.7

func (u UserJwtOperator) Create(ctx context.Context) error

func (UserJwtOperator) Del added in v1.17.7

func (u UserJwtOperator) Del(ctx context.Context) error

func (UserJwtOperator) Exist added in v1.17.7

func (u UserJwtOperator) Exist(ctx context.Context) (bool, error)

func (UserJwtOperator) GetOperateID added in v1.17.7

func (u UserJwtOperator) GetOperateID(ctx context.Context) (uint64, error)

type UserPasskey

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

func (UserPasskey) ReadSession

func (u UserPasskey) ReadSession(ctx context.Context, session any) error

func (UserPasskey) StoreSession

func (u UserPasskey) StoreSession(ctx context.Context, session any, expire time.Duration) error

Jump to

Keyboard shortcuts

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