testv1

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2026 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const EventTTLDuration int64 = 86400

EventTTLDuration is the event TTL from the proto annotation.

View Source
const SnapshotEveryNEvents int32 = 3

SnapshotEveryNEvents is the snapshot interval from the proto annotation.

Variables

View Source
var (
	State_name = map[int32]string{
		0: "STATE_UNSPECIFIED",
		1: "STATE_UNLOCKED",
		2: "STATE_LOCKED",
	}
	State_value = map[string]int32{
		"STATE_UNSPECIFIED": 0,
		"STATE_UNLOCKED":    1,
		"STATE_LOCKED":      2,
	}
)

Enum value maps for State.

View Source
var File_example_app_test_v1_test_v1_proto protoreflect.FileDescriptor

ProviderSet provides the Test repository and binds it to Repo.

Functions

func NewRepository

func NewRepository(store protosource.Store, serializer protosource.Serializer, opts ...protosource.Option) *protosource.Repository

NewRepository creates a new protosource.Repository for the Test aggregate.

Types

type Builder

type Builder struct {
	Events []protosource.Event
	// contains filtered or unexported fields
}

func NewBuilder

func NewBuilder(id string, version int64) *Builder

func (*Builder) Created

func (b *Builder) Created(Actor string, Body string, Color string, Shape string, Number string, Shading string)

func (*Builder) Locked

func (b *Builder) Locked(Actor string)

func (*Builder) Snapshot

func (b *Builder) Snapshot(aggregate *Test)

func (*Builder) Unlocked

func (b *Builder) Unlocked(Actor string)

func (*Builder) Updated

func (b *Builder) Updated(Actor string, Body string, Color string, Shape string, Number string, Shading string)

type Create

type Create struct {
	Id      string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Actor   string `protobuf:"bytes,2,opt,name=actor,proto3" json:"actor,omitempty"`
	Body    string `protobuf:"bytes,3,opt,name=body,proto3" json:"body,omitempty"`
	Color   string `protobuf:"bytes,4,opt,name=color,proto3" json:"color,omitempty"`
	Shape   string `protobuf:"bytes,5,opt,name=shape,proto3" json:"shape,omitempty"`
	Number  string `protobuf:"bytes,6,opt,name=number,proto3" json:"number,omitempty"`
	Shading string `protobuf:"bytes,7,opt,name=shading,proto3" json:"shading,omitempty"`
	// contains filtered or unexported fields
}

Create is the command that is used to create a test. Emits Created (domain fields) then Unlocked (initial state).

func (*Create) CommandName

func (m *Create) CommandName() string

func (*Create) Descriptor deprecated

func (*Create) Descriptor() ([]byte, []int)

Deprecated: Use Create.ProtoReflect.Descriptor instead.

func (*Create) EmitEvents

func (m *Create) EmitEvents(aggregate protosource.Aggregate) []protosource.Event

func (*Create) GetActor

func (x *Create) GetActor() string

func (*Create) GetBody

func (x *Create) GetBody() string

func (*Create) GetColor added in v0.0.8

func (x *Create) GetColor() string

func (*Create) GetId

func (x *Create) GetId() string

func (*Create) GetNumber added in v0.0.8

func (x *Create) GetNumber() string

func (*Create) GetShading added in v0.0.8

func (x *Create) GetShading() string

func (*Create) GetShape added in v0.0.8

func (x *Create) GetShape() string

func (*Create) ProtoMessage

func (*Create) ProtoMessage()

func (*Create) ProtoReflect

func (x *Create) ProtoReflect() protoreflect.Message

func (*Create) ProtoValidate

func (m *Create) ProtoValidate() error

func (*Create) Reset

func (x *Create) Reset()

func (*Create) String

func (x *Create) String() string

func (*Create) ValidateVersion

func (m *Create) ValidateVersion(version int64) error

type Created

type Created struct {
	Id      string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Version int64  `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty"`
	At      int64  `protobuf:"varint,3,opt,name=at,proto3" json:"at,omitempty"`
	Actor   string `protobuf:"bytes,4,opt,name=actor,proto3" json:"actor,omitempty"`
	Body    string `protobuf:"bytes,5,opt,name=body,proto3" json:"body,omitempty"`
	Color   string `protobuf:"bytes,6,opt,name=color,proto3" json:"color,omitempty"`
	Shape   string `protobuf:"bytes,7,opt,name=shape,proto3" json:"shape,omitempty"`
	Number  string `protobuf:"bytes,8,opt,name=number,proto3" json:"number,omitempty"`
	Shading string `protobuf:"bytes,9,opt,name=shading,proto3" json:"shading,omitempty"`
	// contains filtered or unexported fields
}

Created is the event emitted when we create a test.

func (*Created) Descriptor deprecated

func (*Created) Descriptor() ([]byte, []int)

Deprecated: Use Created.ProtoReflect.Descriptor instead.

func (*Created) EventName

func (m *Created) EventName() string

func (*Created) GetActor

func (x *Created) GetActor() string

func (*Created) GetAt

func (x *Created) GetAt() int64

func (*Created) GetBody

func (x *Created) GetBody() string

func (*Created) GetColor added in v0.0.8

func (x *Created) GetColor() string

func (*Created) GetId

func (x *Created) GetId() string

func (*Created) GetNumber added in v0.0.8

func (x *Created) GetNumber() string

func (*Created) GetShading added in v0.0.8

func (x *Created) GetShading() string

func (*Created) GetShape added in v0.0.8

func (x *Created) GetShape() string

func (*Created) GetVersion

func (x *Created) GetVersion() int64

func (*Created) ProtoMessage

func (*Created) ProtoMessage()

func (*Created) ProtoReflect

func (x *Created) ProtoReflect() protoreflect.Message

func (*Created) Reset

func (x *Created) Reset()

func (*Created) String

func (x *Created) String() string

type HTTPClient

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

HTTPClient is a typed HTTP client for the Test aggregate.

func NewHTTPClient

func NewHTTPClient(c httpclient.Doer) *HTTPClient

NewHTTPClient creates a new Test HTTP client. Accepts httpclient.Doer for testability — use *httpclient.Client in production and a mock in tests.

func (*HTTPClient) Create

func (c *HTTPClient) Create(ctx context.Context, id string, body string, color string, shape string, number string, shading string) (*responsev1.CommandResponse, error)

Create sends the Create command.

func (*HTTPClient) Get

func (c *HTTPClient) Get(ctx context.Context, id string) (*Test, error)

Get retrieves the Test aggregate from the materialized store.

func (*HTTPClient) History

func (c *HTTPClient) History(ctx context.Context, id string) (*historyv1.History, error)

History retrieves the full event history for the Test aggregate.

func (*HTTPClient) Load

func (c *HTTPClient) Load(ctx context.Context, id string) (*Test, error)

Load retrieves the current state of the Test aggregate via event replay.

func (*HTTPClient) Lock

Lock sends the Lock command.

func (*HTTPClient) QueryByColor added in v0.0.8

func (c *HTTPClient) QueryByColor(ctx context.Context, color string) ([]*Test, error)

QueryByColor queries by color via GSI1.

func (*HTTPClient) QueryByColorBetweenNumber added in v0.0.8

func (c *HTTPClient) QueryByColorBetweenNumber(ctx context.Context, color string, numberFrom string, numberTo string) ([]*Test, error)

QueryByColorBetweenNumber queries with a between sort key condition (inclusive range).

func (*HTTPClient) QueryByColorBetweenShape added in v0.0.8

func (c *HTTPClient) QueryByColorBetweenShape(ctx context.Context, color string, shapeFrom string, shapeTo string) ([]*Test, error)

QueryByColorBetweenShape queries with a between sort key condition (inclusive range).

func (*HTTPClient) QueryByColorViaGSI2 added in v0.0.8

func (c *HTTPClient) QueryByColorViaGSI2(ctx context.Context, color string) ([]*Test, error)

QueryByColorViaGSI2 queries by color via GSI2.

func (*HTTPClient) QueryByColorWithNumber added in v0.0.8

func (c *HTTPClient) QueryByColorWithNumber(ctx context.Context, color string, skOp string, number string) ([]*Test, error)

QueryByColorWithNumber queries with a sort key condition (eq, lt, le, gt, ge, begins_with). For between queries, use QueryByColorBetweenNumber instead.

func (*HTTPClient) QueryByColorWithShape added in v0.0.8

func (c *HTTPClient) QueryByColorWithShape(ctx context.Context, color string, skOp string, shape string) ([]*Test, error)

QueryByColorWithShape queries with a sort key condition (eq, lt, le, gt, ge, begins_with). For between queries, use QueryByColorBetweenShape instead.

func (*HTTPClient) QueryByNumberAndShading added in v0.0.8

func (c *HTTPClient) QueryByNumberAndShading(ctx context.Context, number string, shading string) ([]*Test, error)

QueryByNumberAndShading queries by number and shading via GSI3.

func (*HTTPClient) QueryByNumberAndShadingBetweenShapeAndCreateBy added in v0.0.8

func (c *HTTPClient) QueryByNumberAndShadingBetweenShapeAndCreateBy(ctx context.Context, number string, shading string, shapeFrom string, shapeTo string, createByFrom string, createByTo string) ([]*Test, error)

QueryByNumberAndShadingBetweenShapeAndCreateBy queries with a between sort key condition (inclusive range).

func (*HTTPClient) QueryByNumberAndShadingWithShapeAndCreateBy added in v0.0.8

func (c *HTTPClient) QueryByNumberAndShadingWithShapeAndCreateBy(ctx context.Context, number string, shading string, skOp string, shape string, createBy string) ([]*Test, error)

QueryByNumberAndShadingWithShapeAndCreateBy queries with a sort key condition (eq, lt, le, gt, ge, begins_with). For between queries, use QueryByNumberAndShadingBetweenShapeAndCreateBy instead.

func (*HTTPClient) QueryByState added in v0.0.9

func (c *HTTPClient) QueryByState(ctx context.Context, state State) ([]*Test, error)

QueryByState queries by state via GSI4.

func (*HTTPClient) QueryByStateBetweenCreateAt added in v0.0.9

func (c *HTTPClient) QueryByStateBetweenCreateAt(ctx context.Context, state State, createAtFrom int64, createAtTo int64) ([]*Test, error)

QueryByStateBetweenCreateAt queries with a between sort key condition (inclusive range).

func (*HTTPClient) QueryByStateWithCreateAt added in v0.0.9

func (c *HTTPClient) QueryByStateWithCreateAt(ctx context.Context, state State, skOp string, createAt int64) ([]*Test, error)

QueryByStateWithCreateAt queries with a sort key condition (eq, lt, le, gt, ge, begins_with). For between queries, use QueryByStateBetweenCreateAt instead.

func (*HTTPClient) Unlock

Unlock sends the Unlock command.

func (*HTTPClient) Update

func (c *HTTPClient) Update(ctx context.Context, id string, body string, color string, shape string, number string, shading string) (*responsev1.CommandResponse, error)

Update sends the Update command.

type Handler

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

Handler provides request handler functions for the Test aggregate.

func NewHandler

func NewHandler(repo Repo, client *TestClient, authorizer authz.Authorizer) *Handler

NewHandler creates a new Handler instance with the given repository, client, and authorizer. Every generated command handler calls authorizer.Authorize with the canonical function name "example.app.test.v1.{CommandMessageName}" before running the command pipeline. Applications that do not enforce authorization at this layer should wire in allowall.Authorizer.

authorizer is required; passing nil panics immediately with a descriptive message rather than deferring to an opaque nil-pointer dereference on the first request.

func (*Handler) HandleCreate

func (h *Handler) HandleCreate(ctx context.Context, request protosource.Request) protosource.Response

HandleCreate processes a Create command.

func (*Handler) HandleGet

func (h *Handler) HandleGet(ctx context.Context, request protosource.Request) protosource.Response

HandleGet retrieves the current state of a Test aggregate.

func (*Handler) HandleGetMaterialized

func (h *Handler) HandleGetMaterialized(ctx context.Context, request protosource.Request) protosource.Response

HandleGetMaterialized retrieves the Test aggregate from the materialized store.

func (*Handler) HandleHistory

func (h *Handler) HandleHistory(ctx context.Context, request protosource.Request) protosource.Response

HandleHistory retrieves the full event history for a Test aggregate.

func (*Handler) HandleLock

func (h *Handler) HandleLock(ctx context.Context, request protosource.Request) protosource.Response

HandleLock processes a Lock command.

func (*Handler) HandleQueryByColor added in v0.0.8

func (h *Handler) HandleQueryByColor(ctx context.Context, request protosource.Request) protosource.Response

HandleQueryByColor queries GSI1 by partition key with optional sort key condition.

func (*Handler) HandleQueryByColorWithNumber added in v0.0.8

func (h *Handler) HandleQueryByColorWithNumber(ctx context.Context, request protosource.Request) protosource.Response

HandleQueryByColorWithNumber queries GSI2 by partition key with optional sort key condition.

func (*Handler) HandleQueryByNumberAndShading added in v0.0.8

func (h *Handler) HandleQueryByNumberAndShading(ctx context.Context, request protosource.Request) protosource.Response

HandleQueryByNumberAndShading queries GSI3 by partition key with optional sort key condition.

func (*Handler) HandleQueryByState added in v0.0.9

func (h *Handler) HandleQueryByState(ctx context.Context, request protosource.Request) protosource.Response

HandleQueryByState queries GSI4 by partition key with optional sort key condition.

func (*Handler) HandleUnlock

func (h *Handler) HandleUnlock(ctx context.Context, request protosource.Request) protosource.Response

HandleUnlock processes a Unlock command.

func (*Handler) HandleUpdate

func (h *Handler) HandleUpdate(ctx context.Context, request protosource.Request) protosource.Response

HandleUpdate processes a Update command.

func (*Handler) RegisterRoutes

func (h *Handler) RegisterRoutes(router *protosource.Router)

RegisterRoutes registers all handler routes on the given router.

type Lock

type Lock struct {
	Id    string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Actor string `protobuf:"bytes,2,opt,name=actor,proto3" json:"actor,omitempty"`
	// contains filtered or unexported fields
}

Lock is the command that locks the aggregate.

func (*Lock) CommandName

func (m *Lock) CommandName() string

func (*Lock) Descriptor deprecated

func (*Lock) Descriptor() ([]byte, []int)

Deprecated: Use Lock.ProtoReflect.Descriptor instead.

func (*Lock) EmitEvents

func (m *Lock) EmitEvents(aggregate protosource.Aggregate) []protosource.Event

func (*Lock) GetActor

func (x *Lock) GetActor() string

func (*Lock) GetId

func (x *Lock) GetId() string

func (*Lock) GuardState added in v0.1.1

func (m *Lock) GuardState(aggregate protosource.Aggregate) error

func (*Lock) ProtoMessage

func (*Lock) ProtoMessage()

func (*Lock) ProtoReflect

func (x *Lock) ProtoReflect() protoreflect.Message

func (*Lock) ProtoValidate

func (m *Lock) ProtoValidate() error

func (*Lock) Reset

func (x *Lock) Reset()

func (*Lock) String

func (x *Lock) String() string

func (*Lock) ValidateVersion

func (m *Lock) ValidateVersion(version int64) error

type Locked

type Locked struct {
	Id      string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Version int64  `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty"`
	At      int64  `protobuf:"varint,3,opt,name=at,proto3" json:"at,omitempty"`
	Actor   string `protobuf:"bytes,4,opt,name=actor,proto3" json:"actor,omitempty"`
	// contains filtered or unexported fields
}

Locked is the event emitted when the aggregate is locked.

func (*Locked) Descriptor deprecated

func (*Locked) Descriptor() ([]byte, []int)

Deprecated: Use Locked.ProtoReflect.Descriptor instead.

func (*Locked) EventName

func (m *Locked) EventName() string

func (*Locked) GetActor

func (x *Locked) GetActor() string

func (*Locked) GetAt

func (x *Locked) GetAt() int64

func (*Locked) GetId

func (x *Locked) GetId() string

func (*Locked) GetVersion

func (x *Locked) GetVersion() int64

func (*Locked) ProtoMessage

func (*Locked) ProtoMessage()

func (*Locked) ProtoReflect

func (x *Locked) ProtoReflect() protoreflect.Message

func (*Locked) Reset

func (x *Locked) Reset()

func (*Locked) String

func (x *Locked) String() string

type Repo

type Repo interface {
	protosource.Repo
}

Repo is a package-specific interface for dependency injection. It embeds protosource.Repo so that *protosource.Repository satisfies it, while giving each aggregate package a distinct type for Wire.

type Repository added in v0.1.4

type Repository struct{ *protosource.Repository }

Repository wraps *protosource.Repository for the Test aggregate, giving Wire a distinct concrete type per aggregate.

func ProvideRepository added in v0.1.4

func ProvideRepository(store protosource.Store, serializer protosource.Serializer) *Repository

ProvideRepository creates a Test repository accepting interfaces.

type Snapshot

type Snapshot struct {
	Id       string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Version  int64  `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty"`
	At       int64  `protobuf:"varint,3,opt,name=at,proto3" json:"at,omitempty"`
	Actor    string `protobuf:"bytes,4,opt,name=actor,proto3" json:"actor,omitempty"`
	Snapshot *Test  `protobuf:"bytes,5,opt,name=snapshot,proto3" json:"snapshot,omitempty"`
	// contains filtered or unexported fields
}

Snapshot is the snapshot of the aggregate

func (*Snapshot) Descriptor deprecated

func (*Snapshot) Descriptor() ([]byte, []int)

Deprecated: Use Snapshot.ProtoReflect.Descriptor instead.

func (*Snapshot) EventName

func (m *Snapshot) EventName() string

func (*Snapshot) GetActor

func (x *Snapshot) GetActor() string

func (*Snapshot) GetAt

func (x *Snapshot) GetAt() int64

func (*Snapshot) GetId

func (x *Snapshot) GetId() string

func (*Snapshot) GetSnapshot

func (x *Snapshot) GetSnapshot() *Test

func (*Snapshot) GetVersion

func (x *Snapshot) GetVersion() int64

func (*Snapshot) ProtoMessage

func (*Snapshot) ProtoMessage()

func (*Snapshot) ProtoReflect

func (x *Snapshot) ProtoReflect() protoreflect.Message

func (*Snapshot) Reset

func (x *Snapshot) Reset()

func (*Snapshot) String

func (x *Snapshot) String() string

type State

type State int32
const (
	State_STATE_UNSPECIFIED State = 0
	State_STATE_UNLOCKED    State = 1
	State_STATE_LOCKED      State = 2
)

func (State) Descriptor

func (State) Descriptor() protoreflect.EnumDescriptor

func (State) Enum

func (x State) Enum() *State

func (State) EnumDescriptor deprecated

func (State) EnumDescriptor() ([]byte, []int)

Deprecated: Use State.Descriptor instead.

func (State) Number

func (x State) Number() protoreflect.EnumNumber

func (State) String

func (x State) String() string

func (State) Type

func (State) Type() protoreflect.EnumType

type Test

type Test struct {
	Id       string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Version  int64  `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty"`
	CreateAt int64  `protobuf:"varint,3,opt,name=create_at,json=createAt,proto3" json:"create_at,omitempty"`
	CreateBy string `protobuf:"bytes,4,opt,name=create_by,json=createBy,proto3" json:"create_by,omitempty"`
	ModifyAt int64  `protobuf:"varint,5,opt,name=modify_at,json=modifyAt,proto3" json:"modify_at,omitempty"`
	ModifyBy string `protobuf:"bytes,6,opt,name=modify_by,json=modifyBy,proto3" json:"modify_by,omitempty"`
	Body     string `protobuf:"bytes,7,opt,name=body,proto3" json:"body,omitempty"`
	State    State  `protobuf:"varint,8,opt,name=state,proto3,enum=example.app.test.v1.State" json:"state,omitempty"`
	Color    string `protobuf:"bytes,9,opt,name=color,proto3" json:"color,omitempty"`
	Shape    string `protobuf:"bytes,10,opt,name=shape,proto3" json:"shape,omitempty"`
	Number   string `protobuf:"bytes,11,opt,name=number,proto3" json:"number,omitempty"`
	Shading  string `protobuf:"bytes,12,opt,name=shading,proto3" json:"shading,omitempty"`
	// contains filtered or unexported fields
}

Test is the aggregate.

It must be defined first in the proto,
its name must match the first part of the package.

func (*Test) Descriptor deprecated

func (*Test) Descriptor() ([]byte, []int)

Deprecated: Use Test.ProtoReflect.Descriptor instead.

func (*Test) EventTTLSeconds

func (aggregate *Test) EventTTLSeconds() int64

func (*Test) GSI1PK

func (m *Test) GSI1PK() string

func (*Test) GSI1SK

func (m *Test) GSI1SK() string

func (*Test) GSI2PK

func (m *Test) GSI2PK() string

func (*Test) GSI2SK

func (m *Test) GSI2SK() string

func (*Test) GSI3PK

func (m *Test) GSI3PK() string

func (*Test) GSI3SK

func (m *Test) GSI3SK() string

func (*Test) GSI4PK

func (m *Test) GSI4PK() string

func (*Test) GSI4SK

func (m *Test) GSI4SK() string

func (*Test) GSI5PK

func (m *Test) GSI5PK() string

func (*Test) GSI5SK

func (m *Test) GSI5SK() string

func (*Test) GSI6PK

func (m *Test) GSI6PK() string

func (*Test) GSI6SK

func (m *Test) GSI6SK() string

func (*Test) GSI7PK

func (m *Test) GSI7PK() string

func (*Test) GSI7SK

func (m *Test) GSI7SK() string

func (*Test) GSI8PK

func (m *Test) GSI8PK() string

func (*Test) GSI8SK

func (m *Test) GSI8SK() string

func (*Test) GSI9PK

func (m *Test) GSI9PK() string

func (*Test) GSI9SK

func (m *Test) GSI9SK() string

func (*Test) GSI10PK

func (m *Test) GSI10PK() string

func (*Test) GSI10SK

func (m *Test) GSI10SK() string

func (*Test) GSI11PK

func (m *Test) GSI11PK() string

func (*Test) GSI11SK

func (m *Test) GSI11SK() string

func (*Test) GSI12PK

func (m *Test) GSI12PK() string

func (*Test) GSI12SK

func (m *Test) GSI12SK() string

func (*Test) GSI13PK

func (m *Test) GSI13PK() string

func (*Test) GSI13SK

func (m *Test) GSI13SK() string

func (*Test) GSI14PK

func (m *Test) GSI14PK() string

func (*Test) GSI14SK

func (m *Test) GSI14SK() string

func (*Test) GSI15PK

func (m *Test) GSI15PK() string

func (*Test) GSI15SK

func (m *Test) GSI15SK() string

func (*Test) GSI16PK

func (m *Test) GSI16PK() string

func (*Test) GSI16SK

func (m *Test) GSI16SK() string

func (*Test) GSI17PK

func (m *Test) GSI17PK() string

func (*Test) GSI17SK

func (m *Test) GSI17SK() string

func (*Test) GSI18PK

func (m *Test) GSI18PK() string

func (*Test) GSI18SK

func (m *Test) GSI18SK() string

func (*Test) GSI19PK

func (m *Test) GSI19PK() string

func (*Test) GSI19SK

func (m *Test) GSI19SK() string

func (*Test) GSI20PK

func (m *Test) GSI20PK() string

func (*Test) GSI20SK

func (m *Test) GSI20SK() string

func (*Test) GetBody

func (x *Test) GetBody() string

func (*Test) GetColor added in v0.0.8

func (x *Test) GetColor() string

func (*Test) GetCreateAt

func (x *Test) GetCreateAt() int64

func (*Test) GetCreateBy

func (x *Test) GetCreateBy() string

func (*Test) GetId

func (x *Test) GetId() string

func (*Test) GetModifyAt

func (x *Test) GetModifyAt() int64

func (*Test) GetModifyBy

func (x *Test) GetModifyBy() string

func (*Test) GetNumber added in v0.0.8

func (x *Test) GetNumber() string

func (*Test) GetShading added in v0.0.8

func (x *Test) GetShading() string

func (*Test) GetShape added in v0.0.8

func (x *Test) GetShape() string

func (*Test) GetState

func (x *Test) GetState() State

func (*Test) GetVersion

func (x *Test) GetVersion() int64

func (*Test) Hydrate

func (m *Test) Hydrate(body []byte) error

func (*Test) On

func (aggregate *Test) On(event protosource.Event) error

On applies an event to the aggregate, rebuilding its state. This method is called during Repository.Load to reconstruct from stored events, and during test scenarios. Events represent facts — never reject based on business rules.

func (*Test) PK

func (m *Test) PK() string

PK is automatic: package#aggregate#id#<id_value>

func (*Test) ProtoMessage

func (*Test) ProtoMessage()

func (*Test) ProtoReflect

func (x *Test) ProtoReflect() protoreflect.Message

func (*Test) Reset

func (x *Test) Reset()

func (*Test) RestoreSnapshot

func (aggregate *Test) RestoreSnapshot(snapshot *Snapshot)

func (*Test) SK

func (m *Test) SK() string

func (*Test) Snapshot

func (aggregate *Test) Snapshot(version int64) protosource.Event

func (*Test) SnapshotInterval

func (aggregate *Test) SnapshotInterval() int32

func (*Test) String

func (x *Test) String() string

type TestClient

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

func NewTestClient

func NewTestClient(store opaquedata.OpaqueStore) *TestClient

func (*TestClient) AddTest

func (c *TestClient) AddTest(ctx context.Context, d *Test, opts ...opaquedata.Option) error

func (*TestClient) DeleteTest

func (c *TestClient) DeleteTest(ctx context.Context, id string) error

func (*TestClient) GetTest

func (c *TestClient) GetTest(ctx context.Context, id string) (*Test, error)

func (*TestClient) SelectTestByColor added in v0.0.8

func (c *TestClient) SelectTestByColor(ctx context.Context, color string) ([]*Test, error)

SelectTestByColor queries GSI1 by partition key.

func (*TestClient) SelectTestByColorViaGSI2 added in v0.0.8

func (c *TestClient) SelectTestByColorViaGSI2(ctx context.Context, color string) ([]*Test, error)

SelectTestByColorViaGSI2 queries GSI2 by partition key.

func (*TestClient) SelectTestByColorWithNumber added in v0.0.8

func (c *TestClient) SelectTestByColorWithNumber(ctx context.Context, color string, op opaquedata.SortOperator, vals ...TestGSI2SK) ([]*Test, error)

SelectTestByColorWithNumber queries GSI2 with a sort key condition.

func (*TestClient) SelectTestByColorWithShape added in v0.0.8

func (c *TestClient) SelectTestByColorWithShape(ctx context.Context, color string, op opaquedata.SortOperator, vals ...TestGSI1SK) ([]*Test, error)

SelectTestByColorWithShape queries GSI1 with a sort key condition.

func (*TestClient) SelectTestByNumberAndShading added in v0.0.8

func (c *TestClient) SelectTestByNumberAndShading(ctx context.Context, number string, shading string) ([]*Test, error)

SelectTestByNumberAndShading queries GSI3 by partition key.

func (*TestClient) SelectTestByNumberAndShadingWithShapeAndCreateBy added in v0.0.8

func (c *TestClient) SelectTestByNumberAndShadingWithShapeAndCreateBy(ctx context.Context, number string, shading string, op opaquedata.SortOperator, vals ...TestGSI3SK) ([]*Test, error)

SelectTestByNumberAndShadingWithShapeAndCreateBy queries GSI3 with a sort key condition.

func (*TestClient) SelectTestByState added in v0.0.9

func (c *TestClient) SelectTestByState(ctx context.Context, state State) ([]*Test, error)

SelectTestByState queries GSI4 by partition key.

func (*TestClient) SelectTestByStateWithCreateAt added in v0.0.9

func (c *TestClient) SelectTestByStateWithCreateAt(ctx context.Context, state State, op opaquedata.SortOperator, vals ...TestGSI4SK) ([]*Test, error)

SelectTestByStateWithCreateAt queries GSI4 with a sort key condition.

func (*TestClient) UpdateTest

func (c *TestClient) UpdateTest(ctx context.Context, d *Test, opts ...opaquedata.Option) error

type TestGSI1SK added in v0.0.8

type TestGSI1SK struct {
	Shape string
}

func (TestGSI1SK) String added in v0.0.8

func (v TestGSI1SK) String() string

type TestGSI2SK added in v0.0.8

type TestGSI2SK struct {
	Number string
}

func (TestGSI2SK) String added in v0.0.8

func (v TestGSI2SK) String() string

type TestGSI3SK added in v0.0.8

type TestGSI3SK struct {
	Shape    string
	CreateBy string
}

func (TestGSI3SK) String added in v0.0.8

func (v TestGSI3SK) String() string

type TestGSI4SK added in v0.0.9

type TestGSI4SK struct {
	CreateAt int64
}

func (TestGSI4SK) String added in v0.0.9

func (v TestGSI4SK) String() string

type TestList

type TestList struct {
	Items []*Test `protobuf:"bytes,1,rep,name=items,proto3" json:"items,omitempty"`
	// contains filtered or unexported fields
}

func (*TestList) Descriptor deprecated

func (*TestList) Descriptor() ([]byte, []int)

Deprecated: Use TestList.ProtoReflect.Descriptor instead.

func (*TestList) GetItems

func (x *TestList) GetItems() []*Test

func (*TestList) ProtoMessage

func (*TestList) ProtoMessage()

func (*TestList) ProtoReflect

func (x *TestList) ProtoReflect() protoreflect.Message

func (*TestList) Reset

func (x *TestList) Reset()

func (*TestList) String

func (x *TestList) String() string

type Unlock

type Unlock struct {
	Id    string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Actor string `protobuf:"bytes,2,opt,name=actor,proto3" json:"actor,omitempty"`
	// contains filtered or unexported fields
}

Unlock is the command that unlocks the aggregate.

func (*Unlock) CommandName

func (m *Unlock) CommandName() string

func (*Unlock) Descriptor deprecated

func (*Unlock) Descriptor() ([]byte, []int)

Deprecated: Use Unlock.ProtoReflect.Descriptor instead.

func (*Unlock) EmitEvents

func (m *Unlock) EmitEvents(aggregate protosource.Aggregate) []protosource.Event

func (*Unlock) GetActor

func (x *Unlock) GetActor() string

func (*Unlock) GetId

func (x *Unlock) GetId() string

func (*Unlock) GuardState added in v0.1.1

func (m *Unlock) GuardState(aggregate protosource.Aggregate) error

func (*Unlock) ProtoMessage

func (*Unlock) ProtoMessage()

func (*Unlock) ProtoReflect

func (x *Unlock) ProtoReflect() protoreflect.Message

func (*Unlock) ProtoValidate

func (m *Unlock) ProtoValidate() error

func (*Unlock) Reset

func (x *Unlock) Reset()

func (*Unlock) String

func (x *Unlock) String() string

func (*Unlock) ValidateVersion

func (m *Unlock) ValidateVersion(version int64) error

type Unlocked

type Unlocked struct {
	Id      string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Version int64  `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty"`
	At      int64  `protobuf:"varint,3,opt,name=at,proto3" json:"at,omitempty"`
	Actor   string `protobuf:"bytes,4,opt,name=actor,proto3" json:"actor,omitempty"`
	// contains filtered or unexported fields
}

Unlocked is the event emitted when the aggregate is unlocked.

func (*Unlocked) Descriptor deprecated

func (*Unlocked) Descriptor() ([]byte, []int)

Deprecated: Use Unlocked.ProtoReflect.Descriptor instead.

func (*Unlocked) EventName

func (m *Unlocked) EventName() string

func (*Unlocked) GetActor

func (x *Unlocked) GetActor() string

func (*Unlocked) GetAt

func (x *Unlocked) GetAt() int64

func (*Unlocked) GetId

func (x *Unlocked) GetId() string

func (*Unlocked) GetVersion

func (x *Unlocked) GetVersion() int64

func (*Unlocked) ProtoMessage

func (*Unlocked) ProtoMessage()

func (*Unlocked) ProtoReflect

func (x *Unlocked) ProtoReflect() protoreflect.Message

func (*Unlocked) Reset

func (x *Unlocked) Reset()

func (*Unlocked) String

func (x *Unlocked) String() string

type Update

type Update struct {
	Id      string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Actor   string `protobuf:"bytes,2,opt,name=actor,proto3" json:"actor,omitempty"`
	Body    string `protobuf:"bytes,3,opt,name=body,proto3" json:"body,omitempty"`
	Color   string `protobuf:"bytes,4,opt,name=color,proto3" json:"color,omitempty"`
	Shape   string `protobuf:"bytes,5,opt,name=shape,proto3" json:"shape,omitempty"`
	Number  string `protobuf:"bytes,6,opt,name=number,proto3" json:"number,omitempty"`
	Shading string `protobuf:"bytes,7,opt,name=shading,proto3" json:"shading,omitempty"`
	// contains filtered or unexported fields
}

Update is the command that is used to update a test.

func (*Update) CommandName

func (m *Update) CommandName() string

func (*Update) Descriptor deprecated

func (*Update) Descriptor() ([]byte, []int)

Deprecated: Use Update.ProtoReflect.Descriptor instead.

func (*Update) EmitEvents

func (m *Update) EmitEvents(aggregate protosource.Aggregate) []protosource.Event

func (*Update) GetActor

func (x *Update) GetActor() string

func (*Update) GetBody

func (x *Update) GetBody() string

func (*Update) GetColor added in v0.0.8

func (x *Update) GetColor() string

func (*Update) GetId

func (x *Update) GetId() string

func (*Update) GetNumber added in v0.0.8

func (x *Update) GetNumber() string

func (*Update) GetShading added in v0.0.8

func (x *Update) GetShading() string

func (*Update) GetShape added in v0.0.8

func (x *Update) GetShape() string

func (*Update) GuardState added in v0.1.1

func (m *Update) GuardState(aggregate protosource.Aggregate) error

func (*Update) ProtoMessage

func (*Update) ProtoMessage()

func (*Update) ProtoReflect

func (x *Update) ProtoReflect() protoreflect.Message

func (*Update) ProtoValidate

func (m *Update) ProtoValidate() error

func (*Update) Reset

func (x *Update) Reset()

func (*Update) String

func (x *Update) String() string

func (*Update) ValidateVersion

func (m *Update) ValidateVersion(version int64) error

type Updated

type Updated struct {
	Id      string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Version int64  `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty"`
	At      int64  `protobuf:"varint,3,opt,name=at,proto3" json:"at,omitempty"`
	Actor   string `protobuf:"bytes,4,opt,name=actor,proto3" json:"actor,omitempty"`
	Body    string `protobuf:"bytes,5,opt,name=body,proto3" json:"body,omitempty"`
	Color   string `protobuf:"bytes,6,opt,name=color,proto3" json:"color,omitempty"`
	Shape   string `protobuf:"bytes,7,opt,name=shape,proto3" json:"shape,omitempty"`
	Number  string `protobuf:"bytes,8,opt,name=number,proto3" json:"number,omitempty"`
	Shading string `protobuf:"bytes,9,opt,name=shading,proto3" json:"shading,omitempty"`
	// contains filtered or unexported fields
}

Updated is the event emitted when we update a test.

func (*Updated) Descriptor deprecated

func (*Updated) Descriptor() ([]byte, []int)

Deprecated: Use Updated.ProtoReflect.Descriptor instead.

func (*Updated) EventName

func (m *Updated) EventName() string

func (*Updated) GetActor

func (x *Updated) GetActor() string

func (*Updated) GetAt

func (x *Updated) GetAt() int64

func (*Updated) GetBody

func (x *Updated) GetBody() string

func (*Updated) GetColor added in v0.0.8

func (x *Updated) GetColor() string

func (*Updated) GetId

func (x *Updated) GetId() string

func (*Updated) GetNumber added in v0.0.8

func (x *Updated) GetNumber() string

func (*Updated) GetShading added in v0.0.8

func (x *Updated) GetShading() string

func (*Updated) GetShape added in v0.0.8

func (x *Updated) GetShape() string

func (*Updated) GetVersion

func (x *Updated) GetVersion() int64

func (*Updated) ProtoMessage

func (*Updated) ProtoMessage()

func (*Updated) ProtoReflect

func (x *Updated) ProtoReflect() protoreflect.Message

func (*Updated) Reset

func (x *Updated) Reset()

func (*Updated) String

func (x *Updated) String() string

Directories

Path Synopsis
Code generated by protoc-gen-protosource.
Code generated by protoc-gen-protosource.

Jump to

Keyboard shortcuts

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