db
db copied to clipboard
Data access layer for PostgreSQL, CockroachDB, MySQL, SQLite and MongoDB with ORM-like features.
I just recently migrated an old app from v1 to v4. In v1 I was using `sqlutil.FetchRows(rows, &myMap)` and this worked fine. Now I'm using `sess.SQL().NewIterator(rows).All(&myMap)` and this is resulting...
..\..\go\pkg\mod\github.com\upper\[email protected]+incompatible\mongo\result.go:37:2: use of internal package upper.io/db.v3/internal/immutable not allowed 
Given two structs User and Profile linked with a foreign key: ```go type User struct { ID uuid.UUID Name string CreatedAt time.Time UpdatedAt time.Time } type Profile struct { ID...
```golang paginator := session.SQL().Select(.....).Where(...).Paginate(10) err := paginator.Page(uint(page)).All(&books) if err != nil { return 0, nil } // the total here is always 1 total, err := paginator.TotalPages() if err !=...
Are there any suggestions about how best to tackle the problem?
One property we relied in the forked pressly bond was the ability to set the `sql.TxOptions`. This has saved us a few times where we explicitly wanted to treat the...
An insert or save query (that goes to an insert) will pass through all columns, and using a null value if that column had no input. This causes failures with...
Is there a reason why `Ping` is called when starting a new transaction? `NewDatabaseTx` clones db with `checkConn` = true https://github.com/upper/db/blob/ca469a8217b7d6a4689fba26f395e22d910da653/mysql/database.go#L219-L220 So `Ping` is called before `begin transaction`: https://github.com/upper/db/blob/ca469a8217b7d6a4689fba26f395e22d910da653/internal/sqladapter/database.go#L330-L334 The...
Per Issue #454. This opens up possibility for modification of a selector query. My use case is building a sudo-graphql api where some base query's "selects" may change on the...
Update() just return error, how to get how many effected rows