Commit Graph

1936 Commits

Author SHA1 Message Date
Jinzhu fd9b688084 Implement parse many2many relation 2020-02-01 18:02:19 +08:00
Jinzhu a9c20291e4 Implement guess relation 2020-02-01 15:23:45 +08:00
Jinzhu eea78f3f30 Implement parse relationship architecture 2020-02-01 12:46:52 +08:00
Jinzhu 010dc7e6dd Add namer when generate schema 2020-01-31 14:31:15 +08:00
Jinzhu bc68fde6aa Implement naming strategy 2020-01-31 14:17:02 +08:00
Jinzhu 1079e17caf Implement schema parser 2020-01-31 12:46:16 +08:00
Jinzhu 5959c81be6 Refactor callbacks 2020-01-31 08:44:45 +08:00
Jinzhu e509b3100d Implement callbacks 2020-01-31 06:35:25 +08:00
Jinzhu 9d5b9834d9 Refactor builder 2020-01-30 19:47:00 +08:00
Jinzhu 85bfd175c6 Implement build conditions 2020-01-30 03:03:06 +08:00
Jinzhu b9cce2be6a Add clause, DB API, model definition 2020-01-29 19:22:44 +08:00
Jinzhu 8eae7e4ab9 Add migrator 2020-01-28 23:01:35 +08:00
Jinzhu f0d514e330 Cleanup 2020-01-28 16:22:07 +08:00
Mike Zuev 7180bd0f27 updated go-sql-driver package (#2859) 2020-01-26 23:28:32 +08:00
jaden 79a77d771d go.mod: remove unnecessary dependences through upgrade go-mssqldb (#2795)
* go.mod: remove unnecessary dependences through upgrade go-mssqldb

$ go get -v -u github.com/denisenkom/go-mssqldb && go mod tidy -v
go: finding github.com/denisenkom/go-mssqldb latest
go: finding github.com/golang-sql/civil latest
go: finding golang.org/x/crypto latest
unused cloud.google.com/go
unused gopkg.in/check.v1
unused gopkg.in/yaml.v2

* mssql: use SCOPE_IDENTITY() if OUTPUT not possible

* go-mssqldb: find a up-to-date version pass test -race
2019-12-06 22:22:28 +08:00
misko f616ccd397 1. fix bug : https://github.com/jinzhu/gorm/issues/2700 2019-12-06 11:38:08 +08:00
Dozer 9d2b65f8c9 add query hint support (#2351)
* add query hint support

* remove add extra space

* add test and fix bug

* fix ut

* fix ut
2019-12-06 09:16:51 +08:00
Jinzhu 5490a87fe9 Should use global NowFunc when trace SQL 2019-12-06 00:01:40 +08:00
Jinzhu 11e2819f44 Extract parseInt 2019-12-05 23:13:54 +08:00
Jinzhu 0f387db5b8
Merge branch 'master' into add-limit-offset-parse-error 2019-12-05 23:00:21 +08:00
Shunsuke Otani e8c07b5531 Set nopLogger to DefaultCallback for avoid nil pointer dereference (#2742) 2019-12-05 22:57:15 +08:00
贾一饼 0aba7ff3a0 Beautify callback log output (#2749) 2019-12-05 18:26:16 +08:00
Jinzhu 376a7290d0 Merge branch 'thomas-tacquet-master' 2019-12-05 18:08:59 +08:00
Thomas Tacquet 32ec5c04a6 bump go-sqlite3 to v1.12.0 to fix go1.13 issues 2019-12-05 18:05:31 +08:00
Jinzhu 2c2fbb99e5 Upgrade go-sqlite to v2.0.1 2019-12-05 18:05:12 +08:00
Jinzhu 9897f80b46
Merge branch 'master' into master 2019-12-05 17:58:37 +08:00
Charles Strahan b543a11ca0 transaction blocks: don't swallow panics (#2774)
This improves upon #2767.

Previously, the code would swallow any panics, which isn't ideal;
panic is intended to be used when a critical error arises,
where the process should fail fast instead of trying to limp along.

This now defers the any recovery (if desired) to the client code.
2019-12-05 17:54:32 +08:00
Thomas Tacquet 9827710b60
bump go-sqlite3 to v1.12.0 to fix go1.13 issues 2019-11-27 15:51:23 +01:00
zaneli 23f6840776 Add limit and offset parse error 2019-11-27 11:21:05 +09:00
Jason Lee 59408390c2 Add `db.Transaction` method for create Transaction block. (#2767)
* Add `db.Transaction` method for create Transaction block.

example:

```go
func CreateAnimals(db *gorm.DB) error {
  db.Transaction(func(tx *gorm.DB) error {
    if err := tx.Create(&Animal{Name: "Giraffe"}).Error; err != nil {
      // return any error will rollback
      return err
    }

    if err := tx.Create(&Animal{Name: "Lion"}).Error; err != nil {
      return err
    }

    // return nil will commit
    return nil
  })
}
```

* Ensure rollback when commit has error.
2019-11-19 16:08:00 +08:00
Emir Beganović 179760d834
Merge pull request #2722 from kohago/master
Add warning comment
2019-10-28 12:18:11 +04:00
Emir Beganović e359feee63
Merge branch 'master' into master 2019-10-28 12:09:43 +04:00
Emir Beganović 2586a05016
Merge pull request #2721 from rubensayshi/isforeignkeyrace
fix a race condition on IsForeignKey that is being detected by -race
2019-10-28 12:09:32 +04:00
Emir Beganović 8420e321b0
Merge branch 'master' into isforeignkeyrace 2019-10-28 12:02:16 +04:00
Emir Beganović 4bd563826b
Merge pull request #2728 from dnathe4th/dn-log-register
Log callback registration if logger exists for consistency
2019-10-28 11:12:32 +04:00
Dom Narducci c46c01c116 Log callback registration if logger exists for consistency 2019-10-25 13:51:29 -07:00
kouha.shu 2ee239a4c0 Update main.go 2019-10-23 10:40:34 +09:00
kouha.shu d926a05bec add warning comment 2019-10-23 10:38:05 +09:00
Ruben de Vries 530711e724
fix a race condition on IsForeignKey that is being detected by -race sometimes. 2019-10-22 11:35:11 +02:00
FWangZil 795328fedc fix(HasTable): database name (#2717)
* fix(HasTable): database name
allow mysql database name with '-' character

* docs: add comment
2019-10-21 20:45:38 +08:00
Jinzhu 5fe32d593f Escape table name for mysql HasTable 2019-10-21 20:20:38 +08:00
macklin-10x 5b3e40ac12 Rename expr type to make it public. (#2604) 2019-10-17 23:44:34 +08:00
aimuz a8a530db5a SetColumn No fields ignored were processed (#2579) 2019-10-17 23:38:37 +08:00
lotus.wu b99f2d8270 1. suport date time '2070-03-30 00:00:00',timestamp can't support large date time. (#1823) 2019-10-17 23:36:06 +08:00
okhowang 120d39b4d6 use show statement in mysql dialect for compatibility for tencent tdsql (#2643) 2019-10-17 23:22:13 +08:00
Lilit 7729627ff6 Fix logging callbacks (#2652) 2019-10-17 23:12:01 +08:00
Devin Samarin d2007b3c82 Describe name of field for invalid SQL datatypes (#2689) 2019-10-17 22:56:19 +08:00
Alex Stockwell 820b5f244a MSSQL Create() fix: Add LastInsertIDReturningSuffix to dialect (#2690)
* MSSQL Create() fix: Add LastInsertIDReturningSuffix to dialect

Per https://github.com/denisenkom/go-mssqldb/issues/355

* MSSQL Create() fix: Added OUTPUT query to Create() builder
2019-10-17 22:54:11 +08:00
Emir Beganović 1bca5dbdd9
Merge pull request #2691 from ken8203/bugfix/fix-typo-of-example-code
Fix typo of example code
2019-10-08 12:04:52 +02:00
Jay Chung e5d0267c0b Fix typo of example code 2019-10-05 12:12:47 +08:00