We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Bun's goal is to help you write idiomatic SQL, not to hide it behind awkward constructs.
It is good for static code, when table schemas are known at compile time.
What about dynamic tables created at runtime? Unknown about table name and field name, how I can use Where family methods to construct conditions?
Where
Field-based query conditions usually exist as a whole, so support for structs would be nice.
The text was updated successfully, but these errors were encountered:
Can you provide more specific use cases?
Sorry, something went wrong.
// dummy fields known at runtime var Main1118 = func() *dynamic.DomainRepository { Main := dynamic.NewDomainRepository("test", "jux_main_1118", "main1118") Main.AddUint64("SystemId", dynamic.WithRaw(`json:"system_id" bun:"system_id"`)) Main.AddString("TypeName", dynamic.WithRaw(`json:"typename" bun:"type_name"`)) Main.AddInt32("RowIndex", dynamic.WithRaw(`json:"rowindex" bun:"row_index"`)) Main.AddInt8("Status", dynamic.WithRaw(`json:"status" bun:"status"`)) return Main }() // create table _ = Main1118.CreateTable(db) // cond and ptr both point the same value, cond for reflect, ptr for static cond, ptr = Main1118.StructValue(map[string]any{ // conditions are different each time. "SystemId": uint64(99), // "test"."jux_main_1118"."system_id" = 99 "TypeName": "XXXX", // "test"."jux_main_1118"."type_name" = 'XXXX' }) _, records, err := Main1118.Slice(db, cond, ptr)
Thank you for the additional use cases.
But I am a supporter of static strong typing. Let’s see what other maintainers think.
No branches or pull requests
It is good for static code, when table schemas are known at compile time.
What about dynamic tables created at runtime?
Unknown about table name and field name, how I can use
Where
family methods to construct conditions?Field-based query conditions usually exist as a whole, so support for structs would be nice.
The text was updated successfully, but these errors were encountered: