eventsam

package module
v0.0.0-...-246ae54 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2024 License: MIT Imports: 7 Imported by: 0

README

eventsam

Simple Event Sourcing

Language

Indonesia

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EventEntity

type EventEntity struct {
	ID            uint   `gorm:"primarykey" json:"id"`
	EventID       string `gorm:"type:varchar(191)" json:"event_id"`
	AggregateName string `gorm:"type:varchar(191);index:,unique,composite:idx_aggregate_version;index" json:"aggregate_name"`
	AggregateID   string `gorm:"type:varchar(191);index:,unique,composite:idx_aggregate_version;index" json:"aggregate_id"`
	EventName     string `gorm:"type:varchar(191)" json:"event_name"`
	Version       int64  `gorm:"index:,unique,composite:idx_aggregate_version;index" json:"version"`
	Data          string `json:"data"`
	TimeMillis    int64  `json:"time_millis"`
}

func (*EventEntity) DataToStruct

func (es *EventEntity) DataToStruct(data any) (err error)

type Eventsam

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

func NewEventsam

func NewEventsam(db *gorm.DB) (es Eventsam, err error)

func (*Eventsam) FetchAggregateEvent

func (es *Eventsam) FetchAggregateEvent(aggregateName string, afterID, limit int) (events []EventEntity, err error)

func (*Eventsam) FetchAggregatesEvent

func (es *Eventsam) FetchAggregatesEvent(aggregateNames []string, afterID, limit int) (events []EventEntity, err error)

func (*Eventsam) FetchAllEvent

func (es *Eventsam) FetchAllEvent(afterID, limit int) (events []EventEntity, err error)

func (*Eventsam) Retrieve

func (es *Eventsam) Retrieve(aggregateID string, aggregateName string, afterVersion int) (events []EventEntity, err error)

func (*Eventsam) SetPublisher

func (es *Eventsam) SetPublisher(id string, publisher Publisher)

func (Eventsam) Store

func (es Eventsam) Store(aggregateID string, aggregateName string, eventName string, version int64, data any) (entity EventEntity, err error)

type Publisher

type Publisher interface {
	Publish(event EventEntity) (err error)
}

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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