Commit Graph

63 Commits

Author SHA1 Message Date
yikakia 1f763c81cb
fix typo chainable_api.go (#6266) 2023-04-26 22:19:06 +08:00
black-06 4b0da0e97a
fix cond in scopes (#6152)
* fix cond in scopes

* replace quote

* fix execute scopes
2023-04-11 12:01:23 +08:00
Cr aa89736db2
fix: miss join type (#6056) 2023-02-18 09:13:36 +08:00
Jinzhu 2bc913787b support implicit table alias, close #5840 #5940 2023-01-02 21:46:27 +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
Nate Armstrong f3c6fc2533
Update func comments in chainable_api and FirstOr_ (#5935)
Add comments to functions in chainable_api. Depending on the method,
these comments add some additional context or details that are relevant
when reading the function, link to the actual docs at gorm.io/docs, or
provide examples of use. These comments should make GORM much more
pleasant to use with an IDE that provides hoverable comments, and are
minimal examples.

Also add in-code documentation to FirstOrInit and FirstOrCreate.

Almost all examples are directly pulled from the docs, with short
comments explaining the code. Most examples omit the `db.Model(&User{})`
for brevity, and would not actually work.

Co-authored-by: Nate Armstrong <nate.armstrong@eluv.io>
2022-12-23 16:51:01 +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
robhafner e8f48b5c15
fix: limit=0 results (#5735) (#5736) 2022-10-07 20:14:14 +08:00
Jinzhu 540b47571a Fix update select clause with before/after expressions, close #5164 2022-03-18 20:57:33 +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
Jinzhu c4a2e891da Fix Join condition with DB 2021-09-28 22:37:15 +08:00
Jinzhu 002bf78ea7 Fix Join condition with DB, close #4719 2021-09-28 21:43:31 +08:00
Jinzhu a16db07945 Refactor Join ON 2021-09-07 21:21:44 +08:00
Adrien Carreira d047f854e6 PR Comments 2021-09-06 20:13:20 +08:00
Adrien Carreira 52cc438d07 JoinsOn unit test + use all primary keys 2021-09-06 20:13:20 +08:00
Adrien Carreira 895c1178a0 Proposal, Add Specific on for Joins queries 2021-09-06 20:13:20 +08:00
SmallTianTian 82fe815303
fix: table couln't be reentrant (#4556) 2021-08-09 13:20:22 +08:00
Walter Scheper a870486c4f
Do not emit ORDER BY for empty values (#4592)
This restores the behavior from gorm v1, where calling `DB.Order` with
an empty string, nil, or any unexpected type is a no-op.
2021-08-09 13:14:23 +08:00
Jinzhu 704e53a774 Call scopes before parse model value, close #4209 2021-03-24 16:35:39 +08:00
Ratan Phayade a3abb5fedf
support named params in Select API (#4142)
* adds support for named arguments in select

* changes clause identifies and adds test
2021-03-07 10:59:00 +08:00
Jinzhu 6b7d18656d Lazy call registered scopes 2021-02-25 20:06:26 +08:00
Jinzhu ade0bd6d60 Fix SELECT with sql expression in some cases, close #3889 2020-12-28 10:40:30 +08:00
Jinzhu 1ef1f0bfe4 Fix Count with complicated Select, close #3826 2020-12-06 14:30:42 +08:00
Jinzhu 7faf1ca80f Fix Select with AS, close #3581, #3567 2020-10-09 11:52:12 +08:00
宋小北 e6f4b711a7
fix order case (#3350) 2020-09-01 15:50:53 +08:00
Jinzhu d50dbb0896 Fix check valid db name, close #3315 2020-08-27 19:15:40 +08:00
Jinzhu 3a97639880 Fix unordered joins, close #3267 2020-08-23 10:45:10 +08:00
deepoli 3411425d65
fix return value and delete unused default (#3280) 2020-08-18 19:03:09 +08:00
Jinzhu b5de8aeb42 Fix overrite SELECT clause 2020-08-18 18:58:53 +08:00
Jinzhu 90183fadde Allow advanced table with args 2020-07-19 21:30:24 +08:00
Jinzhu de764d9e3d Replace FullTable with TableExpr 2020-07-17 21:19:21 +08:00
Jinzhu 362779575c Fix Select with specific symbol, close #3157 2020-07-17 11:24:24 +08:00
Jinzhu 4456df7a5d Lint with golangci-lint 2020-07-16 11:27:12 +08:00
Jinzhu d4b462a351 Fix alias keyword with Table, close #3104 2020-07-10 21:11:28 +08:00
Jinzhu bba569af2b Add NamedArg support 2020-07-10 12:28:24 +08:00
Jinzhu 4e066c9590 Test Or 2020-07-05 12:23:45 +08:00
Jinzhu ee1f46e3a1 Allow to use sql function in Group, Pluck 2020-06-30 23:06:48 +08:00
Jinzhu 56bdded0f8 Fix statement modifier support 2020-06-14 12:18:46 +08:00
Douglas Danger Manley 13f96f7a15
Spelling fix for "condtion" -> "condition" (#3042)
This fixes a spelling error in the word "condition"; in particular,
the `BuildCondtion` function should be named `BuildCondition`.
2020-06-08 11:38:51 +08:00
Jinzhu eda2f023b0 Add Distinct support 2020-06-05 19:19:12 +08:00
Jinzhu e986371a42 Rename package name 2020-06-02 09:18:01 +08:00
Jinzhu dffc2713f0 Add mores tests for query 2020-06-01 10:54:32 +08:00
Jinzhu 55074213bc Add SoftDelete support 2020-05-29 07:35:45 +08:00
Jinzhu ac8708b500 Add FirstOrInit support 2020-05-28 13:12:56 +08:00
Jinzhu 50aa9be4f1 Add joins support 2020-04-15 09:45:43 +08:00
Jinzhu af080e6773 Fix primary key tag 2020-03-12 08:39:42 +08:00
Jinzhu 9e8a4db36b Use *gorm.DB to replace gorm.DB 2020-03-10 08:39:33 +08:00
Jinzhu 3aa1891068 Add sync pool 2020-03-09 15:32:55 +08:00
Jinzhu a145d7e019 Refactor structure 2020-03-09 14:25:50 +08:00
Jinzhu 5fce17543a Add Joins 2020-03-08 19:12:33 +08:00