-
-
Notifications
You must be signed in to change notification settings - Fork 240
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
Insertion without a model #739
Comments
Looks like a bug. |
Hi, I'd be very interested by this feature aswell. Do you have a plan to implement this? |
Still not fixed? Well |
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. |
Any updates? |
Why not use raw query? db.NewRaw("INSERT INTO custom_path(port_a_id, port_b_id) VALUES(?, ?)", portAId, portBId).Exec(ctx) |
I agree the example in the OP may be a bit too simplified, but in real-world situations, I believe ORM is often utilized to dynamically (conditionally) construct SQL queries: query := db.NewInsert().Table("some_table")
if someCondition {
query = query.Value(...)
}
if anotherCondition {
query = query.Value(...)
}
query.Exec(...) So, while |
From the example, it seems more like a SQL Builder rather than an ORM. On the other hand, the core of Bun is the Model. There is no way to generate SQL without relying on the Model. |
How to use bun as a query builder to insert a row into the database?
When I try this:
I get an error "bun: Model(nil)".
The text was updated successfully, but these errors were encountered: