onflow / flow-go-sdk

Tools for building Go applications on Flow :ocean:
https://onflow.org
Apache License 2.0
212 stars 86 forks source link

Update streaming endpoints to return pointers #783

Closed peterargue closed 3 weeks ago

peterargue commented 1 month ago

We recently added several new methods to use the streaming endpoints available on access nodes. Most of the methods return the structs by value. This generally fine, but most of the non-streaming endpoints return the object pointers. This can get awkward for developers if they have to switch back and forth.

Update the streaming endpoints to also return pointers for consistency.

illia-malachyn commented 1 month ago

Are you referring to all the subscribe* endpoints? If so, returning a channel of objects instead of pointers might be more ergonomic. With streaming, the benefits of using pointers are less significant because the objects are already passed through a channel and are not being copied repeatedly. Returning objects directly can simplify code for developers, as they won’t need to constantly dereference pointers.