Documentation
¶
Index ¶
- func InitMongoOrExit(cfg *DBConfig) (entityStore *mongo.Database)
- func InitPostgresOrExit(cfg *DBConfig) (db *gorm.DB, err error)
- func StartEntityGenerator(evs EventStore, eg EntityGenerator, cfg *KafkaConfig)
- type AppConfig
- type Command
- type DBConfig
- type EntityGenerator
- type Event
- type EventEntity
- type EventModel
- type EventStore
- type KafkaConfig
- type Observer
- type Projector
- type Query
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitMongoOrExit ¶
func StartEntityGenerator ¶
func StartEntityGenerator(evs EventStore, eg EntityGenerator, cfg *KafkaConfig)
Types ¶
type Command ¶
type Command struct {
AutoMigration bool
EventStoreDB *DBConfig
Kafka *KafkaConfig
}
type EntityGenerator ¶
type EntityGenerator interface {
CreateEntityAnsSave(events []*EventEntity) error
}
type EventEntity ¶
type EventEntity struct {
ID uint `gorm:"primarykey"`
UserNo uint `gorm:"index"`
EventType string `gorm:"index"`
AggregateId uuid.UUID `gorm:"type:uuid;index"`
Payload json.RawMessage `gorm:"type:json"`
}
func (EventEntity) TableName ¶
func (EventEntity) TableName() string
type EventModel ¶
type EventModel struct {
AggregateID uuid.UUID `json:"id" gorm:"type:uuid;column:id;index"`
EventType string `json:"event_type" gorm:"index"`
AppliedAt time.Time `json:"applied_at"`
}
func (*EventModel) ID ¶
func (ev *EventModel) ID() uuid.UUID
func (*EventModel) Time ¶
func (ev *EventModel) Time() time.Time
func (*EventModel) Type ¶
func (ev *EventModel) Type() string
type EventStore ¶
type EventStore interface {
AddAndPublishEvent(userNo uint, event Event) (*EventEntity, error)
GetAllEvents(aggregateId uuid.UUID) ([]*EventEntity, error)
GetLastEvent(aggregateId uuid.UUID) (*EventEntity, error)
}
func CreateCommander ¶
func CreateCommander(cfg *Command, ec chan Event) EventStore
func NewEventStore ¶
func NewEventStore(db *gorm.DB, ec chan Event) EventStore
type KafkaConfig ¶
type Observer ¶
type Observer interface {
Run()
}
func CreateProjector ¶
func NewObserver ¶
func NewObserver(cfg *KafkaConfig, ec <-chan Event) (Observer, error)
type Projector ¶
type Projector struct {
AutoMigration bool
Kafka *KafkaConfig
}
Click to show internal directories.
Click to hide internal directories.