payload

package
v2.0.0-alpha.3 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BumpItem

type BumpItem struct{}

func (*BumpItem) ApplyProjection

func (b *BumpItem) ApplyProjection(
	ctx context.Context,
	tx bun.Tx,
	repo repository.Repository,
	options ProjectionOptions,
) error

ApplyProjection implements Payload.

func (*BumpItem) Type

func (b *BumpItem) Type() action.Action

Type implements Payload.

type CreateCollection

type CreateCollection struct {
	Name string `json:"name" validate:"required,collection_name"`
}

func (*CreateCollection) ApplyProjection

func (c *CreateCollection) ApplyProjection(
	ctx context.Context,
	tx bun.Tx,
	repo repository.Repository,
	options ProjectionOptions,
) error

ApplyProjection implements Payload.

func (*CreateCollection) Type

func (c *CreateCollection) Type() action.Action

Type implements Payload.

type CreateItem

type CreateItem struct {
	Content      []byte            `json:"content"`
	Mimetype     mimetype.MimeType `json:"mimetype"`
	CollectionID string            `json:"collection_id"`
}

func (*CreateItem) ApplyProjection

func (c *CreateItem) ApplyProjection(
	ctx context.Context,
	tx bun.Tx,
	repo repository.Repository,
	options ProjectionOptions,
) error

ApplyProjection implements Payload.

func (*CreateItem) Type

func (c *CreateItem) Type() action.Action

Type implements Payload.

type DeleteCollection

type DeleteCollection struct{}

func (*DeleteCollection) ApplyProjection

func (d *DeleteCollection) ApplyProjection(
	ctx context.Context,
	tx bun.Tx,
	repo repository.Repository,
	options ProjectionOptions,
) error

ApplyProjection implements Payload.

func (*DeleteCollection) Type

func (d *DeleteCollection) Type() action.Action

Type implements Payload.

type DeleteItem

type DeleteItem struct{}

func (*DeleteItem) ApplyProjection

func (d *DeleteItem) ApplyProjection(
	ctx context.Context,
	tx bun.Tx,
	repo repository.Repository,
	options ProjectionOptions,
) error

ApplyProjection implements Payload.

func (*DeleteItem) Type

func (d *DeleteItem) Type() action.Action

Type implements Payload.

type Payload

type Payload interface {
	Type() action.Action
	ApplyProjection(
		ctx context.Context,
		tx bun.Tx,
		repo repository.Repository,
		options ProjectionOptions,
	) error
}

func Decode

func Decode[P RawPayload](data P, a action.Action) (Payload, error)

Decode decodes the given JSON data into an associated Payload struct based on the action type.

type ProjectionOptions

type ProjectionOptions struct {
	Sequence  int64               // The sequence number of the event being projected.
	Aggregate aggregate.Aggregate // The aggregate associated with the event.
}

type RawPayload

type RawPayload interface {
	[]byte | json.RawMessage
}

type RenameCollection

type RenameCollection struct {
	NewName string `json:"new_name"`
}

func (*RenameCollection) ApplyProjection

func (r *RenameCollection) ApplyProjection(
	ctx context.Context,
	tx bun.Tx,
	repo repository.Repository,
	options ProjectionOptions,
) error

ApplyProjection implements Payload.

func (*RenameCollection) Type

func (r *RenameCollection) Type() action.Action

Type implements Payload.

Jump to

Keyboard shortcuts

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