mysql

package
v0.0.0-...-186dae7 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const ProviderName = "mysql"

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {

	// mysql server host
	Host string

	// mysql server port
	Port int

	// mysql username
	Username string

	// mysql password
	Password string

	// mysql conn charset
	Charset string

	// mysql Collate
	Collate string

	// database name
	Database string

	// session table name
	TableName string

	// mysql conn timeout(s)
	Timeout int

	// mysql read timeout(s)
	ReadTimeout int

	// mysql write timeout(s)
	WriteTimeout int

	// mysql max free idle
	SetMaxIdleConn int

	// mysql max open idle
	SetMaxOpenConn int

	// session value serialize func
	SerializeFunc func(data map[string]interface{}) ([]byte, error)

	// session value unSerialize func
	UnSerializeFunc func(data []byte) (map[string]interface{}, error)
}

func NewConfigWith

func NewConfigWith(host string, port int, user, pass, dbName, tableName string) (cf *Config)

func NewDefaultConfig

func NewDefaultConfig() *Config

func (*Config) Name

func (mc *Config) Name() string

type Provider

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

func NewProvider

func NewProvider() *Provider

new mysql provider

func (*Provider) Count

func (mp *Provider) Count() int

session values count

func (*Provider) Destroy

func (mp *Provider) Destroy(sessionId string) error

destroy session by sessionId

func (*Provider) GC

func (mp *Provider) GC()

session mysql provider not need garbage collection

func (*Provider) Init

func (mp *Provider) Init(lifeTime int64, mysqlConfig fasthttpsession.ProviderConfig) error

init provider config

func (*Provider) NeedGC

func (mp *Provider) NeedGC() bool

not need gc

func (*Provider) ReadStore

func (mp *Provider) ReadStore(sessionId string) (fasthttpsession.SessionStore, error)

read session store by session id

func (*Provider) Regenerate

func (mp *Provider) Regenerate(oldSessionId string, sessionId string) (fasthttpsession.SessionStore, error)

regenerate session

type Store

type Store struct {
	fasthttpsession.Store
}

func NewMysqlStore

func NewMysqlStore(sessionId string) *Store

new default mysql store

func NewMysqlStoreData

func NewMysqlStoreData(sessionId string, data map[string]interface{}) *Store

new mysql store data

func (*Store) Save

func (ms *Store) Save(ctx *fasthttp.RequestCtx) error

save store

Jump to

Keyboard shortcuts

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