Help us shape the future of Go! Take the 2026 Go Developer Survey

captcha

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2022 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCaptchaNotExists    = errors.NewPublic("验证码不存在")
	ErrCaptchaInconsistent = errors.NewPublic("无效的验证码")
)

Functions

This section is empty.

Types

type Captcha

type Captcha struct {
	Namespace string
	Redis     *redis.Client
}

func New added in v0.0.7

func New(options ...Option) *Captcha

func (*Captcha) Create

func (x *Captcha) Create(ctx context.Context, name string, code string, ttl time.Duration) error

Create 创建验证码

func (*Captcha) Delete

func (x *Captcha) Delete(ctx context.Context, name string) error

Delete 移除验证码

func (*Captcha) Exists

func (x *Captcha) Exists(ctx context.Context, name string) (_ bool, err error)

Exists 存在验证码

func (*Captcha) Key

func (x *Captcha) Key(name string) string

Key 验证命名

func (*Captcha) Verify

func (x *Captcha) Verify(ctx context.Context, name string, code string) (err error)

Verify 校验验证码

type Option added in v0.0.7

type Option func(x *Captcha)

func SetNamespace added in v0.0.7

func SetNamespace(v string) Option

func SetRedis added in v0.0.7

func SetRedis(v *redis.Client) Option

Jump to

Keyboard shortcuts

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