Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

helper/schema: Default hashing function for sets #3018

Merged
merged 1 commit into from
Oct 5, 2015
Merged

helper/schema: Default hashing function for sets #3018

merged 1 commit into from
Oct 5, 2015

Commits on Oct 4, 2015

  1. helper/schema: Default hashing function for sets

    A common issue with new resource implementations is not considering parts
    of a complex structure that's used inside a set, which causes quirky
    behavior.
    
    The schema helper has enough information to provide a default reasonable
    implementation of a set function that includes all non-computed attributes
    in a deterministic way. Here we implement such a function and use it
    when no explicit hashing function is provided.
    
    In order to achieve this we encapsulate the construction of the zero
    value for a schema in a new method schema.ZeroValue, which allows us to
    put the fallback logic to the new default function in a single spot.
    It is no longer valid to use &Set{F: schema.Set} and all uses of that
    construct should be replaced with schema.ZeroValue().(*Set) .
    apparentlymart committed Oct 4, 2015
    Configuration menu
    Copy the full SHA
    cc8e8a5 View commit details
    Browse the repository at this point in the history