fact_totem_client

package module
v0.0.0-...-6a43356 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package fact_totem_client abstracts the web interface.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action int
const (
	Append Action = iota
	Read
	Tail
	Scan
)

func (Action) MarshalJSON

func (a Action) MarshalJSON() ([]byte, error)

MarshalJSON marshals the enum as a quoted json string

func (Action) String

func (a Action) String() string

func (*Action) UnmarshalJSON

func (a *Action) UnmarshalJSON(b []byte) error

UnmarshalJSON unmashals a quoted json string to the enum value

type EventStore

type EventStore interface {
	// Append an event to the event store for the fact
	Append(aggregate string, entity string, content interface{}) (*TailResponse, error)
	// Tail gets the last event id
	Tail(aggregate string, entity string) (*TailResponse, error)
	// Read the events for an aggregate from the identified event id
	Read(aggregate string, entity string, originEventId string, maxCount int) (*ReadResponse, error)
	// Scan will list all keys in the aggregate (excluding individual events)
	Scan(aggregate string) (*ScanResponse, error)
}

EventStore provides an interface to store events for a topic, and retrieve them later.

type Fact

type Fact struct {
	Id        ulid.ULID
	Timestamp time.Time
	Content   interface{}
}

type ReadResponse

type ReadResponse struct {
	Aggregate string `json:"aggregate"`
	Entity    string `json:"entity"`
	Facts     []Fact `json:"facts"`
	Total     uint   `json:"total"`
	PageSize  int    `json:"page-size"`
}

type Request

type Request struct {
	Action    Action      `json:"action"`
	Aggregate string      `json:"aggregate"`
	Entity    string      `json:"entity,omitempty"`
	Content   interface{} `json:"content,omitempty"`
	Origin    string      `json:"origin,omitempty"`
	PageSize  int         `json:"page-size,omitempty"`
}

type ScanResponse

type ScanResponse struct {
	Aggregate string   `json:"aggregate"`
	Entities  []string `json:"entities"`
	Total     uint     `json:"total"`
}

type StandardClient

type StandardClient struct {
	Token        string
	FactTotemUrl string
	// contains filtered or unexported fields
}

func (*StandardClient) Append

func (c *StandardClient) Append(aggregate string, entity string, content interface{}) (*TailResponse, error)

func (*StandardClient) Read

func (c *StandardClient) Read(aggregate string, entity string, originEventId string, maxCount int) (*ReadResponse, error)

func (*StandardClient) Refresh

func (c *StandardClient) Refresh() error

func (*StandardClient) Scan

func (c *StandardClient) Scan(aggregate string) (*ScanResponse, error)

func (*StandardClient) Tail

func (c *StandardClient) Tail(aggregate string, entity string) (*TailResponse, error)

type TailResponse

type TailResponse struct {
	Aggregate string `json:"aggregate"`
	Entity    string `json:"entity,omitempty"`
	Fact      Fact   `json:"fact"`
	Total     uint   `json:"total"`
}

Jump to

Keyboard shortcuts

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