Documentation ¶
Index ¶
Constants ¶
View Source
const ( DBUser = "postgres" DBPasword = "password" DBName = "pnw_conf" )
Variables ¶
View Source
var ( // ErrInternalServerError is for occasions when we goof something up // but need a pretty error to return to the user. For example, // there's a function where we return an error to the user. However, // that error could be the result of a bad SQL statement, and // the user doesn't need to know how much we suck at SQL. So, instead, // we just show this. ErrInternalServerError = errors.New("Internal server error.") ErrNoUser = errors.New("No users.") ErrNoUsernameInCookie = errors.New("No user identifier inside of cookie.") )
View Source
var ( DB *sql.DB Pool = &redis.Pool{ MaxIdle: 3, IdleTimeout: 240 * time.Second, Dial: func() (redis.Conn, error) { c, err := redis.Dial("unix", redisSocket) if err != nil { return nil, err } return c, err }, TestOnBorrow: func(c redis.Conn, t time.Time) error { _, err := c.Do("PING") return err }, } )
Functions ¶
func GetAllUsernames ¶
GetAllUsernames returns a slice of all the usernames in the database.
func GetUserData ¶
GetUserData simply returns a user's custom data, as well as any database errors that occurred.
Types ¶
type FailedAttempt ¶
type User ¶
type User struct { Email string // User email address Name string // Username School string // Organization Password []byte // Bcrypt hashed pasword PasswordChanged time.Time // Last time password was changed // User's misc. data stored as XML. []byte instead of string because of // this issue: // https://github.com/go-sql-driver/mysql/wiki/Examples#ignoring-null-values Data []byte }
func CheckUser ¶
CheckUser returns a user's basic information, a bool indicating whether the user exists, and an error if one occurred.
Click to show internal directories.
Click to hide internal directories.