Commit Graph

85 Commits

Author SHA1 Message Date
jessetang cef3de694d
cleanup(prepare_stmt.go): unnecessary map delete (#5849) 2022-11-13 11:12:09 +08:00
Cr 0b7113b618
fix: prepare deadlock (#5568)
* fix: prepare deadlock

* chore[ci skip]: code style

* chore[ci skip]: test remove unnecessary params

* fix: prepare deadlock

* fix: double check prepare

* test: more goroutines

* chore[ci skip]: improve code comments

Co-authored-by: Jinzhu <wosmvp@gmail.com>
2022-09-30 18:13:36 +08:00
kinggo 12237454ed fix: use preparestmt in trasaction will use new conn, close #5508 2022-09-22 16:47:43 +08:00
enwawerueli 573b9fa536 fix: correct grammar 2022-08-15 10:28:36 +08:00
Jinzhu 75720099b5 Create a new db in FindInBatches 2022-07-18 18:07:05 +08:00
ZhangShenao 8333844f71
fix variable shadowing (#5212)
Co-authored-by: Shenao Zhang <shenao.zhang@shopee.com>
2022-03-31 20:57:20 +08:00
Cao Manh Dat 29a8557384 ToSQL should enable SkipDefaultTransaction by default 2022-03-03 09:18:01 +07:00
Jinzhu a0aceeb33e Migrator AlterColumn with full data type 2022-02-10 10:40:48 +08:00
Jinzhu 98c4b78e4d Add Session Initialized option 2022-01-28 19:26:10 +08:00
Jason Lee 8de266b4a7
Add ToSQL support to generate SQL string. (#4787)
* Add db.ToSQL method for generate SQL string.

* Improve sql builder test for all dialects.

Improve assertEqualSQL test helper for ignore quotes in SQL.
2021-11-01 17:08:54 +08:00
heige c13f3011f9
feat: adjust SetupJoinTable func if..else code (#4680) 2021-10-08 11:05:50 +08:00
heige 50e85e14d4
Code optimize (#4415)
* optimize gormSourceDir replace

* fmt.Errorf adjust and Optimize for-break

* strings trim

* feat: avoid using the same name field and if..else optimization adjustment

* optimization callbacks/create.go Create func if...else logic

* fix: callbacks/create.go Create func

* fix FileWithLineNum func and add gormSourceDir unit test

* remove debug print and utils_filenum_test.go
2021-06-10 10:21:28 +08:00
Chris Faulkner 15a46bc042
Fix some typos (#4294) 2021-04-19 21:03:39 +08:00
Jinzhu d278ca49ef sort GORM options before apply 2021-04-09 11:43:24 +08:00
Jinzhu ad53074f1d Pass db error to new instance 2021-04-09 11:07:14 +08:00
Jinzhu 73c6d3e64e Add AfterInitialize error 2021-03-29 18:36:01 +08:00
Jinzhu 0eba7a9ed1 Fix apply option 2021-03-26 14:20:42 +08:00
Jinzhu a9fe025ef5 Add GetDBConnector interface 2021-03-19 15:55:38 +08:00
Jinzhu 912360097a Fix Scopes with Migrator, close #4145 2021-03-11 10:36:14 +08:00
heige bc347758e5
for Config.cacheStore store PreparedStmtDB key (#4149) 2021-03-07 10:57:22 +08:00
heige 495ec4bd87
invalid db error and value and invalid value length error (#4151) 2021-03-07 10:56:32 +08:00
Jinzhu 294625759c Fix after initialize db callback 2021-03-05 14:12:55 +08:00
Jinzhu 1476b2f7d4 Fix apply config 2021-03-04 20:37:44 +08:00
Jinzhu 0157099576 Use functional options 2021-03-04 17:40:25 +08:00
Jinzhu 3d3208ed60 initialize config plugins 2021-02-03 16:27:49 +08:00
Jinzhu 7598204dc3 Support `FullSaveAssociations` for association mode, close #4010 2021-01-29 16:55:26 +08:00
Jinzhu fe553a7c1a Fix prepared statement in transaction mode can't be shared in normal operations, close #3927 2021-01-10 16:46:06 +08:00
Qt f9131e309d
reduce DB's Use method complexity and make it easier to understand (#3930) 2021-01-10 10:15:48 +08:00
Jinzhu a5bfe2f39d Keep Error for new Session 2021-01-07 11:45:40 +08:00
Jinzhu 468152d45b Add DisableNestedTransaction support 2020-12-16 19:33:35 +08:00
Jinzhu 0c12a4c360 Add CreateBatchSize option 2020-12-02 14:59:50 +08:00
Luis Guillermo Gómez 47ffd0bef4
Select all fields in SQL queries avoiding the SELECT * FROM (#3731)
* Select all fields in SQL queries avoiding the SELECT * FROM

* Select table name with fields in SQL queries

* Use QueryFields to execute the SQL query with all fields of the table
2020-11-20 15:38:25 +08:00
Jinzhu 9df9f7688b Change UpdatingColumn to SkipHooks 2020-11-17 17:49:43 +08:00
Jinzhu 26504f5cae Use NewDB to replace WithConditions for Session 2020-11-17 16:28:37 +08:00
Jinzhu f6e1786ca2 Add skip hooks support 2020-11-17 15:19:58 +08:00
Jinzhu 1e241aa645 Reduce GC alloc 2020-11-10 21:23:20 +08:00
Jinzhu bdb30da0a7 Fix copy lock for prepared statement, close #3642, #3607 2020-10-21 15:47:46 +08:00
Jinzhu c0de3c5051 Support FullSaveAssociations Mode, close #3487, #3506 2020-09-24 19:29:15 +08:00
Jinzhu f2adb088c5 Set field size from primary fields to foreign fields 2020-09-03 16:11:15 +08:00
Jinzhu 98e15e0b95 Setup DB's ConnPool in PrepareStmt mode, fix #3362 2020-09-03 12:54:26 +08:00
Jinzhu 9b0ad4730f Squashed commit of the following:
commit 759038a126122d5b3323979fdd7d867a4ab85585
Author: Jinzhu <wosmvp@gmail.com>
Date:   Mon Aug 31 12:06:31 2020 +0800

    Add PreparedStmt tests

commit 066d54db1f
Author: 王岚 <wanglan.backend@bytedance.com>
Date:   Fri Aug 28 18:40:59 2020 +0800

    prepare_stmt add ctx
2020-08-31 12:08:33 +08:00
Jinzhu ebdb4edda8 Add AllowGlobalUpdate mode 2020-08-23 20:08:23 +08:00
Jinzhu c11c939b95 callbacks support sort with wildcard 2020-08-03 21:48:36 +08:00
Jinzhu c7667e9299 Refactor Prepared Statement 2020-07-28 14:46:48 +08:00
Jinzhu ef002fd7ac Add GORMDataType to Field, close #3171 2020-07-20 19:00:03 +08:00
Jinzhu b8692c7671 Allow temporarily disable default transaction 2020-07-16 18:05:55 +08:00
Jinzhu 1df757113a initialize plugins map 2020-06-23 10:36:45 +08:00
Jinzhu f4bfc435cc Add register plugin API 2020-06-23 09:38:51 +08:00
Jinzhu 5d044642d1 Allow DisableForeignKeyConstraintWhenMigrating 2020-06-22 11:04:44 +08:00
Jinzhu 7851faa094 Allow close prepared statements, double check before prepare 2020-06-21 18:18:23 +08:00