Documentation ¶
Index ¶
- type Provider
- func (p *Provider) Close() error
- func (p *Provider) Count() int
- func (p *Provider) Destroy(id []byte) error
- func (p *Provider) Exec(query string, args ...interface{}) (int64, error)
- func (p *Provider) GC() error
- func (p *Provider) Get(id []byte) ([]byte, error)
- func (p *Provider) NeedGC() bool
- func (p *Provider) Regenerate(id, newID []byte, expiration time.Duration) error
- func (p *Provider) Save(id, data []byte, expiration time.Duration) error
- type ProviderConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider backend manager
func NewProvider ¶
func NewProvider(cfg ProviderConfig) (*Provider, error)
NewProvider returns a new configured sql provider
func (*Provider) Close ¶
Close closes the database and prevents new queries from starting. Close then waits for all queries that have started processing on the server to finish.
It is rare to Close a DB, as the DB handle is meant to be long-lived and shared between many goroutines.
func (*Provider) Exec ¶
Exec executes a query without returning any rows. The args are for any placeholder parameters in the query.
Returns the number of rows affected by an update, insert, or delete. Not every database or database driver may support this.
func (*Provider) Regenerate ¶
Regenerate updates the session id and expiration with the new session id of the the given current session id
type ProviderConfig ¶
type ProviderConfig struct { // SQL driver Driver string // DB connection string DSN string // The maximum number of connections in the idle connection pool. // // If MaxOpenConns is greater than 0 but less than the new MaxIdleConns, // then the new MaxIdleConns will be reduced to match the MaxOpenConns limit. // // If n <= 0, no idle connections are retained. // // The default max idle connections is currently 2. This may change in // a future release. MaxIdleConns int // The maximum number of open connections to the database. // // If MaxIdleConns is greater than 0 and the new MaxOpenConns is less than // MaxIdleConns, then MaxIdleConns will be reduced to match the new // MaxOpenConns limit. // // If n <= 0, then there is no limit on the number of open connections. // The default is 0 (unlimited). MaxOpenConns int // The maximum amount of time a connection may be reused. // // Expired connections may be closed lazily before reuse. // // If d <= 0, connections are reused forever. ConnMaxLifetime time.Duration SQLGet string SQLSave string SQLRegenerate string SQLDestroy string SQLCount string SQLInsert string SQLGC string }
ProviderConfig provider settings