Documentation ¶
Index ¶
- func NewConverter() *converter
- func NewRepository(conv EntityConverter) *pgRepository
- func NewService(opRepo OperationRepository, uidService UIDService) *service
- type Entity
- type EntityCollection
- type EntityConverter
- type OperationConverter
- type OperationError
- type OperationRepository
- type OperationService
- type Resolver
- type UIDService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewConverter ¶
func NewConverter() *converter
NewConverter returns a new Converter that can later be used to make the conversions between the service and repository layer representations of an Operation.
func NewRepository ¶
func NewRepository(conv EntityConverter) *pgRepository
NewRepository creates new operation repository
func NewService ¶
func NewService(opRepo OperationRepository, uidService UIDService) *service
NewService creates operations service
Types ¶
type Entity ¶
type Entity struct { ID string `db:"id"` Type string `db:"op_type"` Status string `db:"status"` Data sql.NullString `db:"data"` Error sql.NullString `db:"error"` ErrorSeverity string `db:"error_severity"` Priority int `db:"priority"` CreatedAt *time.Time `db:"created_at"` UpdatedAt *time.Time `db:"updated_at"` }
Entity is a representation of an Operation in the database.
type EntityCollection ¶
type EntityCollection []Entity
EntityCollection is a collection of operations.
func (EntityCollection) Len ¶
func (s EntityCollection) Len() int
Len returns the number of entities in the collection.
type EntityConverter ¶
type EntityConverter interface { ToEntity(in *model.Operation) *Entity FromEntity(entity *Entity) *model.Operation }
EntityConverter missing godoc
type OperationConverter ¶
OperationConverter is responsible for converting operations
type OperationError ¶
type OperationError struct {
CustomError customError `json:"error"`
}
OperationError represents an error from operation processing.
func NewOperationError ¶
func NewOperationError(customErr error) *OperationError
NewOperationError creates OperationError instance.
func (*OperationError) ToJSONRawMessage ¶
func (or *OperationError) ToJSONRawMessage() (json.RawMessage, error)
ToJSONRawMessage converts the operation error ro JSON
type OperationRepository ¶
type OperationRepository interface { Create(ctx context.Context, model *model.Operation) error Get(ctx context.Context, id string) (*model.Operation, error) GetByDataAndType(ctx context.Context, data interface{}, opType model.OperationType) (*model.Operation, error) ListAllByType(ctx context.Context, opType model.OperationType) ([]*model.Operation, error) Update(ctx context.Context, model *model.Operation) error DeleteMultiple(ctx context.Context, ids []string) error PriorityQueueListByType(ctx context.Context, queueLimit int, opType model.OperationType) ([]*model.Operation, error) LockOperation(ctx context.Context, operationID string) (bool, error) DeleteOperations(ctx context.Context, operationType model.OperationType, reschedulePeriod time.Duration) error RescheduleOperations(ctx context.Context, operationType model.OperationType, reschedulePeriod time.Duration, operationStatuses []string) error RescheduleHangedOperations(ctx context.Context, operationType model.OperationType, hangPeriod time.Duration) error }
OperationRepository is responsible for repository-layer operation operations
type OperationService ¶
type OperationService interface { Get(ctx context.Context, id string) (*model.Operation, error) RescheduleOperation(ctx context.Context, operationID string, priority int) error }
OperationService is responsible for service-layer operation operations
type Resolver ¶
type Resolver struct {
// contains filtered or unexported fields
}
Resolver is the operation resolver
func NewResolver ¶
func NewResolver(transact persistence.Transactioner, service OperationService, conv OperationConverter) *Resolver
NewResolver creates operation resolver
type UIDService ¶
type UIDService interface {
Generate() string
}
UIDService is responsible for service-layer uid operations