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