uow

package
v0.0.0-...-c17fed3 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2024 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command interface {
	Execute(ctx context.Context) error
}

type CreateFunc

type CreateFunc[T model.Entity] func(ctx context.Context, entity T) error

type DeleteCommand

type DeleteCommand struct {
	DeleteFunc DeleteFunc
	ID         string
}

func (*DeleteCommand) Execute

func (cmd *DeleteCommand) Execute(ctx context.Context) error

type DeleteFunc

type DeleteFunc func(ctx context.Context, id string) error

type InsertCommand

type InsertCommand[T model.Entity] struct {
	CreateFunc CreateFunc[T]
	Document   T
}

func (*InsertCommand[T]) Execute

func (cmd *InsertCommand[T]) Execute(ctx context.Context) error

type UnitOfWork

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

func (*UnitOfWork) AddCommand

func (u *UnitOfWork) AddCommand(command Command)

func (*UnitOfWork) Commit

func (u *UnitOfWork) Commit(ctx context.Context) error

func (*UnitOfWork) Rollback

func (u *UnitOfWork) Rollback()

type UpdateCommand

type UpdateCommand[T model.Entity] struct {
	UpdateFunc UpdateFunc[T]
	Entity     T
}

func (*UpdateCommand[T]) Execute

func (cmd *UpdateCommand[T]) Execute(ctx context.Context) error

type UpdateFunc

type UpdateFunc[T model.Entity] func(ctx context.Context, id string, entity T) error

Jump to

Keyboard shortcuts

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