Documentation ¶
Index ¶
- func AddSettings() (*mongo.InsertOneResult, error)
- func AddUser(name string, email string, passwd string) (*mongo.InsertOneResult, error)
- func CheckEmailAndPassword(email string, password string) error
- func Connect() (*mongo.Client, error)
- func DeleteSettings(objID *primitive.ObjectID) (*mongo.DeleteResult, error)
- func DeleteUser(email string) error
- type User
- type UserSettings
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddSettings ¶
func AddSettings() (*mongo.InsertOneResult, error)
func AddUser ¶
AddUser creates a new user entry in the DB. Whitespaces in the email are automatically deleted Email is a unique attribute, so the function checks for existing email, before adding a new entry
func CheckEmailAndPassword ¶
func DeleteSettings ¶
func DeleteSettings(objID *primitive.ObjectID) (*mongo.DeleteResult, error)
func DeleteUser ¶
Types ¶
type User ¶
type User struct { Name string `json:"name,omitempty"` Email string `json:"email,omitempty"` Password string `json:"password,omitempty"` SettingsID primitive.ObjectID `bson:"_settings_id" json:"settings_id,omitempty"` }
func GetUserByEmail ¶
GetUserByEmail returns the user defined by the email and password. Whitespaces in the email are automatically removed.
type UserSettings ¶
type UserSettings struct {
Enable2StepsVerif bool `json:"2steps_on,omitempty"`
}
func GetSettings ¶
func GetSettings(objID *primitive.ObjectID) (UserSettings, error)
Click to show internal directories.
Click to hide internal directories.