top

Package postgres for session provider

depends on github.com/lib/pq:

go install github.com/lib/pq

needs this table in your database:

CREATE TABLE session ( session_key char(64) NOT NULL, session_data bytea, session_expiry timestamp NOT NULL, CONSTRAINT session_key PRIMARY KEY(session_key) );

will be activated with these settings in app.conf:

SessionOn = true SessionProvider = postgresql SessionSavePath = "user=a password=b dbname=c sslmode=disable" SessionName = session

Usage: import(

_ "github.com/astaxie/beego/session/postgresql"
"github.com/astaxie/beego/session"

)

func init() {
	globalSessions, _ = session.NewManager("postgresql", ``{"cookieName":"gosessionid","gclifetime":3600,"ProviderConfig":"user=pqgotest dbname=pqgotest sslmode=verify-full"}``)
	go globalSessions.GC()
}

more docs: http://beego.me/docs/module/session.md

Imports 2 package(s) ΒΆ

  1. github.com/astaxie/beego/session
  2. github.com/lib/pq