tableau icon indicating copy to clipboard operation
tableau copied to clipboard

load(patch): patch sheet at top-field level

Open wenchy opened this issue 1 year ago • 0 comments

load formats: JSON/Text/Bin, maybe also support origin formats?

Add new option patch to WorksheetOptions and Metasheet:


// Patch type for both sheet-level and field-level.
enum Patch {
  PATCH_NONE = 0;
  // 1. For patch option in sheet-level: `replace` all fields' value
  // 2. For patch option in field-level: `replace` specified field's value
  PATCH_REPLACE = 1;
  // 1. For patch option in sheet-level:
  //   1. top none-map field (field value):
  //     - `replace`: if field present in both **main** and **patch** sheet
  //   2. top map field patch (key-value pair):
  //     - `add`: if key not exists in **main** sheet
  //     - `replace`: if key exists in both **main** and **patch** sheet
  // 2. For patch option in field-level: NOT supported yet!
  PATCH_MERGE = 2;
}

message WorksheetOptions {
   ...
  // Sheet patch type.
  Patch patch = 20;
}
message Metasheet {
  ...
  // Sheet patch type.
  Patch patch = 20 [(tableau.field) = { name: "Patch " prop:{optional:true}}];
}

Example:

message ToggleConf {
  map<uint32, Toggle> toggle_map = 1;
  message Toggle {
    uint32 id = 1;
    bool enabled = 2; // business logic to check enabled or not
    string name = 3;
  } 
}

Problem to be resolved

  • [ ] top incell-map field (e.g.: KeyValueConf) may need to be replaced as a whole: add field-level option patch with value PATCH_REPLACE

wenchy avatar Jul 25 '24 09:07 wenchy