valueobject

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MinPasswordLength 密码长度限制
	MinPasswordLength = 8
	MaxPasswordLength = 128

	// MinRequiredCharTypes 密码强度要求
	MinRequiredCharTypes = 3 // 至少包含3种字符类型
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Email

type Email struct {
	// contains filtered or unexported fields
}

Email 邮箱地址值对象

func NewEmail

func NewEmail(email string) (Email, error)

func (Email) String

func (e Email) String() string

func (Email) Validate

func (e Email) Validate() error

type Password

type Password struct {
	// contains filtered or unexported fields
}

Password 登录密码值对象

func NewEmptyPassword

func NewEmptyPassword() Password

func NewPassword

func NewPassword(value string) (Password, error)

func NewPasswordByHashText

func NewPasswordByHashText(hashPassword string) (Password, error)

func (*Password) IsEmpty

func (p *Password) IsEmpty() bool

IsEmpty 检查密码是否为空

func (*Password) Value

func (p *Password) Value() string

Value 获取密码哈希值

func (*Password) Verify

func (p *Password) Verify(plainPassword string) bool

type PasswordStrength

type PasswordStrength int

PasswordStrength 密码强度等级

const (
	PasswordStrengthWeak PasswordStrength = iota
	PasswordStrengthMedium
	PasswordStrengthStrong
	PasswordStrengthVeryStrong
)

func EvaluatePasswordStrength

func EvaluatePasswordStrength(password string) PasswordStrength

EvaluatePasswordStrength 评估密码强度

func (PasswordStrength) String

func (ps PasswordStrength) String() string

String 返回密码强度的字符串表示

type Telephone

type Telephone struct {
	// contains filtered or unexported fields
}

Telephone 手机号值对象

func NewEmptyTelephone

func NewEmptyTelephone() Telephone

func NewTelephone

func NewTelephone(telephone string) (Telephone, error)

func (Telephone) String

func (t Telephone) String() string

func (Telephone) Validate

func (t Telephone) Validate() error

func (Telephone) Value

func (t Telephone) Value() string

type Username

type Username struct {
	// contains filtered or unexported fields
}

Username 用户名值对象

func NewUsername

func NewUsername(value string) (Username, error)

func (Username) Validate

func (u Username) Validate() error

func (Username) Value

func (u Username) Value() string

Value 获取用户名值

Jump to

Keyboard shortcuts

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