More control over slice element pointers #2172
Unanswered
adam-stanek
asked this question in
Q&A
Replies: 1 comment
-
#2178 same discussion. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi guys, I have a question or possibly feature request for you.
I am using
ent
in my project. For it, it makes perfect sense to useomit_slice_element_pointers: false
because it internally uses all the entities as pointers. However I have part of the code base which does not expect that and works with structs. For me it is rather painful to do the conversion for big number of arrays. Is there some elegant solution to the problem I haven't thought of?I am going to give you an example to illustrate what I am dealing with.
I have a custom scalar
AssetID
. It is string composed from 2 parts, index name and document id. However it is opaque to the API. For the sake of example it can be simplified asAdditionally I have
MarshalAssetID(aid AssetID) graphql.Marshaler
andUnmarshalAssetID(v interface{}) (AssetID, error)
defined for the scalar.In the schema whenever I use it in schema
[AssetID!]
i get[]*AssetID
which I then need to translate to[]AssetID
because that is what I use in the rest of the application. I have already quite extensive usage in the code base before I stumbled upon this problem and don't want to refactor it - there is no real benefit to having it as a pointer, quite the opposite.Is there a way, how to force a particular field to be omitting the pointer (and produce
[]AssetID
over[]*AssetID
in this case)?I think it would be awesome to have it configurable on field by field basis. Or am I overlooking something?
Thank you
Beta Was this translation helpful? Give feedback.
All reactions