-
-
Notifications
You must be signed in to change notification settings - Fork 239
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
support dynamic conditions, In the form of struct or map. #1061
Labels
Comments
Can you provide more specific use cases? |
// 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. |
This issue has been automatically marked as stale because it has not had activity in the last 30 days. If there is no update within the next 7 days, this issue will be closed. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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: