Comments (4)
Scan makes this easy enough to do by hand.
from pgx.
@jackc Scan works for simple structs. Code generation from sql definition won't work, since most of the queries are not that straight forward. Right now we are doing the scan manually. It is not really convenient if the table has more columns. Also restructuring the fields eats up lot of time if we introduce columns later.
Any possibilities to reconsider ?
from pgx.
I'm not sure if this belongs in the database driver layer or not. Seems like their are multiple approaches and perhaps it belongs in a library that sits above pgx.
I'm currently experimenting with using code generation to make CRUD easier (pgxdata - definitely not usable yet). That may become useful at some point.
I'm not a fan of using reflection for structure binding, so I don't see that landing in core pgx.
Any particular approach you were looking for?
from pgx.
I agree with you concern about reflection. We avoided reflection as much as possible in our application and scanning fields manually. But after some period of time, we felt majority of our code base is for scanning. Most of the database queries involves multiple tables, I am not sure about the code generation approach either.
from pgx.
Related Issues (20)
- unexpected pipeline result: *pgconn.PipelineSync
- `TraceQueryInjectComment` etc to support datadog database monitoring propagation HOT 1
- Destroy connection on particular errors HOT 6
- driver.Valuer should have precedence over json.Marshaler when encoding for JSON columns HOT 1
- I am using pgx.Connect and it works locally, but I get timeouts in Github actions HOT 1
- [Question] Any way to use functions from pgx.Tx and *pgxpool.Pool without if-else check? HOT 8
- Provide method to retrieve parameterStatuses keys from HOT 3
- Change in behavior v4->v5 on inserting nil slices HOT 2
- Panic in prepared statesment HOT 2
- Missing `QueryTracer` `TraceQueryEnd()` call in conn `Query()` func HOT 2
- `raise exception` does not result in an error HOT 2
- Panic during QueryRow HOT 12
- Clone a backend message HOT 1
- DO $$ Statement not working HOT 1
- Panic while row.Scan: rows.resultReader is nil HOT 3
- keep alive a connection waiting for a notifications HOT 3
- PGXv4 returns ExclusionViolation (23P01) instead of UniqueViolation (23505) on unique field duplicates HOT 2
- BUG: cannot unlock unlocked connection HOT 1
- Using pgxpool connection to query by joining multiple tables does not return all the rows. HOT 1
- check ForEachRow second argument includes all field in row HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pgx.