ExRam.Gremlinq icon indicating copy to clipboard operation
ExRam.Gremlinq copied to clipboard

Exposes request id to developers.

Open n-ate opened this issue 3 years ago • 1 comments

Exposes the request id using a class as reference container (RequestIdSource).

The request id is important for identifying request uniqueness. For example: correlating an individual gremlinq call to a particular set of data.

n-ate avatar Sep 22 '22 04:09 n-ate

Hi, I put together a solution to return the request id to the gremlinq query, so that the developer can use it. I hope you use it. My company is looking for this. :)

n-ate avatar Sep 22 '22 04:09 n-ate

I understand the desire to keep the code 100% functional to reduce maintenance and bugs. The only way I know of to accomplish that goal and return the request-id is to return a response object that contains the result instead of just the result. Would you be interested in my putting together a functional example? If so, I think it makes the most sense to have every request return a response object/wrapper for maintainability, rather than having 2 different responses. What do you think?

n-ate avatar Sep 25 '22 19:09 n-ate

Having some notion of a respone object could be nice, however, I wouldn't like to force clients to having to project from Response<TResult> to TResult everywhere in their code. Maybe this could be made opt-in, by a .WithMeta-extension.

danielcweber avatar Sep 26 '22 06:09 danielcweber

@danielcweber, since building a query seemlessly changes from query building to query execution when ToArrayAsync, FirstAsync, FirstOrDefaultAsync, SingleAsync, etc is called, do you imagine having a WithMeta that then returns a new QueryWithMeta type that can be used to create a new collection of extension methods that contains ToArrayAsync, FirstAsync, FirstOrDefaultAsync, SingleAsync, etc that each returns a response object. Or do you think that making the same extensions, but adding WithMeta to the name would be better? I.e. ToArrayWithMetaAsync, FirstWithMetaAsync, FirstOrDefaultWithMetaAsync, SingleWithMetaAsync, etc

Any other approach, I should use? Thanks!

n-ate avatar Sep 27 '22 15:09 n-ate

I think a possible WithMeta method should leave the query domain (I...Query<T>) and change to an IAsyncEnumerable<Result<T>>. On an IAsyncEnumerable there's all the known extensions (ToArrayAsync etc.).

danielcweber avatar Sep 27 '22 17:09 danielcweber

Sounds good. I will take a look at it.

n-ate avatar Sep 27 '22 22:09 n-ate

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Oct 15 '22 21:10 stale[bot]