Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: darccio/mergo
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: Kong/mergo
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Checking mergeability… Don’t worry, you can still create the pull request.
  • 2 commits
  • 3 files changed
  • 1 contributor

Commits on Feb 1, 2022

  1. feat: use isReflectNil instead of isEmptyValue to gate Transformers

    Mergo handles merges with zero-value fields as follows:
    
    	1. dst: true       src: false      ->     dst: true
    	2. dst: nil        src: false      ->     dst: false
    	3. dst: nil	   src: true	   ->	  dst: true
    	4. dst: false	   src: true 	   ->	  dst: true
    
    In some cases (#166) it may be desirable
    to change this default behaviour using a custom Transformer, for example
    to not overwrite 'dst' when it's already set to 'false' (or '0' etc).
    Unfortunately, in such cases (when dst holds a zero-value) no Transformers can
    be applied due to the way these are gated (#166).
    
    Here we are changing how transformers are gated by using the isReflectNil function
    insted of isEmptyValue.
    
    Note that:
    - this change doesn't affect the default behaviour of mergo, as it only affects
      how transformers are gated
    - since custom transformers need to match data types in order to execute,
      this shouldn't affect any existing transformers either
    GGabriele committed Feb 1, 2022
    Configuration menu
    Copy the full SHA
    32bd3e7 View commit details
    Browse the repository at this point in the history

Commits on Feb 2, 2022

  1. Merge pull request #1 from Kong/gating_transformers

    feat: use isReflectNil instead of isEmptyValue to gate Transformers
    GGabriele authored Feb 2, 2022
    Configuration menu
    Copy the full SHA
    a7ccdf3 View commit details
    Browse the repository at this point in the history
Loading