domain

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2025 License: MIT Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Aggregate

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

func ExistingAggregate added in v0.1.8

func ExistingAggregate(id rid.Id, version int32, createdAt time.Time, updatedAt time.Time, deletedAt *time.Time, events []Event) *Aggregate

func NewAggregate

func NewAggregate(id rid.Id) *Aggregate

func (*Aggregate) AddEvent

func (a *Aggregate) AddEvent(e Event)

func (*Aggregate) CreatedAt

func (a *Aggregate) CreatedAt() time.Time

func (*Aggregate) DeletedAt

func (a *Aggregate) DeletedAt() *time.Time

func (*Aggregate) Events

func (a *Aggregate) Events() []Event

func (*Aggregate) ID

func (a *Aggregate) ID() string

func (*Aggregate) IsDeleted

func (a *Aggregate) IsDeleted() bool

func (*Aggregate) PullEvents

func (a *Aggregate) PullEvents() []Event

func (*Aggregate) SoftDelete

func (a *Aggregate) SoftDelete()

func (*Aggregate) Touch

func (a *Aggregate) Touch()

func (*Aggregate) UpdatedAt

func (a *Aggregate) UpdatedAt() time.Time

func (*Aggregate) Version

func (a *Aggregate) Version() int32

type Bus added in v0.3.5

type Bus interface {
	Publish(subject string, data any) error
	Subscribe(subject, durable, queue string, handler func(ctx context.Context, data any) error) error
	EnsureStream(name string, subjects ...string) error
	Close() error
}

type Command added in v0.3.4

type Command interface {
	CommandName() string
	Validate() error
}

type Domain added in v0.1.7

type Domain[T any, P any] interface {
	New(param P) (*T, error)
	Existing(param P) (*T, error)
}

type Event

type Event interface {
	EventName() string
	OccurredAt() time.Time
}

type Query added in v0.3.4

type Query interface {
	QueryName() string
}

type Repository

type Repository[T any] interface {
	Save(entity T) error
	GetByID(id string) (T, error)
	Delete(id string) error
	List() ([]T, error)
}

type ValueObject

type ValueObject interface {
	Equals(other ValueObject) bool
}

ValueObject is a marker interface for DDD value objects

Jump to

Keyboard shortcuts

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