Commit Graph

99 Commits

Author SHA1 Message Date
Jinzhu 6a6dfdae72 Refactor FirstOrCreate, FirstOrInit 2022-04-26 17:16:48 +08:00
Jinzhu d421c67ef5 Remove ErrRecordNotFound error from log when using Save 2022-04-14 10:51:39 +08:00
Jinzhu 41bef26f13 Remove shared sync pool for Scanner compatibility 2022-04-11 21:37:44 +08:00
Jinzhu 9144969c83 Allow to use tag to disable auto create/update time 2022-04-02 17:17:47 +08:00
Jinzhu f92e6747cb Handle field set value error 2022-03-23 17:24:25 +08:00
Jinzhu 0097b39a77 Should ignore error when parsing default value for time, close #5176 2022-03-20 08:55:08 +08:00
Hasan f3e2da5ba3 Added offset when scanning the result back to struct, close #5143
commit 9a2058164d44c98d7b586b87bed1757f89d6fad7
Author: Jinzhu <wosmvp@gmail.com>
Date:   Thu Mar 17 22:34:19 2022 +0800

    Refactor #5143

commit c259de2176
Author: Hasan <mr.k779@outlook.com>
Date:   Mon Mar 14 20:04:01 2022 +0545

    Update scan_test.go

commit 09f127b491
Author: Hasan <mr.k779@outlook.com>
Date:   Mon Mar 14 19:23:47 2022 +0545

    Added test for scanning embedded data into structs

commit aeaca493cf
Author: Hasan <mr.k779@outlook.com>
Date:   Tue Mar 8 04:08:16 2022 +0600

    Added offset when scanning the result back to struct
2022-03-17 22:52:40 +08:00
Jinzhu 6befa0c947 Refactor preload error check 2022-03-17 11:22:25 +08:00
Jinzhu e2e802b837 Refactor Scan 2022-02-28 13:00:30 +08:00
Jinzhu 530b0a12b4 Add fast path for ValueOf, ReflectValueOf 2022-02-27 22:16:31 +08:00
Jinzhu b1201fce4e Fix update with customized time type, close #5101 2022-02-23 17:48:26 +08:00
Jinzhu 48ced75d1d Improve support for AutoMigrate 2022-02-19 23:42:20 +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
Jinzhu 4eeb839cea Better support Stringer when explain SQL 2022-02-09 15:17:25 +08:00
Jinzhu 416c4d0653 Test query with Or and soft delete 2022-02-08 16:31:24 +08:00
Jinzhu 8d293d44dd Fix docker-compose test env for Mac M1 2022-01-30 22:05:38 +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
Jinzhu adf8f70f06 Upgrade go.mod 2021-12-10 17:50:19 +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 92d5a959a0 Fix tests 2021-11-29 15:16:57 +08:00
Jinzhu e1b4c066a8 Fix FullSaveAssociations, close #4874 2021-11-29 11:02:44 +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
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
dependabot[bot] 7b927900e9
Bump gorm.io/driver/sqlserver from 1.1.2 to 1.2.0 in /tests (#4820)
Bumps [gorm.io/driver/sqlserver](https://github.com/go-gorm/sqlserver) from 1.1.2 to 1.2.0.
- [Release notes](https://github.com/go-gorm/sqlserver/releases)
- [Commits](https://github.com/go-gorm/sqlserver/compare/v1.1.2...v1.2.0)

---
updated-dependencies:
- dependency-name: gorm.io/driver/sqlserver
  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-01 17:09:08 +08:00
Jinzhu 9635d25150 Fix query with uninitialized map 2021-11-01 13:00:52 +08:00
Jinzhu 9f533950a2 Add dest value if current size equal zero 2021-10-28 17:12:31 +08:00
Jinzhu e953880d19 Add returning tests 2021-10-28 09:17:33 +08:00
Jinzhu 835d7bde59 Add returning support to delete 2021-10-28 07:56:55 +08:00
Jinzhu af3fbdc2fc Improve returning support 2021-10-26 22:40:14 +08:00
kinggo 696092e287
update tests' go.mod and tests_all.sh (#4774) 2021-10-13 14:41:33 +08:00
Jinzhu d4c838c1ce Upgrade sqlite driver 2021-10-08 17:31:58 +08:00
dependabot[bot] 57d927d046
Bump gorm.io/driver/postgres from 1.1.1 to 1.1.2 in /tests (#4740)
Bumps [gorm.io/driver/postgres](https://github.com/go-gorm/postgres) from 1.1.1 to 1.1.2.
- [Release notes](https://github.com/go-gorm/postgres/releases)
- [Commits](https://github.com/go-gorm/postgres/compare/v1.1.1...v1.1.2)

---
updated-dependencies:
- dependency-name: gorm.io/driver/postgres
  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-10-08 10:54:50 +08:00
dependabot[bot] 199c8529b6
Bump gorm.io/driver/postgres from 1.1.0 to 1.1.1 in /tests (#4699)
Bumps [gorm.io/driver/postgres](https://github.com/go-gorm/postgres) from 1.1.0 to 1.1.1.
- [Release notes](https://github.com/go-gorm/postgres/releases)
- [Commits](https://github.com/go-gorm/postgres/compare/v1.1.0...v1.1.1)

---
updated-dependencies:
- dependency-name: gorm.io/driver/postgres
  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-09-20 21:33:38 +08:00
dependabot[bot] d67120a155
Bump gorm.io/driver/sqlite from 1.1.4 to 1.1.5 in /tests (#4701)
Bumps [gorm.io/driver/sqlite](https://github.com/go-gorm/sqlite) from 1.1.4 to 1.1.5.
- [Release notes](https://github.com/go-gorm/sqlite/releases)
- [Commits](https://github.com/go-gorm/sqlite/compare/v1.1.4...v1.1.5)

---
updated-dependencies:
- dependency-name: gorm.io/driver/sqlite
  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-09-20 21:25:29 +08:00
Jinzhu 3b6a7c8aec Update sqlserver driver 2021-09-07 12:01:19 +08:00
dependabot[bot] a89d4d8fd5
Bump github.com/lib/pq from 1.10.2 to 1.10.3 in /tests (#4676)
Bumps [github.com/lib/pq](https://github.com/lib/pq) from 1.10.2 to 1.10.3.
- [Release notes](https://github.com/lib/pq/releases)
- [Commits](https://github.com/lib/pq/compare/v1.10.2...v1.10.3)

---
updated-dependencies:
- dependency-name: github.com/lib/pq
  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-09-06 16:26:14 +08:00
dependabot[bot] 5f019f74bf
Bump gorm.io/gorm from 1.21.13 to 1.21.14 in /tests (#4655)
Bumps [gorm.io/gorm](https://github.com/go-gorm/gorm) from 1.21.13 to 1.21.14.
- [Release notes](https://github.com/go-gorm/gorm/releases)
- [Commits](https://github.com/go-gorm/gorm/compare/v1.21.13...v1.21.14)

---
updated-dependencies:
- dependency-name: gorm.io/gorm
  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-09-03 17:47:50 +08:00
dependabot[bot] 0934b10856
Bump gorm.io/driver/sqlserver from 1.0.7 to 1.0.8 in /tests (#4631)
Bumps [gorm.io/driver/sqlserver](https://github.com/go-gorm/sqlserver) from 1.0.7 to 1.0.8.
- [Release notes](https://github.com/go-gorm/sqlserver/releases)
- [Commits](https://github.com/go-gorm/sqlserver/compare/v1.0.7...v1.0.8)

---
updated-dependencies:
- dependency-name: gorm.io/driver/sqlserver
  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-08-23 15:30:02 +08:00
dependabot[bot] 7a53d8e46b
Bump gorm.io/driver/mysql from 1.1.1 to 1.1.2 in /tests (#4615)
Bumps [gorm.io/driver/mysql](https://github.com/go-gorm/mysql) from 1.1.1 to 1.1.2.
- [Release notes](https://github.com/go-gorm/mysql/releases)
- [Commits](https://github.com/go-gorm/mysql/compare/v1.1.1...v1.1.2)

---
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>
2021-08-20 17:52:56 +08:00
dependabot[bot] e076e9e0fb
Bump gorm.io/gorm from 1.21.12 to 1.21.13 in /tests (#4616)
Bumps [gorm.io/gorm](https://github.com/go-gorm/gorm) from 1.21.12 to 1.21.13.
- [Release notes](https://github.com/go-gorm/gorm/releases)
- [Commits](https://github.com/go-gorm/gorm/compare/v1.21.12...v1.21.13)

---
updated-dependencies:
- dependency-name: gorm.io/gorm
  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-08-20 17:52:48 +08:00
Matthieu MOREL cbe72751ac
Update Dependencies (#4582)
* Create dependabot.yml

* Bump reviewdog/action-golangci-lint from 1 to 2 (#1)

Bumps [reviewdog/action-golangci-lint](https://github.com/reviewdog/action-golangci-lint) from 1 to 2.
- [Release notes](https://github.com/reviewdog/action-golangci-lint/releases)
- [Commits](https://github.com/reviewdog/action-golangci-lint/compare/v1...v2)

---
updated-dependencies:
- dependency-name: reviewdog/action-golangci-lint
  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>

* Bump actions/stale from 3.0.7 to 4 (#2)

Bumps [actions/stale](https://github.com/actions/stale) from 3.0.7 to 4.
- [Release notes](https://github.com/actions/stale/releases)
- [Changelog](https://github.com/actions/stale/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/stale/compare/v3.0.7...v4)

---
updated-dependencies:
- dependency-name: actions/stale
  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>

* Bump gorm.io/gorm from 1.21.9 to 1.21.12 in /tests (#3)

Bumps [gorm.io/gorm](https://github.com/go-gorm/gorm) from 1.21.9 to 1.21.12.
- [Release notes](https://github.com/go-gorm/gorm/releases)
- [Commits](https://github.com/go-gorm/gorm/compare/v1.21.9...v1.21.12)

---
updated-dependencies:
- dependency-name: gorm.io/gorm
  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>

* Bump gorm.io/driver/mysql from 1.0.5 to 1.1.1 in /tests (#4)

Bumps [gorm.io/driver/mysql](https://github.com/go-gorm/mysql) from 1.0.5 to 1.1.1.
- [Release notes](https://github.com/go-gorm/mysql/releases)
- [Commits](https://github.com/go-gorm/mysql/compare/v1.0.5...v1.1.1)

---
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>

* Bump github.com/lib/pq from 1.6.0 to 1.10.2 in /tests (#5)

Bumps [github.com/lib/pq](https://github.com/lib/pq) from 1.6.0 to 1.10.2.
- [Release notes](https://github.com/lib/pq/releases)
- [Commits](https://github.com/lib/pq/compare/v1.6.0...v1.10.2)

---
updated-dependencies:
- dependency-name: github.com/lib/pq
  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>

* Bump github.com/google/uuid from 1.2.0 to 1.3.0 in /tests (#6)

Bumps [github.com/google/uuid](https://github.com/google/uuid) from 1.2.0 to 1.3.0.
- [Release notes](https://github.com/google/uuid/releases)
- [Commits](https://github.com/google/uuid/compare/v1.2.0...v1.3.0)

---
updated-dependencies:
- dependency-name: github.com/google/uuid
  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>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-08-09 13:16:25 +08:00
Jinzhu 5b65b02805 Update tests go.mod 2021-06-11 16:00:26 +08:00
Jinzhu e425ed6f6a Update tests go.mod 2021-06-10 20:26:21 +08:00
Jinzhu 6b7abc54a2 Fix tests 2021-05-06 13:06:31 +08:00
Jinzhu 704e53a774 Call scopes before parse model value, close #4209 2021-03-24 16:35:39 +08:00
Jinzhu 4d5cec8bdd Add golang 1.16 2021-03-24 14:22:36 +08:00