Uploaded image for project: 'Go Driver'
  1. Go Driver
  2. GODRIVER-3224

Allow Zeroer to apply to more than just structs

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

      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 Unassigned
            Reporter:
            felipe.gasper@mongodb.com Felipe Gasper
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: