diff --git a/pkg/schema/signal.go b/pkg/schema/signal.go index c0701b4..42a85db 100644 --- a/pkg/schema/signal.go +++ b/pkg/schema/signal.go @@ -38,7 +38,7 @@ type SignalInfo struct { GOName string JSONName string BaseGoType string - BaseCHType string + BaseGQLType string Conversions []*ConversionInfo Privileges []string } @@ -105,7 +105,7 @@ func NewSignalInfo(record []string) *SignalInfo { if baseType != "" { // if this is not a branch type, we can convert it to default golang and clickhouse types sig.BaseGoType = goTypeFromVSPEC(baseType) - sig.BaseCHType = chTypeFromVSPEC(baseType) + sig.BaseGQLType = gqlTypeFromVSPEC(baseType) } sig.GOName = goName(sig.Name) sig.JSONName = JSONName(sig.Name) @@ -115,9 +115,6 @@ func NewSignalInfo(record []string) *SignalInfo { // MergeWithDefinition merges the signal with the definition information. func (s *SignalInfo) MergeWithDefinition(definition *DefinitionInfo) { - if definition.ClickHouseType != "" { - s.BaseCHType = definition.ClickHouseType - } if definition.GoType != "" { s.BaseGoType = definition.GoType } @@ -143,12 +140,9 @@ func (s *SignalInfo) GOType() string { return s.BaseGoType } -// CHType returns the clickhouse type of the signal. -func (s *SignalInfo) CHType() string { - if s.IsArray { - return "Array(" + s.BaseCHType + ")" - } - return s.BaseCHType +// GQLType returns the graphql type of the signal. +func (s *SignalInfo) GQLType() string { + return s.BaseGQLType } func goName(name string) string { @@ -180,33 +174,11 @@ func goTypeFromVSPEC(dataType string) string { } } -// chTypeFromVSPEC converts vspec type to clickhouse types. -func chTypeFromVSPEC(baseType string) string { +// gqlTypeFromVSPEC converts vspec type to graphql types. +func gqlTypeFromVSPEC(baseType string) string { switch baseType { - case "uint8": - return "UInt8" - case "int8": - return "Int8" - case "uint16": - return "UInt16" - case "int16": - return "Int16" - case "uint32": - return "UInt32" - case "int32": - return "Int32" - case "uint64": - return "UInt64" - case "int64": - return "Int64" - case "string": - return "String" - case "boolean": - return "Bool" - case "float": - return "Float32" - case "double": - return "Float64" + case "uint8", "int8", "uint16", "int16", "uint32", "int32", "float", "double", "uint64", "int64", "Boolean": + return "Float" default: return "String" } diff --git a/pkg/schema/spec/definitions.yaml b/pkg/schema/spec/definitions.yaml index f933dc1..e613dd6 100755 --- a/pkg/schema/spec/definitions.yaml +++ b/pkg/schema/spec/definitions.yaml @@ -6,11 +6,7 @@ # isArray: Whether the field is an array or not # if null then the value is inferred from the vspec definition isArray: null - - # clickHouseType: The type to use for ClickHouse ase. - #if empty then the type is inferred from the vspec definition - clickHouseType: "" - + # goType: The type to use for Golang struct. # if empty then the type is inferred from the vspec definition goType: "" @@ -31,7 +27,6 @@ - VEHICLE_NON_LOCATION_DATA - vspecName: Vehicle.Chassis.Axle.Row1.Wheel.Right.Tire.Pressure isArray: null - clickHouseType: "" goType: "" gqlType: "" conversions: @@ -42,7 +37,6 @@ - VEHICLE_NON_LOCATION_DATA - vspecName: Vehicle.Chassis.Axle.Row2.Wheel.Left.Tire.Pressure isArray: null - clickHouseType: "" goType: "" gqlType: "" conversions: @@ -53,7 +47,6 @@ - VEHICLE_NON_LOCATION_DATA - vspecName: Vehicle.Chassis.Axle.Row2.Wheel.Right.Tire.Pressure isArray: null - clickHouseType: "" goType: "" gqlType: "" conversions: @@ -64,7 +57,6 @@ - VEHICLE_NON_LOCATION_DATA - vspecName: Vehicle.CurrentLocation.Altitude isArray: null - clickHouseType: "" goType: "" gqlType: "" conversions: @@ -75,7 +67,6 @@ - VEHICLE_ALL_TIME_LOCATION - vspecName: Vehicle.CurrentLocation.Latitude isArray: null - clickHouseType: "" goType: "" gqlType: "" conversions: @@ -86,7 +77,6 @@ - VEHICLE_ALL_TIME_LOCATION - vspecName: Vehicle.CurrentLocation.Longitude isArray: null - clickHouseType: "" goType: "" gqlType: "" conversions: @@ -111,7 +101,6 @@ - VEHICLE_ALL_TIME_LOCATION - vspecName: Vehicle.Exterior.AirTemperature isArray: null - clickHouseType: "" goType: "" gqlType: "" conversions: @@ -122,7 +111,6 @@ - VEHICLE_NON_LOCATION_DATA - vspecName: Vehicle.LowVoltageBattery.CurrentVoltage isArray: null - clickHouseType: "" goType: "" gqlType: "" conversions: @@ -133,7 +121,6 @@ - VEHICLE_NON_LOCATION_DATA - vspecName: Vehicle.OBD.BarometricPressure isArray: null - clickHouseType: "" goType: "" gqlType: "" conversions: @@ -144,7 +131,6 @@ - VEHICLE_NON_LOCATION_DATA - vspecName: Vehicle.OBD.EngineLoad isArray: null - clickHouseType: "" goType: "" gqlType: "" conversions: @@ -155,7 +141,6 @@ - VEHICLE_NON_LOCATION_DATA - vspecName: Vehicle.OBD.IntakeTemp isArray: null - clickHouseType: "" goType: "" gqlType: "" conversions: @@ -166,7 +151,6 @@ - VEHICLE_NON_LOCATION_DATA - vspecName: Vehicle.OBD.RunTime isArray: null - clickHouseType: "" goType: "" gqlType: "" conversions: @@ -177,7 +161,6 @@ - VEHICLE_NON_LOCATION_DATA - vspecName: Vehicle.Powertrain.CombustionEngine.ECT isArray: null - clickHouseType: "" goType: "" gqlType: "" conversions: @@ -188,7 +171,6 @@ - VEHICLE_NON_LOCATION_DATA - vspecName: Vehicle.Powertrain.CombustionEngine.EngineOilLevel isArray: null - clickHouseType: "" goType: "" gqlType: "" conversions: @@ -199,7 +181,6 @@ - VEHICLE_NON_LOCATION_DATA - vspecName: Vehicle.Powertrain.CombustionEngine.Speed isArray: null - clickHouseType: "" goType: "" gqlType: "" conversions: @@ -210,7 +191,6 @@ - VEHICLE_NON_LOCATION_DATA - vspecName: Vehicle.Powertrain.CombustionEngine.TPS isArray: null - clickHouseType: "" goType: "" gqlType: "" conversions: @@ -221,7 +201,6 @@ - VEHICLE_NON_LOCATION_DATA - vspecName: Vehicle.Powertrain.FuelSystem.AbsoluteLevel isArray: null - clickHouseType: "" goType: "" gqlType: "" conversions: @@ -232,7 +211,6 @@ - VEHICLE_NON_LOCATION_DATA - vspecName: Vehicle.Powertrain.FuelSystem.SupportedFuelTypes isArray: false - clickHouseType: "" goType: "" gqlType: "" conversions: @@ -243,7 +221,6 @@ - VEHICLE_NON_LOCATION_DATA - vspecName: Vehicle.Powertrain.Range isArray: null - clickHouseType: "" goType: "" gqlType: "" conversions: @@ -254,7 +231,6 @@ - VEHICLE_NON_LOCATION_DATA - vspecName: Vehicle.Powertrain.TractionBattery.Charging.ChargeLimit isArray: null - clickHouseType: "" goType: "" gqlType: "" conversions: @@ -265,7 +241,6 @@ - VEHICLE_NON_LOCATION_DATA - vspecName: Vehicle.Powertrain.TractionBattery.Charging.IsCharging isArray: null - clickHouseType: "" goType: "" gqlType: "" conversions: @@ -276,7 +251,6 @@ - VEHICLE_NON_LOCATION_DATA - vspecName: Vehicle.Powertrain.TractionBattery.GrossCapacity isArray: null - clickHouseType: "" goType: "" gqlType: "" conversions: @@ -287,7 +261,6 @@ - VEHICLE_NON_LOCATION_DATA - vspecName: Vehicle.Powertrain.TractionBattery.StateOfCharge.Current isArray: null - clickHouseType: "" goType: "" gqlType: "" conversions: @@ -298,7 +271,6 @@ - VEHICLE_NON_LOCATION_DATA - vspecName: Vehicle.Powertrain.Transmission.TravelledDistance isArray: null - clickHouseType: "" goType: "" gqlType: "" conversions: @@ -309,7 +281,6 @@ - VEHICLE_NON_LOCATION_DATA - vspecName: Vehicle.Powertrain.Type isArray: null - clickHouseType: "" goType: "" gqlType: "" conversions: @@ -320,7 +291,6 @@ - VEHICLE_NON_LOCATION_DATA - vspecName: Vehicle.Speed isArray: null - clickHouseType: "" goType: "" gqlType: "" conversions: @@ -331,7 +301,6 @@ - VEHICLE_NON_LOCATION_DATA - vspecName: Vehicle.VehicleIdentification.Brand isArray: null - clickHouseType: "" goType: "" gqlType: "" conversions: @@ -342,7 +311,6 @@ - VEHICLE_NON_LOCATION_DATA - vspecName: Vehicle.VehicleIdentification.Model isArray: null - clickHouseType: "" goType: "" gqlType: "" conversions: @@ -353,7 +321,6 @@ - VEHICLE_NON_LOCATION_DATA - vspecName: Vehicle.VehicleIdentification.Year isArray: null - clickHouseType: "" goType: "" gqlType: "" conversions: @@ -364,7 +331,6 @@ - VEHICLE_NON_LOCATION_DATA - vspecName: Vehicle.Powertrain.CombustionEngine.MAF isArray: null - clickHouseType: "" goType: "" gqlType: "" conversions: @@ -375,7 +341,6 @@ - VEHICLE_NON_LOCATION_DATA - vspecName: Vehicle.DIMO.Aftermarket.HDOP isArray: null - clickHouseType: "" goType: "" gqlType: "" conversions: @@ -386,7 +351,6 @@ - VEHICLE_NON_LOCATION_DATA - vspecName: Vehicle.DIMO.Aftermarket.NSAT isArray: null - clickHouseType: "" goType: "" gqlType: "" conversions: @@ -397,7 +361,6 @@ - VEHICLE_NON_LOCATION_DATA - vspecName: Vehicle.DIMO.Aftermarket.WPAState isArray: null - clickHouseType: "" goType: "" gqlType: "" conversions: @@ -408,7 +371,6 @@ - VEHICLE_NON_LOCATION_DATA - vspecName: Vehicle.DIMO.Aftermarket.SSID isArray: null - clickHouseType: "" goType: "" gqlType: "" conversions: