vobj

package module
v0.0.0-...-fd3fe65 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidCellNumber = errors.New("número de celular inválido")
)
View Source
var (
	// ErrInvalidEmail é retornado quando o formato do email é inválido.
	ErrInvalidEmail = errors.New("formato de email inválido")
)

Functions

This section is empty.

Types

type CellNumber

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

CellNumber é um Value Object para números de celular.

func NewCellNumber

func NewCellNumber(value string) (CellNumber, error)

NewCellNumber cria um novo Value Object CellNumber.

Sanitiza e valida o número, isto é, remove caracteres não numéricos e verifica se o número está no formato brasileiro (DDD com 2 dígitos + número com 9 dígitos).

func (CellNumber) Formatted

func (p CellNumber) Formatted() string

Formatted retorna o número formatado no padrão (XX) XXXXX-XXXX.

func (CellNumber) String

func (p CellNumber) String() string

String retorna o número sanitizado (apenas dígitos).

type Email

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

func NewEmail

func NewEmail(value string) (Email, error)

NewEmail é o construtor para o Value Object Email. Ele valida o formato.

func (Email) String

func (e Email) String() string

String retorna o valor primitivo do email.

type Password

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

Password é um Value Object que gerencia o hash de senhas.

func NewPasswordFromHash

func NewPasswordFromHash(hash string) (Password, error)

NewPasswordFromHash cria um Value Object Password a partir de um hash já existente (do banco de dados). Não há validação aqui, pois confiamos que o hash no banco é válido.

func NewPasswordFromPlainText

func NewPasswordFromPlainText(plainText string) (Password, error)

NewPasswordFromPlainText cria um novo Value Object Password a partir de uma senha em texto plano. Ele gera o hash automaticamente.

func (Password) Compare

func (p Password) Compare(plainText string) bool

Compare compara a senha em texto plano com o hash armazenado.

func (Password) String

func (p Password) String() string

String retorna o valor do hash.

type Period

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

Period representa uma competência no formato MMYYYY.

func NewPeriod

func NewPeriod(value time.Time) (Period, error)

func (Period) Formatted

func (p Period) Formatted() string

Formatted retorna a competência formatada no padrão MM/YYYY.

func (*Period) String

func (p *Period) String() string

Jump to

Keyboard shortcuts

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