Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LogOutSessionUser ¶
func LogOutSessionUser(w http.ResponseWriter, r *http.Request, store *sessions.CookieStore) error
LogOutSessionUser logs out the user
func SetSessionUser ¶
func SetSessionUser(w http.ResponseWriter, r *http.Request, username string, store *sessions.CookieStore) error
SetSessionUser sets the user in the session
Types ¶
type ByRatingDesc ¶
type ByRatingDesc []Interest
ByRatingDesc sorting type for Interests
func (ByRatingDesc) Len ¶
func (a ByRatingDesc) Len() int
func (ByRatingDesc) Less ¶
func (a ByRatingDesc) Less(i, j int) bool
func (ByRatingDesc) Swap ¶
func (a ByRatingDesc) Swap(i, j int)
type FileRepo ¶
type FileRepo struct {
// contains filtered or unexported fields
}
FileRepo is a file based user repository
type MgoRepo ¶
type MgoRepo struct {
// contains filtered or unexported fields
}
MgoRepo is a repository based on a MongoDb
type Repository ¶
type Repository interface { GetUsers() ([]User, error) GetUser(name string) (*User, error) SaveUser(user User) error }
Repository type
func NewMgoRepo ¶
func NewMgoRepo(url, database string) Repository
NewMgoRepo creates a new Mongo database repository
func NewRepo ¶
func NewRepo(filepath string) (Repository, error)
NewRepo creates a new File base repository
type User ¶
type User struct { ID bson.ObjectId `bson:"_id,omitempty"` Name string Location Location Interests Interests }
User type
func GetSessionUser ¶
func GetSessionUser(w http.ResponseWriter, r *http.Request, repo Repository, store *sessions.CookieStore) (*User, error)
GetSessionUser gets the user stored in the session if there is one
Click to show internal directories.
Click to hide internal directories.