usuario

package
v0.0.0-...-b6dc9e9 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2023 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const UserCreatedEventType event.Type = "events.user.created"

Variables

View Source
var ErrInvalidUserId = errors.New("invalid User ID")

Sentinel error

Functions

This section is empty.

Types

type GetUsersDto

type GetUsersDto struct {
	Id      string `json:"id"`
	Name    string `json:"name"`
	Surname string `json:"surname"`
	Email   string `json:"email"`
}

type User

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

Domain entity (data structure that represents a user)

func NewUser

func NewUser(id string, name string, surname string, password string, email string) (User, error)

NewUser creates a new user

func (User) GetEmail

func (u User) GetEmail() string

func (User) GetID

func (u User) GetID() UserId

ID return the user ID

func (User) GetName

func (u User) GetName() string

func (User) GetPassword

func (u User) GetPassword() string

func (User) GetSurname

func (u User) GetSurname() string

func (User) PullEvents

func (u User) PullEvents() []event.Event

Returns all the recorded domain events

func (*User) Record

func (u *User) Record(evt event.Event)

Records a new domain event

type UserCreatedEvent

type UserCreatedEvent struct {
	// Composition
	event.BaseEvent
	// contains filtered or unexported fields
}

func NewUserCreatedEvent

func NewUserCreatedEvent(id, name, surname, password, email string) UserCreatedEvent

func (UserCreatedEvent) Type

func (e UserCreatedEvent) Type() event.Type

func (UserCreatedEvent) UserEmail

func (e UserCreatedEvent) UserEmail() string

func (UserCreatedEvent) UserID

func (e UserCreatedEvent) UserID() string

func (UserCreatedEvent) UserName

func (e UserCreatedEvent) UserName() string

func (UserCreatedEvent) UserPassword

func (e UserCreatedEvent) UserPassword() string

func (UserCreatedEvent) UserSurname

func (e UserCreatedEvent) UserSurname() string

type UserId

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

Value objects strategy

func NewUserId

func NewUserId(value string) (UserId, error)

NewUserId instantiate the value object for UserId

func (UserId) String

func (id UserId) String() string

String type converts the UserID into string

type UserRepository

type UserRepository interface {
	Save(ctx context.Context, user User) error
	FindAll(ctx context.Context) ([]GetUsersDto, error)
}

Domain repository interface

Jump to

Keyboard shortcuts

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