Commit Graph

59 Commits

Author SHA1 Message Date
molon 11c4331058
feat: add MapColumns method (#6901)
* add MapColumns method

* fix MapColumns desc

* add TestMapColumns
2024-06-24 17:42:59 +08:00
Waleed Masoom 73a988ceb2
fix(scan): update Scan function to reset structs to zero values for each scan (#7061)
Co-authored-by: waleed.masoom <waleed.masoom@wheniwork.com>
2024-06-12 18:57:36 +08:00
hakusai22 5e599a07ec
fix: typo (#7003)
* fix: typo

* fix: covered
2024-05-08 12:07:58 +08:00
Wenli Looi 9d370bcb3e
Fix handling of unknown column types (#6540) 2024-04-26 17:53:11 +08:00
jessetang 7b1fb0bd73
fix(scan): array element is set to a zero value (#6890)
* fix(scan): array element is set to a zero value

* add test

* fix test

* optimization
2024-03-15 14:14:48 +08:00
jessetang c4c9aa45e3
fix(scan.go): reflect.MakeSlice passes in the reflect.Array type (#6880) 2024-03-09 17:39:01 +08:00
Cr 8bf1f269cf
feat: support nested join (#6067)
* feat: support nested join

* fix: empty rel value
2023-03-10 17:21:56 +08:00
Edward McFarlane 4ec73c9bf4
Add test case for embedded value selects (#5901)
* Add test case for embedded value selects

* Revert recycle struct optimisation to avoid pointer overwrites
2022-12-19 11:49:05 +08:00
Jinzhu 2c56954cb1 tests mariadb with returning support 2022-10-08 20:48:22 +08:00
Stephano George a3cc6c6088 Fix: wrong value when Find with Join with same column name, close #5723, #5711 2022-09-30 17:18:42 +08:00
Cr 101a7c789f
fix: scan array (#5624)
Co-authored-by: Jinzhu <wosmvp@gmail.com>
2022-09-22 15:51:47 +08:00
jesse.tang 1f634c3937
support scan assign slice cap (#5634)
* support scan assign slice cap

* fix
2022-09-22 14:50:35 +08:00
jesse.tang f78f635fae
Optimize: code logic db.scanIntoStruct() (#5633) 2022-09-05 15:34:33 +08:00
Cr 8d45714628
fix: reset null value in slice (#5417)
* fix: reset null value in slice

* fix: can not set field in-place in join
2022-06-14 13:48:50 +08:00
Bexanderthebex d01de7232b
enhancement: Avoid calling reflect.New() when passing in slice of values to `Scan()` (#5388)
* fix: reduce allocations when slice of values

* chore[test]: Add benchmark for scan

* chore[test]: add bench for scan slice

* chore[test]: add bench for slice pointer and improve tests

* chore[test]: make sure database is empty when doing slice tests

* fix[test]: correct sql delete statement

* enhancement: skip new if rows affected = 0
2022-06-01 11:50:57 +08:00
Cr 7e13b03bd4
fix: duplicate column scan (#5369)
* fix: duplicate column scan

* fix: dup filed in inconsistent schema and database

* chore[ci skip]: gofumpt style

* chore[ci skip]: fix typo
2022-05-28 22:18:07 +08:00
Filippo Del Moro 6aa6d37fc4
Fix scanIntoStruct (#5241)
* Reproduces error case

* Fix scanIntoStruct

Co-authored-by: Filippo Del Moro <filippo.delmoro@facile.it>
2022-04-13 15:47:04 +08:00
Hasan 81c4024232
Offset issue resolved for scanning results back into struct (#5227) 2022-04-07 23:56:41 +08:00
Jinzhu 9dd6ed9c65 Scan with Rows interface 2022-03-29 18:14:37 +08:00
Jinzhu f92e6747cb Handle field set value error 2022-03-23 17:24:25 +08:00
Hasan f3e2da5ba3 Added offset when scanning the result back to struct, close #5143
commit 9a2058164d44c98d7b586b87bed1757f89d6fad7
Author: Jinzhu <wosmvp@gmail.com>
Date:   Thu Mar 17 22:34:19 2022 +0800

    Refactor #5143

commit c259de2176
Author: Hasan <mr.k779@outlook.com>
Date:   Mon Mar 14 20:04:01 2022 +0545

    Update scan_test.go

commit 09f127b491
Author: Hasan <mr.k779@outlook.com>
Date:   Mon Mar 14 19:23:47 2022 +0545

    Added test for scanning embedded data into structs

commit aeaca493cf
Author: Hasan <mr.k779@outlook.com>
Date:   Tue Mar 8 04:08:16 2022 +0600

    Added offset when scanning the result back to struct
2022-03-17 22:52:40 +08:00
Jinzhu e2e802b837 Refactor Scan 2022-02-28 13:00:30 +08:00
Jinzhu 43a72b369e Refactor Scan 2022-02-28 00:16:57 +08:00
Jinzhu 68bb5379d9 Refactor scan into struct 2022-02-27 09:09:29 +08:00
chenrui 397b583b8e fix: query scanner in single column 2022-02-25 22:38:48 +08:00
Jinzhu 39d84cba5f Add serializer support (#5078)
* Update context

* Update GormFieldValuer

* Add Serializer

* Add Serializer Interface

* Refactor gorm field

* Refactor setter, valuer

* Add sync.Pool

* Fix test

* Add pool manager

* Fix pool manager

* Add poolInitializer

* Add Serializer Scan support

* Add Serializer Value method

* Add serializer test

* Finish Serializer

* Fix JSONSerializer for postgres

* Fix JSONSerializer for sqlserver

* Test serializer tag

* Add unixtime serializer

* Update go.mod
2022-02-19 17:02:53 +08:00
Jinzhu 270e38c518 Fix duplicated error when Scan, close #4525 2021-11-29 14:23:10 +08:00
heige 9d5f315b6d
feat: go code style adjust and optimize code for callbacks package (#4861)
* feat: go code style adjust and optimize code for callbacks package

* Update scan.go
2021-11-29 09:33:20 +08:00
Jinzhu 9635d25150 Fix query with uninitialized map 2021-11-01 13:00:52 +08:00
Jinzhu 9f533950a2 Add dest value if current size equal zero 2021-10-28 17:12:31 +08:00
Jinzhu e953880d19 Add returning tests 2021-10-28 09:17:33 +08:00
Jinzhu 835d7bde59 Add returning support to delete 2021-10-28 07:56:55 +08:00
Jinzhu af3fbdc2fc Improve returning support 2021-10-26 22:40:14 +08:00
Jinzhu ab355336cb Fix scan with interface 2021-09-17 18:35:14 +08:00
Jinzhu 12bbde89e6 Fix Scan with interface 2021-09-17 14:04:19 +08:00
Jinzhu c73fe96cfd Fix scan into decimal.Decimal, close #4457 2021-07-13 19:59:31 +08:00
Jinzhu b616d810eb Fix scan single value to custom type, close #4501 2021-07-13 19:29:10 +08:00
Jinzhu 673053f56a Fix context cancel error, close #4259, close #4260 2021-04-09 10:21:01 +08:00
Ben cc61202fe2
retrieving gorm object support pointer (#4006) 2021-01-27 11:50:15 +08:00
Jinzhu 81aa949105 Remove the uncessary reflect.Ptr 2021-01-27 11:48:47 +08:00
rorschach ba59065024 retrieving gorm object support pointer 2021-01-27 11:48:47 +08:00
SmallTianTian 41e52f343a
fix: scan more base type and sql.NullXXX (#3813) 2020-12-02 14:00:16 +08:00
Dakatan acedbb8310
Fix Scan int32, uint32 (#3801) 2020-11-30 10:09:08 +08:00
Jinzhu 1e241aa645 Reduce GC alloc 2020-11-10 21:23:20 +08:00
Jinzhu 9eec6ae066 Fix affected rows for Scan, change affected rows count for row/rows to '-', close #3532 2020-09-27 12:25:38 +08:00
Jinzhu ba253982bf Fix Pluck with Time and Scanner 2020-09-24 20:08:24 +08:00
Jinzhu 02fb382ec0 Support scan into int, string data types 2020-09-11 15:01:02 +08:00
Jinzhu e73147fa8e Better support for scan into map, fix unfriendly data type for interface, close #3351 2020-09-01 17:45:14 +08:00
Jinzhu 9075b33620 Query with smaller struct 2020-07-01 08:56:21 +08:00
Jinzhu 9039e36cfc Allow scan into float close #1373 2020-06-14 19:18:48 +08:00