github.com/Tri-stone/burrow@v0.25.0/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  	ActionInitialize  DBAction = "_INITIALIZE_VENT"
    13  )
    14  
    15  // EventData contains data for each block of events
    16  // already mapped to SQL columns & tables
    17  // Tables map key is the table name
    18  type EventData struct {
    19  	BlockHeight uint64
    20  	Tables      map[string]EventDataTable
    21  }
    22  
    23  // EventDataTable is an array of rows
    24  type EventDataTable []EventDataRow
    25  
    26  // EventDataRow contains each SQL column name and a corresponding value to upsert
    27  // map key is the column name and map value is the given column value
    28  // if Action == 'delete' then the row has to be deleted
    29  type EventDataRow struct {
    30  	Action  DBAction
    31  	RowData map[string]interface{}
    32  	// The EventClass that caused this row to be emitted (if it was caused by an specific event)
    33  	EventClass *EventClass
    34  }