Documentation ¶
Index ¶
Constants ¶
View Source
const (
// The minimum number of bytes to be used for each session token
MinBytesPerToken = 32
)
Variables ¶
View Source
var ( // A common pattern is to add the package as a prefix to the error for context. ErrUsernameTaken = errors.New("models: username is already in use") ErrNotFound = errors.New("models: resource could not be found") )
Functions ¶
Types ¶
type PostgresConfig ¶
type PostgresConfig struct { Host string Port string User string Password string Database string SSLMode string }
func (PostgresConfig) String ¶
func (cfg PostgresConfig) String() string
type Session ¶
Token is only set when creating a new session When look up a session this will be left empty, as we only store the hash of a session token in out database and we cannot reverse it into a raw token
type SessionService ¶
type SessionService struct { DB *sql.DB // BytesPerToken is used to determine how many bytes to use when generating // each session token. If this value is not set or is less than the // MinBytesePerToken const it will be ignored and MinBytesPerToken will be used. BytesPerToken int }
func (*SessionService) Delete ¶
func (service *SessionService) Delete(token string) error
type UserService ¶
func (*UserService) Authenticate ¶
func (us *UserService) Authenticate(username, password string) (*User, error)
Click to show internal directories.
Click to hide internal directories.