entity

package
v0.0.0-...-354f3a1 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2022 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrResourceNotFound = errors.New("resource not found")
)

Functions

This section is empty.

Types

type Email

type Email interface {
	Value() string
}

* Email *

func NewEmail

func NewEmail(value string) (Email, error)

type ID

type ID interface {
	Value() string
	IsEmpty() bool
}

* ID *

type IDGenerator

type IDGenerator interface {
	Generate() ID
	From(value string) (ID, error)
}

* ID generator *

type IDManager

type IDManager interface {
	IDGenerator
	IDValidator
}

func NewIDManager

func NewIDManager(validator IDValidator, generator IDGenerator) IDManager

* ID manager *

type IDValidator

type IDValidator interface {
	Validate(value string) error
}

* ID validator *

type User

type User interface {
	UserID() UserID
	Name() string
	Email() Email
}

* User *

func NewUser

func NewUser(userID UserID, name string, email Email) User

type UserID

type UserID interface {
	ID
}

* UserID *

type UsersReadWriter

type UsersReadWriter interface {
	UsersReader
	UsersWriter
}

type UsersReader

type UsersReader interface {
	FindAll() ([]User, error)
	FindByID(id UserID) (User, error)
}

* Repository *

type UsersWriter

type UsersWriter interface {
	Insert(user User) (User, error)
	Delete(id UserID) error
}

Jump to

Keyboard shortcuts

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