Commit Graph

2647 Commits

Author SHA1 Message Date
labulakalia 61b4c31236
fix when index name is "type", parseFieldIndexes will set index TYPE is "TYPE" (#5155)
* fix index name is type, parseFieldIndexes will set index TYPE is "TYPE"

* check TYPE empty
2022-03-14 21:47:59 +08:00
dependabot[bot] f961bf1c14
chore(deps): bump actions/checkout from 2 to 3 (#5133)
Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2...v3)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-03-12 22:28:18 +08:00
Jason Lee b566ed7913
Merge pull request #5125 from CaoManhDat/master
ToSQL should enable SkipDefaultTransaction by default
2022-03-04 11:37:37 +08:00
Cao Manh Dat 29a8557384 ToSQL should enable SkipDefaultTransaction by default 2022-03-03 09:18:01 +07:00
Jinzhu 4e523499d1 Refactor Tx interface 2022-03-01 16:59:50 +08:00
lianghuan 996b96e812 Add TxConnPoolBeginner and Tx interface 2022-03-01 16:59:50 +08:00
Jinzhu e2e802b837 Refactor Scan 2022-02-28 13:00:30 +08:00
Jinzhu 43a72b369e Refactor Scan 2022-02-28 00:16:57 +08:00
Jinzhu 530b0a12b4 Add fast path for ValueOf, ReflectValueOf 2022-02-27 22:16:31 +08:00
Jinzhu 4d14ac39ff Merge branch 'a631807682-i5091' 2022-02-27 09:12:35 +08:00
Jinzhu 68bb5379d9 Refactor scan into struct 2022-02-27 09:09:29 +08:00
Jinzhu f2edda50e1 Refactor check missing where condition 2022-02-27 08:40:15 +08:00
chenrui 397b583b8e fix: query scanner in single column 2022-02-25 22:38:48 +08:00
Jinzhu 6a18a15c93 Refactor check missing where condition 2022-02-25 10:48:23 +08:00
jing1 3741f258d0
feat: support gob serialize (#5108) 2022-02-24 10:21:27 +08:00
Michael Nussbaum 45ef1da7e4
Fix naming longer then 64 chars with dots in table (#5045)
Ensures that foreign key relationships and indexes are given
syntactically valid names when their name length exceeds 64 characters
and they contained dot characters within the name. This is most often
relevant when a Postgres table name is fully qualified by including its schema
as part of its name
2022-02-24 10:10:20 +08:00
Jinzhu b1201fce4e Fix update with customized time type, close #5101 2022-02-23 17:48:26 +08:00
Qt 7837fb6fa0
fix typo in TxCommitter interface comment & improve CheckTruth, chek val empty first (#5094)
* fix typo in TxCommitter interface comment

* improve CheckTruth, chek val empty first
2022-02-20 21:19:15 +08:00
codingxh 664c5fb767
strings.replace -> strings.replaceAll (#5095)
Co-authored-by: huquan<xxhh_quan_g@163.com>
2022-02-20 19:55:04 +08:00
Gilad Weiss f3547e00cc
Inherit clone flag (NewDB) on transaction creation (#5012)
* Inherit clone flag (NewDB) on transaction creation

I find it very reassuring to know that after a finisher API, I get a clean db object for my next queries.
If you look at the example in https://gorm.io/docs i’d see many queries running one after the other.. but in reality they wouldn’t work as the they are portrayed and that’s because in default mode NewDB is false and will make all the clauses stay even after a finisher API.

My solution is just to have the value of the clone flag in the “parent” db object, be injected to its children transactions.

* Fix typo
2022-02-20 08:33:12 +08:00
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