model

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2021 License: MIT Imports: 1 Imported by: 3

Documentation

Index

Constants

View Source
const AwsContext = "AwsContext"

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context struct {
	AwsObjectStore  ObjectStore
	AwsEventStore   EventStore
	AwsEventBus     EventBus
	AwsStateStore   StateStore
	AwsGraphGateway GraphqlGateway
}

type EventBus

type EventBus interface {
	PublishEvent(ctx context.Context, event *EventObject)
}

type EventObject

type EventObject struct {
	Reference     *ObjectRef              `json:"_ref,omitempty"`
	SourceID      string                  `json:"source_id,omitempty"`
	SourceType    string                  `json:"source_type,omitempty"`
	SourceTime    int64                   `json:"source_time,omitempty"`
	SourceOwner   string                  `json:"source_owner,omitempty"`
	SourceState   *map[string]interface{} `json:"source_state,omitempty"`
	EventID       uint64                  `json:"event_id,omitempty"`
	EventType     string                  `json:"event_type,omitempty"`
	EventTime     int64                   `json:"event_time,omitempty"`
	EventAuthor   string                  `json:"event_author,omitempty"`
	EventPayload  *map[string]interface{} `json:"event_payload,omitempty"`
	TriggerSource string                  `json:"trigger_source,omitempty"`
	TriggerID     uint64                  `json:"trigger_id,omitempty"`
	Transaction   string                  `json:"transaction,omitempty"`
}

type EventStore

type EventStore interface {
	GetEventById(ctx context.Context, source string, id uint64) *EventObject
	GetLatestEvent(ctx context.Context, source string) *EventObject
	SaveEvent(ctx context.Context, event *EventObject)
}

type GraphqlGateway

type GraphqlGateway interface {
	ExecuteGraphql(ctx context.Context, request *GraphqlRequest) (*GraphqlResponse, error)
}

type GraphqlRequest

type GraphqlRequest struct {
	Query     string                 `json:"query"`
	Variables map[string]interface{} `json:"variables"`
}

type GraphqlResponse

type GraphqlResponse struct {
	Data   map[string]interface{}   `json:"data"`
	Errors []map[string]interface{} `json:"errors"`
}

type ObjectRef

type ObjectRef struct {
	Bucket  string  `json:"bucket,omitempty"`
	Region  string  `json:"region,omitempty"`
	Key     string  `json:"key,omitempty"`
	Version *string `json:"version,omitempty"`
}

type ObjectStore

type ObjectStore interface {
	GetObject(ctx context.Context, ref *ObjectRef, v interface{})
	SaveObject(ctx context.Context, key string, v interface{}) *ObjectRef
}

type StateStore

type StateStore interface {
	UpdateState(ctx context.Context, events []*EventObject)
}

Jump to

Keyboard shortcuts

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