Documentation ¶
Index ¶
Constants ¶
const ( // VersionTableName is the table name for this model VersionTableName = "data_version" // VersionFieldName is the name for the version field in Version struct VersionFieldName = "version" // ServiceFieldName is the name for the service_name field in Version struct ServiceFieldName = "service_name" // LastUpdatedTsFieldName is the name for last_updated_timestamp field in Version struct LastUpdatedTsFieldName = "last_updated_timestamp" // ExistsFieldName is the name for exists field in Version struct ExistsFieldName = "exists" )
const (
// EventTableBaseName is the type of table this code defines
EventTableBaseName = "event"
)
Variables ¶
This section is empty.
Functions ¶
func CreateEventTableIndices ¶
CreateEventTableIndices returns the query to create this table
func CreateEventTableQuery ¶
CreateEventTableQuery returns the query to create this table
func CreateVersionTableQuery ¶
CreateVersionTableQuery returns the query to create this table version and service_name are unique.
Types ¶
type Event ¶
type Event struct { EventType string `db:"event_type"` EventHash string `db:"hash"` ContractAddress string `db:"contract_address"` ContractName string `db:"contract_name"` Timestamp int64 `db:"timestamp"` RetrievalMethod int `db:"retrieval_method"` EventPayload cpostgres.JsonbPayload `db:"payload"` LogPayload cpostgres.JsonbPayload `db:"log_payload"` }
Event is the model for events table in DB
func NewDbEventFromEvent ¶
NewDbEventFromEvent constructs an event for DB from a model.event
func (*Event) DBToEventData ¶
DBToEventData converts the db event model to a model. NOTE(IS): because jsonb payloads are stored in DB as a map[string]interface{}, Postgres converts some fields, see notes in function.
func (*Event) DBToEventLogData ¶
DBToEventLogData converts the DB raw log payload back to types.Log NOTE(IS): because jsonb payloads are stored in DB as a map[string]interface{}, Postgres converts some fields, see notes in function.
func (*Event) EventDataToDB ¶
EventDataToDB converts event data payload types so they can be stored in the DB
func (*Event) EventLogDataToDB ¶
EventLogDataToDB explicitly converts the raw log data to Postgresql types