token

package
v0.2.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	Prefix = "Auth:"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Token

type Token[T any] struct {
	// contains filtered or unexported fields
}

func NewTokenService

func NewTokenService[T any](db *redis.Client) Token[T]

func (*Token[T]) ClearAllLogin

func (t *Token[T]) ClearAllLogin(prefix string) error

func (*Token[T]) CreateToken

func (t *Token[T]) CreateToken(data interface{}, expiration time.Duration, roleId ...string) (string, error)

func (*Token[T]) DeleteToken

func (t *Token[T]) DeleteToken(key ...string) error

func (*Token[T]) GetDataFromToken

func (t *Token[T]) GetDataFromToken(token string) (T, error)

func (*Token[T]) GetDataListFromRoleId

func (t *Token[T]) GetDataListFromRoleId(roleId string) ([]T, error)

func (*Token[T]) GetTokenByRoleId

func (t *Token[T]) GetTokenByRoleId(roleId string) ([]string, error)

func (*Token[T]) UpdateTokenWithoutRefreshExpireTime

func (t *Token[T]) UpdateTokenWithoutRefreshExpireTime(key string, data interface{}) error

Jump to

Keyboard shortcuts

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