253 Commits

Author SHA1 Message Date
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 95d00e6ff2668233f3eca98aa4917291e3d869bd
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 40cbba49f374c9bae54f80daee16697ae45e905b
Author: chenrui <chenrui@jingdaka.com>
Date:   Sat Mar 5 17:36:56 2022 +0800

    test: fix test fail

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

    test: drop table and auto migrate

commit 7cbf019a930019476a97ac7ac0f5fc186e8d5b42
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 8559f51102c01be6c19913c0bc3a5771721ff1f5
Author: chenrui <chenrui@jingdaka.com>
Date:   Mon Mar 7 20:33:12 2022 +0800

    fix: should add deleted_at exprs for every joins

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

    test: move debug flag

commit ce13a2a7bc50d2c23678806acf65dbd589827c77
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 6e3ca2d1aa09943dcfb5d9a4b93bea28212f71be
Author: a631807682 <631807682@qq.com>
Date:   Sun Mar 13 12:52:08 2022 +0800

    test: add test for LoadOrStoreVisitMap

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

    chore: add more comment

commit bfffefb179c883389b72bef8f04469c0a8418043
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 e55cdfa4b3fbcf8b80baf009e8ddb2e40d471494
Author: chenrui <chenrui@jingdaka.com>
Date:   Tue Mar 8 17:48:01 2022 +0800

    chore: go lint

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

    chore: add test comment

commit 326862f3f8980482a09d7d1a7f4d1011bb8a7c59
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
Jinzhu
8627634959 Fix create associations with zero primary key, close #4890 2021-12-02 10:20:16 +08:00
Jinzhu
27e2753c9d Fix create duplicated value when updating nested has many relationship, close #4796 2021-11-29 18:43:39 +08:00
Jinzhu
e1b4c066a8 Fix FullSaveAssociations, close #4874 2021-11-29 11:02:44 +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
riverchu
33bc56cbb5 feat(update): update when has SET clause 2021-11-09 19:55:47 +08:00
Jinzhu
ca7accdbf6 Fix preload all associations with inline conditions, close #4836 2021-11-08 19:47:10 +08:00
heige
4c8810a848
Refactor if logic (#4683)
* adjust code for preload

* adjust code for Create
2021-11-04 13:45:44 +08:00
kinggo
c170af11e9
fix connections leak (#4826)
* fix connections leak

* fix connections leak

* fix connections leak

* fix connections leak

Co-authored-by: 李龙 <lilong.21@bytedance.com>
2021-11-03 13:39:52 +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
b27095e8a1 Refactor Convert SQL null values to zero values for model fields which are not pointers #4710 2021-10-13 21:01:36 +08:00
Jim
19cf645dbd feat: Convert SQL nulls to zero values (ConvertNullToZeroValues)
Makes it the default behavior to convert SQL null values to zero
values for model fields which are not pointers.
2021-10-13 08:11:22 -04:00
kinggo
418c60c83c
fixed: clauseSelect.Columns missed when use Join And execute multiple query. (#4757) 2021-10-09 16:55:45 +08:00
kinggo
b46e2afc4a
fix : update miss where's condition when primary key use "<-:create" tag (#4738)
* fix:update miss where condition

* fix:rename test case
2021-10-08 13:47:01 +08:00
Jinzhu
da16a8aac6 Update updated_at when upserting with Create OnConflict 2021-09-17 15:29:49 +08:00