Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix conn data race #123

Closed
wants to merge 125 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
125 commits
Select commit Hold shift + click to select a range
29169ab
Merge pull request #1 from longbridgeapp/fix-ci
huacnlee Jan 17, 2022
76fccb0
Update README.md
huacnlee Jan 17, 2022
27d85a7
Update README.md
huacnlee Jan 17, 2022
cd1fd4b
Update progress graph
huacnlee Jan 17, 2022
cb443ca
Update README
huacnlee Jan 17, 2022
8cdb157
full table and pk algorithm is optional
hyperphoton Jan 18, 2022
8a5214f
a full usage example
hyperphoton Jan 18, 2022
b85c699
improve document
hyperphoton Jan 18, 2022
7351822
Update go.dev badge
huacnlee Jan 19, 2022
88518eb
Update README.md
huacnlee Jan 19, 2022
16fec82
update README
hyperphoton Jan 19, 2022
3fc29ae
update README
hyperphoton Jan 19, 2022
f0cedb6
fix small mistake in diagram
hyperphoton Jan 19, 2022
39a6729
merge en and zh readmes
hyperphoton Jan 19, 2022
b4a7b66
Create LICENSE
huacnlee Jan 19, 2022
03560ae
Improve guides on README.md
huacnlee Jan 19, 2022
f1a85f5
Update package name longbridgeapp/gorm-sharding -> gorm.io/sharding
huacnlee Jan 19, 2022
4485b91
Fix typo in README
huacnlee Jan 19, 2022
adbcf4c
Fix example typo
huacnlee Jan 19, 2022
b3aa4ac
Update README.md
huacnlee Jan 19, 2022
13c9dc2
improve config
hyperphoton Jan 19, 2022
fffaf06
Merge pull request #4 from go-gorm/feature/config
huacnlee Jan 19, 2022
49af4ff
Use DoubleWrite until a better name
hyperphoton Jan 21, 2022
8274639
add benchmark test for keygen
hyperphoton Jan 23, 2022
0407ffc
add bit struct to keygen README
hyperphoton Jan 24, 2022
aa0aa36
Move keygen to github.com/longbridgeapp/longkey
hyperphoton Jan 25, 2022
2db1e87
Integrate primary key generator
hyperphoton Jan 25, 2022
f0e25a5
Merge LongKey and Snowflake
hyperphoton Jan 25, 2022
8ffb270
Simplify config
hyperphoton Jan 25, 2022
65cb951
small improvements
hyperphoton Jan 25, 2022
98bd24e
Merge pull request #5 from go-gorm/feature/pk
huacnlee Jan 25, 2022
0403d2a
Add mysql support
hyperphoton Jan 28, 2022
2e7583b
Merge pull request #10 from go-gorm/feature/mysql
huacnlee Jan 28, 2022
c0bb681
Add MySQL test for GitHub Action
huacnlee Jan 28, 2022
1dc5e2e
Merge pull request #9 from go-gorm/feat/test-on-mysql
huacnlee Jan 28, 2022
89b4332
Update README
huacnlee Jan 28, 2022
f7fa959
Split primary_key gen as single file
huacnlee Jan 28, 2022
19cbc32
Render mermaid on README.md
huacnlee Feb 15, 2022
c3f7e6d
Update Graph
huacnlee Feb 15, 2022
67d65e0
Move Graph to bottom of README.md
huacnlee Feb 15, 2022
8354724
Fix test
hyperphoton Feb 15, 2022
5d95324
Compile config on Gorm plugin init for fix table name get by model.
huacnlee Feb 21, 2022
bb68c3f
Default mysql dsn for test
hyperphoton Feb 21, 2022
647bdbb
Upgrade gorm
hyperphoton Feb 21, 2022
5e08fa3
Update README
hyperphoton Feb 21, 2022
9420eb5
Fix PostgreSQL sequence key not exist error for PKPGSequence.
huacnlee Feb 22, 2022
c5b9de9
Merge pull request #12 from go-gorm/improve-register-table-name
huacnlee Feb 22, 2022
ae93a75
Update README
huacnlee Feb 22, 2022
d1dc9ab
Readwrite-splitting
hyperphoton Mar 15, 2022
43f93af
Format readme
hyperphoton Mar 15, 2022
e7eb8c9
Combining with dbresolver
hyperphoton Mar 17, 2022
864d9d6
Create databases on ci
hyperphoton Mar 18, 2022
837d460
try localhost on ci
hyperphoton Mar 18, 2022
c72daa5
connect to pg on ci
hyperphoton Mar 18, 2022
9437767
connect to pg on ci
hyperphoton Mar 18, 2022
a9571d4
connect to mysql on ci
hyperphoton Mar 18, 2022
d70088a
connect to mysql on ci
hyperphoton Mar 18, 2022
6a4fc20
connect to mysql on ci
hyperphoton Mar 18, 2022
ec8906c
connect to mysql on ci
hyperphoton Mar 18, 2022
9ab4916
connect to mysql on ci
hyperphoton Mar 18, 2022
607f053
connect to mysql on ci
hyperphoton Mar 18, 2022
273108e
fix mysql tests
hyperphoton Mar 18, 2022
a8af674
Merge pull request #13 from go-gorm/feature/read-write-connections
huacnlee Mar 18, 2022
eb8decc
feat: Support for AutoMigrate (#17)
a631807682 Apr 22, 2022
371edfa
Fix CI config for allows run CI on Pull Request.
huacnlee Apr 22, 2022
2a004db
Fix db.Statement when parse table name
hyperphoton Apr 25, 2022
9b2527b
Merge branch 'main' of github.com:go-gorm/sharding
hyperphoton Apr 25, 2022
67f6a8d
feat: support drop table
a631807682 Apr 25, 2022
e9c14ba
action: dependabot (#21)
a631807682 Apr 25, 2022
3f3be9a
Bump actions/setup-go from 1 to 3
dependabot[bot] Apr 25, 2022
c520615
Bump actions/checkout from 1 to 3 (#23)
dependabot[bot] Apr 26, 2022
45ccf63
Bump gorm.io/gorm from 1.23.2 to 1.23.4 (#26)
dependabot[bot] Apr 26, 2022
b9c45d9
Bump gorm.io/driver/mysql from 1.3.2 to 1.3.3 (#25)
dependabot[bot] Apr 26, 2022
9cd1354
Merge pull request #20 from a631807682/feat_droptable
hyperphoton Apr 26, 2022
4b409ba
fix: auto migrate should ignore sharding checker when query schema info
a631807682 Apr 26, 2022
39e8d2c
Bump gorm.io/gorm from 1.23.4 to 1.23.5
dependabot[bot] May 2, 2022
4bffab2
Bump gorm.io/plugin/dbresolver from 1.1.0 to 1.2.0
dependabot[bot] May 2, 2022
6351043
Merge pull request #22 from go-gorm/dependabot/github_actions/actions…
jinzhu May 4, 2022
159f7c6
Merge pull request #30 from go-gorm/dependabot/go_modules/gorm.io/gor…
jinzhu May 4, 2022
00e292f
Merge pull request #31 from go-gorm/dependabot/go_modules/gorm.io/plu…
jinzhu May 4, 2022
4ccf52a
Merge pull request #28 from a631807682/fix_migrator_ignore_sharding
jinzhu May 4, 2022
da4c170
fix: test case can not change golbal db
a631807682 May 5, 2022
594254e
Merge pull request #34 from a631807682/fix_test
huacnlee May 5, 2022
b92b0b7
fix: create multiple record
a631807682 May 7, 2022
c4fe744
refactor: define error
a631807682 May 7, 2022
bd1bf3c
test: fix sfid compare
a631807682 May 7, 2022
2e30120
Bump gorm.io/driver/postgres from 1.3.1 to 1.3.7
dependabot[bot] May 30, 2022
c60677e
Merge pull request #39 from go-gorm/dependabot/go_modules/gorm.io/dri…
hyperphoton Jun 7, 2022
a1f49b5
Bump gorm.io/driver/mysql from 1.3.3 to 1.3.4
dependabot[bot] Jun 7, 2022
745f8fc
Merge pull request #40 from go-gorm/dependabot/go_modules/gorm.io/dri…
hyperphoton Jun 7, 2022
4b6af78
Merge pull request #35 from a631807682/fix_create_multiple_record
hyperphoton Jun 9, 2022
35eb6e9
Update README for add guides to use Primary key generator.
huacnlee Jun 30, 2022
2957b92
Update README
huacnlee Jun 30, 2022
975319d
Fix typo on README
huacnlee Jul 5, 2022
96f89fb
Update README
hyperphoton Jul 13, 2022
34fb0e1
Fix transcation
hyperphoton Aug 7, 2022
71df317
Merge pull request #59 from go-gorm/fix/tx
huacnlee Aug 8, 2022
1e4b60f
Bump gorm.io/plugin/dbresolver from 1.2.0 to 1.2.2
dependabot[bot] Aug 8, 2022
4ad01e7
Merge pull request #60 from go-gorm/dependabot/go_modules/gorm.io/plu…
huacnlee Aug 9, 2022
e530c28
Bump gorm.io/driver/mysql from 1.3.4 to 1.4.1
dependabot[bot] Oct 10, 2022
f0b83b3
Add note in README
hyperphoton Oct 14, 2022
34deff3
Update README
hyperphoton Oct 14, 2022
fee7e89
Merge pull request #70 from go-gorm/dependabot/go_modules/gorm.io/dri…
hyperphoton Oct 14, 2022
6494075
Bump gorm.io/gorm from 1.23.5 to 1.24.0
dependabot[bot] Oct 14, 2022
175c1b4
Bump gorm.io/plugin/dbresolver from 1.2.2 to 1.3.0
dependabot[bot] Oct 14, 2022
c0dc820
Merge pull request #71 from go-gorm/dependabot/go_modules/gorm.io/gor…
hyperphoton Oct 14, 2022
aab366a
Merge pull request #72 from go-gorm/dependabot/go_modules/gorm.io/plu…
hyperphoton Oct 14, 2022
026cc1f
Bump gorm.io/driver/postgres from 1.3.7 to 1.4.4
dependabot[bot] Oct 14, 2022
07b7548
Merge pull request #73 from go-gorm/dependabot/go_modules/gorm.io/dri…
hyperphoton Oct 14, 2022
051ba9f
Fix tests
hyperphoton Mar 8, 2023
96663aa
Upgrade go version in workflows
hyperphoton Mar 8, 2023
3e41916
Fix go version in workflows
hyperphoton Mar 8, 2023
48af730
Fix mariadb tests
hyperphoton Mar 8, 2023
a66df90
Bump gorm.io/driver/postgres from 1.4.8 to 1.5.0
dependabot[bot] Mar 13, 2023
52a88db
Bump actions/setup-go from 3 to 4 (#105)
dependabot[bot] Mar 21, 2023
af10086
Bump gorm.io/gorm from 1.24.7-0.20230306060331-85eaf9eeda11 to 1.25.1
dependabot[bot] May 8, 2023
4279061
Fixed a bug where the table suffix is a string. When adding a record,…
May 11, 2023
0aa5d78
Merge pull request #109 from go-gorm/dependabot/go_modules/gorm.io/go…
jinzhu May 19, 2023
e8ddaf3
Bump gorm.io/hints from 1.1.1 to 1.1.2
dependabot[bot] May 19, 2023
659b44e
Merge pull request #111 from mocanxi/support_string_suffiix
jinzhu May 19, 2023
ae56b35
Merge pull request #108 from go-gorm/dependabot/go_modules/gorm.io/hi…
jinzhu May 19, 2023
b23c943
fix conn data race
liangjunmo Aug 17, 2023
0f17322
Support for optional primary key (#127)
hyperphoton Aug 25, 2023
ada87ad
Merge branch 'main' into fix-conn-data-race
liangjunmo Aug 25, 2023
163e891
clean code
liangjunmo Aug 25, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
version: 2
updates:
- package-ecosystem: gomod
directory: /
schedule:
interval: weekly
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
29 changes: 0 additions & 29 deletions .github/workflows/go.yml

This file was deleted.

185 changes: 185 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
name: Tests
on:
push:
branches:
- "main"
tags:
- "v*"
pull_request:
jobs:
postgres:
strategy:
matrix:
dbversion:
[
"postgres:latest",
"postgres:13",
"postgres:12",
"postgres:11",
"postgres:10",
]
platform: [ubuntu-latest] # can not run in macOS and Windows
runs-on: ${{ matrix.platform }}

services:
postgres:
image: ${{ matrix.dbversion }}
env:
POSTGRES_DB: sharding-test
POSTGRES_USER: gorm
POSTGRES_PASSWORD: gorm
TZ: Asia/Shanghai
ports:
- 5432:5432
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5

env:
DIALECTOR: postgres
DB_URL: postgres://gorm:gorm@localhost:5432/sharding-test
DB_NOID_URL: postgres://gorm:gorm@localhost:5432/sharding-noid-test
DB_READ_URL: postgres://gorm:gorm@localhost:5432/sharding-read-test
DB_WRITE_URL: postgres://gorm:gorm@localhost:5432/sharding-write-test
steps:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "1.20"
id: go

- name: Create No ID Database
run: PGPASSWORD=gorm psql -h localhost -U gorm -d sharding-test -c 'CREATE DATABASE "sharding-noid-test";'

- name: Create Read Database
run: PGPASSWORD=gorm psql -h localhost -U gorm -d sharding-test -c 'CREATE DATABASE "sharding-read-test";'

- name: Create Write Databases
run: PGPASSWORD=gorm psql -h localhost -U gorm -d sharding-test -c 'CREATE DATABASE "sharding-write-test";'

- name: Check out code into the Go module directory
uses: actions/checkout@v3

- name: Get dependencies
run: |
go get -v -t -d ./...

- name: Test
run: go test
mysql:
name: MySQL

strategy:
matrix:
dbversion: ["mysql:latest", "mysql:5.7"]
platform: [ubuntu-latest]
runs-on: ${{ matrix.platform }}

services:
mysql:
image: ${{ matrix.dbversion }}
env:
MYSQL_DATABASE: sharding-test
MYSQL_USER: gorm
MYSQL_PASSWORD: gorm
MYSQL_ROOT_PASSWORD: gorm
ports:
- 3306:3306
options: >-
--health-cmd "mysqladmin ping -ugorm -pgorm"
--health-interval 10s
--health-start-period 10s
--health-timeout 5s
--health-retries 10

env:
DIALECTOR: mysql
DB_URL: gorm:gorm@tcp(127.0.0.1:3306)/sharding-test?charset=utf8mb4&parseTime=True&loc=Local
DB_NOID_URL: root:gorm@tcp(127.0.0.1:3306)/sharding-noid-test?charset=utf8mb4&parseTime=True&loc=Local
DB_READ_URL: root:gorm@tcp(127.0.0.1:3306)/sharding-read-test?charset=utf8mb4&parseTime=True&loc=Local
DB_WRITE_URL: root:gorm@tcp(127.0.0.1:3306)/sharding-write-test?charset=utf8mb4&parseTime=True&loc=Local
steps:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "1.20"
id: go

- name: Create No ID Database
run: mysqladmin -h 127.0.0.1 -uroot -pgorm create sharding-noid-test

- name: Create Read Database
run: mysqladmin -h 127.0.0.1 -uroot -pgorm create sharding-read-test

- name: Create Write Database
run: mysqladmin -h 127.0.0.1 -uroot -pgorm create sharding-write-test

- name: Check out code into the Go module directory
uses: actions/checkout@v3

- name: Get dependencies
run: |
go get -v -t -d ./...

- name: Test
run: go test
mariadb:
name: MariaDB

strategy:
matrix:
dbversion: ["mariadb:10.11"]
platform: [ubuntu-latest]
runs-on: ${{ matrix.platform }}

services:
mariadb:
image: ${{ matrix.dbversion }}
env:
MYSQL_DATABASE: sharding-test
MYSQL_USER: gorm
MYSQL_PASSWORD: gorm
MYSQL_ROOT_PASSWORD: gorm
ports:
- 3306:3306
options: >-
--health-cmd "mysqladmin ping -ugorm -pgorm"
--health-interval 10s
--health-start-period 10s
--health-timeout 5s
--health-retries 10

env:
DIALECTOR: mariadb
DB_URL: gorm:gorm@tcp(127.0.0.1:3306)/sharding-test?charset=utf8mb4&parseTime=True&loc=Local
DB_NOID_URL: root:gorm@tcp(127.0.0.1:3306)/sharding-noid-test?charset=utf8mb4&parseTime=True&loc=Local
DB_READ_URL: root:gorm@tcp(127.0.0.1:3306)/sharding-read-test?charset=utf8mb4&parseTime=True&loc=Local
DB_WRITE_URL: root:gorm@tcp(127.0.0.1:3306)/sharding-write-test?charset=utf8mb4&parseTime=True&loc=Local
steps:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "1.20"
id: go

- name: Create No ID Database
run: mysqladmin -h 127.0.0.1 -uroot -pgorm create sharding-noid-test

- name: Create Read Database
run: mysqladmin -h 127.0.0.1 -uroot -pgorm create sharding-read-test

- name: Create Write Database
run: mysqladmin -h 127.0.0.1 -uroot -pgorm create sharding-write-test

- name: Check out code into the Go module directory
uses: actions/checkout@v3

- name: Get dependencies
run: |
go get -v -t -d ./...

- name: Test
run: go test
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022 Longbridge

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Loading