postgres

package
v1.1.7-0...-85f9cc7 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const ProviderName = "postgres"

ProviderName postgres provider name

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(src session.Dict) ([]byte, error)

	// session value unSerialize func
	UnSerializeFunc func(dst *session.Dict, src []byte) error
}

Config session postgres configuration

func NewConfigWith

func NewConfigWith(host string, port int64, username string, password string, dbName string, tableName string) *Config

NewConfigWith instance new configuration with especific paremters

func NewDefaultConfig

func NewDefaultConfig() *Config

NewDefaultConfig return default configuration

func (*Config) Name

func (pc *Config) Name() string

Name return provider name

type DBRow

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

DBRow database row definition

func (*DBRow) Reset

func (row *DBRow) Reset()

Reset reset database row memory

type Dao

type Dao struct {
	session.Dao
	// contains filtered or unexported fields
}

Dao database access object

func NewDao

func NewDao(driver, dsn, tableName string) (*Dao, error)

NewDao create new database access object

type Provider

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

Provider provider struct

func NewProvider

func NewProvider() *Provider

NewProvider new postgres provider

func (*Provider) Count

func (pp *Provider) Count() int

Count session values count

func (*Provider) Destroy

func (pp *Provider) Destroy(sessionID []byte) error

Destroy destroy session by sessionID

func (*Provider) GC

func (pp *Provider) GC()

GC session garbage collection

func (*Provider) Get

func (pp *Provider) Get(sessionID []byte) (session.Storer, error)

Get read session store by session id

func (*Provider) Init

func (pp *Provider) Init(expiration time.Duration, cfg session.ProviderConfig) error

Init init provider config

func (*Provider) NeedGC

func (pp *Provider) NeedGC() bool

NeedGC need gc

func (*Provider) Put

func (pp *Provider) Put(store session.Storer)

Put put store into the pool.

func (*Provider) Regenerate

func (pp *Provider) Regenerate(oldID, newID []byte) (session.Storer, error)

Regenerate regenerate session

type Store

type Store struct {
	session.Store
}

Store store struct

func (*Store) Save

func (ps *Store) Save() error

Save save store

Jump to

Keyboard shortcuts

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