Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ValidateVIN ¶ added in v1.2.17
Types ¶
type MatchQuality ¶ added in v1.6.5
type MatchQuality string
MatchQuality reports how confidently MatchTrim narrowed a Template to a single Trim.
const ( // MatchExact means exactly one trim's selectors matched the signals. MatchExact MatchQuality = "exact" // MatchAmbiguous means more than one trim's selectors matched. Picking // one arbitrarily would silently reintroduce the blended-record bug this // matcher exists to fix, so no trim is chosen. MatchAmbiguous MatchQuality = "ambiguous" // MatchModelOnly means no trim's selectors matched. Only the template's // own attributes are returned -- never a partial merge from a trim that // nearly matched. MatchModelOnly MatchQuality = "model-only" )
type MatchSignals ¶ added in v1.6.5
MatchSignals are the decoded-VIN signals MatchTrim narrows a Template against. A zero-value field means that signal was not available; it never participates in matching.
type PowerTrainTypeService ¶ added in v1.0.14
type PowerTrainTypeService interface {
ResolvePowerTrainType(makeSlug string, modelSlug string, drivlyData null.JSON, vincarioData null.JSON) (string, error)
ResolvePowerTrainFromVinInfo(styleName, fuelType string) string
}
func NewPowerTrainTypeService ¶ added in v1.0.14
func NewPowerTrainTypeService(rulesFileName string, logger *zerolog.Logger, ddCatalogSvc gateways.DeviceDefinitionCatalogService) (PowerTrainTypeService, error)
type Resolved ¶ added in v1.6.5
type Resolved struct {
DefinitionID string
TemplateVersion int
Trim string
Quality MatchQuality
MatchedBy []string
Candidates []string
Attributes map[string]any
HardwareTemplateID string
}
Resolved is the outcome of narrowing a Template to (at most) one Trim.
func MatchTrim ¶ added in v1.6.5
func MatchTrim(tmpl *coremodels.Template, sig MatchSignals) Resolved
MatchTrim narrows tmpl to the single Trim whose selectors agree with sig.
A trim matches when every selector it declares agrees with sig; a trim with no selectors at all matches unconditionally (the single-trim, no-disambiguation-needed case). Exactly one matching trim is an exact match: its attributes are merged over the template's, and its powertrain/tank/etc. always come from that same trim -- never a mix of trims. Zero matches is model-only: only the template's own attributes are returned. More than one match is ambiguous: no trim is chosen, and only the attributes every candidate agrees on are returned, alongside the names of the trims still in contention.
HardwareTemplateID is DIMO hardware configuration, not a vehicle attribute; it is resolved independently of Attributes, taking the matched trim's value when set and otherwise the template's. On an ambiguous or model-only result, no single trim is chosen, so the template's value is used unchanged -- taking a candidate's hardware value when we have explicitly declined to pick a candidate would still be picking one, in the one field that decides what hardware DIMO ships. The template's value is what every candidate shares by construction, so it's the only non-arbitrary answer available.
MatchTrim is pure: no I/O, no logging, no clock. The same tmpl and sig always produce the same Resolved.
type VINDecodingService ¶ added in v0.7.9
type VINDecodingService interface {
// GetVIN decodes a vin using one of the providers passed in or if AllProviders applies an ordered logic. Only pass TeslaProvider if know it is a Tesla.
//
// The vendor extra is never nil, on any path including a failure: it is
// what the caller writes to failed_vin_decodes, and returning nil there
// panicked the decode instead of recording the failure.
GetVIN(ctx context.Context, vin string, provider coremodels.DecodeProviderEnum, country string) (*coremodels.VINDecodingInfoData, *coremodels.VINDecodingVendorExtra, error)
}
func NewVINDecodingService ¶ added in v0.7.9
func NewVINDecodingService(drivlyAPISvc gateways.DrivlyAPIService, vincarioAPISvc gateways.VincarioAPIService, autoIso gateways.AutoIsoAPIService, logger *zerolog.Logger, catalogSvc gateways.DeviceDefinitionCatalogService, datGroupAPIService gateways.DATGroupAPIService, dbs func() *db.ReaderWriter, japan17VINAPI gateways.Japan17VINAPI, carvxAPI gateways.CarVxVINAPI, elevaAPI gateways.ElevaAPI) VINDecodingService