Documentation
¶
Index ¶
- Variables
- type Email
- type Name
- func (n *Name) DisplayName() string
- func (n *Name) Equals(other *Name) bool
- func (n *Name) FirstName() string
- func (n *Name) Initials() string
- func (n *Name) IsMononym() bool
- func (n *Name) LastName() string
- func (n Name) MarshalJSON() ([]byte, error)
- func (n *Name) MiddleNames() []string
- func (n *Name) String() string
- func (n *Name) UnmarshalJSON(data []byte) error
- type Password
- type PasswordPolicy
- type Status
- func (s Status) CanPerformActions() bool
- func (s Status) CanTransitionTo(target Status) bool
- func (s Status) Equals(other Status) bool
- func (s Status) GetAllowedTransitions() []Status
- func (s Status) IsActive() bool
- func (s Status) IsDeleted() bool
- func (s Status) IsInactive() bool
- func (s Status) IsPending() bool
- func (s Status) IsSuspended() bool
- func (s Status) IsTerminal() bool
- func (s Status) MarshalJSON() ([]byte, error)
- func (s Status) RequiresVerification() bool
- func (s Status) String() string
- func (s *Status) TransitionTo(target Status) error
- func (s *Status) UnmarshalJSON(data []byte) error
- type Token
Constants ¶
This section is empty.
Variables ¶
var StatusTransitions = map[Status][]Status{ StatusPending: { StatusActive, StatusInactive, StatusDeleted, }, StatusActive: { StatusInactive, StatusSuspended, StatusDeleted, }, StatusInactive: { StatusActive, StatusDeleted, }, StatusSuspended: { StatusActive, StatusInactive, StatusDeleted, }, StatusDeleted: {}, }
StatusTransitions defines allowed status transitions
var ValidStatuses = map[Status]bool{ StatusActive: true, StatusInactive: true, StatusPending: true, StatusSuspended: true, StatusDeleted: true, }
ValidStatuses contains all valid status values
Functions ¶
This section is empty.
Types ¶
type Email ¶
type Email struct {
// contains filtered or unexported fields
}
Email represents an email address value object
func (*Email) IsBusinessEmail ¶
IsBusinessEmail checks if the email is from a business domain (not free email providers)
func (Email) MarshalJSON ¶
MarshalJSON implements json.Marshaler interface
func (*Email) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler interface
type Name ¶
type Name struct {
// contains filtered or unexported fields
}
Name represents a person's name value object
func (*Name) DisplayName ¶
DisplayName returns a formatted display name
func (Name) MarshalJSON ¶
MarshalJSON implements json.Marshaler interface
func (*Name) MiddleNames ¶
MiddleNames returns the middle names if any
func (*Name) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler interface
type Password ¶
type Password struct {
// contains filtered or unexported fields
}
func NewPassword ¶
func NewPasswordWithPolicy ¶ added in v0.1.78
func NewPasswordWithPolicy(plainPassword string, policy *PasswordPolicy) (*Password, error)
NewPasswordWithPolicy creates a new password value object with custom policy
type PasswordPolicy ¶ added in v0.1.78
type PasswordPolicy struct {
MinLength int
RequireUppercase bool
RequireLowercase bool
RequireNumber bool
RequireSpecial bool
}
PasswordPolicy defines the password validation rules
func DefaultPasswordPolicy ¶ added in v0.1.78
func DefaultPasswordPolicy() *PasswordPolicy
DefaultPasswordPolicy returns the default password policy with strong complexity requirements
func (*PasswordPolicy) ValidatePassword ¶ added in v0.1.78
func (p *PasswordPolicy) ValidatePassword(password string) error
ValidatePassword validates password against the policy
type Status ¶
type Status string
Status represents the user status value object
const ( StatusActive Status = "active" StatusInactive Status = "inactive" StatusPending Status = "pending" StatusSuspended Status = "suspended" StatusDeleted Status = "deleted" )
Status constants
func ParseStatus ¶
ParseStatus parses a string to Status (case-insensitive)
func (Status) CanPerformActions ¶
CanPerformActions checks if a user with this status can perform actions
func (Status) CanTransitionTo ¶
CanTransitionTo checks if the current status can transition to the target status
func (Status) GetAllowedTransitions ¶
GetAllowedTransitions returns all allowed transitions from the current status
func (Status) IsInactive ¶
IsInactive checks if the status is inactive
func (Status) IsSuspended ¶
IsSuspended checks if the status is suspended
func (Status) IsTerminal ¶
IsTerminal checks if the status is terminal (no further transitions possible)
func (Status) MarshalJSON ¶
MarshalJSON implements json.Marshaler interface
func (Status) RequiresVerification ¶
RequiresVerification checks if the status requires verification before activation
func (*Status) TransitionTo ¶
TransitionTo attempts to transition to a new status
func (*Status) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler interface
type Token ¶
type Token struct {
// contains filtered or unexported fields
}