ports

package
v0.0.0-...-e28bd7b Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2024 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IncomingEventHandlers

type IncomingEventHandlers interface {
	Create(request service.ProviderRequest, out OutgoingEventPort)
	Update(request service.ProviderRequest, out OutgoingEventPort)
	Delete(request service.ProviderRequest, out OutgoingEventPort)
}

IncomingEventHandlers is an interface that represents handlers for event, the implementation is in domain package.

type IncomingEventPort

type IncomingEventPort interface {
	SetHandlers(handlers IncomingEventHandlers)
	Start(ctx context.Context, wg *sync.WaitGroup) error
}

IncomingEventPort ...

type IncomingQueryHandlers

type IncomingQueryHandlers interface {
	Get(ctx context.Context, actor service.Actor, id common.ID) service.ProviderResponse
	List(ctx context.Context, actor service.Actor) service.ProviderListModel
}

IncomingQueryHandlers is an interface that represents handlers for query, the implementation is in domain package.

type IncomingQueryPort

type IncomingQueryPort interface {
	SetHandlers(handlers IncomingQueryHandlers)
	Start(ctx context.Context, wg *sync.WaitGroup) error
}

IncomingQueryPort ...

type OutgoingEventPort

type OutgoingEventPort interface {
	Created(service.ProviderResponse)
	CreateFailed(service.ProviderResponse)
	Updated(service.ProviderResponse)
	UpdateFailed(service.ProviderResponse)
	Deleted(service.ProviderResponse)
	DeleteFailed(service.ProviderResponse)
}

OutgoingEventPort represents all events this service will be publishing.

type Port

type Port interface {
	Init(config *types.Config) error
}

Port is a special type of port that will has an asynchronous behavior to it, such as being event-driven outside of the primary domain thread (e.g. incoming message queues). This ports should communicate with the domain object using a threaded approach (i.e. go routine, go channels and possibly waitgroups)

type ProviderStoragePort

type ProviderStoragePort interface {
	Port
	Create(service.Actor, types.Provider) error
	Get(id common.ID) (types.Provider, error)
	// ListPublicAndOwnedByUser return public providers and providers owned by user.
	ListPublicAndOwnedByUser(actor string, skip uint, limit uint) ([]types.Provider, error)
	// ListAll will return all providers
	ListAll(skip uint, limit uint) ([]types.Provider, error)
	Update(providerID common.ID, update types.ProviderUpdate) error
	Delete(service.Actor, common.ID) error
}

ProviderStoragePort ...

type UserService

type UserService interface {
	Port
	// CheckForAdmin communicates with user service to check if a user is admin.
	// Return error if check fails or user is NOT admin.
	// This can be overridden with config to skip checks.
	CheckForAdmin(actor service.Actor) (actorIsAdmin bool, err error)
}

UserService ...

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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