Commit Graph

269 Commits

Author SHA1 Message Date
贾一饼 9c4070ed19
fix: AfterQuery should clear FROM Clause's Joins rather than the Statement (#7027) 2024-06-12 17:51:44 +08:00
Cr 85299bfca7
perf: merge nested preload query when using join (#6990)
* pref: merge nest preload query

* fix: preload test
2024-04-25 20:21:03 +08:00
yetone 9a61ef2af8
fix: duplicated preload (#6948) 2024-04-15 11:20:20 +08:00
Jinzhu 1e13fd7543 Fix duplicated columns in INSERT SQL for some fields with default value 2024-04-08 11:29:55 +08:00
Jinzhu 81536f823c Fix insert id into map results, fix #6812 2024-03-19 11:50:28 +08:00
Jinghao Lu f7ebf049da
fix(create): fix insert column order (#6855)
* fix(create): fix insert column order

* chore: add ConvertToCreateValues ut for Slice case

* fix: remvoe testify dependency

---------

Co-authored-by: lujinghao <lujinghao@bytedance.com>
2024-03-18 13:48:42 +08:00
jessetang ab89d54d87
chore: UnixNano convert to UnixMilli (#6907) 2024-03-18 13:44:55 +08:00
black-06 e4e23d26d2
fix: nested preload with join panic when find (#6877) 2024-03-09 21:27:19 +08:00
Chef f118e55db5
Add unittest test helper function ConvertSliceOfMapToValuesForCreate (#6854) 2024-03-05 10:22:57 +08:00
Chef 52404cddbb
CHORE add unittest test function ConvertMapToValueForCreate (#6846)
* CHORE add unittest test function  ConvertMapToValueForCreate

* CHORE move the test cases located in the files convert_map_test.go and visit_map_test.go into the file helper_test.go.
2024-02-27 10:48:04 +08:00
black-06 418ee3fc19
fix: preload shouldn't overwrite the value of join (#6771)
* fix: preload shouldn't overwrite the value of join

* fix lint

* fix: join may automatically add nested query
2024-01-29 11:34:57 +08:00
FangSqing 3207ad6033
map insert support return increment id (#6662) 2023-11-15 21:32:56 +08:00
Jinzhu c3d7d08b9a Clear SET clause after build SQL 2023-05-15 15:43:44 +08:00
Cr 407bedae0a
fix: nested joins alias (#6265) 2023-04-26 22:19:32 +08:00
black-06 828e22b17f
feat: support embedded preload (#6137)
* feat: support embedded preload

* fix lint and test

* fix test...
2023-04-11 13:10:38 +08:00
bsmith-auth0 ccc3cb758a
fix: many2many association with duplicate belongs to elem (#6206) 2023-04-11 11:06:13 +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
Cr b62192456f
fix: diff schema update assign value (#6096) 2023-03-10 17:04:54 +08:00
Cr e9f25c73ee
fix: on confilct with default null (#6129)
* fix: on confilct with default null

* Update create.go

---------

Co-authored-by: Jinzhu <wosmvp@gmail.com>
2023-03-10 16:35:26 +08:00
black-06 e66a059b82
fix: update panic if model is not ptr (#6037)
* fix: update panic if model is not ptr

* fix: update panic if model is not ptr

* fix: update panic if model is not ptr

* fix: raise an error if the value is not addressable

* fix: return
2023-02-18 09:20:29 +08:00
Michael Anstis 532e9cf4cc
Issue 6054: Unscoped not working with PreLoad on Joins (#6058)
* Issue 6054: Unscoped not working with PreLoad on Joins

* Formatting

---------

Co-authored-by: Michael Anstis <manstis@redhat.com>
2023-02-18 09:06:43 +08:00
Cr 878ac51e98
fix:throw model value required error (#6031)
* fix:throw model value required error

* chore:ingore typecheck

* chore:ingore errcheck

* refactor: use other error

* chore: gofumpt style
2023-02-08 13:40:41 +08:00
Cr 1935eb0adb
feat: support inner join (#5583)
* feat: support inner join

* test: mixed inner join and left join

* chore: code comment

* Update statement.go

Co-authored-by: Jinzhu <wosmvp@gmail.com>
2022-12-24 12:27:38 +08:00
Cr b2f42528a4
fix(Joins): args with select and omit (#5790)
* fix(Joins): args with select and omit

* chore: gofumpt style
2022-11-02 10:28:00 +08:00
Cr 186e8a9e14
fix: association without pks (#5779) 2022-10-18 11:58:42 +08:00
qqxhb 490625981a
fix: update omit (#5699) 2022-09-16 15:02:44 +08:00
alingse 099813bf11
Adjust ToStringKey use unpack params, fix pass []any as any in variadic function (#5500)
* fix pass []any as any in variadic function

* add .vscode to gitignore
2022-07-14 20:05:22 +08:00
Jinzhu b13d1757fa Refactor Model with slice data 2022-07-07 15:39:29 +08:00
Jinzhu fe01e1b9f4 Fix Model with slice data 2022-07-07 14:43:33 +08:00
Cr c74bc57add
fix: association many2many duplicate elem (#5473)
* fix: association many2many duplicate elem

* chore: gofumpt style
2022-07-01 15:12:15 +08:00
Cr 19b8d37ae8
fix: preload with skip hooks (#5310) 2022-05-04 18:57:53 +08:00
ZhangShenao e0ed3ce400
fix spelling mistake (#5256)
Co-authored-by: Shenao Zhang <shenao.zhang@shopee.com>
2022-04-14 20:32:57 +08:00
huangcheng1 38a24606da fix: tables lost when joins exists in from clause, close #5218
commit 7f6a603afa26820e187489b5203f93adc513687c
Author: Jinzhu <wosmvp@gmail.com>
Date:   Sat Apr 2 17:26:48 2022 +0800

    Refactor #5218

commit 95d00e6ff2
Author: huangcheng1 <huangcheng1@sensetime.com>
Date:   Fri Apr 1 16:30:27 2022 +0800

    fix: tables lost when joins exists in from clause
2022-04-02 17:27:53 +08:00
Jinzhu ea8509b777 Use defer to close rows to avoid scan panic leak rows 2022-03-29 18:48:32 +08:00
Jinzhu f92e6747cb Handle field set value error 2022-03-23 17:24:25 +08:00
Jinzhu a7b3b5956f Fix hooks order, close https://github.com/go-gorm/gorm.io/pull/519 2022-03-22 22:42:36 +08:00
Jin 2d5cb997ed
style: fix linter check for NamingStrategy and onConflictOption (#5174) 2022-03-20 09:02:45 +08:00
chenrui 5431da8caf fix: preload panic when model and dest different close #5130
commit e8307b5ef5273519a32cd8e4fd29250d1c277f6e
Author: Jinzhu <wosmvp@gmail.com>
Date:   Fri Mar 18 13:37:22 2022 +0800

    Refactor #5130

commit 40cbba49f3
Author: chenrui <chenrui@jingdaka.com>
Date:   Sat Mar 5 17:36:56 2022 +0800

    test: fix test fail

commit 66d3f07829
Author: chenrui <chenrui@jingdaka.com>
Date:   Sat Mar 5 17:29:09 2022 +0800

    test: drop table and auto migrate

commit 7cbf019a93
Author: chenrui <chenrui@jingdaka.com>
Date:   Sat Mar 5 15:27:45 2022 +0800

    fix: preload panic when model and dest different
2022-03-18 13:38:46 +08:00
chenrui c2e36ebe62 fix: soft delete for join, close #5132
commit a83023bdfc0dc6eaccc6704b64ff6436c2fe7725
Author: Jinzhu <wosmvp@gmail.com>
Date:   Fri Mar 18 01:05:25 2022 +0800

    Refactor #5132

commit 8559f51102
Author: chenrui <chenrui@jingdaka.com>
Date:   Mon Mar 7 20:33:12 2022 +0800

    fix: should add deleted_at exprs for every joins

commit 2b7a1bdcf3
Author: chenrui <chenrui@jingdaka.com>
Date:   Mon Mar 7 14:46:48 2022 +0800

    test: move debug flag

commit ce13a2a7bc
Author: chenrui <chenrui@jingdaka.com>
Date:   Mon Mar 7 14:39:56 2022 +0800

    fix: soft delete for join.on
2022-03-18 01:09:20 +08:00
chenrui 9b9ae325bb fix: circular reference save, close #5140
commit 2ac099a37ac7bd74f0a98a6fdc42cc8527404144
Author: Jinzhu <wosmvp@gmail.com>
Date:   Thu Mar 17 23:49:21 2022 +0800

    Refactor #5140

commit 6e3ca2d1aa
Author: a631807682 <631807682@qq.com>
Date:   Sun Mar 13 12:52:08 2022 +0800

    test: add test for LoadOrStoreVisitMap

commit 9d5c68e410
Author: chenrui <chenrui@jingdaka.com>
Date:   Thu Mar 10 20:33:47 2022 +0800

    chore: add more comment

commit bfffefb179
Author: chenrui <chenrui@jingdaka.com>
Date:   Thu Mar 10 20:28:48 2022 +0800

    fix: should check values has been saved instead of rel.Name

commit e55cdfa4b3
Author: chenrui <chenrui@jingdaka.com>
Date:   Tue Mar 8 17:48:01 2022 +0800

    chore: go lint

commit fe4715c5bd
Author: chenrui <chenrui@jingdaka.com>
Date:   Tue Mar 8 17:27:24 2022 +0800

    chore: add test comment

commit 326862f3f8
Author: chenrui <chenrui@jingdaka.com>
Date:   Tue Mar 8 17:22:33 2022 +0800

    fix: circular reference save
2022-03-17 23:53:31 +08:00
Jinzhu 6befa0c947 Refactor preload error check 2022-03-17 11:22:25 +08:00
Jinzhu e2e802b837 Refactor Scan 2022-02-28 13:00:30 +08:00
Jinzhu 6a18a15c93 Refactor check missing where condition 2022-02-25 10:48:23 +08:00
Jinzhu b1201fce4e Fix update with customized time type, close #5101 2022-02-23 17:48:26 +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
li-jin-gou c0bea447b9
fix: omit not work when use join (#5034) 2022-01-28 22:16:42 +08:00
kinggo b47cf57f5e
ci: add gofumpt check in reviewdog (#4973) 2022-01-06 15:02:53 +08:00
liweitingwt 24026bf1fe
modify unscoped judge (#4929)
* modify unscoped judge

* modify unscoped judge

Co-authored-by: liweiting <liweiting1995@gmail.com>
2021-12-16 10:41:34 +08:00
kinggo e5bdd610c3
fix: save not use soft_delete (#4897)
* fix: Save not use soft_delete

* fix: save not use soft_delete

* fix: save not use soft_delete

* fix: save not use soft_delete

Co-authored-by: kinggo <>
2021-12-08 13:58:06 +08:00
Jinzhu 300a23fc31 Check rows.Close error, close #4891 2021-12-02 10:39:24 +08:00