Skip to content

Feat: Select(): Implement batch relation loading instead of loading recursively which would have caused an N+1 problem - #12

Merged
VoidClancy merged 1 commit into
masterfrom
integration
Jul 4, 2026
Merged

Feat: Select(): Implement batch relation loading instead of loading recursively which would have caused an N+1 problem#12
VoidClancy merged 1 commit into
masterfrom
integration

Conversation

@VoidClancy

Copy link
Copy Markdown
Owner

1- refactor delegates into model structs, relations, header, and create in the templates

2- refactor the client generation into a core client and per model file so code is easy to navigate

3- add bindVars() in client that uses the dialect's bindVar() in the relationships construction

4- add fkForRelation() in helpers to explicitly include the FK when a relation is selected

5- add missing dialect to the transaction template which caused nil pointer ref panic on tx execution

6- add conditional dialect in the client template to only generate the dialect for the specified provider

7- update generator.go and handleGenerate.go to output multiple files mapped by filename instead of a single giant client.go

8- add integration/selection_test.go verifying Select/Omit fields and deep batch relation loading

9- add integration/benchmark_test.go comparing ORM against raw SQL and raw SQL + scan + CUID in creation

10- optimize query compiler in execution layer using strings.Builder with sb.Grow() to prevent heap allocations

11- cache default model columns statically in model structs for O(1) select resolution if none are selected

12- add lint target, benchmark to makefile to run staticcheck and gocritic linter checks and to run the benchmark

…ecursively which would have caused an N+1 problem

1- refactor delegates into model structs, relations, header, and create in the templates

2- refactor the client generation into a core client and per model file so code is easy to navigate

3- add bindVars() in client that uses the dialect's bindVar() in the relationships construction

4- add fkForRelation() in helpers to explicitly include the FK when a relation is selected

5- add missing dialect to the transaction template which caused nil pointer ref panic on tx execution

6- add conditional dialect in the client template to only generate the dialect for the specified provider

7- update generator.go and handleGenerate.go to output multiple files mapped by filename instead of a single giant client.go

8- add integration/selection_test.go verifying Select/Omit fields and deep batch relation loading

9- add integration/benchmark_test.go comparing ORM against raw SQL and raw SQL + scan + CUID in creation

10- optimize query compiler in execution layer using strings.Builder with sb.Grow() to prevent heap allocations

11- cache default model columns statically in model structs for O(1) select resolution if none are selected

12- add lint target, benchmark to makefile to run staticcheck and gocritic linter checks and to run the benchmark
@VoidClancy VoidClancy self-assigned this Jul 4, 2026
@VoidClancy
VoidClancy merged commit 094a305 into master Jul 4, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant