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

feat(cmd/gf): add ShardingPattern option for command gf gen dao to support generating dao files sharding tables #4081

Merged
merged 6 commits into from
Dec 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 0 additions & 3 deletions .github/workflows/ci-main.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
#!/usr/bin/env bash

# Define the latest Go version requirement
LATEST_GO_VERSION="1.23"

coverage=$1

# find all path that contains go.mod.
Expand Down
28 changes: 20 additions & 8 deletions .github/workflows/ci-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,21 @@ concurrency:

env:
TZ: "Asia/Shanghai"

# for unit testing cases of some components that only execute on the latest go version.
LATEST_GO_VERSION: "1.23"

jobs:
code-test:
strategy:
matrix:
# 🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥
# When adding new go version to the list, make sure:
# 1. Update the `LATEST_GO_VERSION` env variable.
# 2. Update the `Report Coverage` action.
# 🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥
go-version: [ "1.20", "1.21", "1.22", "1.23" ]
goarch: [ "386", "amd64" ]

runs-on: ubuntu-20.04

# Service containers to run with `code-test`
Expand Down Expand Up @@ -72,8 +83,13 @@ jobs:
- 3306:3306

# MariaDb backend server.
# docker run -d --name mariadb \
# -p 3307:3306 \
# -e MYSQL_DATABASE=test \
# -e MYSQL_ROOT_PASSWORD=12345678 \
# mariadb:11.4
mariadb:
image: mariadb:10.4
image: mariadb:11.4
env:
MARIADB_DATABASE: test
MARIADB_ROOT_PASSWORD: 12345678
Expand Down Expand Up @@ -185,11 +201,6 @@ jobs:
ports:
- 2181:2181

strategy:
matrix:
go-version: [ "1.20", "1.21", "1.22", "1.23" ]
goarch: [ "386", "amd64" ]

steps:
# TODO: szenius/set-timezone update to node16
# sudo ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
Expand Down Expand Up @@ -256,7 +267,8 @@ jobs:

- name: Report Coverage
uses: codecov/codecov-action@v4
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
# Only report coverage on the latest go version and amd64 arch
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' && matrix.go-version == '1.23' && matrix.goarch == 'amd64' }}
with:
flags: go-${{ matrix.go-version }}-${{ matrix.goarch }}
token: ${{ secrets.CODECOV_TOKEN }}
11 changes: 8 additions & 3 deletions .github/workflows/ci-sub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,22 @@ concurrency:

env:
TZ: "Asia/Shanghai"

# for unit testing cases of some components that only execute on the latest go version.
LATEST_GO_VERSION: "1.23"

jobs:
code-test:
runs-on: ubuntu-latest

strategy:
matrix:
# 🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥
# When adding new go version to the list, make sure:
# 1. Update the `LATEST_GO_VERSION` env variable.
# 🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥
go-version: [ "1.20", "1.21", "1.22", "1.23" ]
goarch: [ "386", "amd64" ]

runs-on: ubuntu-latest

steps:
- name: Setup Timezone
uses: szenius/[email protected]
Expand Down
1 change: 0 additions & 1 deletion cmd/gf/go.work
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,5 @@ replace (
github.com/gogf/gf/contrib/drivers/oracle/v2 => ../../contrib/drivers/oracle
github.com/gogf/gf/contrib/drivers/pgsql/v2 => ../../contrib/drivers/pgsql
github.com/gogf/gf/contrib/drivers/sqlite/v2 => ../../contrib/drivers/sqlite
github.com/gogf/gf/contrib/drivers/dm/v2 => ../../contrib/drivers/dm
github.com/gogf/gf/v2 => ../../
)
4 changes: 3 additions & 1 deletion cmd/gf/internal/cmd/cmd_gen_dao.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ package cmd

import (
_ "github.com/gogf/gf/contrib/drivers/clickhouse/v2"
// _ "github.com/gogf/gf/contrib/drivers/dm/v2" // precompilation does not support certain target platforms.
_ "github.com/gogf/gf/contrib/drivers/mssql/v2"
_ "github.com/gogf/gf/contrib/drivers/mysql/v2"
_ "github.com/gogf/gf/contrib/drivers/oracle/v2"
_ "github.com/gogf/gf/contrib/drivers/pgsql/v2"
_ "github.com/gogf/gf/contrib/drivers/sqlite/v2"

// do not add dm in cli pre-compilation,
// the dm driver does not support certain target platforms.
// _ "github.com/gogf/gf/contrib/drivers/dm/v2"
"github.com/gogf/gf/cmd/gf/v2/internal/cmd/gendao"
)

Expand Down
Loading
Loading