Add Values functions to flat structs to map them to []interface for clickhouse

This commit is contained in:
2026-01-06 15:31:48 +01:00
parent fcc1b1807e
commit 05ca9fc9d7

View File

@@ -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) {