Documentation ¶
Index ¶
- Constants
- type PublicUser
- type User
- func (user *User) Delete() api_errors.RestErr
- func (user *User) FindByEmail() api_errors.RestErr
- func (user *User) FindByEmailAndPassword() api_errors.RestErr
- func (user *User) Get() api_errors.RestErr
- func (user *User) IsAvailableEmail() api_errors.RestErr
- func (user *User) Marshal() interface{}
- func (user *User) Save() api_errors.RestErr
- func (user *User) Validate() api_errors.RestErr
- type UserLoginRequest
Constants ¶
View Source
const ( //DB_NAME is the db name DB_NAME = "mydb" //USERS_COLLECTION_NAME is the name for the users collection USERS_COLLECTION_NAME = "users" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PublicUser ¶
type User ¶
type User struct { ID string `json:"id" bson:"_id,omitempty"` FirstName string `json:"first_name" bson:"first_name"` LastName string `json:"last_name" bson:"last_name"` Email string `json:"email"` DateCreated string `json:"date_created" bson:"date_created"` Status string `json:"status"` Password string `json:"password"` }
User is the domain
func (*User) Delete ¶
func (user *User) Delete() api_errors.RestErr
Delete delete the document from the collection by the userID
func (*User) FindByEmail ¶
func (user *User) FindByEmail() api_errors.RestErr
FindByEmail fill the &user with the data user if the filter founds one otherwise returns an RestErr
func (*User) FindByEmailAndPassword ¶
func (user *User) FindByEmailAndPassword() api_errors.RestErr
FindByEmailAndPassword try to get a User by the email and password
func (*User) IsAvailableEmail ¶
func (user *User) IsAvailableEmail() api_errors.RestErr
IsAvailableEmail returns an RestErr if the email already exist
func (*User) Save ¶
func (user *User) Save() api_errors.RestErr
Save save a new user to the users collections
func (*User) Validate ¶
func (user *User) Validate() api_errors.RestErr
Validate validates FirstName, LastName, Email and Password (only trimspace)
type UserLoginRequest ¶
Click to show internal directories.
Click to hide internal directories.