account

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2024 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrInvalidPassword = "密码由大小写字母、数字、符号组成,且至少需要8位"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	ID       int64
	Mobile   string
	Email    string
	Password string
	Salt     string
}

func NewAccount

func NewAccount(options ...AccountOption) *Account

func NewAccountWithModel

func NewAccountWithModel(model *models.Account) *Account

func (*Account) CheckPassword

func (a *Account) CheckPassword(password string) error

func (*Account) EncryptPassword

func (a *Account) EncryptPassword() error

func (*Account) GenerateId

func (a *Account) GenerateId()

func (*Account) IsPasswordValid

func (a *Account) IsPasswordValid(patterns ...string) bool

func (*Account) ModifyPassword

func (a *Account) ModifyPassword(password string) error

func (*Account) ToModel

func (a *Account) ToModel() *models.Account

type AccountOption

type AccountOption func(*Account)

func WithEmail

func WithEmail(email string) AccountOption

func WithID

func WithID(id int64) AccountOption

func WithMobile

func WithMobile(mobile string) AccountOption

func WithPassword

func WithPassword(password string) AccountOption

Jump to

Keyboard shortcuts

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