postgres

package
v1.0.9 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const ProviderName = "postgres"

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {

	// The host to connect to. Values that start with / are for unix domain sockets. (default is localhost)
	Host string

	// The port to bind to. (default is 5432)
	Port int64

	// postgres user to sign in as
	Username string

	// postgres user's password
	Password string

	// Maximum wait for connection, in seconds. Zero or
	// not specified means wait indefinitely.
	ConnTimeout int64

	// name of the database to connect to
	Database string

	// session table name
	TableName string

	// postgres max free idle
	SetMaxIdleConn int

	// postgres 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 int64, username string, password string, dbName string, tableName string) (cf *Config)

func NewDefaultConfig

func NewDefaultConfig() *Config

func (*Config) Name

func (pc *Config) Name() string

type Provider

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

func NewProvider

func NewProvider() *Provider

new postgres provider

func (*Provider) Count

func (pp *Provider) Count() int

session values count

func (*Provider) Destroy

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

destroy session by sessionId

func (*Provider) GC

func (pp *Provider) GC()

session postgres provider not need garbage collection

func (*Provider) Init

func (pp *Provider) Init(lifeTime int64, postgresConfig fasthttpsession.ProviderConfig) error

init provider config

func (*Provider) NeedGC

func (pp *Provider) NeedGC() bool

not need gc

func (*Provider) ReadStore

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

read session store by session id

func (*Provider) Regenerate

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

regenerate session

type Store

type Store struct {
	fasthttpsession.Store
}

func NewPostgresStore

func NewPostgresStore(sessionId string) *Store

new default postgres store

func NewPostgresStoreData

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

new postgres store data

func (*Store) Save

func (ps *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