eventsourcingdb

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2025 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package eventsourcingdb provides the official Go client SDK for EventSourcingDB.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bound added in v0.29.0

type Bound struct {
	ID   string
	Type BoundType
}

type BoundType added in v0.29.0

type BoundType string
const (
	BoundTypeInclusive BoundType = "inclusive"
	BoundTypeExclusive BoundType = "exclusive"
)

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(baseURL *url.URL, apiToken string) (*Client, error)

func (*Client) ObserveEvents added in v0.29.0

func (c *Client) ObserveEvents(
	ctx context.Context,
	subject string,
	options ObserveEventsOptions,
) iter.Seq2[Event, error]

func (*Client) Ping

func (c *Client) Ping() error

func (*Client) ReadEventType added in v1.2.0

func (c *Client) ReadEventType(
	eventType string,
) (EventType, error)

func (*Client) ReadEventTypes added in v0.29.0

func (c *Client) ReadEventTypes(
	ctx context.Context,
) iter.Seq2[EventType, error]

func (*Client) ReadEvents added in v0.29.0

func (c *Client) ReadEvents(
	ctx context.Context,
	subject string,
	options ReadEventsOptions,
) iter.Seq2[Event, error]

func (*Client) ReadSubjects added in v0.29.0

func (c *Client) ReadSubjects(
	ctx context.Context,
	baseSubject string,
) iter.Seq2[string, error]

func (*Client) RegisterEventSchema added in v0.29.0

func (c *Client) RegisterEventSchema(eventType string, schema map[string]any) error

func (*Client) RunEventQLQuery added in v0.29.0

func (c *Client) RunEventQLQuery(
	ctx context.Context,
	query string,
) iter.Seq2[json.RawMessage, error]

func (*Client) VerifyAPIToken

func (c *Client) VerifyAPIToken() error

func (*Client) WriteEvents added in v0.28.0

func (c *Client) WriteEvents(events []EventCandidate, preconditions []Precondition) ([]Event, error)

type Container

type Container struct {
	// contains filtered or unexported fields
}

func NewContainer

func NewContainer() *Container

func (*Container) GetAPIToken

func (c *Container) GetAPIToken() string

func (*Container) GetBaseURL

func (c *Container) GetBaseURL(ctx context.Context) (*url.URL, error)

func (*Container) GetClient

func (c *Container) GetClient(ctx context.Context) (*Client, error)

func (*Container) GetHost

func (c *Container) GetHost(ctx context.Context) (string, error)

func (*Container) GetMappedPort

func (c *Container) GetMappedPort(ctx context.Context) (int, error)

func (*Container) GetSigningKey added in v1.3.0

func (c *Container) GetSigningKey() (*ed25519.PrivateKey, error)

func (*Container) GetVerificationKey added in v1.3.0

func (c *Container) GetVerificationKey() (*ed25519.PublicKey, error)

func (*Container) IsRunning

func (c *Container) IsRunning() bool

func (*Container) Start

func (c *Container) Start(ctx context.Context) error

func (*Container) Stop

func (c *Container) Stop(ctx context.Context) error

func (*Container) WithAPIToken

func (c *Container) WithAPIToken(token string) *Container

func (*Container) WithImageTag

func (c *Container) WithImageTag(tag string) *Container

func (*Container) WithPort

func (c *Container) WithPort(port int) *Container

func (*Container) WithSigningKey added in v1.3.0

func (c *Container) WithSigningKey() *Container

type Event added in v0.28.0

type Event struct {
	SpecVersion     string
	ID              string
	Time            time.Time
	Source          string
	Subject         string
	Type            string
	DataContentType string
	Data            json.RawMessage
	Hash            string
	PredecessorHash string
	TraceParent     *string
	TraceState      *string
	Signature       *string
}

func (Event) VerifyHash added in v1.3.0

func (event Event) VerifyHash() error

func (Event) VerifySignature added in v1.3.0

func (event Event) VerifySignature(verificationKey ed25519.PublicKey) error

type EventCandidate added in v0.28.0

type EventCandidate struct {
	Source      string
	Subject     string
	Type        string
	Data        any
	TraceParent *string
	TraceState  *string
}

type EventType added in v0.29.0

type EventType struct {
	EventType string
	IsPhantom bool
	Schema    *map[string]any
}

type ObserveEventsOptions added in v0.29.0

type ObserveEventsOptions struct {
	Recursive       bool
	LowerBound      *Bound
	FromLatestEvent *ObserveFromLatestEvent
}

type ObserveFromLatestEvent added in v0.29.0

type ObserveFromLatestEvent struct {
	Subject          string
	Type             string
	IfEventIsMissing ObserveIfEventIsMissing
}

type ObserveIfEventIsMissing added in v0.29.0

type ObserveIfEventIsMissing string
const (
	WaitForEventIfEventIsMissing      ObserveIfEventIsMissing = "wait-for-event"
	ObserveEverythingIfEventIsMissing ObserveIfEventIsMissing = "read-everything"
)

type Order added in v0.29.0

type Order string

func OrderAntichronological added in v0.29.0

func OrderAntichronological() *Order

func OrderChronological added in v0.29.0

func OrderChronological() *Order

type Precondition added in v0.28.0

type Precondition interface {
	// contains filtered or unexported methods
}

func NewIsEventQLQueryTruePrecondition added in v1.2.1

func NewIsEventQLQueryTruePrecondition(query string) Precondition

func NewIsSubjectOnEventIDPrecondition added in v0.28.0

func NewIsSubjectOnEventIDPrecondition(subject string, eventID string) Precondition

func NewIsSubjectPristinePrecondition added in v0.28.0

func NewIsSubjectPristinePrecondition(subject string) Precondition

type ReadEventsOptions added in v0.29.0

type ReadEventsOptions struct {
	Recursive       bool
	Order           *Order
	LowerBound      *Bound
	UpperBound      *Bound
	FromLatestEvent *ReadFromLatestEvent
}

type ReadFromLatestEvent added in v0.29.0

type ReadFromLatestEvent struct {
	Subject          string
	Type             string
	IfEventIsMissing ReadIfEventIsMissing
}

type ReadIfEventIsMissing added in v0.29.0

type ReadIfEventIsMissing string
const (
	ReadNothingIfEventIsMissing    ReadIfEventIsMissing = "read-nothing"
	ReadEverythingIfEventIsMissing ReadIfEventIsMissing = "read-everything"
)

Jump to

Keyboard shortcuts

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