sammyrnycreal
5edc78116f
Fixed the use of "or" to be " OR ", to account for words that contain "or" or "and" (e.g., 'score', 'band') in a sql statement as the name of a field.
2022-02-20 08:22:21 +08:00
Jinzhu
48ced75d1d
Improve support for AutoMigrate
2022-02-19 23:42:20 +08:00
Jinzhu
e0b4e0ec8f
Update auto stale days
2022-02-19 17:11:23 +08:00
Jinzhu
0af95f509a
Enhance migrator Columntype interface ( #5088 )
...
* Update Migrator ColumnType interface
* Update MigrateColumn Test
* Upgrade test drivers
* Fix typo
2022-02-19 17:02:53 +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
19ac396a22
fix: isPrintable incorrect ( #5076 )
...
* fix: isPrintable incorrect
* fix: isPrintable incorrect
* style: use ReplaceAll instead of Replace
2022-02-15 20:32:03 +08:00
Jinzhu
a0aceeb33e
Migrator AlterColumn with full data type
2022-02-10 10:40:48 +08:00
Jinzhu
df2365057b
Remove uncessary switch case
2022-02-09 17:23:16 +08:00
Jinzhu
4eeb839cea
Better support Stringer when explain SQL
2022-02-09 15:17:25 +08:00
li-jin-gou
d22215129e
fix: replace empty table name result in panic ( #5048 )
...
* fix: replace empty name result in panic
* fix: replace empty table name result in panic
2022-02-08 17:06:10 +08:00
Jinzhu
416c4d0653
Test query with Or and soft delete
2022-02-08 16:31:24 +08:00
Jason Lee
93b1a6f7ea
Merge pull request #5043 from Saurabh-Thakre/patch-2
2022-02-04 22:31:21 +08:00
Saurabh Thakre
581a879bf1
Added comments to existing methods
...
Added two comments to describe FirstOrInit and FirstOrCreate methods.
2022-01-31 17:26:28 +05:30
Jinzhu
f19b84d104
Fix github action
2022-01-30 22:46:41 +08:00
Jinzhu
8d293d44dd
Fix docker-compose test env for Mac M1
2022-01-30 22:05:38 +08:00
Ning
8c3673286d
preoload not allowd before count ( #5023 )
...
Co-authored-by: ningfei <accelerator314@outlook.com>
2022-01-30 18:17:06 +08:00
li-jin-gou
c0bea447b9
fix: omit not work when use join ( #5034 )
2022-01-28 22:16:42 +08:00
Jinzhu
98c4b78e4d
Add Session Initialized option
2022-01-28 19:26:10 +08:00
Jinzhu
cec0d32aec
Support use clause.Expression as argument
2022-01-28 18:48:32 +08:00
dependabot[bot]
e5894ca449
chore(deps): bump gorm.io/driver/mysql from 1.2.1 to 1.2.3 in /tests ( #4987 )
...
Bumps [gorm.io/driver/mysql](https://github.com/go-gorm/mysql ) from 1.2.1 to 1.2.3.
- [Release notes](https://github.com/go-gorm/mysql/releases )
- [Commits](https://github.com/go-gorm/mysql/compare/v1.2.1...v1.2.3 )
---
updated-dependencies:
- dependency-name: gorm.io/driver/mysql
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-01-12 13:11:57 +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
Jinzhu
eae73624ad
Fix return failed to begin transaction error when failed to start a transaction
2022-01-07 10:04:35 +08:00
kinggo
0df42e9afc
feat: add `Connection` to execute multiple commands in a single connection; ( #4982 )
2022-01-07 09:49:56 +08:00
halfcrazy
f757b8fdc9
fix: auto migration column order unpredictable ( #4980 )
2022-01-06 18:55:20 +08:00
kinggo
b47cf57f5e
ci: add gofumpt check in reviewdog ( #4973 )
2022-01-06 15:02:53 +08:00
kinggo
4dd2647967
Merge pull request #4964 from liweitingwt/f_test_error
...
improve the error handle in tests_test
2021-12-31 14:25:04 +08:00
kinggo
8dde09e0be
fix: generate sql incorrect when use soft_delete and only one OR ( #4969 )
...
* fix: generate sql incorrect when use soft_delete and only one OR
2021-12-30 11:47:14 +08:00
liweiting.wt
b9667cb747
fix: fix the error handle in tests_test
2021-12-28 18:22:17 +08:00
Emre Güllü
2c3fc2db28
Fix: Where clauses with named arguments may cause generation of unintended queries ( #4937 )
2021-12-21 19:50:00 +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
Jinzhu
adf8f70f06
Upgrade go.mod
2021-12-10 17:50:19 +08:00
piyongcai
380cc64ff5
fix type alias AutoMigrate bug(Add Test Case) ( #4888 )
...
* fix type alias AutoMigrate bug. eg
```go
package main
type IDer interface{ GetID() int64 }
// ID will add some method to implement some interface eg: GetID
type ID int64
func (z ID) GetID() int64 { return int64(z) }
type Test struct {
ID
Code string `gorm:"size:50"`
Name string `gorm:"size:50"`
}
func main() {
db, err := gorm.Open(postgres.New(postgres.Config{
DSN: `dsn`,
PreferSimpleProtocol: false,
}), &gorm.Config{
Logger: logger.Default.LogMode(logger.Info),
SkipDefaultTransaction: true,
})
if err != nil {
log.Fatal(err)
}
if err = db.AutoMigrate(&Test{}); err != nil {
// invalid embedded struct for Test's field ID, should be struct, but got main.ID
log.Fatal(err)
}
}
```
* fix type alias AutoMigrate bug. eg
```go
package main
type IDer interface{ GetID() int64 }
// ID will add some method to implement some interface eg: GetID
type ID int64
func (z ID) GetID() int64 { return int64(z) }
type Test struct {
ID
Code string `gorm:"size:50"`
Name string `gorm:"size:50"`
}
func main() {
db, err := gorm.Open(postgres.New(postgres.Config{
DSN: `dsn`,
PreferSimpleProtocol: false,
}), &gorm.Config{
Logger: logger.Default.LogMode(logger.Info),
SkipDefaultTransaction: true,
})
if err != nil {
log.Fatal(err)
}
if err = db.AutoMigrate(&Test{}); err != nil {
// invalid embedded struct for Test's field ID, should be struct, but got main.ID
log.Fatal(err)
}
}
```
* Add typealis test.
* try to fix golangci-lint
2021-12-10 17:45:36 +08:00
Matthieu MOREL
2a578d767f
Use Golangci configuration file ( #4896 )
2021-12-10 17:44:11 +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
3a3b82263a
Fix auto migration always alert table, close #4198
2021-11-29 20:24:16 +08:00
kinggo
d8a710cba2
fix: count() when use group by and only find one record ( #4885 )
...
Co-authored-by: 李龙 <lilong.21@bytedance.com>
2021-11-29 20:14:23 +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
45e804dd3f
Fix call valuer interface when using nil value
2021-11-29 16:19:11 +08:00
Jinzhu
92d5a959a0
Fix tests
2021-11-29 15:16:57 +08:00
Jinzhu
270e38c518
Fix duplicated error when Scan, close #4525
2021-11-29 14:23:10 +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
Jinzhu
b8f33a42a4
Add unused argument ( #4871 )
...
* Append unused argument to gorm statement
2021-11-23 17:11:52 +08:00
dependabot[bot]
cff7845e58
Bump gorm.io/driver/mysql from 1.1.3 to 1.2.0 in /tests ( #4856 )
...
Bumps [gorm.io/driver/mysql](https://github.com/go-gorm/mysql ) from 1.1.3 to 1.2.0.
- [Release notes](https://github.com/go-gorm/mysql/releases )
- [Commits](https://github.com/go-gorm/mysql/compare/v1.1.3...v1.2.0 )
---
updated-dependencies:
- dependency-name: gorm.io/driver/mysql
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-11-23 11:40:18 +08:00
dependabot[bot]
0f8e861597
Bump github.com/jinzhu/now from 1.1.2 to 1.1.3 in /tests ( #4866 )
...
Bumps [github.com/jinzhu/now](https://github.com/jinzhu/now ) from 1.1.2 to 1.1.3.
- [Release notes](https://github.com/jinzhu/now/releases )
- [Commits](https://github.com/jinzhu/now/compare/v1.1.2...v1.1.3 )
---
updated-dependencies:
- dependency-name: github.com/jinzhu/now
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-11-23 11:40:03 +08:00
dependabot[bot]
11d5c346ae
Bump github.com/jinzhu/now from 1.1.2 to 1.1.3 ( #4865 )
...
Bumps [github.com/jinzhu/now](https://github.com/jinzhu/now ) from 1.1.2 to 1.1.3.
- [Release notes](https://github.com/jinzhu/now/releases )
- [Commits](https://github.com/jinzhu/now/compare/v1.1.2...v1.1.3 )
---
updated-dependencies:
- dependency-name: github.com/jinzhu/now
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-11-23 11:39:42 +08:00
dino.ma
5e64ac7de9
feat(migrator,migrator/migrator.go,tests/migrate_test.go) : Get multiple data tables for migrator. ( #4841 )
...
* feat(migrator,migrator/migrator.go,tests/migrate_test.go) : Get multiple data tables for migrator.
* feat(migrator.go and migrator/migrator.go) : remove Table Struct replace with []string
* fix(migrator) : Return all data tables
* Update migrator.go
* fix(migrator/migrator.go):remove var sql
* feat(migrate_test.go/go.mod):update sqlserver,sqlite,postgres,pq version and add getTables test
* fix(migrate_test.go):change GetTables Method Test,use intersection
Co-authored-by: dino.ma <mashengjie03@baidu.com>
2021-11-13 14:03:33 +08:00
riverchu
33bc56cbb5
feat(update): update when has SET clause
2021-11-09 19:55:47 +08:00