auth

Paddy 2015-04-06 Parent:8267e1c8bcd1

154:5f670aba87b4 Go to Latest

auth/postgres.go

Implement a session store in postgres. Write the postgres implementation of our sessionStore type. Write the SQL statements to initialize the database for us. Include the postgres implementation of our sessionStore type in our sessionStore tests when the appropriate environment variable is passed.

History
1 package auth
3 import (
4 "database/sql"
5 )
7 func NewPostgres(conn string) (postgres, error) {
8 db, err := sql.Open("postgres", conn)
9 if err != nil {
10 return postgres{}, err
11 }
12 return postgres{db: db}, nil
13 }
15 type postgres struct {
16 db *sql.DB
17 }