Allow Zeroer to apply to more than just structs

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Unresolved
    • Priority: Unknown
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Go Drivers
    • None
    • None
    • None
    • None
    • None
    • None

      Context

      bson.Zeroer only works when implemented on a struct type. It’d be nice if it could work on any type.

      Describe the background behind the problem.
      Before I realized that GODRIVER-3223 was a bug (thank you, preston.vasquez@mongodb.com!), I tried implementing Zeroer on our wrapper around Google’s UUID package. Then I saw that the Zeroer docs say it’s only for structs, which is rather a surprise.

      Definition of done

      The encoder should honor IsZero() on any type, not just structs.

      Pitfalls

      What should the implementer watch out for? What are the risks?

      This could count as a breaking change since IsZero() could conceptually be implemented on some type independently of BSON. IOW, there could be “accidental” Zeroer implementations out there.

              Assignee:
              Unassigned
              Reporter:
              Felipe Gasper
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated: