manifoldco / go-manifold

Go client API for Manifold (unstable)
https://www.manifold.co
BSD 3-Clause "New" or "Revised" License
4 stars 1 forks source link

New ID type to hold external and internal IDs #80

Closed tim-speed closed 5 years ago

tim-speed commented 5 years ago

This adds a new ID type we can use to reference both internal and external entities. It sets some constraints on what is allowed in those IDs, but they are pretty flexible. We will first use this on resources, to replace the User_ID and Team_ID fields with a single Owner_ID. This will allow us to set external owners on resources in addition to the internal ones. We also have plans to use this in Billing for subscription ownership. In Marketplace we will use the Domain portion of this ID to reference partners, and constrain it's usage around them.

Relates manifoldco/engineering#6573

tim-speed commented 5 years ago

Coverage is 100% says my local testing :)

tim-speed commented 5 years ago

Fixing some issues with the UnMarshaling right now

tim-speed commented 5 years ago

I added it as a way to easily translate between the two and enforce some constraints on IDs in our domain. I can't think of any negative consequences in that regard. But this ID type itself will take up more memory. And we will need to add constraints around Domain, I'm thinking each Partner will have a domain on the partner object, and we can constrain the use of IDs to manifold and partner domains.