MCPcopy Index your code
hub / github.com/coder/coder / validate

Function validate

scripts/aibridgepricesgen/main.go:178–185  ·  view source on GitHub ↗

validate checks invariants on the converted rows. Catches upstream changes that produce structurally valid but semantically broken seed data, e.g. a renamed `cost` key that leaves every row with all-null prices.

(rows []priceRow)

Source from the content-addressed store, hash-verified

176// data, e.g. a renamed `cost` key that leaves every row with all-null
177// prices.
178func validate(rows []priceRow) error {
179 for _, r := range rows {
180 if r.InputPrice != nil || r.OutputPrice != nil {
181 return nil
182 }
183 }
184 return xerrors.New("converted rows have no pricing data; upstream schema may have changed")
185}
186
187// toMicros scales a price into integer micro-units (1 unit = 1,000,000),
188// rounding to avoid float-truncation errors. Returns nil for nil input, and

Callers 2

TestValidateFunction · 0.70
runFunction · 0.70

Calls 1

NewMethod · 0.65

Tested by 1

TestValidateFunction · 0.56