domain

package
v0.0.0-...-cb49113 Latest Latest
Warning

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

Go to latest
Published: May 3, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type WatcherEntity

type WatcherEntity struct {
	ID            string    `json:"watcher_id" validate:"required" docstore:"watcher_id"`
	ServiceName   string    `json:"service_name" validate:"required" docstore:"service_name"`
	TransactionID *string   `json:"transaction_id,omitempty" docstore:"transaction_id,omitempty"`
	EventType     string    `json:"event_type" validate:"required" docstore:"event_type"`
	Content       string    `json:"content" validate:"required" docstore:"content"`
	Importance    string    `json:"importance" validate:"required" docstore:"importance"`
	Provider      string    `json:"provider" validate:"required" docstore:"provider"`
	DispatchTime  time.Time `json:"dispatch_time" validate:"required" docstore:"dispatch_time"`
}

WatcherEntity Represents an event log record

* Service Name = Service who dispatched the event * Transaction ID = Distributed transaction ID *Only for SAGA pattern * Event Type = Type of the event dispatched (integration or domain) * Content = Message body, mostly bytes or JSON-into string * Importance = Event's importance * Provider = Message Broker Provider (Kafka, RabbitMQ) * Dispatch Time = Event's dispatching timestamp

func NewWatcherEntity

func NewWatcherEntity(serviceName, transactionID, eventType, content, importance, provider string) *WatcherEntity

NewWatcherEntity Create a new watcher entity using domain rules

type WatcherRepository

type WatcherRepository interface {
	// Save Store a watcher entity
	Save(watcher *WatcherEntity) error
	// Fetch Get watcher entities
	Fetch(params *util.PaginationParams, filterParams util.FilterParams) ([]*WatcherEntity, error)
	// FetchByID Get an specific watcher entity
	FetchByID(id string) (*WatcherEntity, error)
	// Update Update an specific watcher entity
	Update(watcherUpdated *WatcherEntity) error
	// Remove Delete an specific watcher entity (hard-delete)
	Remove(id string) error
}

WatcherRepository Store manager for watcher entities

Jump to

Keyboard shortcuts

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