Documentation
¶
Index ¶
- Constants
- func CloudEventToObjectKey(event *cloudevent.CloudEventHeader) string
- func CloudEventToSlice(event *cloudevent.CloudEventHeader) []any
- func CloudEventToSliceWithKey(event *cloudevent.CloudEventHeader, key string) []any
- func StoredEventToSlice(stored *cloudevent.StoredEvent, indexKey string) []any
- func UnmarshalCloudEventSlice(jsonArray []byte) ([]any, error)
Constants ¶
const ( // TableName is the name of the table in Clickhouse. TableName = "cloud_event" // SubjectColumn is the name of the subject column in Clickhouse. SubjectColumn = "subject" // TimestampColumn is the name of the timestamp column in Clickhouse. TimestampColumn = "event_time" // TypeColumn is the name of the cloud event type column in Clickhouse. TypeColumn = "event_type" // IDColumn is the name of the ID column in Clickhouse. IDColumn = "id" // SourceColumn is the name of the source column in Clickhouse. SourceColumn = "source" // ProducerColumn is the name of the producer column in Clickhouse. ProducerColumn = "producer" // DataContentTypeColumn is the name of the data content type column in Clickhouse. DataContentTypeColumn = "data_content_type" // DataVersionColumn is the name of the data version column in Clickhouse. DataVersionColumn = "data_version" // ExtraColumn is the name of the extra column in Clickhouse. ExtrasColumn = "extras" // IndexKeyColumn is the name of the index name column in Clickhouse. IndexKeyColumn = "index_key" // DataIndexKeyColumn is the name of the data index name column in Clickhouse. DataIndexKeyColumn = "data_index_key" // VoidsIDColumn is the name of the voids_id column in Clickhouse. For // dimo.tombstone events it holds the id of the event, usually an attestation, // being tombstoned; empty for all other event types. VoidsIDColumn = "voids_id" // InsertStmt is the SQL statement for inserting a row into Clickhouse. InsertStmt = "INSERT INTO " + TableName + " (" + SubjectColumn + ", " + TimestampColumn + ", " + TypeColumn + ", " + IDColumn + ", " + SourceColumn + ", " + ProducerColumn + ", " + DataContentTypeColumn + ", " + DataVersionColumn + ", " + ExtrasColumn + ", " + IndexKeyColumn + ", " + DataIndexKeyColumn + ", " + VoidsIDColumn + ") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" )
Variables ¶
This section is empty.
Functions ¶
func CloudEventToObjectKey ¶
func CloudEventToObjectKey(event *cloudevent.CloudEventHeader) string
CloudEventToObjectKey generates a unique key for storing cloud events. The key is composed of the event's key with a hex prefix derived from the hash of the key.
func CloudEventToSlice ¶
func CloudEventToSlice(event *cloudevent.CloudEventHeader) []any
CloudEventToSlice converts a CloudEvent to an array of any for Clickhouse insertion. The order of the elements in the array match the order of the columns in the table. index_key is computed from the event's headers.
func CloudEventToSliceWithKey ¶
func CloudEventToSliceWithKey(event *cloudevent.CloudEventHeader, key string) []any
CloudEventToSliceWithKey converts a CloudEvent to an array of any for Clickhouse insertion. The order of the elements in the array match the order of the columns in the table. This variant allows the caller to specify a value for index_key.
func StoredEventToSlice ¶ added in v0.2.8
func StoredEventToSlice(stored *cloudevent.StoredEvent, indexKey string) []any
StoredEventToSlice converts a StoredEvent to an array of any for Clickhouse insertion, populating index_key (caller-supplied), data_index_key, and voids_id (both carried on the wrapper). The order of the elements matches the column order in the table.
func UnmarshalCloudEventSlice ¶
UnmarshalCloudEventSlice unmarshals a byte slice into an array of any for Clickhouse insertion.
Types ¶
This section is empty.