You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
singleflight is a great library, but the return value of the argument function uses interface{}. If you use generics, you can make it a flexible function by simply passing a type.
For compatibility, define it with a different name than singleflight.Group, e.g. singleflight.GroupGenerics.
singleflight.GroupGenerics has exported functions Do(), DoChan() and Forget() as well as singleflight.
singleflight.GroupGenerics has the following types, arguments, and return values.
Please include the new API with docs (but without the implementation) in this issue. That makes it a easier for people to see the API being proposed. Thanks.
ianlancetaylor
changed the title
proposal: x/sync: Add an API that can use generics to singleflight
proposal: x/sync/singleflight: add generic API
Apr 25, 2022
interface{}
. If you use generics, you can make it a flexible function by simply passing a type.singleflight.Group
, e.g.singleflight.GroupGenerics
.singleflight.GroupGenerics
has exported functionsDo()
,DoChan()
andForget()
as well as singleflight.singleflight.GroupGenerics
has the following types, arguments, and return values.I changed the existing API to try it out. Please refer to it.
https://github.com/catatsuy/sync/pull/1/files
The text was updated successfully, but these errors were encountered: