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
Hi.
I am probably on an impossible quest, but I am gonna ask anyways.
We use HotChocolate 13.0.5 and Marten 5.11. However we use only a Datastore in this service, not EventSourcing. Meaning data is stored as json within table fields of the postgres db.
We have a big table that shows an Entity, lets name it Book. The Book has a lot of data, but also Fields that are Person Data, like an Owner.
Now, all of Entity Book is in one table, except for the Person Data. The reasoning is, that Person Data should be easy to delete due to data privacy laws. So Person Data should be in one table only, one entry per person, and not spread through different other tables or in multiple entries. The Book entity has an identifier to Person Data within its json data.
When loading Book to display in a table in the frontend, we use Resolvers to fill in the required Person data.
publicclassPersonByIdDataloader:BatchDataLoader<string,Person>{protectedoverrideasyncTask<IReadOnlyDictionary<string,Person>>LoadBatchAsync(IReadOnlyList<string>keys,CancellationTokencancellationToken){varresult=await _personResolver.LoadByIds(keys, cancellationToken);return result.Where(m => m is not null).ToDictionary(m => m.Id);}}
Now we had the requirement to make all fields of the Book table sortable and searchable. Easy Peasy thanks to HotChocolate, put [UseFiltering] and [UseSorting] on the endpoint, done.
But, it did not sort or search for the Person Data.
Now I tried making a custom SortInputType and FilterInputType including those fields, but even that did not make the fields sortable. Lots of research and experimenting followed.
Thinking about it, of course it won't be able to do this at the database level, because the entities are not connected at the database level, there can't be a Join as this is not a relational database model. The Person data is loaded and attached by PersonId using the custom resolver.
So it seemed to be the only option would be to sort and search in memory, on the fully loaded entities.
But even for that I couldnt really find a way to do so.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi.
I am probably on an impossible quest, but I am gonna ask anyways.
We use HotChocolate 13.0.5 and Marten 5.11. However we use only a Datastore in this service, not EventSourcing. Meaning data is stored as json within table fields of the postgres db.
We have a big table that shows an Entity, lets name it Book. The Book has a lot of data, but also Fields that are Person Data, like an Owner.
Now, all of Entity Book is in one table, except for the Person Data. The reasoning is, that Person Data should be easy to delete due to data privacy laws. So Person Data should be in one table only, one entry per person, and not spread through different other tables or in multiple entries. The Book entity has an identifier to Person Data within its json data.
When loading Book to display in a table in the frontend, we use Resolvers to fill in the required Person data.
Now we had the requirement to make all fields of the Book table sortable and searchable. Easy Peasy thanks to HotChocolate, put [UseFiltering] and [UseSorting] on the endpoint, done.
But, it did not sort or search for the Person Data.
Now I tried making a custom SortInputType and FilterInputType including those fields, but even that did not make the fields sortable. Lots of research and experimenting followed.
Thinking about it, of course it won't be able to do this at the database level, because the entities are not connected at the database level, there can't be a Join as this is not a relational database model. The Person data is loaded and attached by PersonId using the custom resolver.
So it seemed to be the only option would be to sort and search in memory, on the fully loaded entities.
But even for that I couldnt really find a way to do so.
Has anyone done this before?
Or any other ideas?
Beta Was this translation helpful? Give feedback.
All reactions