Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AllOf ¶
type AllOf []Condition
AllOf will return true if all of its underlying Conditions return true. Logical And.
func AllOfThese ¶
func AllOfThese(definitions []ConditionDefinition) (allOf AllOf, err error)
AllOfThese creates an AllOf Condition from a list of definitions
type AnyOf ¶
type AnyOf []Condition
AnyOf will return true if any of its underlying Conditions return true. Logical Or.
func AnyOfThese ¶
func AnyOfThese(definitions []ConditionDefinition) (anyOf AnyOf, err error)
AnyOfThese creates an AnyOf from other definitions
type Condition ¶
type Condition interface { Check(*message.Transaction) bool // contains filtered or unexported methods }
Condition models the an assertion that can be applied to a Transaction
func GetConditionFromArgsOrStdIn ¶
GetConditionFromArgsOrStdIn will attempt to parse the first argument as a tko condition. If no args are available it will instead try to parse stdin
func ReadConditionFromJSON ¶
ReadConditionFromJSON parses a json string into a condition
type ConditionDefinition ¶
type ConditionDefinition struct { Always *Always `json:"always"` IsTransaction *TransactionIs `json:"transaction_is"` TransactionsThat *[]ConditionDefinition `json:"transactions_that"` HasMessage *HasMessage `json:"has_message"` Not *ConditionDefinition `json:"not"` AnyOf *[]ConditionDefinition `json:"any_of"` AllOf *[]ConditionDefinition `json:"all_of"` }
ConditionDefinition wraps around the condition and allows it to be parsed generically. Only 1 of the fields will be returned if multiple exist
type HasMessage ¶
type HasMessage struct { Type *message.Type `json:"type"` DatabaseName *string `json:"db"` Namespace *string `json:"ns"` Relation *string `json:"rel"` TupleID *string `json:"ctid"` PrevTupleID *string `json:"prev_ctid"` FieldsMatch map[string]interface{} `json:"fields_match"` MissingFields *bool `json:"missing_fields"` Waits *bool `json:"waits"` }
HasMessage will match if any message in the transaction matches the provided message.
func (*HasMessage) Check ¶
func (c *HasMessage) Check(txn *message.Transaction) bool
Check will return true if all of the defined conditions for HasMessage match.
type Not ¶
type Not struct {
// contains filtered or unexported fields
}
Not will return the inverse of the underlying condition.
type TransactionIs ¶
TransactionIs will match a specific TransactionID
func (*TransactionIs) Check ¶
func (c *TransactionIs) Check(txn *message.Transaction) bool
Check will return true if the transaction id matches for TransactionIDMatches conditions.
type TransactionsThat ¶
type TransactionsThat struct {
// contains filtered or unexported fields
}
TransactionsThat will return false until a transaction is found for every conditions. It is a stateful transaction filter.
func TransactionsOfThese ¶
func TransactionsOfThese(definitions []ConditionDefinition) (transactionsThat *TransactionsThat, err error)
TransactionsOfThese creates an TransactionsThat from other definitions
func (*TransactionsThat) Check ¶
func (t *TransactionsThat) Check(txn *message.Transaction) bool
Check will return true if any of the underlying conditions return true.