Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a way to only return all records of only 1 column #27

Open
c-emin opened this issue Feb 12, 2025 · 6 comments
Open

Is there a way to only return all records of only 1 column #27

c-emin opened this issue Feb 12, 2025 · 6 comments

Comments

@c-emin
Copy link

c-emin commented Feb 12, 2025

Using your Person Data Collection from the example...

I would like to query the Table and only return the Data for column _Age.

I know I can do a GetAll, and then get the single column from that...
I'm just trying to keep things fast and only querying data that is needed.

Something like this would be nice:

var AllThePeeps = await manager.GetAll();

var AllTheAges = await manager.GetAll<Person,_Age>();

@yueyinqiu
Copy link
Collaborator

yueyinqiu commented Feb 12, 2025

Hmm... I don't think this can be done simply.

First manager.GetAll<Person,_Age>() is not a valid expression in C#. A possible substitute might be manager.GetAll<Person>(x => x._Age). And that requires us to resolve the expression tree x => x._Age and properly pass it to JavaScript layer.

And at the meantime, others may also like x => (x._Age, x._Name), so finally it should become something like IQueryable, which allows you to use Where, Select and some more LINQ methods.

So maybe a deeper consideration is required about this issue.

@magiccodingman
Copy link
Owner

@yueyinqiu @c-emin Actually I think I can do this. It's simply a deferred execution of "Select(x => x._Name)". I've sadly clocked too much time on my most recent PR for this project and need to focus on other things for a bit. But I do not think this is that crazy of an additional feature. Actually a really good feature. But I brought up a pretty major concern and scalability feature here:
#37

And I'd like to resolve that first prior to coming back to this, but I will note this as a feature request. Because I have some good ideas to pull it off and there's tons of use cases for this.

@c-emin
Copy link
Author

c-emin commented Feb 19, 2025

I know you have been working on a lot of other features/issues.
Just curious, if this Feature Request will be completed in the next week or so?

I did like your suggestion on allowing multiple field names! x => (x._Age, x._Name)

@magiccodingman
Copy link
Owner

magiccodingman commented Feb 20, 2025

I'd love to promise a week or so, but I really can't sadly. I work 12-16 hour days for my company. Do I think I'll get it done in 30 days? I think so. But just don't want to make promises I can't keep.

But I do agree about multiple from the select. I was thinking of making it work nearly identical to the current Select. So you can choose to have it go to one thing or to an object

@magiccodingman
Copy link
Owner

@c-emin I made this new feature request where this would be tied into it:
#47

I won't be able to promise the month timeline though. I've got some code base crisis issues that has eaten up my time significantly. I dumped already more time into this project for fun than I should of and after this update #43 which is a monster of an update, which was somehow larger than #38

These updates have opened up a world of possibilities. And with the newly created Issue 47 this will become a likely reality!

But I have to drop off and put out fires 🔥so hopefully next month I can spend time refactoring the expression builder and bringing to life more LINQ like capabilities.

I'm going to close this ticket since I've already documented this as a necessity for another feature. Have a good one.

@magiccodingman
Copy link
Owner

Re-opening ticket because I decided to separate it from #47
As I brought up before, I did see this as possible. The new update #26 brings this into reality.

With the new Cursor querying logic implemented. Though the Select isn't available yet. We can implement new logic and utilize a cursor to grab efficiently only what we want. Thus very similarly emulating a "Select" statement in LINQ.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants