Merge pull request #16 from caarlos0/10

Improved docs for #10
This commit is contained in:
Anton Lindström 2015-09-18 21:34:32 +02:00
commit 646ee39852
1 changed files with 4 additions and 2 deletions

View File

@ -31,7 +31,8 @@ type Session struct {
ExpiresOn time.Time `db:"expires_on"` ExpiresOn time.Time `db:"expires_on"`
} }
// NewPGStore creates a new PGStore instance and a new database/sql pool // NewPGStore creates a new PGStore instance and a new database/sql pool.
// This will also create in the database the schema needed by pgstore.
func NewPGStore(dbURL string, keyPairs ...[]byte) *PGStore { func NewPGStore(dbURL string, keyPairs ...[]byte) *PGStore {
db, err := sql.Open("postgres", dbURL) db, err := sql.Open("postgres", dbURL)
if err != nil { if err != nil {
@ -42,7 +43,8 @@ func NewPGStore(dbURL string, keyPairs ...[]byte) *PGStore {
} }
// NewPGStoreFromPool creates a new PGStore instance from an existing // NewPGStoreFromPool creates a new PGStore instance from an existing
// database/sql pool // database/sql pool.
// This will also create in the database the schema needed by pgstore.
func NewPGStoreFromPool(db *sql.DB, keyPairs ...[]byte) *PGStore { func NewPGStoreFromPool(db *sql.DB, keyPairs ...[]byte) *PGStore {
dbmap := &gorp.DbMap{Db: db, Dialect: gorp.PostgresDialect{}} dbmap := &gorp.DbMap{Db: db, Dialect: gorp.PostgresDialect{}}