support datafields in projection
This commit is contained in:
1 parent
b128608316
commit
d04679daf5
4 files changed
+64
-7
No files matched your search
@@ -61,6 +61,9 @@ type Schema struct {
|
||||
CategoryField string `json:"category_field,omitempty"`
|
||||
BrandField string `json:"brand_field,omitempty"`
|
||||
ImageField string `json:"image_field,omitempty"`
|
||||
// AttributesFields names the keys in the source map[string]any that
|
||||
// should be extracted and built into the Projection's json.RawMessage Attributes field.
|
||||
AttributesFields []string `json:"attributes_fields,omitempty"`
|
||||
// ItemIdField is the source-side key carrying the producer's catalog
|
||||
// item id (uint32-equivalent). DefaultSchema points at "id" (matching
|
||||
// the product service's /api/get/{sku} shape). Producers that omit
|
||||
@@ -127,6 +130,7 @@ func DefaultSchema() Schema {
|
||||
// Standard product service carries the integer catalog id under "id".
|
||||
ItemIdField: "id",
|
||||
UpdatedAtField: "updated_at",
|
||||
AttributesFields: []string{"data"},
|
||||
|
||||
FixedCurrency: "", // read from source if present
|
||||
DefaultTaxClass: "standard",
|
||||
@@ -165,6 +169,7 @@ func BygglagretSchema() Schema {
|
||||
ImageField: "PrimaryImage",
|
||||
ItemIdField: "item_id",
|
||||
UpdatedAtField: "LastModifiedMs",
|
||||
AttributesFields: []string{"data"},
|
||||
|
||||
FixedCurrency: "SEK",
|
||||
DefaultTaxClass: "standard",
|
||||
|
||||
Reference in new issue
Block a user