postgres

package
v0.0.0-...-a4dd944 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package postgres contains code that depends on a Postgresql database backend, and github.com/lib/pq

Index

Constants

View Source
const (
	DEFAULT_SESSION_TIMEOUT = 30 * 24 * 60 * 60

	TABLE_DEFINITION = `CREATE TABLE IF NOT EXISTS sessions (
		id char(72) PRIMARY KEY,
		content bytea,
		expires timestamp with time zone
	)`
)
View Source
const (
	PG_UNIQUE_VIOLATION = pq.ErrorCode("23505")
)

Variables

This section is empty.

Functions

func NewSessionHolder

func NewSessionHolder(db *sql.DB) (base.SessionHolder, error)

NewSessionHolder creates a new postgres-backed session holder

Types

type SessionHolder

type SessionHolder struct {
	base.BaseSessionHolder
	// contains filtered or unexported fields
}

SessionHolder is a Postgres-backed session store. It uses the postgres bytea data type and the gob encoding to store the session

func (*SessionHolder) Destroy

func (sh *SessionHolder) Destroy(c web.C, session *base.Session) error

Destroy deletes a session from postgres

func (*SessionHolder) Get

func (sh *SessionHolder) Get(c web.C, r *http.Request) (*base.Session, error)

Get the session for this request from Postgres

func (*SessionHolder) RegenerateId

func (sh *SessionHolder) RegenerateId(c web.C, session *base.Session) (string, error)

func (*SessionHolder) ResetTTL

func (sh *SessionHolder) ResetTTL(c web.C, session *base.Session) error

func (*SessionHolder) Save

func (sh *SessionHolder) Save(c web.C, session *base.Session) error

Save a session to postgres

Jump to

Keyboard shortcuts

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