Documentation
¶
Overview ¶
Package angzarr provides a client library for Angzarr gRPC services.
Index ¶
- Constants
- func CacheKey(v interface{}) string
- func CommandPages(book *pb.CommandBook) []*pb.CommandPage
- func CorrelationID(v interface{}) string
- func CoverOf(v interface{}) *pb.Cover
- func DecodeEvent(page *pb.EventPage, typeSuffix string, msg interface{ ... }) bool
- func DivergenceFor(e *pb.Edition, domain string) int64
- func Domain(v interface{}) string
- func Edition(v interface{}) string
- func EditionOpt(v interface{}) *string
- func EventPages(book *pb.EventBook) []*pb.EventPage
- func EventsFromResponse(resp *pb.CommandResponse) []*pb.EventPage
- func ExplicitEdition(name string, divergences []*pb.DomainDivergence) *pb.Edition
- func HasCorrelationID(v interface{}) bool
- func ImplicitEdition(name string) *pb.Edition
- func IsClientError(err error) bool
- func IsMainTimeline(e *pb.Edition) bool
- func MainTimeline() *pb.Edition
- func NewCommandBook(cover *pb.Cover, pages ...*pb.CommandPage) *pb.CommandBook
- func NewCommandPage(sequence uint32, command *anypb.Any) *pb.CommandPage
- func NewCover(domain string, root uuid.UUID, correlationID string) *pb.Cover
- func NewCoverWithEdition(domain string, root uuid.UUID, correlationID string, edition *pb.Edition) *pb.Cover
- func NewQueryWithRange(cover *pb.Cover, lower uint32, upper *uint32) *pb.Query
- func NewQueryWithTemporal(cover *pb.Cover, temporal *pb.TemporalQuery) *pb.Query
- func NextSequence(book *pb.EventBook) uint32
- func Now() *timestamppb.Timestamp
- func ParseTimestamp(rfc3339 string) (*timestamppb.Timestamp, error)
- func ProtoToUUID(u *pb.UUID) (uuid.UUID, error)
- func RangeSelection(lower uint32, upper *uint32) *pb.Query_Range
- func RootIDHex(v interface{}) string
- func RootUUID(v interface{}) (uuid.UUID, bool)
- func RoutingKey(v interface{}) string
- func TemporalSelectionBySequence(seq uint32) *pb.Query_Temporal
- func TemporalSelectionByTime(ts *timestamppb.Timestamp) *pb.Query_Temporal
- func TypeNameFromURL(typeURL string) string
- func TypeURL(packageName, typeName string) string
- func TypeURLMatches(typeURL, suffix string) bool
- func UUIDToProto(u uuid.UUID) *pb.UUID
- type AggregateClient
- func (c *AggregateClient) Close() error
- func (c *AggregateClient) Command(domain string, root uuid.UUID) *CommandBuilder
- func (c *AggregateClient) CommandNew(domain string) *CommandBuilder
- func (c *AggregateClient) DryRunHandle(ctx context.Context, req *pb.DryRunRequest) (*pb.CommandResponse, error)
- func (c *AggregateClient) Handle(ctx context.Context, cmd *pb.CommandBook) (*pb.CommandResponse, error)
- func (c *AggregateClient) HandleSync(ctx context.Context, cmd *pb.SyncCommandBook) (*pb.CommandResponse, error)
- type Client
- type ClientError
- func (e *ClientError) Code() codes.Code
- func (e *ClientError) Error() string
- func (e *ClientError) IsConnectionError() bool
- func (e *ClientError) IsInvalidArgument() bool
- func (e *ClientError) IsNotFound() bool
- func (e *ClientError) IsPreconditionFailed() bool
- func (e *ClientError) Status() *status.Status
- func (e *ClientError) Unwrap() error
- type CommandBookW
- func (w *CommandBookW) CacheKey() string
- func (w *CommandBookW) CorrelationID() string
- func (w *CommandBookW) CoverWrapper() *CoverW
- func (w *CommandBookW) Domain() string
- func (w *CommandBookW) HasCorrelationID() bool
- func (w *CommandBookW) Pages() []*CommandPageW
- func (w *CommandBookW) RootUUID() (uuid.UUID, bool)
- func (w *CommandBookW) RoutingKey() string
- type CommandBuilder
- func (b *CommandBuilder) Build() (*pb.CommandBook, error)
- func (b *CommandBuilder) Execute(ctx context.Context) (*pb.CommandResponse, error)
- func (b *CommandBuilder) WithCommand(typeURL string, msg proto.Message) *CommandBuilder
- func (b *CommandBuilder) WithCorrelationID(id string) *CommandBuilder
- func (b *CommandBuilder) WithSequence(seq uint32) *CommandBuilder
- type CommandPageW
- type CommandResponseW
- type CoverW
- func (w *CoverW) CacheKey() string
- func (w *CoverW) CorrelationID() string
- func (w *CoverW) Domain() string
- func (w *CoverW) Edition() string
- func (w *CoverW) EditionOpt() *string
- func (w *CoverW) HasCorrelationID() bool
- func (w *CoverW) RootIDHex() string
- func (w *CoverW) RootUUID() (uuid.UUID, bool)
- func (w *CoverW) RoutingKey() string
- type DomainClient
- func (c *DomainClient) Close() error
- func (c *DomainClient) Command(domain string, root uuid.UUID) *CommandBuilder
- func (c *DomainClient) CommandNew(domain string) *CommandBuilder
- func (c *DomainClient) Execute(ctx context.Context, cmd *pb.CommandBook) (*pb.CommandResponse, error)
- func (c *DomainClient) NewQuery(domain string, root uuid.UUID) *QueryBuilder
- func (c *DomainClient) NewQueryDomain(domain string) *QueryBuilder
- type ErrorKind
- type EventBookW
- func (w *EventBookW) CacheKey() string
- func (w *EventBookW) CorrelationID() string
- func (w *EventBookW) CoverWrapper() *CoverW
- func (w *EventBookW) Domain() string
- func (w *EventBookW) Edition() string
- func (w *EventBookW) HasCorrelationID() bool
- func (w *EventBookW) NextSequence() uint32
- func (w *EventBookW) Pages() []*EventPageW
- func (w *EventBookW) RootIDHex() string
- func (w *EventBookW) RootUUID() (uuid.UUID, bool)
- func (w *EventBookW) RoutingKey() string
- type EventPageW
- type QueryBuilder
- func (b *QueryBuilder) AsOfSequence(seq uint32) *QueryBuilder
- func (b *QueryBuilder) AsOfTime(rfc3339 string) *QueryBuilder
- func (b *QueryBuilder) Build() (*pb.Query, error)
- func (b *QueryBuilder) ByCorrelationID(id string) *QueryBuilder
- func (b *QueryBuilder) GetEventBook(ctx context.Context) (*pb.EventBook, error)
- func (b *QueryBuilder) GetEvents(ctx context.Context) ([]*pb.EventBook, error)
- func (b *QueryBuilder) GetPages(ctx context.Context) ([]*pb.EventPage, error)
- func (b *QueryBuilder) Range(lower uint32) *QueryBuilder
- func (b *QueryBuilder) RangeTo(lower, upper uint32) *QueryBuilder
- func (b *QueryBuilder) WithEdition(edition string) *QueryBuilder
- type QueryClient
- func (c *QueryClient) Close() error
- func (c *QueryClient) GetEventBook(ctx context.Context, query *pb.Query) (*pb.EventBook, error)
- func (c *QueryClient) GetEvents(ctx context.Context, query *pb.Query) ([]*pb.EventBook, error)
- func (c *QueryClient) Query(domain string, root uuid.UUID) *QueryBuilder
- func (c *QueryClient) QueryDomain(domain string) *QueryBuilder
- type QueryW
- type SpeculativeClient
- func (c *SpeculativeClient) Close() error
- func (c *SpeculativeClient) DryRun(ctx context.Context, req *pb.DryRunRequest) (*pb.CommandResponse, error)
- func (c *SpeculativeClient) ProcessManager(ctx context.Context, req *pb.SpeculatePmRequest) (*pb.ProcessManagerHandleResponse, error)
- func (c *SpeculativeClient) Projector(ctx context.Context, req *pb.SpeculateProjectorRequest) (*pb.Projection, error)
- func (c *SpeculativeClient) Saga(ctx context.Context, req *pb.SpeculateSagaRequest) (*pb.SagaResponse, error)
Constants ¶
const ( UnknownDomain = "unknown" WildcardDomain = "*" DefaultEdition = "angzarr" MetaAngzarrDomain = "_angzarr" ProjectionDomainPrefix = "projection:" CorrelationIDHeader = "x-correlation-id" TypeURLPrefix = "type.googleapis.com/" )
Constants matching Rust proto_ext::constants
Variables ¶
This section is empty.
Functions ¶
func CacheKey ¶
func CacheKey(v interface{}) string
CacheKey generates a cache key based on domain + root.
func CommandPages ¶
func CommandPages(book *pb.CommandBook) []*pb.CommandPage
CommandPages returns the command pages from a CommandBook, or empty slice if nil.
func CorrelationID ¶
func CorrelationID(v interface{}) string
CorrelationID returns the correlation_id from a Cover-bearing type, or empty if missing.
func DecodeEvent ¶
func DecodeEvent(page *pb.EventPage, typeSuffix string, msg interface{ Unmarshal([]byte) error }) bool
DecodeEvent attempts to decode an event payload if the type URL matches.
func DivergenceFor ¶
DivergenceFor returns the divergence sequence for a domain, or -1 if not found.
func Domain ¶
func Domain(v interface{}) string
Domain returns the domain from a Cover-bearing type, or UnknownDomain if missing.
func Edition ¶
func Edition(v interface{}) string
Edition returns the edition name from a Cover-bearing type, defaulting to DefaultEdition.
func EditionOpt ¶
func EditionOpt(v interface{}) *string
EditionOpt returns the edition name as a pointer, nil if not set.
func EventPages ¶
EventPages returns the event pages from an EventBook, or empty slice if nil.
func EventsFromResponse ¶
func EventsFromResponse(resp *pb.CommandResponse) []*pb.EventPage
EventsFromResponse extracts the event pages from a CommandResponse.
func ExplicitEdition ¶
func ExplicitEdition(name string, divergences []*pb.DomainDivergence) *pb.Edition
ExplicitEdition creates an edition with divergence points.
func HasCorrelationID ¶
func HasCorrelationID(v interface{}) bool
HasCorrelationID returns true if the correlation_id is present and non-empty.
func ImplicitEdition ¶
ImplicitEdition creates an edition with the given name but no divergences.
func IsClientError ¶
IsClientError checks if an error is a ClientError.
func IsMainTimeline ¶
IsMainTimeline checks if an edition represents the main timeline.
func MainTimeline ¶
MainTimeline returns an Edition representing the main timeline.
func NewCommandBook ¶
func NewCommandBook(cover *pb.Cover, pages ...*pb.CommandPage) *pb.CommandBook
NewCommandBook creates a CommandBook with a single command.
func NewCommandPage ¶
func NewCommandPage(sequence uint32, command *anypb.Any) *pb.CommandPage
NewCommandPage creates a command page from a sequence and Any message.
func NewCoverWithEdition ¶
func NewCoverWithEdition(domain string, root uuid.UUID, correlationID string, edition *pb.Edition) *pb.Cover
NewCoverWithEdition creates a Cover with an edition.
func NewQueryWithRange ¶
NewQueryWithRange creates a Query with a cover and range selection.
func NewQueryWithTemporal ¶
NewQueryWithTemporal creates a Query with a temporal selection.
func NextSequence ¶
NextSequence returns the next sequence number from an EventBook. The framework computes this value on load.
func ParseTimestamp ¶
func ParseTimestamp(rfc3339 string) (*timestamppb.Timestamp, error)
ParseTimestamp parses an RFC3339 timestamp string.
func ProtoToUUID ¶
ProtoToUUID converts a proto UUID to uuid.UUID.
func RangeSelection ¶
func RangeSelection(lower uint32, upper *uint32) *pb.Query_Range
RangeSelection creates a sequence range selection (returns the oneof wrapper).
func RootIDHex ¶
func RootIDHex(v interface{}) string
RootIDHex returns the root UUID as a hex string, or empty if missing.
func RoutingKey ¶
func RoutingKey(v interface{}) string
RoutingKey computes the bus routing key for a Cover-bearing type.
func TemporalSelectionBySequence ¶
func TemporalSelectionBySequence(seq uint32) *pb.Query_Temporal
TemporalSelectionBySequence creates a temporal selection as-of a sequence.
func TemporalSelectionByTime ¶
func TemporalSelectionByTime(ts *timestamppb.Timestamp) *pb.Query_Temporal
TemporalSelectionByTime creates a temporal selection as-of a timestamp.
func TypeNameFromURL ¶
TypeNameFromURL extracts the type name from a type URL.
func TypeURLMatches ¶
TypeURLMatches checks if a type URL ends with the given suffix.
Types ¶
type AggregateClient ¶
type AggregateClient struct {
// contains filtered or unexported fields
}
AggregateClient wraps the AggregateCoordinatorService for command execution.
func AggregateClientFromConn ¶
func AggregateClientFromConn(conn *grpc.ClientConn) *AggregateClient
AggregateClientFromConn creates a client from an existing connection.
func AggregateClientFromEnv ¶
func AggregateClientFromEnv(envVar, defaultEndpoint string) (*AggregateClient, error)
AggregateClientFromEnv connects using an environment variable with fallback.
func NewAggregateClient ¶
func NewAggregateClient(endpoint string) (*AggregateClient, error)
NewAggregateClient connects to an aggregate coordinator at the given endpoint.
func (*AggregateClient) Close ¶
func (c *AggregateClient) Close() error
Close closes the underlying connection.
func (*AggregateClient) Command ¶
func (c *AggregateClient) Command(domain string, root uuid.UUID) *CommandBuilder
Command starts building a command for the given domain and root.
func (*AggregateClient) CommandNew ¶
func (c *AggregateClient) CommandNew(domain string) *CommandBuilder
CommandNew starts building a command for a new aggregate.
func (*AggregateClient) DryRunHandle ¶
func (c *AggregateClient) DryRunHandle(ctx context.Context, req *pb.DryRunRequest) (*pb.CommandResponse, error)
DryRunHandle executes a command in dry-run mode (no persistence).
func (*AggregateClient) Handle ¶
func (c *AggregateClient) Handle(ctx context.Context, cmd *pb.CommandBook) (*pb.CommandResponse, error)
Handle executes a command asynchronously.
func (*AggregateClient) HandleSync ¶
func (c *AggregateClient) HandleSync(ctx context.Context, cmd *pb.SyncCommandBook) (*pb.CommandResponse, error)
HandleSync executes a command synchronously with the specified sync mode.
type Client ¶
type Client struct {
Aggregate *AggregateClient
Query *QueryClient
Speculative *SpeculativeClient
// contains filtered or unexported fields
}
Client combines aggregate, query, and speculative clients.
func ClientFromConn ¶
func ClientFromConn(conn *grpc.ClientConn) *Client
ClientFromConn creates a client from an existing connection.
func ClientFromEnv ¶
ClientFromEnv connects using an environment variable with fallback.
type ClientError ¶
ClientError represents errors from client operations.
func AsClientError ¶
func AsClientError(err error) *ClientError
AsClientError extracts a ClientError from an error chain.
func ConnectionError ¶
func ConnectionError(msg string) *ClientError
ConnectionError creates a connection error.
func InvalidArgumentError ¶
func InvalidArgumentError(msg string) *ClientError
InvalidArgumentError creates an invalid argument error.
func InvalidTimestampError ¶
func InvalidTimestampError(msg string) *ClientError
InvalidTimestampError creates a timestamp parsing error.
func TransportError ¶
func TransportError(err error) *ClientError
TransportError wraps a transport error.
func (*ClientError) Code ¶
func (e *ClientError) Code() codes.Code
Code returns the gRPC status code if this is a gRPC error.
func (*ClientError) Error ¶
func (e *ClientError) Error() string
func (*ClientError) IsConnectionError ¶
func (e *ClientError) IsConnectionError() bool
IsConnectionError returns true if this is a connection or transport error.
func (*ClientError) IsInvalidArgument ¶
func (e *ClientError) IsInvalidArgument() bool
IsInvalidArgument returns true if this is an "invalid argument" error.
func (*ClientError) IsNotFound ¶
func (e *ClientError) IsNotFound() bool
IsNotFound returns true if this is a "not found" error.
func (*ClientError) IsPreconditionFailed ¶
func (e *ClientError) IsPreconditionFailed() bool
IsPreconditionFailed returns true if this is a "precondition failed" error.
func (*ClientError) Status ¶
func (e *ClientError) Status() *status.Status
Status returns the gRPC Status if this is a gRPC error.
func (*ClientError) Unwrap ¶
func (e *ClientError) Unwrap() error
type CommandBookW ¶ added in v0.1.1
type CommandBookW struct {
*pb.CommandBook
}
CommandBookW wraps a CommandBook proto with extension methods.
func NewCommandBookW ¶ added in v0.1.1
func NewCommandBookW(proto *pb.CommandBook) *CommandBookW
NewCommandBookW creates a new CommandBookW wrapper.
func (*CommandBookW) CacheKey ¶ added in v0.1.1
func (w *CommandBookW) CacheKey() string
CacheKey generates a cache key based on domain + root.
func (*CommandBookW) CorrelationID ¶ added in v0.1.1
func (w *CommandBookW) CorrelationID() string
CorrelationID returns the correlation_id from the cover, or empty string if missing.
func (*CommandBookW) CoverWrapper ¶ added in v0.1.1
func (w *CommandBookW) CoverWrapper() *CoverW
CoverWrapper returns a CoverW wrapping the cover.
func (*CommandBookW) Domain ¶ added in v0.1.1
func (w *CommandBookW) Domain() string
Domain returns the domain from the cover, or UnknownDomain if missing.
func (*CommandBookW) HasCorrelationID ¶ added in v0.1.1
func (w *CommandBookW) HasCorrelationID() bool
HasCorrelationID returns true if the correlation_id is present and non-empty.
func (*CommandBookW) Pages ¶ added in v0.1.1
func (w *CommandBookW) Pages() []*CommandPageW
Pages returns the command pages as wrapped CommandPageW instances.
func (*CommandBookW) RootUUID ¶ added in v0.1.1
func (w *CommandBookW) RootUUID() (uuid.UUID, bool)
RootUUID extracts the root UUID from the cover.
func (*CommandBookW) RoutingKey ¶ added in v0.1.1
func (w *CommandBookW) RoutingKey() string
RoutingKey computes the bus routing key.
type CommandBuilder ¶
type CommandBuilder struct {
// contains filtered or unexported fields
}
CommandBuilder provides fluent construction and execution of commands.
func NewCommandBuilder ¶
func NewCommandBuilder(client *AggregateClient, domain string, root uuid.UUID) *CommandBuilder
NewCommandBuilder creates a command builder for an existing aggregate.
func NewCommandBuilderNew ¶
func NewCommandBuilderNew(client *AggregateClient, domain string) *CommandBuilder
NewCommandBuilderNew creates a command builder for a new aggregate (no root yet).
func (*CommandBuilder) Build ¶
func (b *CommandBuilder) Build() (*pb.CommandBook, error)
Build constructs the CommandBook without executing.
func (*CommandBuilder) Execute ¶
func (b *CommandBuilder) Execute(ctx context.Context) (*pb.CommandResponse, error)
Execute builds and executes the command.
func (*CommandBuilder) WithCommand ¶
func (b *CommandBuilder) WithCommand(typeURL string, msg proto.Message) *CommandBuilder
WithCommand sets the command type URL and message.
func (*CommandBuilder) WithCorrelationID ¶
func (b *CommandBuilder) WithCorrelationID(id string) *CommandBuilder
WithCorrelationID sets the correlation ID for request tracing.
func (*CommandBuilder) WithSequence ¶
func (b *CommandBuilder) WithSequence(seq uint32) *CommandBuilder
WithSequence sets the expected sequence number for optimistic locking.
type CommandPageW ¶ added in v0.1.1
type CommandPageW struct {
*pb.CommandPage
}
CommandPageW wraps a CommandPage proto with extension methods.
func NewCommandPageW ¶ added in v0.1.1
func NewCommandPageW(proto *pb.CommandPage) *CommandPageW
NewCommandPageW creates a new CommandPageW wrapper.
func (*CommandPageW) Sequence ¶ added in v0.1.1
func (w *CommandPageW) Sequence() uint32
Sequence returns the sequence number.
type CommandResponseW ¶ added in v0.1.1
type CommandResponseW struct {
*pb.CommandResponse
}
CommandResponseW wraps a CommandResponse proto with extension methods.
func NewCommandResponseW ¶ added in v0.1.1
func NewCommandResponseW(proto *pb.CommandResponse) *CommandResponseW
NewCommandResponseW creates a new CommandResponseW wrapper.
func (*CommandResponseW) Events ¶ added in v0.1.1
func (w *CommandResponseW) Events() []*EventPageW
Events extracts the event pages as wrapped EventPageW instances.
func (*CommandResponseW) EventsBook ¶ added in v0.1.1
func (w *CommandResponseW) EventsBook() *EventBookW
EventsBook returns the events as a wrapped EventBookW, or nil if not set.
type CoverW ¶ added in v0.1.1
CoverW wraps a Cover proto with extension methods.
func (*CoverW) CorrelationID ¶ added in v0.1.1
CorrelationID returns the correlation_id, or empty string if missing.
func (*CoverW) Edition ¶ added in v0.1.1
Edition returns the edition name, defaulting to DefaultEdition.
func (*CoverW) EditionOpt ¶ added in v0.1.1
EditionOpt returns the edition name as a pointer, nil if not set.
func (*CoverW) HasCorrelationID ¶ added in v0.1.1
HasCorrelationID returns true if the correlation_id is present and non-empty.
func (*CoverW) RootIDHex ¶ added in v0.1.1
RootIDHex returns the root UUID as a hex string, or empty string if missing.
func (*CoverW) RoutingKey ¶ added in v0.1.1
RoutingKey computes the bus routing key.
type DomainClient ¶
type DomainClient struct {
Aggregate *AggregateClient
Query *QueryClient
// contains filtered or unexported fields
}
DomainClient combines aggregate and query clients for a single domain.
func DomainClientFromConn ¶
func DomainClientFromConn(conn *grpc.ClientConn) *DomainClient
DomainClientFromConn creates a client from an existing connection.
func DomainClientFromEnv ¶
func DomainClientFromEnv(envVar, defaultEndpoint string) (*DomainClient, error)
DomainClientFromEnv connects using an environment variable with fallback.
func NewDomainClient ¶
func NewDomainClient(endpoint string) (*DomainClient, error)
NewDomainClient connects to a domain's coordinator at the given endpoint.
func (*DomainClient) Close ¶
func (c *DomainClient) Close() error
Close closes the underlying connection.
func (*DomainClient) Command ¶
func (c *DomainClient) Command(domain string, root uuid.UUID) *CommandBuilder
Command starts building a command via the domain client's aggregate.
func (*DomainClient) CommandNew ¶
func (c *DomainClient) CommandNew(domain string) *CommandBuilder
CommandNew starts building a command for a new aggregate.
func (*DomainClient) Execute ¶
func (c *DomainClient) Execute(ctx context.Context, cmd *pb.CommandBook) (*pb.CommandResponse, error)
Execute is a convenience method that delegates to Aggregate.Handle.
func (*DomainClient) NewQuery ¶
func (c *DomainClient) NewQuery(domain string, root uuid.UUID) *QueryBuilder
NewQuery starts building a query via the domain client's query client.
func (*DomainClient) NewQueryDomain ¶
func (c *DomainClient) NewQueryDomain(domain string) *QueryBuilder
NewQueryDomain starts building a query by domain only.
type ErrorKind ¶
type ErrorKind int
ErrorKind categorizes client errors.
const ( // ErrConnection indicates a connection failure. ErrConnection ErrorKind = iota // ErrTransport indicates a transport-level error. ErrTransport // ErrGRPC indicates a gRPC error from the server. ErrGRPC // ErrInvalidArgument indicates an invalid argument from the caller. ErrInvalidArgument // ErrInvalidTimestamp indicates a timestamp parsing failure. ErrInvalidTimestamp )
type EventBookW ¶ added in v0.1.1
EventBookW wraps an EventBook proto with extension methods.
func NewEventBookW ¶ added in v0.1.1
func NewEventBookW(proto *pb.EventBook) *EventBookW
NewEventBookW creates a new EventBookW wrapper.
func (*EventBookW) CacheKey ¶ added in v0.1.1
func (w *EventBookW) CacheKey() string
CacheKey generates a cache key based on domain + root.
func (*EventBookW) CorrelationID ¶ added in v0.1.1
func (w *EventBookW) CorrelationID() string
CorrelationID returns the correlation_id from the cover, or empty string if missing.
func (*EventBookW) CoverWrapper ¶ added in v0.1.1
func (w *EventBookW) CoverWrapper() *CoverW
CoverWrapper returns a CoverW wrapping the cover.
func (*EventBookW) Domain ¶ added in v0.1.1
func (w *EventBookW) Domain() string
Domain returns the domain from the cover, or UnknownDomain if missing.
func (*EventBookW) Edition ¶ added in v0.1.1
func (w *EventBookW) Edition() string
Edition returns the edition name, defaulting to DefaultEdition.
func (*EventBookW) HasCorrelationID ¶ added in v0.1.1
func (w *EventBookW) HasCorrelationID() bool
HasCorrelationID returns true if the correlation_id is present and non-empty.
func (*EventBookW) NextSequence ¶ added in v0.1.1
func (w *EventBookW) NextSequence() uint32
NextSequence returns the next sequence number.
func (*EventBookW) Pages ¶ added in v0.1.1
func (w *EventBookW) Pages() []*EventPageW
Pages returns the event pages as wrapped EventPageW instances.
func (*EventBookW) RootIDHex ¶ added in v0.1.1
func (w *EventBookW) RootIDHex() string
RootIDHex returns the root UUID as a hex string, or empty string if missing.
func (*EventBookW) RootUUID ¶ added in v0.1.1
func (w *EventBookW) RootUUID() (uuid.UUID, bool)
RootUUID extracts the root UUID from the cover.
func (*EventBookW) RoutingKey ¶ added in v0.1.1
func (w *EventBookW) RoutingKey() string
RoutingKey computes the bus routing key.
type EventPageW ¶ added in v0.1.1
EventPageW wraps an EventPage proto with extension methods.
func NewEventPageW ¶ added in v0.1.1
func NewEventPageW(proto *pb.EventPage) *EventPageW
NewEventPageW creates a new EventPageW wrapper.
func (*EventPageW) DecodeEvent ¶ added in v0.1.1
func (w *EventPageW) DecodeEvent(typeSuffix string, msg interface{ Unmarshal([]byte) error }) bool
DecodeEvent attempts to decode an event payload if the type URL matches.
type QueryBuilder ¶
type QueryBuilder struct {
// contains filtered or unexported fields
}
QueryBuilder provides fluent construction and execution of queries.
func NewQueryBuilder ¶
func NewQueryBuilder(client *QueryClient, domain string, root uuid.UUID) *QueryBuilder
NewQueryBuilder creates a query builder for a specific aggregate.
func NewQueryBuilderDomain ¶
func NewQueryBuilderDomain(client *QueryClient, domain string) *QueryBuilder
NewQueryBuilderDomain creates a query builder by domain only (use with ByCorrelationID).
func (*QueryBuilder) AsOfSequence ¶
func (b *QueryBuilder) AsOfSequence(seq uint32) *QueryBuilder
AsOfSequence queries state as of a specific sequence number.
func (*QueryBuilder) AsOfTime ¶
func (b *QueryBuilder) AsOfTime(rfc3339 string) *QueryBuilder
AsOfTime queries state as of a specific timestamp (RFC3339 format).
func (*QueryBuilder) Build ¶
func (b *QueryBuilder) Build() (*pb.Query, error)
Build constructs the Query without executing.
func (*QueryBuilder) ByCorrelationID ¶
func (b *QueryBuilder) ByCorrelationID(id string) *QueryBuilder
ByCorrelationID queries by correlation ID instead of root.
func (*QueryBuilder) GetEventBook ¶
GetEventBook executes the query and returns a single EventBook.
func (*QueryBuilder) Range ¶
func (b *QueryBuilder) Range(lower uint32) *QueryBuilder
Range queries a range of sequences from lower (inclusive).
func (*QueryBuilder) RangeTo ¶
func (b *QueryBuilder) RangeTo(lower, upper uint32) *QueryBuilder
RangeTo queries a range of sequences with upper bound (inclusive).
func (*QueryBuilder) WithEdition ¶
func (b *QueryBuilder) WithEdition(edition string) *QueryBuilder
WithEdition queries events from a specific edition.
type QueryClient ¶
type QueryClient struct {
// contains filtered or unexported fields
}
QueryClient wraps the EventQueryService for event retrieval.
func NewQueryClient ¶
func NewQueryClient(endpoint string) (*QueryClient, error)
NewQueryClient connects to an event query service at the given endpoint.
func QueryClientFromConn ¶
func QueryClientFromConn(conn *grpc.ClientConn) *QueryClient
QueryClientFromConn creates a client from an existing connection.
func QueryClientFromEnv ¶
func QueryClientFromEnv(envVar, defaultEndpoint string) (*QueryClient, error)
QueryClientFromEnv connects using an environment variable with fallback.
func (*QueryClient) Close ¶
func (c *QueryClient) Close() error
Close closes the underlying connection.
func (*QueryClient) GetEventBook ¶
GetEventBook retrieves a single EventBook for the query.
func (*QueryClient) Query ¶
func (c *QueryClient) Query(domain string, root uuid.UUID) *QueryBuilder
Query starts building a query for the given domain and root.
func (*QueryClient) QueryDomain ¶
func (c *QueryClient) QueryDomain(domain string) *QueryBuilder
QueryDomain starts building a query by domain only.
type QueryW ¶ added in v0.1.1
QueryW wraps a Query proto with extension methods.
func (*QueryW) CorrelationID ¶ added in v0.1.1
CorrelationID returns the correlation_id from the cover, or empty string if missing.
func (*QueryW) CoverWrapper ¶ added in v0.1.1
CoverWrapper returns a CoverW wrapping the cover.
func (*QueryW) Domain ¶ added in v0.1.1
Domain returns the domain from the cover, or UnknownDomain if missing.
func (*QueryW) HasCorrelationID ¶ added in v0.1.1
HasCorrelationID returns true if the correlation_id is present and non-empty.
func (*QueryW) RoutingKey ¶ added in v0.1.1
RoutingKey computes the bus routing key.
type SpeculativeClient ¶
type SpeculativeClient struct {
// contains filtered or unexported fields
}
SpeculativeClient wraps the SpeculativeService for what-if scenarios.
func NewSpeculativeClient ¶
func NewSpeculativeClient(endpoint string) (*SpeculativeClient, error)
NewSpeculativeClient connects to a speculative service at the given endpoint.
func SpeculativeClientFromConn ¶
func SpeculativeClientFromConn(conn *grpc.ClientConn) *SpeculativeClient
SpeculativeClientFromConn creates a client from an existing connection.
func SpeculativeClientFromEnv ¶
func SpeculativeClientFromEnv(envVar, defaultEndpoint string) (*SpeculativeClient, error)
SpeculativeClientFromEnv connects using an environment variable with fallback.
func (*SpeculativeClient) Close ¶
func (c *SpeculativeClient) Close() error
Close closes the underlying connection.
func (*SpeculativeClient) DryRun ¶
func (c *SpeculativeClient) DryRun(ctx context.Context, req *pb.DryRunRequest) (*pb.CommandResponse, error)
DryRun executes a command without persistence.
func (*SpeculativeClient) ProcessManager ¶
func (c *SpeculativeClient) ProcessManager(ctx context.Context, req *pb.SpeculatePmRequest) (*pb.ProcessManagerHandleResponse, error)
ProcessManager speculatively executes a process manager.
func (*SpeculativeClient) Projector ¶
func (c *SpeculativeClient) Projector(ctx context.Context, req *pb.SpeculateProjectorRequest) (*pb.Projection, error)
Projector speculatively executes a projector against events.
func (*SpeculativeClient) Saga ¶
func (c *SpeculativeClient) Saga(ctx context.Context, req *pb.SpeculateSagaRequest) (*pb.SagaResponse, error)
Saga speculatively executes a saga against events.