eventstore

package
v0.0.1-0...-6deec57 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2022 License: MIT Imports: 14 Imported by: 0

README

eventstore GoDoc

Package eventstore provides mongo implementation of domain event store

Download:

go get -u github.com/bradishungry/go-api-learning/pkg/eventstore/mongo

Package eventstore provides mongo implementation of domain event store

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(ctx context.Context, collectionName string, mongoDB *mongo.Database) (baseeventstore.EventStore, error)

New creates new mongo event store

Types

type DTO

type DTO struct {
	ID            string            `bson:"event_id"`
	Type          string            `bson:"event_type"`
	StreamID      string            `bson:"stream_id"`
	StreamName    string            `bson:"stream_name"`
	StreamVersion int               `bson:"stream_version"`
	OccurredAt    time.Time         `bson:"occurred_at"`
	ExpiresAt     *time.Time        `bson:"expires_at,omitempty"`
	Payload       bson.Raw          `bson:"payload"`
	Metadata      *EventMetadataDTO `bson:"metadata,omitempty"`
}

func NewDTOFromEvent

func NewDTOFromEvent(e *domain.Event) (*DTO, error)

func (*DTO) ToEvent

func (o *DTO) ToEvent() (*domain.Event, error)

type EventMetadataDTO

type EventMetadataDTO struct {
	Identity  *identity.Identity `bson:"identity,omitempty"`
	IPAddress net.IP             `bson:"ip_address,omitempty"`
	UserAgent string             `bson:"http_user_agent,omitempty"`
	Referer   string             `bson:"http_referer,omitempty"`
}

Jump to

Keyboard shortcuts

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