github.com/Tri-stone/burrow@v0.25.0/event/convention.go (about)

     1  package event
     2  
     3  import (
     4  	"fmt"
     5  
     6  	"github.com/hyperledger/burrow/event/query"
     7  )
     8  
     9  const (
    10  	EventTypeKey   = "EventType"
    11  	EventIDKey     = "EventID"
    12  	MessageTypeKey = "MessageType"
    13  	TxHashKey      = "TxHash"
    14  	HeightKey      = "Height"
    15  	IndexKey       = "Index"
    16  	StackDepthKey  = "StackDepth"
    17  	AddressKey     = "Address"
    18  )
    19  
    20  type EventID string
    21  
    22  func (eid EventID) Matches(tags query.Tagged) bool {
    23  	value, ok := tags.Get(EventIDKey)
    24  	if !ok {
    25  		return false
    26  	}
    27  	return string(eid) == value
    28  }
    29  
    30  func (eid EventID) String() string {
    31  	return fmt.Sprintf("%s = %s", EventIDKey, string(eid))
    32  }
    33  
    34  // Get a query that matches events with a specific eventID
    35  func QueryForEventID(eventID string) query.Queryable {
    36  	// Since we're accepting external output here there is a chance it won't parse...
    37  	return query.AsQueryable(EventID(eventID))
    38  }