Commit Graph

139 Commits

Author SHA1 Message Date
Jinzhu 940358e0dd Fix tests doesn't follow https://gorm.io/docs/method_chaining.html convention 2024-01-12 16:42:21 +08:00
Stephano George 436cca753c
fix: join and select mytable.* not working (#6761)
* fix: select mytable.* not working

* fix: select mytable.*: will not match `mytable."*"`.
feat: increase readability of code matching table name column name
2023-12-23 21:19:41 +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 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
chyroc e1f46eb802
fix: ignore nil query (#6021) 2023-02-02 17:54:51 +08:00
Jinzhu 3d35ddba55 Fix use table.* as select/omit columns 2023-01-12 16:52:56 +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
Jinzhu 3f20a543fa Support use clause.Interface as query params 2022-10-18 18:01:55 +08:00
Jiepeng Cao b3eb1c8c51
simplified regexp (#5677) 2022-09-05 15:39:19 +08:00
Jinzhu 3262daf8d4 Fix select with association column 2022-07-13 18:26:35 +08:00
Jinzhu cae30e9a50 Fix select with association column 2022-07-13 18:02:11 +08:00
Jinzhu a7063848ef Fix select with uppercase column name 2022-07-13 17:44:14 +08:00
Jinzhu 08f6d06e47 Fix select with quoted column name 2022-07-13 17:21:19 +08:00
Jinzhu a70af2a4c0 Fix Select with digits in column name 2022-06-20 15:35:40 +08:00
Cr 9b80fe9e96
fix: stmt.Changed zero value filed behavior (#5281)
* fix: stmt.Changed zero value filed behavior

* chore: rename var
2022-04-24 09:08:52 +08:00
Jinzhu 88c26b62ee Support Scopes in group conditions 2022-04-20 17:21:38 +08:00
Jinzhu f92e6747cb Handle field set value error 2022-03-23 17:24:25 +08:00
Mikhail Faraponov 2990790fbc
Use WriteByte for single byte operations (#5167)
Co-authored-by: Mikhail Faraponov <mikefaraponov@Mikhails-MacBook-Pro.local>
2022-03-17 22:54:30 +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 df2365057b Remove uncessary switch case 2022-02-09 17:23:16 +08:00
Jinzhu cec0d32aec Support use clause.Expression as argument 2022-01-28 18:48:32 +08:00
piyongcai a0d6ff1fea
time.Time, []byte type add alias support. (rebase master) (#4992)
* time.Time, []byte type add alias support

* reformat
2022-01-12 13:11:40 +08:00
kinggo b47cf57f5e
ci: add gofumpt check in reviewdog (#4973) 2022-01-06 15:02:53 +08:00
Jinzhu 45e804dd3f Fix call valuer interface when using nil value 2021-11-29 16:19:11 +08:00
Jinzhu b8f33a42a4
Add unused argument (#4871)
* Append unused argument to gorm statement
2021-11-23 17:11:52 +08:00
Jinzhu b23c3b290e Don't query with primary key when using Save 2021-11-08 18:49:59 +08:00
Jason Lee d3211908a0
Refactor ParseWithSchemaTable method and improve test. (#4789)
* Refactor ParseWithSchemaTable method and improve test.

* Fix schema.ParseWithSchemaTable method for only use schemaTable in migrator and improve test.

* Rename `schemaTable` to `specialTableName` for clearly argument.
2021-10-25 11:26:44 +08:00
Wendell Sun a3bd9c3ea2 fix: automigrate error caused by indexes while using dynamic table name 2021-10-19 09:59:57 +08:00
Jinzhu bfda75d099 Support specify select/omit columns with table 2021-10-09 10:42:41 +08:00
Jinzhu 6312d86c54 Support specify select/omit columns with table 2021-10-08 17:51:27 +08:00
heige e3fc49a694
feat: ajust PreparedStmtDB unlock location and BuildCondition if logic (#4681) 2021-10-08 11:16:58 +08:00
River 851fea0221
fix: QuoteTo not fully support raw mode (#4735)
* fix: QuoteTo not fully support raw mode

* fix: table alias without AS

* test: clause.Column/Table quote test

* fix: revert table alias quote
2021-09-29 14:02:35 +08:00
Jinzhu a16db07945 Refactor Join ON 2021-09-07 21:21:44 +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
River 25f561a742
feat: QuoteTo accept clause.Expr (#4621)
* feat: QuoteTo accept clause.Expr

* test: update Expr build test
2021-08-19 14:33:18 +08:00
heyanfu 363f9b7863
golint standard (#4421) 2021-05-31 10:08:06 +08:00
Jinzhu ea1bce3771 Only check struct value can address or not 2021-05-23 11:21:56 +08:00
Jinzhu 6951be0284 Allow customize clauses 2021-04-28 17:19:30 +08:00
Jinzhu d327926425 Check ReflectValue.CanAddr before set field value 2021-04-19 21:37:38 +08:00
Chris Faulkner 15a46bc042
Fix some typos (#4294) 2021-04-19 21:03:39 +08:00
heige 74e7a9ca07
Optimize reflect value length and method (#4280)
* Respect ignore migration when add column (#4276)

continue https://github.com/go-gorm/gorm/pull/4028

* feat: Optimal value type acquisition for v (#4278)

* feat: optimize relect value length and value

* feat: optimize ConvertSliceOfMapToValuesForCreate method

Co-authored-by: yrong1997 <yrong1997@gmail.com>
2021-04-14 13:00:54 +08:00
Jinzhu a3d9bbfc36 build *clause.Expr 2021-03-19 13:21:43 +08:00
Jinzhu 9fccb17d07 Fix double pointer for where conditions, close #4159 2021-03-10 19:46:59 +08:00
Shubhendra Singh Chauhan 0348b1d3c1
chore: improve code quality (#4123)
* Combine multiple `append`s into a single call

* Clean up copied struct fields with type conversion

* Remove unnecessary use of slice
2021-03-08 10:46:43 +08:00
Jinzhu ddeb143eb9 Lazy call registered scopes 2021-02-25 22:01:59 +08:00
Jinzhu 828e6b646b Lazy call registered scopes 2021-02-25 18:49:01 +08:00
Jinzhu 79225bfe48 Fix Omit/Select without Model value, close #4098 2021-02-18 10:53:29 +08:00
Jinzhu 84ea3ec0cc Fix sub query argument order with multiple raw SQL 2021-02-09 19:56:45 +08:00