Skip to content

Commit

Permalink
chore: Merge v1.13 (#424)
Browse files Browse the repository at this point in the history
* Upgrade v1.13.1

* Merge #305, #306 to v1.13.x (#308)

* Upgrade v1.13.1 (#295)

* Update README

* build(deps): bump the go-modules group with 1 update (#296)

Bumps the go-modules group with 1 update: [github.com/bytedance/sonic](https://github.com/bytedance/sonic).

- [Release notes](https://github.com/bytedance/sonic/releases)
- [Commits](bytedance/sonic@v1.10.0...v1.10.1)

---
updated-dependencies:
- dependency-name: github.com/bytedance/sonic
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: go-modules
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps): bump the go-modules group with 1 update (#297)

Bumps the go-modules group with 1 update: [github.com/golang-module/carbon/v2](https://github.com/golang-module/carbon).

- [Release notes](https://github.com/golang-module/carbon/releases)
- [Commits](golang-module/carbon@v2.2.6...v2.2.7)

---
updated-dependencies:
- dependency-name: github.com/golang-module/carbon/v2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: go-modules
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps): bump the go-modules group with 1 update (#299)

Bumps the go-modules group with 1 update: [google.golang.org/grpc](https://github.com/grpc/grpc-go).

- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](grpc/grpc-go@v1.58.0...v1.58.1)

---
updated-dependencies:
- dependency-name: google.golang.org/grpc
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: go-modules
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps): bump the github-actions group with 1 update (#300)

Bumps the github-actions group with 1 update: [codecov/codecov-action](https://github.com/codecov/codecov-action).

- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](codecov/codecov-action@v3...v4)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Wenbo Han <[email protected]>

* feat: add GetBytes method and test cases (#298)

* feat: add GetBytes method and test cases

* workflow: remove filesystem

* fix: lint

* feat: optimize code

* feat: optimize test

* fix: windows tests

* workflow: fix

* fix: file not close

* feat: optimize code

* fix: lint

* fix: lint

* fix: test

* feat: Add interface comments (#292)

* Add interface comments to all facades

* Add comments for remaining contracts

* convert the first letter of word to a lower case in godoc comments

* Add a space for each comment after //

* build(deps): bump the go-modules group with 1 update (#301)

Bumps the go-modules group with 1 update: [github.com/golang-module/carbon/v2](https://github.com/golang-module/carbon).

- [Release notes](https://github.com/golang-module/carbon/releases)
- [Commits](golang-module/carbon@v2.2.7...v2.2.8)

---
updated-dependencies:
- dependency-name: github.com/golang-module/carbon/v2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: go-modules
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps): bump the go-modules group with 1 update (#303)

Bumps the go-modules group with 1 update: [google.golang.org/grpc](https://github.com/grpc/grpc-go).

- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](grpc/grpc-go@v1.58.1...v1.58.2)

---
updated-dependencies:
- dependency-name: google.golang.org/grpc
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: go-modules
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* fix:[#263] There is a path error in the filesystem module (#305)

* feat: Add Fluent String helpers (#304)

* add fluent strings helpers

* add more fluent string helpers

* add headline helper

* add test cases for fluent strings

* add test cases for headline function

* modify, according to suggestions

* modify, according to suggestions

* reformat the str file

* fix: #267 (#306)

* feat: add environment helper

* feat: optimize sonic

* fix: tests

* feat: rename to env

* feat: optimize json

* fix: optimize tests

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: 耗子 <[email protected]>
Co-authored-by: krishan kumar <[email protected]>

* fix: [#270] Optimize postgres DNS (#309)

* fix: [#270] Optimize postgres DNS

* Fix unit test

* fix: [#253] [Bug] The With method can't be used with the Cursor method together (#311)

* fix: #253 [Bug] The With method can't be used with the Cursor method together

* Remove test

* Upgrade v1.13.2

* Update README

* fix: Register multiple events (#317)

* Upgrade v1.13.1 (#295)

* Update README

* build(deps): bump the go-modules group with 1 update (#296)

Bumps the go-modules group with 1 update: [github.com/bytedance/sonic](https://github.com/bytedance/sonic).

- [Release notes](https://github.com/bytedance/sonic/releases)
- [Commits](bytedance/sonic@v1.10.0...v1.10.1)

---
updated-dependencies:
- dependency-name: github.com/bytedance/sonic
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: go-modules
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps): bump the go-modules group with 1 update (#297)

Bumps the go-modules group with 1 update: [github.com/golang-module/carbon/v2](https://github.com/golang-module/carbon).

- [Release notes](https://github.com/golang-module/carbon/releases)
- [Commits](golang-module/carbon@v2.2.6...v2.2.7)

---
updated-dependencies:
- dependency-name: github.com/golang-module/carbon/v2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: go-modules
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps): bump the go-modules group with 1 update (#299)

Bumps the go-modules group with 1 update: [google.golang.org/grpc](https://github.com/grpc/grpc-go).

- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](grpc/grpc-go@v1.58.0...v1.58.1)

---
updated-dependencies:
- dependency-name: google.golang.org/grpc
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: go-modules
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps): bump the github-actions group with 1 update (#300)

Bumps the github-actions group with 1 update: [codecov/codecov-action](https://github.com/codecov/codecov-action).

- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](codecov/codecov-action@v3...v4)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Wenbo Han <[email protected]>

* feat: add GetBytes method and test cases (#298)

* feat: add GetBytes method and test cases

* workflow: remove filesystem

* fix: lint

* feat: optimize code

* feat: optimize test

* fix: windows tests

* workflow: fix

* fix: file not close

* feat: optimize code

* fix: lint

* fix: lint

* fix: test

* feat: Add interface comments (#292)

* Add interface comments to all facades

* Add comments for remaining contracts

* convert the first letter of word to a lower case in godoc comments

* Add a space for each comment after //

* build(deps): bump the go-modules group with 1 update (#301)

Bumps the go-modules group with 1 update: [github.com/golang-module/carbon/v2](https://github.com/golang-module/carbon).

- [Release notes](https://github.com/golang-module/carbon/releases)
- [Commits](golang-module/carbon@v2.2.7...v2.2.8)

---
updated-dependencies:
- dependency-name: github.com/golang-module/carbon/v2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: go-modules
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps): bump the go-modules group with 1 update (#303)

Bumps the go-modules group with 1 update: [google.golang.org/grpc](https://github.com/grpc/grpc-go).

- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](grpc/grpc-go@v1.58.1...v1.58.2)

---
updated-dependencies:
- dependency-name: google.golang.org/grpc
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: go-modules
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* fix:[#263] There is a path error in the filesystem module (#305)

* feat: Add Fluent String helpers (#304)

* add fluent strings helpers

* add more fluent string helpers

* add headline helper

* add test cases for fluent strings

* add test cases for headline function

* modify, according to suggestions

* modify, according to suggestions

* reformat the str file

* fix: #267 (#306)

* feat: add environment helper

* feat: optimize sonic

* fix: tests

* feat: rename to env

* feat: optimize json

* fix: optimize tests

* refactor: move mocks (#307)

* feat: update mocks

* refactor: move mocks

* workflow: remove code review

* workflow: fix mockery

* fix: update mocks

* refactor: move gorm initialize interface to contracts folder

* feat: test generate mock

* workflow: update mock

* chore: update mocks

* chore: remove unnecessary go generate tag

* workflow: only generate mocks in master branch

* workflow: fix lint

* workflow: make mockery only run on pr

* feat: move Gorm interface to contracts/database/gorm

* feat: move Gorm interface to contracts/database/gorm

* feat: move interface

* chore: update mocks

* fix: test

---------

Co-authored-by: devhaozi <[email protected]>

* build(deps): bump the go-modules group with 1 update (#310)

Bumps the go-modules group with 1 update: [golang.org/x/crypto](https://github.com/golang/crypto).

- [Commits](golang/crypto@v0.13.0...v0.14.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: go-modules
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps): bump the github-actions group with 1 update (#312)

Bumps the github-actions group with 1 update: [stefanzweifel/git-auto-commit-action](https://github.com/stefanzweifel/git-auto-commit-action).

- [Release notes](https://github.com/stefanzweifel/git-auto-commit-action/releases)
- [Changelog](https://github.com/stefanzweifel/git-auto-commit-action/blob/master/CHANGELOG.md)
- [Commits](stefanzweifel/git-auto-commit-action@v4...v5)

---
updated-dependencies:
- dependency-name: stefanzweifel/git-auto-commit-action
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps): bump the go-modules group with 1 update (#313)

Bumps the go-modules group with 1 update: [github.com/spf13/viper](https://github.com/spf13/viper).

- [Release notes](https://github.com/spf13/viper/releases)
- [Commits](spf13/viper@v1.16.0...v1.17.0)

---
updated-dependencies:
- dependency-name: github.com/spf13/viper
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: go-modules
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Wenbo Han <[email protected]>

* build(deps): bump the go-modules group with 2 updates (#315)

Bumps the go-modules group with 2 updates: [github.com/bytedance/sonic](https://github.com/bytedance/sonic) and [github.com/golang-module/carbon/v2](https://github.com/golang-module/carbon).


Updates `github.com/bytedance/sonic` from 1.10.1 to 1.10.2
- [Release notes](https://github.com/bytedance/sonic/releases)
- [Commits](bytedance/sonic@v1.10.1...v1.10.2)

Updates `github.com/golang-module/carbon/v2` from 2.2.8 to 2.2.9
- [Release notes](https://github.com/golang-module/carbon/releases)
- [Commits](golang-module/carbon@v2.2.8...v2.2.9)

---
updated-dependencies:
- dependency-name: github.com/bytedance/sonic
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: go-modules
- dependency-name: github.com/golang-module/carbon/v2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: go-modules
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Register multiple events

* Fix typo

* Restore

* Allow multiple events registeration

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: Wenbo Han <[email protected]>
Co-authored-by: Bowen <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: 耗子 <[email protected]>
Co-authored-by: krishan kumar <[email protected]>
Co-authored-by: devhaozi <[email protected]>

* fix: database variable (#316)

* Upgrade v1.13.1 (#295)

* Update README

* build(deps): bump the go-modules group with 1 update (#296)

Bumps the go-modules group with 1 update: [github.com/bytedance/sonic](https://github.com/bytedance/sonic).

- [Release notes](https://github.com/bytedance/sonic/releases)
- [Commits](bytedance/sonic@v1.10.0...v1.10.1)

---
updated-dependencies:
- dependency-name: github.com/bytedance/sonic
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: go-modules
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps): bump the go-modules group with 1 update (#297)

Bumps the go-modules group with 1 update: [github.com/golang-module/carbon/v2](https://github.com/golang-module/carbon).

- [Release notes](https://github.com/golang-module/carbon/releases)
- [Commits](golang-module/carbon@v2.2.6...v2.2.7)

---
updated-dependencies:
- dependency-name: github.com/golang-module/carbon/v2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: go-modules
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps): bump the go-modules group with 1 update (#299)

Bumps the go-modules group with 1 update: [google.golang.org/grpc](https://github.com/grpc/grpc-go).

- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](grpc/grpc-go@v1.58.0...v1.58.1)

---
updated-dependencies:
- dependency-name: google.golang.org/grpc
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: go-modules
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps): bump the github-actions group with 1 update (#300)

Bumps the github-actions group with 1 update: [codecov/codecov-action](https://github.com/codecov/codecov-action).

- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](codecov/codecov-action@v3...v4)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Wenbo Han <[email protected]>

* feat: add GetBytes method and test cases (#298)

* feat: add GetBytes method and test cases

* workflow: remove filesystem

* fix: lint

* feat: optimize code

* feat: optimize test

* fix: windows tests

* workflow: fix

* fix: file not close

* feat: optimize code

* fix: lint

* fix: lint

* fix: test

* feat: Add interface comments (#292)

* Add interface comments to all facades

* Add comments for remaining contracts

* convert the first letter of word to a lower case in godoc comments

* Add a space for each comment after //

* build(deps): bump the go-modules group with 1 update (#301)

Bumps the go-modules group with 1 update: [github.com/golang-module/carbon/v2](https://github.com/golang-module/carbon).

- [Release notes](https://github.com/golang-module/carbon/releases)
- [Commits](golang-module/carbon@v2.2.7...v2.2.8)

---
updated-dependencies:
- dependency-name: github.com/golang-module/carbon/v2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: go-modules
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps): bump the go-modules group with 1 update (#303)

Bumps the go-modules group with 1 update: [google.golang.org/grpc](https://github.com/grpc/grpc-go).

- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](grpc/grpc-go@v1.58.1...v1.58.2)

---
updated-dependencies:
- dependency-name: google.golang.org/grpc
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: go-modules
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* fix:[#263] There is a path error in the filesystem module (#305)

* feat: Add Fluent String helpers (#304)

* add fluent strings helpers

* add more fluent string helpers

* add headline helper

* add test cases for fluent strings

* add test cases for headline function

* modify, according to suggestions

* modify, according to suggestions

* reformat the str file

* fix: #267 (#306)

* feat: add environment helper

* feat: optimize sonic

* fix: tests

* feat: rename to env

* feat: optimize json

* fix: optimize tests

* refactor: move mocks (#307)

* feat: update mocks

* refactor: move mocks

* workflow: remove code review

* workflow: fix mockery

* fix: update mocks

* refactor: move gorm initialize interface to contracts folder

* feat: test generate mock

* workflow: update mock

* chore: update mocks

* chore: remove unnecessary go generate tag

* workflow: only generate mocks in master branch

* workflow: fix lint

* workflow: make mockery only run on pr

* feat: move Gorm interface to contracts/database/gorm

* feat: move Gorm interface to contracts/database/gorm

* feat: move interface

* chore: update mocks

* fix: test

---------

Co-authored-by: devhaozi <[email protected]>

* build(deps): bump the go-modules group with 1 update (#310)

Bumps the go-modules group with 1 update: [golang.org/x/crypto](https://github.com/golang/crypto).

- [Commits](golang/crypto@v0.13.0...v0.14.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: go-modules
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps): bump the github-actions group with 1 update (#312)

Bumps the github-actions group with 1 update: [stefanzweifel/git-auto-commit-action](https://github.com/stefanzweifel/git-auto-commit-action).

- [Release notes](https://github.com/stefanzweifel/git-auto-commit-action/releases)
- [Changelog](https://github.com/stefanzweifel/git-auto-commit-action/blob/master/CHANGELOG.md)
- [Commits](stefanzweifel/git-auto-commit-action@v4...v5)

---
updated-dependencies:
- dependency-name: stefanzweifel/git-auto-commit-action
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps): bump the go-modules group with 1 update (#313)

Bumps the go-modules group with 1 update: [github.com/spf13/viper](https://github.com/spf13/viper).

- [Release notes](https://github.com/spf13/viper/releases)
- [Commits](spf13/viper@v1.16.0...v1.17.0)

---
updated-dependencies:
- dependency-name: github.com/spf13/viper
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: go-modules
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Wenbo Han <[email protected]>

* build(deps): bump the go-modules group with 2 updates (#315)

Bumps the go-modules group with 2 updates: [github.com/bytedance/sonic](https://github.com/bytedance/sonic) and [github.com/golang-module/carbon/v2](https://github.com/golang-module/carbon).


Updates `github.com/bytedance/sonic` from 1.10.1 to 1.10.2
- [Release notes](https://github.com/bytedance/sonic/releases)
- [Commits](bytedance/sonic@v1.10.1...v1.10.2)

Updates `github.com/golang-module/carbon/v2` from 2.2.8 to 2.2.9
- [Release notes](https://github.com/golang-module/carbon/releases)
- [Commits](golang-module/carbon@v2.2.8...v2.2.9)

---
updated-dependencies:
- dependency-name: github.com/bytedance/sonic
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: go-modules
- dependency-name: github.com/golang-module/carbon/v2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: go-modules
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Fix database variable

* Restore

* Fix database typo

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: Wenbo Han <[email protected]>
Co-authored-by: Bowen <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: 耗子 <[email protected]>
Co-authored-by: krishan kumar <[email protected]>
Co-authored-by: devhaozi <[email protected]>

* feat: [#265] The Config module supports get system environment variables (#329)

* feat: [#265] The Config module supports get system environment variables (#335)

* feat: [#265] The Config module supports get system environment variables

* Add unit tests

* Upgrade v1.13.3

* Update mock

* Upgrade v1.13.4

* fix: [#312] orm connection is not working (#354)

* fix: [#312] orm connection is not working

* Optimize logic

* Optimize unit test

* Optimize unit test

* Optimize unit tests

---------

Co-authored-by: Bowen <[email protected]>

* fix: [#320] mock.Log() is not working (#355)

* Upgrade v1.13.5 (#357)

* fix: [#341] The Chain Query isn't executed one by one (#380)

* Upgrade v1.13.7

* Merge orm

* Optmize merge

* update go.mod

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: 耗子 <[email protected]>
Co-authored-by: krishan kumar <[email protected]>
Co-authored-by: Ahmed M. Ammar <[email protected]>
Co-authored-by: devhaozi <[email protected]>
Co-authored-by: Bowen <[email protected]>
  • Loading branch information
7 people authored Feb 22, 2024
1 parent 1a9f352 commit f65cadd
Show file tree
Hide file tree
Showing 21 changed files with 2,070 additions and 1,135 deletions.
2 changes: 1 addition & 1 deletion config/application_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ DB_PORT=3306
`))
temp, err := os.CreateTemp("", "goravel.env")
assert.Nil(t, err)
defer os.Remove(temp.Name())
defer temp.Close()
defer os.Remove(temp.Name())

_, err = temp.Write([]byte(`
APP_KEY=12345678901234567890123456789012
Expand Down
57 changes: 57 additions & 0 deletions database/gorm/conditions.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package gorm

import (
ormcontract "github.com/goravel/framework/contracts/database/orm"
)

type Conditions struct {
distinct []any
group string
having *Having
join []Join
limit *int
lockForUpdate bool
model any
offset *int
omit []string
order []any
scopes []func(ormcontract.Query) ormcontract.Query
selectColumns *Select
sharedLock bool
table *Table
where []Where
with []With
withoutEvents bool
withTrashed bool
}

type Having struct {
query any
args []any
}

type Join struct {
query string
args []any
}

type Select struct {
query any
args []any
}

type Table struct {
name string
args []any
}

type Where struct {
query any
args []any
or bool
}

type With struct {
query string
args []any
}
8 changes: 6 additions & 2 deletions database/gorm/cursor.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,12 @@ func (c *CursorImpl) Scan(value any) error {
return err
}

for relation, args := range c.query.with {
if err := c.query.origin.Load(value, relation, args...); err != nil {
for _, item := range c.query.conditions.with {
// Need to new a query, avoid to clear the conditions
query := c.query.new(c.query.instance)
// The new query must be cleared
query.clearConditions()
if err := query.Load(value, item.query, item.args...); err != nil {
return err
}
}
Expand Down
265 changes: 131 additions & 134 deletions database/gorm/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,102 @@ func NewEvent(query *QueryImpl, model, dest any) *Event {
}
}

func (e *Event) ColumnNamesWithDbColumnNames() map[string]string {
if e.columnNamesWithDbColumnNames != nil {
return e.columnNamesWithDbColumnNames
}

res := make(map[string]string)
var modelType reflect.Type
var modelValue reflect.Value

if e.model != nil {
modelType = reflect.TypeOf(e.model)
modelValue = reflect.ValueOf(e.model)
} else {
modelType = reflect.TypeOf(e.dest)
modelValue = reflect.ValueOf(e.dest)
}
if modelType.Kind() == reflect.Pointer {
modelType = modelType.Elem()
modelValue = modelValue.Elem()
}

for i := 0; i < modelType.NumField(); i++ {
if !modelType.Field(i).IsExported() {
continue
}
if modelType.Field(i).Name == "Model" && modelValue.Field(i).Type().Kind() == reflect.Struct {
structField := modelValue.Field(i).Type()
for j := 0; j < structField.NumField(); j++ {
if !structField.Field(i).IsExported() {
continue
}
dbColumn := structNameToDbColumnName(structField.Field(j).Name, structField.Field(j).Tag.Get("gorm"))
res[structField.Field(j).Name] = dbColumn
res[dbColumn] = dbColumn
}
}

dbColumn := structNameToDbColumnName(modelType.Field(i).Name, modelType.Field(i).Tag.Get("gorm"))
res[modelType.Field(i).Name] = dbColumn
res[dbColumn] = dbColumn
}

return res
}

func (e *Event) Context() context.Context {
return e.query.instance.Statement.Context
}

func (e *Event) DestOfMap() map[string]any {
if e.destOfMap != nil {
return e.destOfMap
}

var destOfMap map[string]any
if destMap, ok := e.dest.(map[string]any); ok {
destOfMap = destMap
} else {
destType := reflect.TypeOf(e.dest)
if destType.Kind() == reflect.Pointer {
destType = destType.Elem()
}
if destType.Kind() == reflect.Struct {
destOfMap = structToMap(e.dest)
}
}

e.destOfMap = destOfMap

return e.destOfMap
}

func (e *Event) GetAttribute(key string) any {
destOfMap := e.DestOfMap()
value, exist := destOfMap[e.toDBColumnName(key)]
if exist && e.validColumn(key) && e.validValue(key, value) {
return value
}

return e.GetOriginal(key)
}

func (e *Event) GetOriginal(key string, def ...any) any {
modelOfMap := e.ModelOfMap()
value, exist := modelOfMap[e.toDBColumnName(key)]
if exist {
return value
}

if len(def) > 0 {
return def[0]
}

return nil
}

func (e *Event) IsDirty(columns ...string) bool {
destOfMap := e.DestOfMap()

Expand Down Expand Up @@ -63,15 +159,22 @@ func (e *Event) IsClean(fields ...string) bool {
return !e.IsDirty(fields...)
}

func (e *Event) Query() orm.Query {
return NewQueryImplByInstance(e.query.instance.Session(&gorm.Session{NewDB: true}), &QueryImpl{
config: e.query.config,
withoutEvents: false,
})
func (e *Event) ModelOfMap() map[string]any {
if e.modelOfMap != nil {
return e.modelOfMap
}

if e.model == nil {
return map[string]any{}
}

e.modelOfMap = structToMap(e.model)

return e.modelOfMap
}

func (e *Event) Context() context.Context {
return e.query.instance.Statement.Context
func (e *Event) Query() orm.Query {
return NewQueryImpl(e.query.ctx, e.query.config, e.query.connection, e.query.instance.Session(&gorm.Session{NewDB: true}), nil)
}

func (e *Event) SetAttribute(key string, value any) {
Expand Down Expand Up @@ -113,28 +216,35 @@ func (e *Event) SetAttribute(key string, value any) {
}
}

func (e *Event) GetAttribute(key string) any {
destOfMap := e.DestOfMap()
value, exist := destOfMap[e.toDBColumnName(key)]
if exist && e.validColumn(key) && e.validValue(key, value) {
return value
func (e *Event) dirty(destColumn string, destValue any) bool {
modelOfMap := e.ModelOfMap()
dbDestColumn := e.toDBColumnName(destColumn)

if modelValue, exist := modelOfMap[dbDestColumn]; exist {
return !reflect.DeepEqual(modelValue, destValue)
}

return e.GetOriginal(key)
return true
}

func (e *Event) GetOriginal(key string, def ...any) any {
modelOfMap := e.ModelOfMap()
value, exist := modelOfMap[e.toDBColumnName(key)]
if exist {
return value
func (e *Event) equalColumnName(origin, source string) bool {
originDbColumnName := e.toDBColumnName(origin)
sourceDbColumnName := e.toDBColumnName(source)

if originDbColumnName == "" || sourceDbColumnName == "" {
return false
}

if len(def) > 0 {
return def[0]
return originDbColumnName == sourceDbColumnName
}

func (e *Event) toDBColumnName(name string) string {
dbColumnName, exist := e.ColumnNamesWithDbColumnNames()[name]
if exist {
return dbColumnName
}

return nil
return ""
}

func (e *Event) validColumn(name string) bool {
Expand Down Expand Up @@ -197,119 +307,6 @@ func (e *Event) validValue(name string, value any) bool {
return !valueValue.IsZero()
}

func (e *Event) dirty(destColumn string, destValue any) bool {
modelOfMap := e.ModelOfMap()
dbDestColumn := e.toDBColumnName(destColumn)

if modelValue, exist := modelOfMap[dbDestColumn]; exist {
return !reflect.DeepEqual(modelValue, destValue)
}

return true
}

func (e *Event) equalColumnName(origin, source string) bool {
originDbColumnName := e.toDBColumnName(origin)
sourceDbColumnName := e.toDBColumnName(source)

if originDbColumnName == "" || sourceDbColumnName == "" {
return false
}

return originDbColumnName == sourceDbColumnName
}

func (e *Event) toDBColumnName(name string) string {
dbColumnName, exist := e.ColumnNamesWithDbColumnNames()[name]
if exist {
return dbColumnName
}

return ""
}

func (e *Event) ModelOfMap() map[string]any {
if e.modelOfMap != nil {
return e.modelOfMap
}

if e.model == nil {
return map[string]any{}
}

e.modelOfMap = structToMap(e.model)

return e.modelOfMap
}

func (e *Event) DestOfMap() map[string]any {
if e.destOfMap != nil {
return e.destOfMap
}

var destOfMap map[string]any
if destMap, ok := e.dest.(map[string]any); ok {
destOfMap = destMap
} else {
destType := reflect.TypeOf(e.dest)
if destType.Kind() == reflect.Pointer {
destType = destType.Elem()
}
if destType.Kind() == reflect.Struct {
destOfMap = structToMap(e.dest)
}
}

e.destOfMap = destOfMap

return e.destOfMap
}

func (e *Event) ColumnNamesWithDbColumnNames() map[string]string {
if e.columnNamesWithDbColumnNames != nil {
return e.columnNamesWithDbColumnNames
}

res := make(map[string]string)
var modelType reflect.Type
var modelValue reflect.Value

if e.model != nil {
modelType = reflect.TypeOf(e.model)
modelValue = reflect.ValueOf(e.model)
} else {
modelType = reflect.TypeOf(e.dest)
modelValue = reflect.ValueOf(e.dest)
}
if modelType.Kind() == reflect.Pointer {
modelType = modelType.Elem()
modelValue = modelValue.Elem()
}

for i := 0; i < modelType.NumField(); i++ {
if !modelType.Field(i).IsExported() {
continue
}
if modelType.Field(i).Name == "Model" && modelValue.Field(i).Type().Kind() == reflect.Struct {
structField := modelValue.Field(i).Type()
for j := 0; j < structField.NumField(); j++ {
if !structField.Field(i).IsExported() {
continue
}
dbColumn := structNameToDbColumnName(structField.Field(j).Name, structField.Field(j).Tag.Get("gorm"))
res[structField.Field(j).Name] = dbColumn
res[dbColumn] = dbColumn
}
}

dbColumn := structNameToDbColumnName(modelType.Field(i).Name, modelType.Field(i).Tag.Get("gorm"))
res[modelType.Field(i).Name] = dbColumn
res[dbColumn] = dbColumn
}

return res
}

func structToMap(data any) map[string]any {
res := make(map[string]any)
modelType := reflect.TypeOf(data)
Expand Down
Loading

0 comments on commit f65cadd

Please sign in to comment.