domain

package
v0.0.0-...-436674b Latest Latest
Warning

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

Go to latest
Published: Oct 9, 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"
	ErrRefrehsToken    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"
	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 + ErrRefrehsToken + 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)
	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 LoginRequest

type LoginRequest 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.
	Password string `json:"password"`  // Password is the password of the user.
}

LoginRequest is a struct that represents the required values of login.

func NewEmptyLoginRequest

func NewEmptyLoginRequest() *LoginRequest

NewEmptyLoginRequest creates a new *LoginRequest with empty values.

func NewLoginRequest

func NewLoginRequest(userName string,
	email string,
	password string) *LoginRequest

NewLoginRequest creates a new *LoginRequest.

func (*LoginRequest) Clear

func (s *LoginRequest) Clear()

Clear clears the LoginRequest.

func (*LoginRequest) Clone

func (s *LoginRequest) Clone() *LoginRequest

Clone returns a clone of the required values of login.

func (*LoginRequest) Equals

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

Equals returns true if the login values is equal to the other login values.

func (*LoginRequest) IsEmpty

func (s *LoginRequest) IsEmpty() bool

IsEmpty returns true if the login values are empty.

func (*LoginRequest) IsNotEmpty

func (s *LoginRequest) IsNotEmpty() bool

IsNotEmpty returns true if the login values are not empty.

func (*LoginRequest) String

func (s *LoginRequest) String() string

String returns a string representation of the reqiured values of login.

func (*LoginRequest) Validate

func (s *LoginRequest) Validate() error

Validate validates the LoginRequest.

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 Token

type Token struct {
	AuthenticationToken string `json:"authentication_token"` // AuthenticationToken is the authentication token.
	RefreshToken        string `json:"refresh_token"`        // RefreshToken is the refresh token.
}

Token is a struct that represents the object of a token for authentication.

func NewEmptyToken

func NewEmptyToken() *Token

NewEmptyToken creates a new *Token with empty values.

func NewToken

func NewToken(authenticationToken string,
	refreshToken string) *Token

NewToken creates a new *Token.

func (*Token) Clear

func (s *Token) Clear()

Clear clears the Token.

func (*Token) Clone

func (s *Token) Clone() *Token

Clone returns a clone of the Token.

func (*Token) Equals

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

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

func (*Token) IsEmpty

func (s *Token) IsEmpty() bool

IsEmpty returns true if the Token is empty.

func (*Token) IsNotEmpty

func (s *Token) IsNotEmpty() bool

IsNotEmpty returns true if the Token is not empty.

func (*Token) String

func (s *Token) String() string

String returns a string representation of the Token.

func (*Token) Validate

func (s *Token) Validate() error

Validate validates the Token.

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