logic

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2023 License: MPL-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PanicChangeMetaNotSet             string = "change meta not set"
	PanicRegistrationMetaNotSet       string = "change meta not set"
	PanicRegistrationChangeMetaNotSet string = "change meta not set"
	ChangeIdNotProvided               string = "change id not provided"
	RegisterFilterHandlerNotProvided  string = "unable to register; neither fitler or handler not provided"
	DefaultQueueSize                  int    = 100
)

Variables

View Source
var (
	ErrChangeIdNotProvided              = errors.New(ChangeIdNotProvided)
	ErrRegisterFilterHandlerNotProvided = errors.New(RegisterFilterHandlerNotProvided)
	QueueSize                           = DefaultQueueSize
)

Functions

func New

New will generate a new instance of logic that implements the interfaces Logic and Owner, from the provided parameters we can set the logger and the employee meta (required)

Types

type HandlerFx

type HandlerFx func(ctx context.Context, handlerId string, changes []*data.Change) error

type Logic

type Logic interface {
	//changes
	ChangeUpsert(ctx context.Context, change data.ChangePartial) (*data.Change, error)
	ChangeRead(ctx context.Context, changeId string) (*data.Change, error)
	ChangesRead(ctx context.Context, search data.ChangeSearch) ([]*data.Change, error)
	ChangesDelete(ctx context.Context, changeIds ...string) error

	//registrations
	RegistrationUpsert(ctx context.Context, registrationId string) error
	RegistrationChangesRead(ctx context.Context, registrationId string) ([]*data.Change, error)
	RegistrationChangeAcknowledge(ctx context.Context, registrationId string, changeIds ...string) error
	RegistrationDelete(ctx context.Context, registrationId string) error

	//handlers
	HandlerCreate(ctx context.Context, handleFx HandlerFx) (handlerId string, err error)
	HandlerDelete(ctx context.Context, handlerId string) error
}

Jump to

Keyboard shortcuts

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