Documentation
¶
Index ¶
- Variables
- func CreateInitialDelayTrigger(ctx context.Context, initalDelay libtime.Duration) run.Trigger
- func NewResultMessageHandler(resultHandler ResultHandler, logSamplerFactory log.SamplerFactory) kafka.MessageHandler
- func NewResultMessageHandlerTx(resultHandler ResultHandlerTx, logSamplerFactory log.SamplerFactory) kafka.MessageHandlerTx
- func RequestIDChannel(ctx context.Context) <-chan RequestID
- type Branch
- type Cache
- type CacheAdder
- type CacheCleaner
- type CacheGetter
- type CacheKey
- type CacheValue
- type Command
- type CommandCreator
- type CommandHeader
- type CommandHeaders
- type CommandOperation
- type Event
- func (e Event) Get(name FieldName) (interface{}, bool)
- func (e Event) MarshalInto(ctx context.Context, into interface{}) error
- func (e Event) Merge(event Event) Event
- func (e Event) Ptr() *Event
- func (e Event) Set(name FieldName, value interface{}) Event
- func (e Event) Validate(ctx context.Context) error
- type EventID
- type EventIDs
- type FieldName
- type FieldNames
- type Identifier
- type IdentifierGenerator
- type IdentifierGeneratorFunc
- type Identifiers
- type Object
- type ObjectIdentifier
- type Provider
- type ProviderFunc
- type RequestID
- type Result
- type ResultHandler
- type ResultHandlerFunc
- type ResultHandlerList
- type ResultHandlerTx
- type ResultHandlerTxFunc
- type ResultHandlerTxList
- type ResultHandlerTxOperation
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrCacheNotFound = stderrors.New("key not found") ErrCacheExpired = stderrors.New("key expired") // Deprecated: Use ErrCacheNotFound instead. CacheNotFoundError = ErrCacheNotFound //nolint:errname // Deprecated: Use ErrCacheExpired instead. CacheExpiredError = ErrCacheExpired //nolint:errname )
Functions ¶
func NewResultMessageHandler ¶
func NewResultMessageHandler( resultHandler ResultHandler, logSamplerFactory log.SamplerFactory, ) kafka.MessageHandler
func NewResultMessageHandlerTx ¶
func NewResultMessageHandlerTx( resultHandler ResultHandlerTx, logSamplerFactory log.SamplerFactory, ) kafka.MessageHandlerTx
func RequestIDChannel ¶
RequestIDChannel provides a channel of RequestIDs for high performance operations.
Types ¶
type Cache ¶
type Cache[Key CacheKey, Value any] interface { CacheAdder[Key, Value] CacheGetter[Key, Value] CacheCleaner }
type CacheAdder ¶
type CacheCleaner ¶
type CacheGetter ¶
type CacheKey ¶
type CacheKey interface {
comparable
}
type CacheValue ¶
type Command ¶
type Command struct {
RequestID RequestID `json:"requestID"`
RequestTime time.Time `json:"requestTime"`
Initiator iam.Initiator `json:"initiator"`
Operation CommandOperation `json:"operation"`
ID EventID `json:"id"`
Data Event `json:"data"`
Header CommandHeader `json:"header"`
}
type CommandCreator ¶
type CommandCreator interface {
NewCommand(operation CommandOperation, initiator iam.Initiator, id EventID, data Event) Command
NewCommandWithHeader(
operation CommandOperation,
initiator iam.Initiator,
id EventID,
data Event,
header CommandHeader,
) Command
CreateCommand(initiator iam.Initiator, data Event) Command
UpdateCommand(initiator iam.Initiator, id EventID, data Event) Command
PatchCommand(initiator iam.Initiator, id EventID, data Event) Command
DeleteCommand(initiator iam.Initiator, id EventID) Command
}
func NewCommandCreator ¶
func NewCommandCreator(requestIDChan <-chan RequestID) CommandCreator
type CommandHeader ¶
type CommandHeaders ¶
type CommandHeaders []CommandHeader
func (CommandHeaders) Merge ¶
func (c CommandHeaders) Merge() CommandHeader
type CommandOperation ¶
type CommandOperation string
const ( CreateOperation CommandOperation = "create" DeleteOperation CommandOperation = "delete" UpdateOperation CommandOperation = "update" PatchOperation CommandOperation = "patch" )
func CommandOperationFromMethod ¶
func CommandOperationFromMethod(method string) CommandOperation
func (CommandOperation) Method ¶
func (c CommandOperation) Method() string
func (CommandOperation) String ¶
func (c CommandOperation) String() string
type Event ¶
type Event map[FieldName]interface{}
Event contains all data of an event
type EventIDs ¶
type EventIDs []EventID
func EventIDsFromStrings ¶
type FieldNames ¶
type FieldNames []FieldName
func ParseFieldNames ¶
func ParseFieldNames(values []string) FieldNames
func ParseFieldNamesFromString ¶
func ParseFieldNamesFromString(value string) FieldNames
func (FieldNames) Len ¶
func (f FieldNames) Len() int
func (FieldNames) Less ¶
func (f FieldNames) Less(i, j int) bool
func (FieldNames) Strings ¶
func (f FieldNames) Strings() []string
func (FieldNames) Swap ¶
func (f FieldNames) Swap(i, j int)
type Identifier ¶
type Identifier string
Identifier a Signal, ExpectedBase or ActualBase
func (Identifier) Bytes ¶
func (i Identifier) Bytes() []byte
func (Identifier) Equal ¶
func (i Identifier) Equal(identifier ObjectIdentifier) bool
func (Identifier) String ¶
func (i Identifier) String() string
type IdentifierGenerator ¶
func NewIdentifierGeneratorCounter ¶
func NewIdentifierGeneratorCounter[Identifier ~string | ~[]byte]() IdentifierGenerator[Identifier]
func NewIdentifierGeneratorUUID ¶
func NewIdentifierGeneratorUUID[Identifier ~string | ~[]byte]() IdentifierGenerator[Identifier]
type IdentifierGeneratorFunc ¶
func (IdentifierGeneratorFunc[Identifier]) NewIdentifier ¶
func (t IdentifierGeneratorFunc[Identifier]) NewIdentifier() Identifier
type Identifiers ¶
type Identifiers []Identifier
func ParseIdentifiers ¶
func ParseIdentifiers(values []string) Identifiers
func (Identifiers) Contains ¶
func (t Identifiers) Contains(identifier Identifier) bool
func (Identifiers) Interfaces ¶
func (t Identifiers) Interfaces() []interface{}
type Object ¶
type Object[I ObjectIdentifier] struct { Identifier I `json:"identifier"` // Create time of the expectedTrade Created libtime.DateTime `json:"created"` // Modified of the actual trade Modified libtime.DateTime `json:"modified"` }
type ObjectIdentifier ¶
type ObjectIdentifier interface {
validation.HasValidation
Equal(identifier ObjectIdentifier) bool
}
type ProviderFunc ¶
type RequestID ¶
type RequestID string
RequestID identify each request/command and the corresponding result.
func NewRequestID ¶
func NewRequestID() RequestID
NewRequestID returns a new RequestID. RequestIDChannel pre generates RequestIDs for better performance.
type Result ¶
type Result struct {
RequestID RequestID `json:"requestID"`
RequestTime time.Time `json:"requestTime"`
Initiator iam.Initiator `json:"initiator"`
Operation CommandOperation `json:"operation"`
ID EventID `json:"id"`
Data Event `json:"data"`
Header CommandHeader `json:"header"`
Success bool `json:"success"`
Message string `json:"message"`
}
type ResultHandler ¶
type ResultHandlerFunc ¶
func (ResultHandlerFunc) HandleResult ¶
func (r ResultHandlerFunc) HandleResult(ctx context.Context, result Result) error
type ResultHandlerList ¶
type ResultHandlerList []ResultHandler
func (ResultHandlerList) HandleResult ¶
func (c ResultHandlerList) HandleResult(ctx context.Context, result Result) error
type ResultHandlerTx ¶
type ResultHandlerTx interface {
HandleResult(ctx context.Context, tx libkv.Tx, result Result) error
}
func NewResultHandlerTxLog ¶
func NewResultHandlerTxLog( logSamplerFactory log.SamplerFactory, ) ResultHandlerTx
type ResultHandlerTxFunc ¶
func (ResultHandlerTxFunc) HandleResult ¶
type ResultHandlerTxList ¶
type ResultHandlerTxList []ResultHandlerTx
func (ResultHandlerTxList) HandleResult ¶
type ResultHandlerTxOperation ¶
type ResultHandlerTxOperation map[CommandOperation]ResultHandlerTx
ResultHandlerTxOperation allow define result handler per option
func (ResultHandlerTxOperation) HandleResult ¶
Source Files
¶
- base_branch.go
- base_cache.go
- base_command-creator.go
- base_command-header.go
- base_command-operation.go
- base_command.go
- base_event-id.go
- base_event.go
- base_fieldname.go
- base_identifier-generator.go
- base_identifier.go
- base_jnitial-delay-trigger.go
- base_object.go
- base_provider.go
- base_request-id.go
- base_result-handler-log.go
- base_result-handler-operation.go
- base_result-handler-tx.go
- base_result-handler.go
- base_result-message-handler-tx.go
- base_result-message-handler.go
- base_result.go
Click to show internal directories.
Click to hide internal directories.