utils

package
v0.2.5-beta Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BcryptCheck

func BcryptCheck(password, hash string) bool

func BcryptEncrypt

func BcryptEncrypt(password string) string

func NewJwtToken added in v0.2.3

func NewJwtToken(secretKey, uuid, roleString string, iat, seconds int64, roleIds []string) (string, error)

func ParseTags added in v0.1.4

func ParseTags(lang string) []language.Tag

func WithTx added in v0.1.4

func WithTx(ctx context.Context, client *ent.Client, fn func(tx *ent.Tx) error) error

WithTx uses transaction in ent.

Types

type RedisStore

type RedisStore struct {
	Expiration time.Duration
	PreKey     string
	Context    context.Context
	Redis      *redis.Redis
}

RedisStore stores captcha data.

func NewRedisStore

func NewRedisStore(r *redis.Redis) *RedisStore

NewRedisStore returns a redis store for captcha.

func (*RedisStore) Get

func (r *RedisStore) Get(key string, clear bool) string

Get gets the captcha KV from redis.

func (*RedisStore) Set

func (r *RedisStore) Set(id string, value string) error

Set sets the captcha KV to redis.

func (*RedisStore) UseWithCtx

func (r *RedisStore) UseWithCtx(ctx context.Context) base64Captcha.Store

UseWithCtx add context for captcha.

func (*RedisStore) Verify

func (r *RedisStore) Verify(id, answer string, clear bool) bool

Verify verifies the captcha whether it is correct.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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