mirror of
https://github.com/astaxie/beego.git
synced 2025-06-12 07:40:39 +00:00
update the documents & comments
This commit is contained in:
@ -1,43 +1,55 @@
|
||||
// Beego (http://beego.me/)
|
||||
// Copyright 2014 beego Author. All Rights Reserved.
|
||||
//
|
||||
// @description beego is an open-source, high-performance web framework for the Go programming language.
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// @link http://github.com/astaxie/beego for the canonical source repository
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// @license http://github.com/astaxie/beego/blob/master/LICENSE
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// package postgresql for session provider
|
||||
//
|
||||
// @authors astaxie
|
||||
// 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
|
||||
package session
|
||||
|
||||
/*
|
||||
|
||||
beego session provider for postgresql
|
||||
-------------------------------------
|
||||
|
||||
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
|
||||
|
||||
*/
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
"net/http"
|
||||
|
Reference in New Issue
Block a user