domain

package
v0.0.0-...-94051e6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 31, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
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"
)
View Source
const (
	ErrEmpty               string = "empty"
	ErrTooShort            string = "tooshort"
	ErrTooLong             string = "toolong"
	ErrNotValid            string = "notvalid"
	ErrContainsSpecialChar string = "containsSpecialChar"
	ErrInactive            string = "inactive"
	ErrAlreadyExists       string = "alreadyexists"
)

Variables

View Source
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)
)
View Source
var MESSAGES []string = []string{}
View Source
var (
	MessageNone string = ""
)

Functions

func GetErrors

func GetErrors() []error

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 NewEmptyUser

func NewEmptyUser() *User

NewEmptyUser creates a new *User with empty 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) Clear

func (s *User) Clear()

Clear clears the User.

func (*User) Clone

func (s *User) Clone() *User

Clone returns a clone of the User.

func (*User) Equals

func (s *User) Equals(other *User) bool

Equals returns true if the User is equal to the other User.

func (*User) IsEmpty

func (s *User) IsEmpty() bool

IsEmpty returns true if the User is empty.

func (*User) IsNotEmpty

func (s *User) IsNotEmpty() bool

IsNotEmpty returns true if the User is not empty.

func (*User) String

func (s *User) String() string

String returns a string representation of the User.

func (*User) Validate

func (s *User) Validate() error

Validate validates the User.

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) Clear

func (s *UserPassword) Clear()

Clear clears the 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
)

type UserType

type UserType int8

UserType is a type that represents the type of a user.

const (
	UserTypeNONE UserType = iota
	UserTypeADMIN
	UserTypeUSER
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL