usecases

package
v0.0.78 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateResource

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

CreateResource provides the business logic for creating a resource.

func NewCreateResource

func NewCreateResource(
	clock repositories.Clock,
	uuidgen repositories.UUIDGenerator,
) *CreateResource

NewCreateResource creates a new CreateResource.

func (*CreateResource) Execute

func (u *CreateResource) Execute(
	ctx context.Context,
	store repositories.Resource,
	resource *entities.Resource,
) (*entities.Resource, error)

Execute creates a resource.

If the resource name is already in use, ErrAlreadyExists is returned. Any other failure will cause ErrInternal to be returned.

type DeleteResource

type DeleteResource struct{}

DeleteResource provides the business logic for deleting a resource.

func NewDeleteResource

func NewDeleteResource() *DeleteResource

NewDeleteResource creates a new DeleteResource.

func (*DeleteResource) Execute

func (u *DeleteResource) Execute(
	ctx context.Context,
	store repositories.Resource,
	id uuid.UUID,
) error

Execute deletes a resource.

If the resource ID does not exist, ErrNotFound is returned. Any other failure will cause ErrInternal to be returned.

type GetResource

type GetResource struct{}

GetResource provides the business logic for getting a single resource.

func NewGetResource

func NewGetResource() *GetResource

NewGetResource creates a new GetResource.

func (*GetResource) Execute

func (u *GetResource) Execute(
	ctx context.Context,
	store repositories.Resource,
	id uuid.UUID,
) (*entities.Resource, error)

Execute gets a single resource.

If the resource ID does not exist, ErrNotFound is returned. Any other failure will cause ErrInternal to be returned.

type ListAuditEvents

type ListAuditEvents struct{}

ListResources provides the business logic for listing multiple audit events.

func NewListAuditEvents

func NewListAuditEvents() *ListAuditEvents

NewListResources creates a new ListResources.

func (*ListAuditEvents) Execute

Execute lists multiple audit events.

Any failure will cause ErrInternal to be returned.

type ListResources

type ListResources struct{}

ListResources provides the business logic for listing multiple resources.

func NewListResources

func NewListResources() *ListResources

NewListResources creates a new ListResources.

func (*ListResources) Execute

func (u *ListResources) Execute(
	ctx context.Context,
	store repositories.Resource,
) ([]*entities.Resource, error)

Execute lists multiple resources.

Any failure will cause ErrInternal to be returned.

type UpdateResource

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

UpdateResource provides the business logic for updating a resource.

func NewUpdateResource

func NewUpdateResource(
	clock repositories.Clock,
) *UpdateResource

NewUpdateResource creates a new UpdateResource.

func (*UpdateResource) Execute

func (u *UpdateResource) Execute(
	ctx context.Context,
	store repositories.Resource,
	changes *entities.Resource,
) (*entities.Resource, error)

Execute gets a single resource.

If the resource ID does not exist, ErrNotFound is returned. If the resource name is already in use, ErrAlreadyExists is returned. Any other failure will cause ErrInternal to be returned.

type WatchAuditEvents

type WatchAuditEvents struct{}

...

func NewWatchAuditEvents

func NewWatchAuditEvents() *WatchAuditEvents

...

func (*WatchAuditEvents) Execute

func (u *WatchAuditEvents) Execute(
	ctx context.Context,
	store repositories.AuditEvent,
) <-chan *entities.AuditEvent

...

Jump to

Keyboard shortcuts

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