Documentation ¶
Index ¶
- func GetSession(col *Collection, key string) (*objects.Session, error)
- func GetUserByID(col *Collection, id primitive.ObjectID) (*objects.User, error)
- func GetUserByUsernameOrEmail(col *Collection, u string) (*objects.User, primitive.ObjectID, error)
- func MongoFilterID(id string) (bson.D, error)
- func UpdateSessionLastSeen(col *Collection, session *objects.Session)
- type Collection
- type Database
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetSession ¶
func GetSession(col *Collection, key string) (*objects.Session, error)
GetSession finds and returns session. Error if session isn't found
func GetUserByID ¶
GetUserByID finds user in database by id and returns pointer to user object
func GetUserByUsernameOrEmail ¶
GetUserByUsernameOrEmail will retrieve user for username or email
func MongoFilterID ¶
MongoFilterID takes id string and returns proper BSON object
func UpdateSessionLastSeen ¶
func UpdateSessionLastSeen(col *Collection, session *objects.Session)
UpdateSessionLastSeen updates the TimeStamp of LastSeenTime in the session document
Types ¶
type Collection ¶
type Collection struct {
*mongo.Collection
}
Collection (table) to access documents (rows)
type Database ¶
Database struct contains whatever db client we are using
func ConnectDB ¶
func ConnectDB() *Database
ConnectDB connects to a specified database, and puts it in type Database
func (*Database) GetMongoCollection ¶
func (db *Database) GetMongoCollection(collection string) *Collection
GetMongoCollection returns a collection of the Database db
Click to show internal directories.
Click to hide internal directories.