dbstore

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2020 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CommonDialect = commonDialect{}

CommonDialect is a common dialect.

Functions

This section is empty.

Types

type Dialect

type Dialect interface {
	// BindVar bind variable.
	BindVar(i int) string
	// Quote escapes key.
	Quote(key string) string
}

Dialect is a database dialect.

type Option

type Option func(*Store)

Option is a function that receives a pointer of store.

func Category

func Category(category string) Option

Category sets captcha category.

func Expiration

func Expiration(expiration time.Duration) Option

Expiration sets expiration.

func GCInterval

func GCInterval(interval time.Duration) Option

GCInterval sets garbage collection .

func TableName

func TableName(name string) Option

TableName sets captcha table name.

type Store

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

Store is a database store.

func New

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

New returns a db store.

func (*Store) Get

func (s *Store) Get(id string, clear bool) (string, error)

Get implements Store.Get.

func (*Store) Set

func (s *Store) Set(id, answer string) error

Set implements Store.Set.

Jump to

Keyboard shortcuts

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