diff --git a/clickhouse.go b/clickhouse.go index 655f910..9002b2c 100644 --- a/clickhouse.go +++ b/clickhouse.go @@ -6,9 +6,35 @@ import ( "strings" ) -// =============================================== -// CONVERSION FUNCTIONS -// =============================================== +// Values returns all fields in the order expected by ClickHouse INSERT +func (fk *FlatKillmail) Values() []interface{} { + return []interface{}{ + fk.KillmailID, + fk.KillmailTime, + fk.SolarSystemID, + fk.KillmailHash, + fk.VictimShipTypeID, + fk.VictimCharacterID, + fk.VictimCorporationID, + fk.VictimAllianceID, + fk.VictimDamageTaken, + fk.VictimPosX, + fk.VictimPosY, + fk.VictimPosZ, + fk.AttackerCount, + fk.TotalDamageDone, + fk.FinalBlowShipType, + fk.Attackers, + fk.Items, + } +} +func (fm *FlatModule) Values() []interface{} { + return []interface{}{ + fm.KillmailID, + fm.ItemTypeID, + string(fm.Slot), + } +} // FlattenKillmail converts the nested JSON structure to ClickHouse format func (k *Killmail) FlattenKillmail() (*FlatKillmail, []*FlatModule) {