package labels import "encoding/json" // The stock row stores its geometry as JSON so adding a field never needs a // migration; the name is duplicated into its own column for listing. func parseStock(doc string, s *Stock) error { return json.Unmarshal([]byte(doc), s) } func encodeStock(s Stock) (string, error) { s.ID = 0 // the row id is authoritative; never persist a stale copy inside the blob b, err := json.Marshal(s) return string(b), err }