Documentation ¶
Index ¶
- Constants
- Variables
- func GetErrors() []error
- func GetMessages() []string
- type PasswordStatus
- type User
- type UserPassword
- func (s *UserPassword) Clear()
- func (s *UserPassword) Clone() *UserPassword
- func (s *UserPassword) ComparePass(pass string) bool
- func (s *UserPassword) Equals(other *UserPassword) bool
- func (s *UserPassword) IsEmpty() bool
- func (s *UserPassword) IsNotEmpty() bool
- func (s *UserPassword) String() string
- func (s *UserPassword) Validate() error
- type UserSortField
- type UserStatus
- type UserType
Constants ¶
const ( ErrId string = "id" ErrUser string = "user" ErrUserName string = "username" ErrPassword string = "password" ErrToken string = "token" ErrAuthentication string = "authentication" ErrRefreshToken string = "refreshtoken" ErrEmail string = "email" ErrRole string = "role" ErrUserNameOrEmail string = "username_or_email" )
Variables ¶
var ( ErrorNone error = nil ErrorUserNotFound error = errors.New(smodel.ErrBase + smodel.ErrSep + ErrUser + smodel.ErrSep + smodel.ErrNotFound) ErrorUserIdIsEmpty error = errors.New(smodel.ErrBase + smodel.ErrSep + ErrUser + smodel.ErrSep + ErrId + smodel.ErrSep + ErrEmpty) ErrorUserIsEmpty error = errors.New(smodel.ErrBase + smodel.ErrSep + ErrUser + smodel.ErrSep + ErrEmpty) ErrorUserIsInactive error = errors.New(smodel.ErrBase + smodel.ErrSep + ErrUser + smodel.ErrSep + ErrInactive) ErrorUserUsernameOrEmailAreEmpty error = errors.New(smodel.ErrBase + smodel.ErrSep + ErrUser + smodel.ErrSep + ErrUserNameOrEmail + smodel.ErrSep + ErrEmpty) ErrorUserTokenIsEmpty error = errors.New(smodel.ErrBase + smodel.ErrSep + ErrUser + smodel.ErrSep + ErrToken + smodel.ErrSep + ErrEmpty) ErrorUserAuthenticationTokenAndRefreshTokenAreEmpty error = errors.New(smodel.ErrBase + smodel.ErrSep + ErrUser + smodel.ErrSep + ErrAuthentication + smodel.ErrSep + ErrRefreshToken + smodel.ErrSep + ErrEmpty) ErrorUserUsernameIsEmpty error = errors.New(smodel.ErrBase + smodel.ErrSep + ErrUser + smodel.ErrSep + ErrUserName + smodel.ErrSep + ErrEmpty) ErrorUserUsernameIsExists error = errors.New(smodel.ErrBase + smodel.ErrSep + ErrUser + smodel.ErrSep + ErrUserName + smodel.ErrSep + ErrAlreadyExists) ErrorUserUsernameIsTooShort error = errors.New(smodel.ErrBase + smodel.ErrSep + ErrUser + smodel.ErrSep + ErrUserName + smodel.ErrSep + ErrTooShort) ErrorUserUsernameIsTooLong error = errors.New(smodel.ErrBase + smodel.ErrSep + ErrUser + smodel.ErrSep + ErrUserName + smodel.ErrSep + ErrTooLong) ErrorUserUsernameIsNotValid error = errors.New(smodel.ErrBase + smodel.ErrSep + ErrUser + smodel.ErrSep + ErrUserName + smodel.ErrSep + ErrNotValid) ErrorUserUsernameContainsSpecialChar error = errors.New(smodel.ErrBase + smodel.ErrSep + ErrUser + smodel.ErrSep + ErrUserName + smodel.ErrSep + ErrContainsSpecialChar) ErrorUserEmailIsEmpty error = errors.New(smodel.ErrBase + smodel.ErrSep + ErrUser + smodel.ErrSep + ErrEmail + smodel.ErrSep + ErrEmpty) ErrorUserEmailIsNotValid error = errors.New(smodel.ErrBase + smodel.ErrSep + ErrUser + smodel.ErrSep + ErrEmail + smodel.ErrSep + ErrNotValid) ErrorUserEmailIsExists error = errors.New(smodel.ErrBase + smodel.ErrSep + ErrUser + smodel.ErrSep + ErrEmail + smodel.ErrSep + ErrAlreadyExists) ErrorUserRoleIsEmpty error = errors.New(smodel.ErrBase + smodel.ErrSep + ErrUser + smodel.ErrSep + ErrRole + smodel.ErrSep + ErrEmpty) ErrorUserPasswordIsEmpty error = errors.New(smodel.ErrBase + smodel.ErrSep + ErrUser + smodel.ErrSep + ErrPassword + smodel.ErrSep + ErrEmpty) ErrorUserPasswordIsTooShort error = errors.New(smodel.ErrBase + smodel.ErrSep + ErrUser + smodel.ErrSep + ErrPassword + smodel.ErrSep + ErrTooShort) ErrorUserPasswordIsTooLong error = errors.New(smodel.ErrBase + smodel.ErrSep + ErrUser + smodel.ErrSep + ErrPassword + smodel.ErrSep + ErrTooLong) ErrorUserPasswordIsNotValid error = errors.New(smodel.ErrBase + smodel.ErrSep + ErrUser + smodel.ErrSep + ErrPassword + smodel.ErrSep + ErrNotValid) ErrorUserPasswordNotFound error = errors.New(smodel.ErrBase + smodel.ErrSep + ErrUser + smodel.ErrSep + ErrPassword + smodel.ErrSep + smodel.ErrNotFound) ErrorUserPasswordIsInactive error = errors.New(smodel.ErrBase + smodel.ErrSep + ErrUser + smodel.ErrSep + ErrPassword + smodel.ErrSep + ErrInactive) )
var ERRORS []error = []error{ ErrorNone, ErrorUserNotFound, ErrorUserIdIsEmpty, ErrorUserIsEmpty, ErrorUserIsInactive, ErrorUserUsernameOrEmailAreEmpty, ErrorUserTokenIsEmpty, ErrorUserAuthenticationTokenAndRefreshTokenAreEmpty, ErrorUserUsernameIsEmpty, ErrorUserUsernameIsExists, ErrorUserUsernameIsTooShort, ErrorUserUsernameIsTooLong, ErrorUserUsernameIsNotValid, ErrorUserUsernameContainsSpecialChar, ErrorUserEmailIsEmpty, ErrorUserEmailIsNotValid, ErrorUserEmailIsExists, ErrorUserRoleIsEmpty, ErrorUserPasswordIsEmpty, ErrorUserPasswordIsTooShort, ErrorUserPasswordIsTooLong, ErrorUserPasswordIsNotValid, ErrorUserPasswordNotFound, ErrorUserPasswordIsInactive, }
var MESSAGES []string = []string{}
var (
MessageNone string = ""
)
Functions ¶
func GetMessages ¶
func GetMessages() []string
Types ¶
type PasswordStatus ¶
type PasswordStatus int8
PasswordStatus is a type that represents the status of a password.
const ( PasswordStatusNONE PasswordStatus = iota PasswordStatusACTIVE PasswordStatusINACTIVE PasswordStatusAUTO_GENERATED PasswordStatusCHANGE_REQUIRED PasswordStatusEXPIRED )
type User ¶
type User struct { UserName string `json:"user_name"` // UserName is the user name of the user. Email string `json:"email"` // Email is the email address of the user. Role string `json:"role"` // Role is the role of the user. UserType UserType `json:"user_type"` // UserType is the type of the user. UserStatus UserStatus `json:"user_status"` // UserStatus is the status of the user. Tags []string `json:"tags"` // Tags is the tags of the user. FirstName string `json:"first_name"` // FirstName is the first name of the user. LastName string `json:"last_name"` // LastName is the last name of the user. }
User is a struct that represents the object of a user basic values.
func NewUser ¶
func NewUser(userName string, email string, role string, userType UserType, userStatus UserStatus, tags []string, firstName string, lastName string) *User
NewUser creates a new *User.
func (*User) IsNotEmpty ¶
IsNotEmpty returns true if the User is not empty.
type UserPassword ¶
type UserPassword struct { Password string `json:"password"` // Password is the password of the user. PasswordStatus PasswordStatus `json:"password_status"` // PasswordStatus is the status of password of the user. }
UserPassword is a struct that represents the object of a user password values.
func NewEmptyUserPassword ¶
func NewEmptyUserPassword() *UserPassword
NewEmptyUserPassword creates a new *UserPassword with empty values.
func NewUserPassword ¶
func NewUserPassword(password string, passwordStatus PasswordStatus) *UserPassword
NewUserPassword creates a new *UserPassword.
func (*UserPassword) Clone ¶
func (s *UserPassword) Clone() *UserPassword
ClonePassword returns a clone of the UserPassword.
func (*UserPassword) ComparePass ¶
func (s *UserPassword) ComparePass(pass string) bool
ComparePass compares hashes of the passwords
func (*UserPassword) Equals ¶
func (s *UserPassword) Equals(other *UserPassword) bool
Equals returns true if the User is equal to the other UserPassword.
func (*UserPassword) IsEmpty ¶
func (s *UserPassword) IsEmpty() bool
IsEmpty returns true if the UserPassword is empty.
func (*UserPassword) IsNotEmpty ¶
func (s *UserPassword) IsNotEmpty() bool
IsNotEmpty returns true if the UserPassword is not empty.
func (*UserPassword) String ¶
func (s *UserPassword) String() string
String returns a string representation of the UserPassword.
func (*UserPassword) Validate ¶
func (s *UserPassword) Validate() error
Validate validates the UserPassword.
type UserSortField ¶
type UserSortField int8
UserSortField is a type that represents the sort fields of a user.
const ( UserSortFieldNONE UserSortField = iota UserSortFieldId UserSortFieldName UserSortFieldCreatedAt UserSortFieldUpdatedAt )
type UserStatus ¶
type UserStatus int8
UserStatus is a status that represents the status of a user.
const ( UserStatusNONE UserStatus = iota UserStatusACTIVE UserStatusINACTIVE )