github.com/hyperledger/burrow@v0.34.5-0.20220512172541-77f09336001d/vent/types/event_data.go (about)

     1  package types
     2  
     3  // DBAction generic type
     4  type DBAction string
     5  
     6  const (
     7  	ActionDelete      DBAction = "DELETE"
     8  	ActionUpsert      DBAction = "UPSERT"
     9  	ActionRead        DBAction = "READ"
    10  	ActionCreateTable DBAction = "CREATE"
    11  	ActionAlterTable  DBAction = "ALTER"
    12  )
    13  
    14  // EventData contains data for each block of events
    15  // already mapped to SQL columns & tables
    16  // Tables map key is the table name
    17  type EventData struct {
    18  	BlockHeight uint64
    19  	Tables      map[string]EventDataTable
    20  }
    21  
    22  // EventDataTable is an array of rows
    23  type EventDataTable []EventDataRow
    24  
    25  // EventDataRow contains each SQL column name and a corresponding value to upsert
    26  // map key is the column name and map value is the given column value
    27  // if Action == 'delete' then the row has to be deleted
    28  type EventDataRow struct {
    29  	Action  DBAction
    30  	RowData map[string]interface{}
    31  	// The EventClass that caused this row to be emitted (if it was caused by an specific event)
    32  	EventClass *EventClass `json:"-"`
    33  }