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

Load(T, WhereT) #49

Open
mk3008 opened this issue Jan 29, 2024 · 0 comments
Open

Load(T, WhereT) #49

mk3008 opened this issue Jan 29, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@mk3008
Copy link
Owner

mk3008 commented Jan 29, 2024

Allows upper brain search conditions to be specified.
The return value will be a collection, so name the function "Loads".
The function definition assumes the following.

List<T> Loas <T, WhereT>(Predicate<WhereT>)

T is the starting type. WhereT is the upper layer type when viewed from T.

Usage example

List<book> Loads <book, author>(x => author_id == 1);

Generated SQL

select
*
from
book
inner join author on book.author_id = author.author_id
where
author.author_id = 1

WhereT does not need to be the immediate parent; it can be any number of layers above.
However, the search condition is restricted to the primary key.
(It's not necessary, but I'm mainly using key search)

After writing this, I thought that after loading, it is necessary to use Author for the saving process. If so, it is difficult to use if it is not returned as Author when reading. Therefore, I think the following functions are easier to use.

Usage example

author Load <author, book>(x => author_id == 1);

Generated SQL

select
*
from
book
inner join author on book.author_id = author.author_id
where
author.author_id = 1
@mk3008 mk3008 changed the title Add Loads method Load(T, WhereT) Jan 29, 2024
@mk3008 mk3008 self-assigned this Feb 12, 2024
@mk3008 mk3008 added the enhancement New feature or request label Feb 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

1 participant