Closed subhasishgoswami closed 1 year ago
Hi @subhasishgoswami,
Thank you for contributing. However, we should make the library to be general and don't use custom tag for opinional use cases. Anyway, what's your issue here? The library still can support the above use case.
var query struct {
RouterTxReceipts []struct {
TxId `graphql:"txId"`
User `graphql:"user"`
InitiationHash `graphql:"initiationHash"`
} `graphql:"routerTxReceipts(first: $first, where:{user: $user})"`
}
variables := map[string]interface{} {
"first": 1,
"user": ...
}
Hi @hgiasac I was trying to add custom filter tags but I think what you gave works fine-
var query struct {
RouterTxReceipts []struct {
TxId `graphql:"txId"`
User `graphql:"user"`
InitiationHash `graphql:"initiationHash"`
} `graphql:"routerTxReceipts(first: $first, where:{user: $user})"`
}
I will close this pr for now and use it but if find anything that doesn't work for the use case I will try discussing in the comments.
Currently filter using
where
is not supported and the only way to do is by using native raw queries andclient.Exec
. Added agraph_filter
tag which can allow for users to specify filter pairs and use the already available value mapping to create filtered queries.For Example-
The given query can be converted to-
{routerTxReceipts(first: $first, where:{user: $user}){txId,user,initiationHash,srcChainId,dstChainId,initiationTimestamp}}