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
This works, but it's also counter-intuitive. If I construct a list like []interface{}{"foo", 123}, why shouldn't I be able to use bindnode.Wrap and have it work with the schema [Any]? At the moment, I have to manually transform my []interface{} into []datamodel.Node, which is possible, but cumbersome.
This might be a reason to not use basicnode to implement Any, and instead rely on bindnode itself to construct and use the plain Go types (basic types, lists, maps). This is because basicnode hides the underlying Go values, so we wouldn't be able to easily assign them into the user's value.
We only support binding the schema type
Any
todatamodel.Node
, with the understanding that it will be filled via https://pkg.go.dev/github.com/ipld/go-ipld-prime/node/basicnode.This works, but it's also counter-intuitive. If I construct a list like
[]interface{}{"foo", 123}
, why shouldn't I be able to usebindnode.Wrap
and have it work with the schema[Any]
? At the moment, I have to manually transform my[]interface{}
into[]datamodel.Node
, which is possible, but cumbersome.This might be a reason to not use basicnode to implement
Any
, and instead rely on bindnode itself to construct and use the plain Go types (basic types, lists, maps). This is because basicnode hides the underlying Go values, so we wouldn't be able to easily assign them into the user's value.cc @warpfork
The text was updated successfully, but these errors were encountered: