mysqlstore

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2020 License: BSD-3-Clause Imports: 5 Imported by: 0

README

MySQL Store for Captchas

Firstly, you need to create a captcha table, migration.

$ go get clevergo.tech/captchas/stores/mysqlstore
import (
	"clevergo.tech/captchas/stores/mysqlstore"
	_ "github.com/go-sql-driver/mysql"
)
db, err := sql.Open("mysql", "")
if err != nil {
	// ...
}
store := mysqlstore.New(
	db,
	dbstore.Expiration(10*time.Minute), // captcha expiration, optional.
	dbstore.GCInterval(time.Minute), // garbage collection interval to delete expired captcha, optional.
	dbstore.TableName("captchas"), // table name, optional.
	dbstore.Category("default"), // category, optional.
)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

type Store struct {
	*dbstore.Store
}

Store is a MySQL store.

func New

func New(db *sql.DB, opts ...dbstore.Option) *Store

New returns store instance.

Jump to

Keyboard shortcuts

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