You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by mi...@apache.org on 2023/04/13 06:08:05 UTC
[shardingsphere-on-cloud] branch feat-storagenode updated: Chore: Rebase main (#309)
This is an automated email from the ASF dual-hosted git repository.
miaoliyao pushed a commit to branch feat-storagenode
in repository https://gitbox.apache.org/repos/asf/shardingsphere-on-cloud.git
The following commit(s) were added to refs/heads/feat-storagenode by this push:
new fc8a053 Chore: Rebase main (#309)
fc8a053 is described below
commit fc8a0531685dc292febe3aceb8bef5638f0a7a34
Author: wentao-xu <cu...@yahoo.com>
AuthorDate: Thu Apr 13 14:07:59 2023 +0800
Chore: Rebase main (#309)
* bugfix(pitr): fix storage nodes info struct error, add endtime to backup file, and fix backup mode ptrack did not work. (#288)
* chore(ci): add golangci-lint and refactor according to the result (#294)
* chore: add golangci-lint check config and update Makefile for check
* fix: fix according to golangci-lint
* fix: rename Api to API
* fix: fix sharedVolumeAndMountBuild SetVolumeMountSize non-zero slice
* fix: remove overlapped Build method from shardingSphereProxyContainerBuilder
* chore: add license header
* chore(ci): add golangci-lint (#295)
* chore(ci): add golangci-lint to github action
Signed-off-by: mlycore <ma...@126.com>
* chore(ci): seperate unit tests
Signed-off-by: mlycore <ma...@126.com>
* chore(ci): add golangci-lint for pitr
Signed-off-by: mlycore <ma...@126.com>
* chore(ci): fix license header
Signed-off-by: mlycore <ma...@126.com>
---------
Signed-off-by: mlycore <ma...@126.com>
* refactor(operator): refactor according to golangci-lint (#296)
* chore: seperate golangci-lint to base and advanced lints
Signed-off-by: mlycore <ma...@126.com>
* fix: introduce CondSucceed to Proxy and ComputeNode status
Signed-off-by: mlycore <ma...@126.com>
* chore: fix according to golangci-lint
Signed-off-by: mlycore <ma...@126.com>
* chore: refactor according to golangci-lint
Signed-off-by: mlycore <ma...@126.com>
* chore: update golangci-lint
Signed-off-by: mlycore <ma...@126.com>
* chore: remove loggercheck
Signed-off-by: mlycore <ma...@126.com>
* fix: fix unit test
Signed-off-by: mlycore <ma...@126.com>
* chore(ci): seperate golint to operator and pitr
Signed-off-by: mlycore <ma...@126.com>
* chore: add lint for commit message
Signed-off-by: mlycore <ma...@126.com>
---------
Signed-off-by: mlycore <ma...@126.com>
* fix: fix proxy controller according to golangci-lint (#299)
* chore: update golangci-lint
Signed-off-by: mlycore <ma...@126.com>
* chore: fix according to golangci-lint
Signed-off-by: mlycore <ma...@126.com>
* refactor: refactor update service with computenode
Signed-off-by: mlycore <ma...@126.com>
* fix: update service
Signed-off-by: mlycore <ma...@126.com>
* refactor: refactor proxy controller reconcile hpa, deployment and configmap according to golangci-lint
Signed-off-by: mlycore <ma...@126.com>
* chore: update commit-msg action
Signed-off-by: mlycore <ma...@126.com>
---------
Signed-off-by: mlycore <ma...@126.com>
* chore: update varnamelen default to 1
Signed-off-by: mlycore <ma...@126.com>
* fix: fix updateSSProxyContainer
Signed-off-by: mlycore <ma...@126.com>
* refactor: refactor getReadyProxyInstances
Signed-off-by: mlycore <ma...@126.com>
* refactor: refactor getReadyNodes
Signed-off-by: mlycore <ma...@126.com>
* fix: fix NewDeployment and set agent
Signed-off-by: mlycore <ma...@126.com>
* chore: update golangci-lint
Signed-off-by: mlycore <ma...@126.com>
* bugfix(pitr): fix test case show no record (#297)
* test(pitr): fix test case show no record
* style: lint code
* feat: Implements EncryptionRule DistSQL Parser Visitor with AST (#301)
* feat: implements encrypt rule distsql visitor interface with ast
Signed-off-by: wangbo <wa...@sphere-ex.com>
* feat: add TODO
Signed-off-by: wangbo <wa...@sphere-ex.com>
* chore: fix import package error
Signed-off-by: wangbo <wa...@sphere-ex.com>
* chore: fix ci error
Signed-off-by: wangbo <wa...@sphere-ex.com>
* chore: fix lint
Signed-off-by: wangbo <wa...@sphere-ex.com>
* feat: add encrypt distsql ast
Signed-off-by: wangbo <wa...@sphere-ex.com>
---------
Signed-off-by: wangbo <wa...@sphere-ex.com>
Co-authored-by: wangbo <wa...@sphere-ex.com>
* chore: add ifExists to ast (#304)
Signed-off-by: wangbo <wa...@sphere-ex.com>
Co-authored-by: wangbo <wa...@sphere-ex.com>
* Common builder (#305)
* refactor container builder to pkg/common
* fix golang-lint check
* add lincense check
---------
Co-authored-by: moonman <ag...@163.com>
* refactor configmap to common pkg (#306)
Co-authored-by: moonman <ag...@163.com>
---------
Signed-off-by: mlycore <ma...@126.com>
Signed-off-by: wangbo <wa...@sphere-ex.com>
Co-authored-by: liyao <ma...@126.com>
Co-authored-by: Zhengqiang Duan <du...@apache.org>
Co-authored-by: Jack <87...@qq.com>
Co-authored-by: wangbo <wa...@sphere-ex.com>
Co-authored-by: moomman <85...@users.noreply.github.com>
Co-authored-by: moonman <ag...@163.com>
---
.github/workflows/commit-msg.yml | 41 +
.github/workflows/operator-golint.yml | 54 +
.../{unit-test.yml => operator-unit-test.yml} | 20 +-
.github/workflows/pitr-golint.yml | 59 +
.../{unit-test.yml => pitr-unit-test.yml} | 18 -
pitr/agent/.golangci.yml | 365 ++
pitr/agent/Makefile | 4 +-
pitr/agent/internal/cons/error.go | 10 +-
pitr/agent/internal/handler/backup.go | 14 +-
.../internal/handler/middleware/http_header.go | 2 +-
pitr/agent/internal/handler/middleware/logger.go | 12 +-
pitr/agent/internal/handler/middleware/recovery.go | 1 +
.../handler/middleware/uniform_err_resp.go | 1 +
pitr/agent/internal/handler/restore.go | 8 +-
pitr/agent/internal/handler/show.go | 13 +-
pitr/agent/internal/handler/view/backup.go | 12 +-
pitr/agent/internal/handler/view/restore.go | 19 +-
pitr/agent/internal/handler/view/show.go | 39 +-
pitr/agent/internal/pkg/model/backup.go | 4 +-
pitr/agent/internal/pkg/opengauss.go | 22 +-
pitr/agent/internal/pkg/opengauss_test.go | 1 +
pitr/agent/main.go | 11 +-
pitr/agent/pkg/cmds/cmd.go | 2 +-
pitr/agent/pkg/gsutil/conn.go | 7 +-
pitr/agent/pkg/logging/field.go | 6 +-
pitr/agent/pkg/logging/log.go | 1 +
pitr/agent/pkg/logging/zap_log.go | 1 +
pitr/agent/pkg/strutil/rand_string.go | 23 +-
pitr/agent/pkg/syncutils/recover_func.go | 4 +-
pitr/cli/.golangci.yml | 365 ++
pitr/cli/Makefile | 4 +-
pitr/cli/go.mod | 2 +
pitr/cli/go.sum | 5 +
pitr/cli/internal/cmd/backup.go | 87 +-
pitr/cli/internal/cmd/cmd_suite_test.go | 1 +
pitr/cli/internal/cmd/restore.go | 15 +-
pitr/cli/internal/cmd/restore_test.go | 45 +-
pitr/cli/internal/cmd/root.go | 5 +-
pitr/cli/internal/cmd/show.go | 12 +-
pitr/cli/internal/cmd/show_test.go | 6 +-
pitr/cli/internal/pkg/agent-server.go | 9 +-
pitr/cli/internal/pkg/agent-server_test.go | 20 +-
pitr/cli/internal/pkg/local-storage.go | 19 +-
pitr/cli/internal/pkg/mocks/local-storage.go | 4 +-
pitr/cli/internal/pkg/model/as_backup.go | 4 +-
pitr/cli/internal/pkg/model/as_restore.go | 6 +-
pitr/cli/internal/pkg/model/as_show.go | 12 +-
pitr/cli/internal/pkg/model/ls_backup.go | 15 +-
pitr/cli/internal/pkg/shardingsphere-proxy.go | 46 +-
pitr/cli/internal/pkg/xerr/err.go | 11 +-
pitr/cli/main.go | 2 +-
pitr/cli/pkg/gsutil/conn_test.go | 29 +-
pitr/cli/pkg/httputils/req.go | 3 +
pitr/cli/pkg/logging/field.go | 11 -
pitr/cli/pkg/stringutil/rand_string.go | 24 +-
pitr/cli/pkg/stringutil/rand_string_test.go | 4 +-
shardingsphere-operator/.golangci.yml | 365 ++
shardingsphere-operator/Makefile | 9 +
.../api/v1alpha1/compute_node_types.go | 4 +-
.../api/v1alpha1/proxy_status.go | 8 +-
shardingsphere-operator/go.mod | 1 +
shardingsphere-operator/go.sum | 2 +
.../pkg/controllers/compute_node_controller.go | 220 +-
.../controllers/compute_node_controller_test.go | 111 +
.../pkg/controllers/proxy_controller.go | 114 +-
.../pkg/controllers/proxyconfig_controller.go | 2 +-
.../antlr4/encrypt/Alphabet.g4} | 52 +-
.../antlr4/encrypt/BaseRule.g4} | 56 +-
.../pkg/distsql/antlr4/encrypt/Keyword.g4 | 184 +
.../antlr4/encrypt/Literals.g4} | 49 +-
.../pkg/distsql/antlr4/encrypt/RDLStatement.g4 | 116 +
.../antlr4/encrypt/RQLStatement.g4} | 35 +-
.../pkg/distsql/antlr4/encrypt/Symbol.g4 | 61 +
shardingsphere-operator/pkg/distsql/ast/rdl_ast.go | 163 +
.../pkg/distsql/visitor/rdl_visitor.go | 406 ++
.../encrypt/rdlstatement_base_visitor.go | 154 +
.../visitor_parser/encrypt/rdlstatement_lexer.go | 647 +++
.../visitor_parser/encrypt/rdlstatement_parser.go | 4651 ++++++++++++++++++++
.../visitor_parser/encrypt/rdlstatement_visitor.go | 123 +
.../pkg/reconcile/common/configmap.go | 68 +
.../pkg/reconcile/common/container.go | 160 +
.../pkg/reconcile/common/container_test.go | 70 +
.../pkg/reconcile/computenode/configmap.go | 89 +-
.../pkg/reconcile/computenode/configmap_test.go | 8 +-
.../pkg/reconcile/computenode/deployment.go | 258 +-
.../pkg/reconcile/computenode/deployment_test.go | 74 +-
.../pkg/reconcile/computenode/service.go | 71 +-
.../pkg/reconcile/computenode/service_test.go | 3 +-
.../pkg/reconcile/proxy/deployment.go | 150 +-
.../pkg/reconcile/proxy/deployment_test.go | 11 +-
.../pkg/reconcile/proxy/resource.go | 6 +-
.../pkg/reconcile/proxy/service.go | 2 +-
.../pkg/reconcile/proxy/status.go | 10 +-
.../pkg/reconcile/proxyconfig/configmap.go | 4 +-
shardingsphere-operator/pkg/webhook/webhook.go | 11 +-
95 files changed, 9143 insertions(+), 925 deletions(-)
diff --git a/.github/workflows/commit-msg.yml b/.github/workflows/commit-msg.yml
new file mode 100644
index 0000000..f9fae1c
--- /dev/null
+++ b/.github/workflows/commit-msg.yml
@@ -0,0 +1,41 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+
+name: lint-commit-message
+on: [pull_request]
+
+jobs:
+ commit-msg:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v3
+ with:
+ fetch-depth: 0
+ - name: Cache lint-commit-message
+ id: cache-lint-commit-message
+ uses: actions/cache@v3
+ with:
+ path: lint-commit-message
+ key: ${{ runner.os }}-lint-commit-message
+ - name: Lint commit message
+ run: |
+ git log --oneline ${{ github.event.pull_request.base.sha }}... \
+ | grep -vP '^\w{8} Merge ' \
+ | grep -vP '^\w{8} (feat|fix|build|chore|docs|style|refactor|perf|test|ci)(\(\w+(-\w+)?\))?:(\s*).*'
diff --git a/.github/workflows/operator-golint.yml b/.github/workflows/operator-golint.yml
new file mode 100644
index 0000000..f2dc26c
--- /dev/null
+++ b/.github/workflows/operator-golint.yml
@@ -0,0 +1,54 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+name: golangci-lint
+
+on:
+ push:
+ branches:
+ - main
+ pull_request:
+ branches:
+ - main
+ paths:
+ - 'shardingsphere-operator/**'
+ - '.github/workflows/operator-golint.yml'
+ - 'shardingsphere-operator/.golangci-lint.yml'
+
+jobs:
+ changes:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v3
+ golangci-lint:
+ name: lint
+ needs: changes
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v3
+ - name: Setup Go Env
+ uses: actions/setup-go@v3
+ with:
+ go-version: '1.19'
+ - name: Download golangci-lint
+ run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.49.0
+ - name: Lint ShardingSphere-Operator
+ run: |
+ cd shardingsphere-operator/
+ $(go env GOPATH)/bin/golangci-lint run -v --timeout 300s ./...
diff --git a/.github/workflows/unit-test.yml b/.github/workflows/operator-unit-test.yml
similarity index 73%
copy from .github/workflows/unit-test.yml
copy to .github/workflows/operator-unit-test.yml
index 5e77403..d8a2149 100644
--- a/.github/workflows/unit-test.yml
+++ b/.github/workflows/operator-unit-test.yml
@@ -22,8 +22,7 @@ on:
branches: [ main ]
paths:
- 'shardingsphere-operator/**'
- - 'pitr/**'
- - '.github/workflows/unit-test.yml'
+ - '.github/workflows/operator-unit-test.yml'
jobs:
operator:
runs-on: ubuntu-latest
@@ -42,20 +41,3 @@ jobs:
uses: codecov/codecov-action@v3
with:
files: ./shardingsphere-operator/coverage.txt
- pitr-cli:
- runs-on: ubuntu-latest
- steps:
- - name: "checkout codes"
- uses: actions/checkout@v3
- - name: "setup go"
- uses: actions/setup-go@v4
- with:
- go-version: '^1.18.1'
- - name: "unit test"
- run: |
- cd pitr/cli
- make test
- - name: "Code coverage"
- uses: codecov/codecov-action@v3
- with:
- files: ./pitr/cli/cover.out
diff --git a/.github/workflows/pitr-golint.yml b/.github/workflows/pitr-golint.yml
new file mode 100644
index 0000000..456f3a3
--- /dev/null
+++ b/.github/workflows/pitr-golint.yml
@@ -0,0 +1,59 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+name: golangci-lint
+
+on:
+ push:
+ branches:
+ - main
+ pull_request:
+ branches:
+ - main
+ paths:
+ - 'pitr/**'
+ - '.github/workflows/pitr-golint.yml'
+ - 'pitr/agent/.golangci-lint.yml'
+ - 'pitr/cli/.golangci-lint.yml'
+
+jobs:
+ changes:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v3
+ golangci-lint:
+ name: lint
+ needs: changes
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v3
+ - name: Setup Go Env
+ uses: actions/setup-go@v3
+ with:
+ go-version: '1.19'
+ - name: Download golangci-lint
+ run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.49.0
+ - name: Lint Pitr Cli
+ run: |
+ cd pitr/cli
+ $(go env GOPATH)/bin/golangci-lint run -v --timeout 300s ./...
+ - name: Lint Pitr Agent
+ run: |
+ cd pitr/agent
+ $(go env GOPATH)/bin/golangci-lint run -v --timeout 300s ./...
diff --git a/.github/workflows/unit-test.yml b/.github/workflows/pitr-unit-test.yml
similarity index 73%
rename from .github/workflows/unit-test.yml
rename to .github/workflows/pitr-unit-test.yml
index 5e77403..560f31f 100644
--- a/.github/workflows/unit-test.yml
+++ b/.github/workflows/pitr-unit-test.yml
@@ -21,27 +21,9 @@ on:
pull_request:
branches: [ main ]
paths:
- - 'shardingsphere-operator/**'
- 'pitr/**'
- '.github/workflows/unit-test.yml'
jobs:
- operator:
- runs-on: ubuntu-latest
- steps:
- - name: "checkout codes"
- uses: actions/checkout@v3
- - name: "setup go"
- uses: actions/setup-go@v4
- with:
- go-version: '^1.18.1'
- - name: "unit test"
- run: |
- cd shardingsphere-operator
- make test
- - name: "Code coverage"
- uses: codecov/codecov-action@v3
- with:
- files: ./shardingsphere-operator/coverage.txt
pitr-cli:
runs-on: ubuntu-latest
steps:
diff --git a/pitr/agent/.golangci.yml b/pitr/agent/.golangci.yml
new file mode 100644
index 0000000..1eb7449
--- /dev/null
+++ b/pitr/agent/.golangci.yml
@@ -0,0 +1,365 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+run:
+ timeout: 10m
+ skip-files:
+ - "^zz_generated.*"
+ - "_test.go"
+linters:
+ disable-all: true
+ enable:
+ # The base lints
+ - errcheck
+ - gosimple
+ - govet
+ - ineffassign
+ - staticcheck
+ - typecheck
+ - unused
+ - unused
+ - bodyclose
+ - cyclop
+ - nilerr
+ - goimports
+ - asciicheck
+ - prealloc
+ - stylecheck
+ - exportloopref
+ - rowserrcheck
+ - makezero
+ - durationcheck
+ - gosec
+ - predeclared
+ # Deprecated lints
+ - structcheck
+ - varcheck
+ - deadcode
+
+ # The advanced lints
+ - dupl
+ - exhaustive
+ - godot
+ - misspell
+ #- varnamelen
+ - gocritic
+ #- exhaustruct
+ #- nestif
+ #- wsl
+ #- gocognit
+# Refers: https://gist.github.com/maratori/47a4d00457a92aa426dbd48a18776322
+linters-settings:
+ wsl:
+ # See https://github.com/bombsimon/wsl/blob/master/doc/configuration.md for documentation of available settings.
+ # These are the defaults for `golangci-lint`.
+
+ # Do strict checking when assigning from append (x = append(x, y)). If
+ # this is set to true - the append call must append either a variable
+ # assigned, called or used on the line above.
+ strict-append: true
+ # Allows assignments to be cuddled with variables used in calls on
+ # line above and calls to be cuddled with assignments of variables
+ # used in call on line above.
+ allow-assign-and-call: true
+ # Allows assignments to be cuddled with anything.
+ allow-assign-and-anything: false
+ # Allows cuddling to assignments even if they span over multiple lines.
+ allow-multiline-assign: true
+ # If the number of lines in a case block is equal to or lager than this
+ # number, the case *must* end white a newline.
+ force-case-trailing-whitespace: 0
+ # Allow blocks to end with comments.
+ allow-trailing-comment: false
+ # Allow multiple comments in the beginning of a block separated with newline.
+ allow-separated-leading-comment: false
+ # Allow multiple var/declaration statements to be cuddled.
+ allow-cuddle-declarations: false
+ # A list of call idents that everything can be cuddled with.
+ # Defaults to calls looking like locks.
+ allow-cuddle-with-calls: ["Lock", "RLock"]
+ # AllowCuddleWithRHS is a list of right hand side variables that is allowed
+ # to be cuddled with anything. Defaults to assignments or calls looking
+ # like unlocks.
+ allow-cuddle-with-rhs: ["Unlock", "RUnlock"]
+ # Causes an error when an If statement that checks an error variable doesn't
+ # cuddle with the assignment of that variable.
+ force-err-cuddling: false
+ # When force-err-cuddling is enabled this is a list of names
+ # used for error variables to check for in the conditional.
+ error-variable-names: ["err"]
+ # Causes an error if a short declaration (:=) cuddles with anything other than
+ # another short declaration.
+ # This logic overrides force-err-cuddling among others.
+ force-short-decl-cuddling: false
+ varnamelen:
+ # The longest distance, in source lines, that is being considered a "small scope".
+ # Variables used in at most this many lines will be ignored.
+ # Default: 5
+ max-distance: 6
+ # The minimum length of a variable's name that is considered "long".
+ # Variable names that are at least this long will be ignored.
+ # Default: 3
+ min-name-length: 2
+ # Check method receivers.
+ # Default: false
+ check-receiver: false
+ # Check named return values.
+ # Default: false
+ check-return: true
+ # Check type parameters.
+ # Default: false
+ check-type-param: true
+ # Ignore "ok" variables that hold the bool return value of a type assertion.
+ # Default: false
+ ignore-type-assert-ok: true
+ # Ignore "ok" variables that hold the bool return value of a map index.
+ # Default: false
+ ignore-map-index-ok: true
+ # Ignore "ok" variables that hold the bool return value of a channel receive.
+ # Default: false
+ ignore-chan-recv-ok: true
+ # Optional list of variable names that should be ignored completely.
+ # Default: []
+ ignore-names:
+ - err
+ # Optional list of variable declarations that should be ignored completely.
+ # Entries must be in one of the following forms (see below for examples):
+ # - for variables, parameters, named return values, method receivers, or type parameters:
+ # <name> <type> (<type> can also be a pointer/slice/map/chan/...)
+ # - for constants: const <name>
+ #
+ # Default: []
+ ignore-decls:
+ - c echo.Context
+ - t testing.T
+ - f *foo.Bar
+ - e error
+ - i int
+ - const C
+ - T any
+ - m map[string]int
+ prealloc:
+ # IMPORTANT: we don't recommend using this linter before doing performance profiling.
+ # For most programs usage of prealloc will be a premature optimization.
+
+ # Report pre-allocation suggestions only on simple loops that have no returns/breaks/continues/gotos in them.
+ # Default: true
+ simple: false
+ # Report pre-allocation suggestions on range loops.
+ # Default: true
+ range-loops: false
+ # Report pre-allocation suggestions on for loops.
+ # Default: false
+ for-loops: true
+ #nestif:
+ # Minimal complexity of if statements to report.
+ # Default: 5
+ # min-complexity: 4
+ misspell:
+ # Correct spellings using locale preferences for US or UK.
+ # Setting locale to US will correct the British spelling of 'colour' to 'color'.
+ # Default is to use a neutral variety of English.
+ locale: US
+ # Default: []
+ ignore-words:
+ - someword
+ godot:
+ # Comments to be checked: `declarations`, `toplevel`, or `all`.
+ # Default: declarations
+ scope: toplevel
+ # List of regexps for excluding particular comment lines from check.
+ # Default: []
+ exclude:
+ # Exclude todo and fixme comments.
+ - "^fixme:"
+ - "^todo:"
+ # Check that each sentence ends with a period.
+ # Default: true
+ period: false
+ # Check that each sentence starts with a capital letter.
+ # Default: false
+ capital: false
+ dupl:
+ # Tokens count to trigger issue.
+ # Default: 150
+ threshold: 100
+ cyclop:
+ # The maximal code complexity to report.
+ # Default: 10
+ max-complexity: 30
+ # The maximal average package complexity.
+ # If it's higher than 0.0 (float) the check is enabled
+ # Default: 0.0
+ package-average: 10.0
+ errcheck:
+ # Report about not checking of errors in type assertions: `a := b.(MyStruct)`.
+ # Such cases aren't reported by default.
+ # Default: false
+ check-type-assertions: true
+ exhaustive:
+ # Program elements to check for exhaustiveness.
+ # Default: [ switch ]
+ check:
+ - switch
+ - map
+ funlen:
+ # Checks the number of lines in a function.
+ # If lower than 0, disable the check.
+ # Default: 60
+ lines: 100
+ # Checks the number of statements in a function.
+ # If lower than 0, disable the check.
+ # Default: 40
+ statements: 50
+ gocognit:
+ # Minimal code complexity to report.
+ # Default: 30 (but we recommend 10-20)
+ min-complexity: 20
+ gocritic:
+ # Which checks should be enabled; can't be combined with 'disabled-checks'.
+ # See https://go-critic.github.io/overview#checks-overview.
+ # To check which checks are enabled run `GL_DEBUG=gocritic golangci-lint run`.
+ # By default, list of stable checks is used.
+ enabled-checks:
+ - elseif
+ - nestingReduce
+ - unnamedResult
+ # - ruleguard
+ - truncateCmp
+ - hugeparam
+ - rangevalcopy
+ - captlocal
+ - underef
+ - toomanyresultschecker
+ - rangeexprcopy
+ # Which checks should be disabled; can't be combined with 'enabled-checks'.
+ # Default: []
+ disabled-checks:
+ - regexpMust
+ # Enable multiple checks by tags, run `GL_DEBUG=gocritic golangci-lint run` to see all tags and checks.
+ # See https://github.com/go-critic/go-critic#usage -> section "Tags".
+ # Default: []
+ enabled-tags:
+ - diagnostic
+ - style
+ - performance
+ - experimental
+ - opinionated
+ disabled-tags:
+ - diagnostic
+ - style
+ - performance
+ - experimental
+ - opinionated
+ # Settings passed to gocritic.
+ # The settings key is the name of a supported gocritic checker.
+ # The list of supported checkers can be find in https://go-critic.github.io/overview.
+ settings:
+ # Must be valid enabled check name.
+ captLocal:
+ # Whether to restrict checker to params only.
+ # Default: true
+ paramsOnly: false
+ elseif:
+ # Whether to skip balanced if-else pairs.
+ # Default: true
+ skipBalanced: false
+ hugeParam:
+ # Size in bytes that makes the warning trigger.
+ # Default: 80
+ sizeThreshold: 70
+ nestingReduce:
+ # Min number of statements inside a branch to trigger a warning.
+ # Default: 5
+ bodyWidth: 4
+ rangeExprCopy:
+ # Size in bytes that makes the warning trigger.
+ # Default: 512
+ sizeThreshold: 516
+ # Whether to check test functions
+ # Default: true
+ skipTestFuncs: false
+ rangeValCopy:
+ # Size in bytes that makes the warning trigger.
+ # Default: 128
+ sizeThreshold: 32
+ # Whether to check test functions.
+ # Default: true
+ skipTestFuncs: false
+ ruleguard:
+ # Enable debug to identify which 'Where' condition was rejected.
+ # The value of the parameter is the name of a function in a ruleguard file.
+ #
+ # When a rule is evaluated:
+ # If:
+ # The Match() clause is accepted; and
+ # One of the conditions in the Where() clause is rejected,
+ # Then:
+ # ruleguard prints the specific Where() condition that was rejected.
+ #
+ # The flag is passed to the ruleguard 'debug-group' argument.
+ # Default: ""
+ debug: 'emptyDecl'
+ # Deprecated, use 'failOn' param.
+ # If set to true, identical to failOn='all', otherwise failOn=''
+ failOnError: false
+ # Determines the behavior when an error occurs while parsing ruleguard files.
+ # If flag is not set, log error and skip rule files that contain an error.
+ # If flag is set, the value must be a comma-separated list of error conditions.
+ # - 'all': fail on all errors.
+ # - 'import': ruleguard rule imports a package that cannot be found.
+ # - 'dsl': gorule file does not comply with the ruleguard DSL.
+ # Default: ""
+ failOn: dsl
+ # Comma-separated list of file paths containing ruleguard rules.
+ # If a path is relative, it is relative to the directory where the golangci-lint command is executed.
+ # The special '${configDir}' variable is substituted with the absolute directory containing the golangci config file.
+ # Glob patterns such as 'rules-*.go' may be specified.
+ # Default: ""
+ rules: '${configDir}/ruleguard/rules-*.go,${configDir}/myrule1.go'
+ # Comma-separated list of enabled groups or skip empty to enable everything.
+ # Tags can be defined with # character prefix.
+ # Default: "<all>"
+ enable: "myGroupName,#myTagName"
+ # Comma-separated list of disabled groups or skip empty to enable everything.
+ # Tags can be defined with # character prefix.
+ # Default: ""
+ disable: "myGroupName,#myTagName"
+ tooManyResultsChecker:
+ # Maximum number of results.
+ # Default: 5
+ maxResults: 10
+ truncateCmp:
+ # Whether to skip int/uint/uintptr types.
+ # Default: true
+ skipArchDependent: false
+ underef:
+ # Whether to skip (*x).method() calls where x is a pointer receiver.
+ # Default: true
+ skipRecvDeref: false
+ unnamedResult:
+ # Whether to check exported functions.
+ # Default: false
+ checkExported: true
+issues:
+ exclude-rules:
+ - path: _test\.go
+ linters:
+ - errcheck
+ - gosec
+ - rowserrcheck
+ - makezero
diff --git a/pitr/agent/Makefile b/pitr/agent/Makefile
index 6f3a0ae..7fd3b96 100644
--- a/pitr/agent/Makefile
+++ b/pitr/agent/Makefile
@@ -1,4 +1,4 @@
-.PHONY:openssl-local test build
+.PHONY:openssl-local test build lint
GOOS := $(shell go env GOOS)
@@ -12,3 +12,5 @@ test:
build:
GOOS=$(GOOS) go build -o pitr-agent
+lint:
+ golangci-lint run -v --timeout 5m
diff --git a/pitr/agent/internal/cons/error.go b/pitr/agent/internal/cons/error.go
index d9b2b2a..bf4a961 100644
--- a/pitr/agent/internal/cons/error.go
+++ b/pitr/agent/internal/cons/error.go
@@ -23,7 +23,7 @@ import (
var (
Internal = xerror.New(10000, "Internal error.")
- InvalidHttpHeader = xerror.New(10001, "Invalid http header.")
+ InvalidHTTPHeader = xerror.New(10001, "Invalid http header.")
DataNotFound = xerror.New(10002, "Data not found.")
CmdOperateFailed = xerror.New(10003, "Command operate failed.")
BackupPathAlreadyExist = xerror.New(10004, "The backup path already exists.")
@@ -33,7 +33,7 @@ var (
StartOpenGaussFailed = xerror.New(10008, "Failed to start opengauss.")
StopOpenGaussFailed = xerror.New(10009, "Failed to stop opengauss.")
RestoreFailed = xerror.New(10010, "Failed to restore opengauss.")
- InvalidDbPort = xerror.New(10011, "Invalid dn port.")
+ InvalidDBPort = xerror.New(10011, "Invalid dn port.")
MissingUsername = xerror.New(10012, "Missing username")
MissingPassword = xerror.New(10013, "Missing password.")
MissingDnBackupPath = xerror.New(10014, "Missing dn backup path.")
@@ -41,10 +41,10 @@ var (
MissingDnBackupMode = xerror.New(10016, "Missing dn backup mode.")
InvalidDnBackupMode = xerror.New(10017, "Invalid dn backup mode.")
MissingInstance = xerror.New(10018, "Missing instance.")
- MissingDnBackupId = xerror.New(10019, "Missing dn backup id.")
+ MissingDnBackupID = xerror.New(10019, "Missing dn backup id.")
BodyParseFailed = xerror.New(10020, "Invalid http request body.")
- MissingDbName = xerror.New(10021, "Missing db name.")
- DbConnectionFailed = xerror.New(10022, "Database connection failed.")
+ MissingDBName = xerror.New(10021, "Missing db name.")
+ DBConnectionFailed = xerror.New(10022, "Database connection failed.")
UnmatchBackupID = xerror.New(10023, "Unmatch any backup id.")
InvalidPgDataDir = xerror.New(10024, "Invalid PGDATA dir.")
UnknownOgStatus = xerror.New(10025, "Unknown openGauss status.")
diff --git a/pitr/agent/internal/handler/backup.go b/pitr/agent/internal/handler/backup.go
index b69e16d..bb000f7 100644
--- a/pitr/agent/internal/handler/backup.go
+++ b/pitr/agent/internal/handler/backup.go
@@ -20,14 +20,12 @@ package handler
import (
"errors"
"fmt"
- "github.com/apache/shardingsphere-on-cloud/pitr/agent/internal/pkg"
- "github.com/apache/shardingsphere-on-cloud/pitr/agent/pkg/responder"
+ "github.com/apache/shardingsphere-on-cloud/pitr/agent/internal/cons"
"github.com/apache/shardingsphere-on-cloud/pitr/agent/internal/handler/view"
-
+ "github.com/apache/shardingsphere-on-cloud/pitr/agent/internal/pkg"
+ "github.com/apache/shardingsphere-on-cloud/pitr/agent/pkg/responder"
"github.com/gofiber/fiber/v2"
-
- "github.com/apache/shardingsphere-on-cloud/pitr/agent/internal/cons"
)
func Backup(ctx *fiber.Ctx) error {
@@ -41,9 +39,9 @@ func Backup(ctx *fiber.Ctx) error {
return fmt.Errorf("invalid parameter,err=%w", err)
}
- if err := pkg.OG.Auth(in.Username, in.Password, in.DbName, in.DbPort); err != nil {
+ if err := pkg.OG.Auth(in.Username, in.Password, in.DBName, in.DBPort); err != nil {
efmt := "pkg.OG.Auth failure[un=%s,pw.len=%d,db=%s],err=%w"
- return fmt.Errorf(efmt, in.Username, len(in.Password), in.DbName, err)
+ return fmt.Errorf(efmt, in.Username, len(in.Password), in.DBName, err)
}
// try to add backup instance
@@ -51,7 +49,7 @@ func Backup(ctx *fiber.Ctx) error {
return fmt.Errorf("add instance failed, err=%w", err)
}
- backupID, err := pkg.OG.AsyncBackup(in.DnBackupPath, in.Instance, in.DnBackupMode, 1, in.DbPort)
+ backupID, err := pkg.OG.AsyncBackup(in.DnBackupPath, in.Instance, in.DnBackupMode, 1, in.DBPort)
if err != nil {
efmt := "pkg.OG.AsyncBackup[path=%s,instance=%s,mode=%s] failure,err=%w"
return fmt.Errorf(efmt, in.DnBackupPath, in.Instance, in.DnBackupMode, err)
diff --git a/pitr/agent/internal/handler/middleware/http_header.go b/pitr/agent/internal/handler/middleware/http_header.go
index 09bd16e..d41962b 100644
--- a/pitr/agent/internal/handler/middleware/http_header.go
+++ b/pitr/agent/internal/handler/middleware/http_header.go
@@ -29,7 +29,7 @@ import (
func RequestIDChecker() fiber.Handler {
return func(ctx *fiber.Ctx) error {
if id := ctx.Get(cons.RequestID); strings.Trim(id, " ") == "" {
- return responder.Error(ctx, cons.InvalidHttpHeader)
+ return responder.Error(ctx, cons.InvalidHTTPHeader)
}
return ctx.Next()
}
diff --git a/pitr/agent/internal/handler/middleware/logger.go b/pitr/agent/internal/handler/middleware/logger.go
index fe8b062..beac16f 100644
--- a/pitr/agent/internal/handler/middleware/logger.go
+++ b/pitr/agent/internal/handler/middleware/logger.go
@@ -33,13 +33,14 @@ func Logger(log logging.ILog) fiber.Handler {
start = time.Now()
)
err := ctx.Next()
+ //nolint:exhaustive
m := map[logging.FieldKey]string{
logging.Duration: fmt.Sprintf("%dms", time.Since(start).Milliseconds()),
logging.Path: ctx.Route().Path,
- logging.RequestUri: string(ctx.Request().RequestURI()),
+ logging.RequestURI: string(ctx.Request().RequestURI()),
logging.RequestID: ctx.Get(cons.RequestID),
- logging.HttpStatus: fmt.Sprintf("%d", ctx.Response().StatusCode()),
- logging.HttpMethod: ctx.Method(),
+ logging.HTTPStatus: fmt.Sprintf("%d", ctx.Response().StatusCode()),
+ logging.HTTPMethod: ctx.Method(),
}
if err != nil {
m[logging.ErrorKey] = err.Error()
@@ -52,11 +53,12 @@ func Logger(log logging.ILog) fiber.Handler {
// AccessLog logging Access log.
func AccessLog(log logging.ILog) fiber.Handler {
return func(ctx *fiber.Ctx) error {
+ //nolint:exhaustive
log.Fields(map[logging.FieldKey]string{
logging.Path: ctx.Route().Path,
- logging.RequestUri: string(ctx.Request().RequestURI()),
+ logging.RequestURI: string(ctx.Request().RequestURI()),
logging.RequestID: ctx.Get(cons.RequestID),
- logging.HttpMethod: ctx.Method(),
+ logging.HTTPMethod: ctx.Method(),
}).Info("Access log")
return ctx.Next()
}
diff --git a/pitr/agent/internal/handler/middleware/recovery.go b/pitr/agent/internal/handler/middleware/recovery.go
index cd8acaf..868b262 100644
--- a/pitr/agent/internal/handler/middleware/recovery.go
+++ b/pitr/agent/internal/handler/middleware/recovery.go
@@ -32,6 +32,7 @@ func Recover(log logging.ILog) fiber.Handler {
return func(ctx *fiber.Ctx) error {
defer func() {
if r := recover(); r != nil {
+ //nolint:exhaustive
log.Fields(map[logging.FieldKey]string{
logging.RequestID: ctx.Get(cons.RequestID),
logging.ErrorKey: fmt.Sprint(r),
diff --git a/pitr/agent/internal/handler/middleware/uniform_err_resp.go b/pitr/agent/internal/handler/middleware/uniform_err_resp.go
index e8b4958..06e8083 100644
--- a/pitr/agent/internal/handler/middleware/uniform_err_resp.go
+++ b/pitr/agent/internal/handler/middleware/uniform_err_resp.go
@@ -32,6 +32,7 @@ func UniformErrResp(log logging.ILog) fiber.Handler {
if err == nil {
return nil
}
+ //nolint:exhaustive
log.Fields(map[logging.FieldKey]string{
logging.ErrorKey: err.Error(),
logging.RequestID: ctx.Get(cons.RequestID),
diff --git a/pitr/agent/internal/handler/restore.go b/pitr/agent/internal/handler/restore.go
index 080e0e2..32d2045 100644
--- a/pitr/agent/internal/handler/restore.go
+++ b/pitr/agent/internal/handler/restore.go
@@ -42,9 +42,9 @@ func Restore(ctx *fiber.Ctx) (err error) {
return
}
- if err = pkg.OG.Auth(in.Username, in.Password, in.DbName, in.DbPort); err != nil {
+ if err = pkg.OG.Auth(in.Username, in.Password, in.DBName, in.DBPort); err != nil {
efmt := "pkg.OG.Auth failure[un=%s,pw.len=%d,db=%s],err=%w"
- err = fmt.Errorf(efmt, in.Username, len(in.Password), in.DbName, err)
+ err = fmt.Errorf(efmt, in.Username, len(in.Password), in.DBName, err)
return
}
@@ -68,9 +68,9 @@ func Restore(ctx *fiber.Ctx) (err error) {
return
}
- if err = pkg.OG.Restore(in.DnBackupPath, in.Instance, in.DnBackupId); err != nil {
+ if err = pkg.OG.Restore(in.DnBackupPath, in.Instance, in.DnBackupID); err != nil {
efmt := "pkg.OG.Restore failure[path=%s,instance=%s,backupID=%s],err=%w"
- err = fmt.Errorf(efmt, in.DnBackupPath, in.Instance, in.DnBackupId, err)
+ err = fmt.Errorf(efmt, in.DnBackupPath, in.Instance, in.DnBackupID, err)
err2 := pkg.OG.MvTempToPgData()
err = fmt.Errorf("resotre failre[err=%s],pkg.OG.MvTempToPgData return err=%w", err, err2)
diff --git a/pitr/agent/internal/handler/show.go b/pitr/agent/internal/handler/show.go
index 076eb7f..58d8092 100644
--- a/pitr/agent/internal/handler/show.go
+++ b/pitr/agent/internal/handler/show.go
@@ -19,6 +19,7 @@ package handler
import (
"fmt"
+
"github.com/apache/shardingsphere-on-cloud/pitr/agent/internal/pkg"
"github.com/apache/shardingsphere-on-cloud/pitr/agent/pkg/responder"
@@ -40,15 +41,15 @@ func Show(ctx *fiber.Ctx) error {
return fmt.Errorf("invalid parameter,err=%w", err)
}
- if err := pkg.OG.Auth(in.Username, in.Password, in.DbName, in.DbPort); err != nil {
+ if err := pkg.OG.Auth(in.Username, in.Password, in.DBName, in.DBPort); err != nil {
efmt := "pkg.OG.Auth failure[un=%s,pw.len=%d,db=%s],err=%w"
- return fmt.Errorf(efmt, in.Username, len(in.Password), in.DbName, err)
+ return fmt.Errorf(efmt, in.Username, len(in.Password), in.DBName, err)
}
- data, err := pkg.OG.ShowBackup(in.DnBackupPath, in.Instance, in.DnBackupId)
+ data, err := pkg.OG.ShowBackup(in.DnBackupPath, in.Instance, in.DnBackupID)
if err != nil {
efmt := "pkg.OG.ShowBackupDetail failure[backupPath=%s,instance=%s,backupID=%s],err=%w"
- return fmt.Errorf(efmt, in.DnBackupPath, in.Instance, in.DnBackupId, err)
+ return fmt.Errorf(efmt, in.DnBackupPath, in.Instance, in.DnBackupID, err)
}
return responder.Success(ctx, view.NewBackupInfo(data, in.DnBackupPath, in.Instance))
@@ -65,9 +66,9 @@ func ShowList(ctx *fiber.Ctx) error {
return fmt.Errorf("invalid parameter,err=%w", err)
}
- if err := pkg.OG.Auth(in.Username, in.Password, in.DbName, in.DbPort); err != nil {
+ if err := pkg.OG.Auth(in.Username, in.Password, in.DBName, in.DBPort); err != nil {
efmt := "pkg.OG.Auth failure[un=%s,pw.len=%d,db=%s],err=%w"
- return fmt.Errorf(efmt, in.Username, len(in.Password), in.DbName, err)
+ return fmt.Errorf(efmt, in.Username, len(in.Password), in.DBName, err)
}
//Show list
diff --git a/pitr/agent/internal/handler/view/backup.go b/pitr/agent/internal/handler/view/backup.go
index b08952d..738078b 100644
--- a/pitr/agent/internal/handler/view/backup.go
+++ b/pitr/agent/internal/handler/view/backup.go
@@ -21,8 +21,8 @@ import "github.com/apache/shardingsphere-on-cloud/pitr/agent/internal/cons"
type (
BackupIn struct {
- DbPort uint16 `json:"db_port"`
- DbName string `json:"db_name"`
+ DBPort uint16 `json:"db_port"`
+ DBName string `json:"db_name"`
Username string `json:"username"`
Password string `json:"password"`
@@ -42,12 +42,12 @@ func (in *BackupIn) Validate() error {
return cons.Internal
}
- if in.DbPort == 0 {
- return cons.InvalidDbPort
+ if in.DBPort == 0 {
+ return cons.InvalidDBPort
}
- if in.DbName == "" {
- return cons.MissingDbName
+ if in.DBName == "" {
+ return cons.MissingDBName
}
if in.Username == "" {
diff --git a/pitr/agent/internal/handler/view/restore.go b/pitr/agent/internal/handler/view/restore.go
index 632db61..39a340c 100644
--- a/pitr/agent/internal/handler/view/restore.go
+++ b/pitr/agent/internal/handler/view/restore.go
@@ -20,26 +20,27 @@ package view
import "github.com/apache/shardingsphere-on-cloud/pitr/agent/internal/cons"
type RestoreIn struct {
- DbPort uint16 `json:"db_port"`
- DbName string `json:"db_name"`
+ DBPort uint16 `json:"db_port"`
+ DBName string `json:"db_name"`
Username string `json:"username"`
Password string `json:"password"`
Instance string `json:"instance"`
DnBackupPath string `json:"dn_backup_path"`
- DnBackupId string `json:"dn_backup_id"`
+ DnBackupID string `json:"dn_backup_id"`
}
+//nolint:dupl
func (in *RestoreIn) Validate() error {
if in == nil {
return cons.Internal
}
- if in.DbPort == 0 {
- return cons.InvalidDbPort
+ if in.DBPort == 0 {
+ return cons.InvalidDBPort
}
- if in.DbName == "" {
- return cons.MissingDbName
+ if in.DBName == "" {
+ return cons.MissingDBName
}
if in.Username == "" {
@@ -54,8 +55,8 @@ func (in *RestoreIn) Validate() error {
return cons.MissingDnBackupPath
}
- if in.DnBackupId == "" {
- return cons.MissingDnBackupId
+ if in.DnBackupID == "" {
+ return cons.MissingDnBackupID
}
if in.Instance == "" {
diff --git a/pitr/agent/internal/handler/view/show.go b/pitr/agent/internal/handler/view/show.go
index 022180c..22434af 100644
--- a/pitr/agent/internal/handler/view/show.go
+++ b/pitr/agent/internal/handler/view/show.go
@@ -24,18 +24,18 @@ import (
type (
ShowIn struct {
- DbPort uint16 `json:"db_port"`
- DbName string `json:"db_name"`
+ DBPort uint16 `json:"db_port"`
+ DBName string `json:"db_name"`
Username string `json:"username"`
Password string `json:"password"`
- DnBackupId string `json:"dn_backup_id"`
+ DnBackupID string `json:"dn_backup_id"`
DnBackupPath string `json:"dn_backup_path"`
Instance string `json:"instance"`
}
ShowListIn struct {
- DbPort uint16 `json:"db_port"`
- DbName string `json:"db_name"`
+ DBPort uint16 `json:"db_port"`
+ DBName string `json:"db_name"`
Username string `json:"username"`
Password string `json:"password"`
DnBackupPath string `json:"dn_backup_path"`
@@ -43,7 +43,7 @@ type (
}
BackupInfo struct {
- Id string `json:"dn_backup_id"`
+ ID string `json:"dn_backup_id"`
Path string `json:"dn_backup_path"`
Mode string `json:"db_backup_mode"`
Instance string `json:"instance"`
@@ -53,17 +53,18 @@ type (
}
)
+//nolint:dupl
func (in *ShowIn) Validate() error {
if in == nil {
return cons.Internal
}
- if in.DbPort == 0 {
- return cons.InvalidDbPort
+ if in.DBPort == 0 {
+ return cons.InvalidDBPort
}
- if in.DbName == "" {
- return cons.MissingDbName
+ if in.DBName == "" {
+ return cons.MissingDBName
}
if in.Username == "" {
@@ -78,8 +79,8 @@ func (in *ShowIn) Validate() error {
return cons.MissingDnBackupPath
}
- if in.DnBackupId == "" {
- return cons.MissingDnBackupId
+ if in.DnBackupID == "" {
+ return cons.MissingDnBackupID
}
if in.Instance == "" {
@@ -93,7 +94,7 @@ func NewBackupInfo(data *model.Backup, path, instance string) *BackupInfo {
return nil
}
return &BackupInfo{
- Id: data.ID,
+ ID: data.ID,
Path: path,
Mode: data.BackupMode,
Instance: instance,
@@ -103,14 +104,14 @@ func NewBackupInfo(data *model.Backup, path, instance string) *BackupInfo {
}
}
-func NewBackupInfoList(list []model.Backup, path, instance string) []BackupInfo {
+func NewBackupInfoList(list []*model.Backup, path, instance string) []BackupInfo {
if len(list) == 0 {
return []BackupInfo{}
}
ret := make([]BackupInfo, 0, len(list))
for _, v := range list {
ret = append(ret, BackupInfo{
- Id: v.ID,
+ ID: v.ID,
Path: path,
Mode: v.BackupMode,
Instance: instance,
@@ -140,12 +141,12 @@ func (in *ShowListIn) Validate() error {
return cons.Internal
}
- if in.DbPort == 0 {
- return cons.InvalidDbPort
+ if in.DBPort == 0 {
+ return cons.InvalidDBPort
}
- if in.DbName == "" {
- return cons.MissingDbName
+ if in.DBName == "" {
+ return cons.MissingDBName
}
if in.Username == "" {
diff --git a/pitr/agent/internal/pkg/model/backup.go b/pitr/agent/internal/pkg/model/backup.go
index 017a64d..5672564 100644
--- a/pitr/agent/internal/pkg/model/backup.go
+++ b/pitr/agent/internal/pkg/model/backup.go
@@ -48,7 +48,7 @@ type (
}
BackupList struct {
- Instance string `json:"instance"`
- List []Backup `json:"backups"`
+ Instance string `json:"instance"`
+ List []*Backup `json:"backups"`
}
)
diff --git a/pitr/agent/internal/pkg/opengauss.go b/pitr/agent/internal/pkg/opengauss.go
index 32b8970..3db2ff8 100644
--- a/pitr/agent/internal/pkg/opengauss.go
+++ b/pitr/agent/internal/pkg/opengauss.go
@@ -21,15 +21,14 @@ import (
"encoding/json"
"errors"
"fmt"
- "github.com/apache/shardingsphere-on-cloud/pitr/agent/pkg/gsutil"
- "github.com/apache/shardingsphere-on-cloud/pitr/agent/pkg/logging"
"strings"
- "github.com/dlclark/regexp2"
-
"github.com/apache/shardingsphere-on-cloud/pitr/agent/internal/cons"
"github.com/apache/shardingsphere-on-cloud/pitr/agent/internal/pkg/model"
"github.com/apache/shardingsphere-on-cloud/pitr/agent/pkg/cmds"
+ "github.com/apache/shardingsphere-on-cloud/pitr/agent/pkg/gsutil"
+ "github.com/apache/shardingsphere-on-cloud/pitr/agent/pkg/logging"
+ "github.com/dlclark/regexp2"
)
type (
@@ -50,7 +49,7 @@ type (
Stop() error
Status() (string, error)
Restore(backupPath, instance, backupID string) error
- ShowBackupList(backupPath, instanceName string) ([]model.Backup, error)
+ ShowBackupList(backupPath, instanceName string) ([]*model.Backup, error)
Auth(user, password, dbName string, dbPort uint16) error
MvTempToPgData() error
MvPgDataToTemp() error
@@ -115,9 +114,9 @@ func (og *openGauss) AsyncBackup(backupPath, instanceName, backupMode string, th
if err != nil {
return "", fmt.Errorf("og.getBackupID[source=%s] return err=%w", output.Message, err)
}
- //ignore other output
+ // ignore other output
go og.ignore(outputs)
- return bid, nil
+ return bid, nil //nolint
}
return "", fmt.Errorf("unknow err")
}
@@ -129,7 +128,7 @@ func (og *openGauss) ShowBackup(backupPath, instanceName, backupID string) (*mod
return nil, fmt.Errorf("cmds.Exec[shell=%s,cmd=%s] return err=%w", og.shell, cmd, err)
}
- var list []model.BackupList
+ var list []*model.BackupList
if err = json.Unmarshal([]byte(output), &list); err != nil {
return nil, fmt.Errorf("json.Unmarshal[output=%s] return err=%s,wrap=%w", output, err, cons.Internal)
}
@@ -140,7 +139,7 @@ func (og *openGauss) ShowBackup(backupPath, instanceName, backupID string) (*mod
return nil, fmt.Errorf("instance[name=%s],backupList[v=%+v],err=%w", ins.Instance, list, cons.DataNotFound)
}
- return &ins.List[0], nil
+ return ins.List[0], nil
}
}
@@ -278,6 +277,7 @@ func (og *openGauss) Restore(backupPath, instance, backupID string) error {
outputs, err := cmds.AsyncExec(og.shell, cmd)
for output := range outputs {
og.log.
+ //nolint:exhaustive
Fields(map[logging.FieldKey]string{
"backup_path": backupPath,
"instance": instance,
@@ -295,14 +295,14 @@ func (og *openGauss) Restore(backupPath, instance, backupID string) error {
return nil
}
-func (og *openGauss) ShowBackupList(backupPath, instanceName string) ([]model.Backup, error) {
+func (og *openGauss) ShowBackupList(backupPath, instanceName string) ([]*model.Backup, error) {
cmd := fmt.Sprintf(_showListFmt, instanceName, backupPath)
output, err := cmds.Exec(og.shell, cmd)
if err != nil {
return nil, fmt.Errorf("cmds.Exec[shell=%s,cmd=%s] return err=%w", og.shell, cmd, err)
}
- var list []model.BackupList
+ var list []*model.BackupList
if err = json.Unmarshal([]byte(output), &list); err != nil {
return nil, fmt.Errorf("json.Unmarshal[output=%s] return err=%s,wrap=%w", output, err, cons.Internal)
}
diff --git a/pitr/agent/internal/pkg/opengauss_test.go b/pitr/agent/internal/pkg/opengauss_test.go
index ac51154..19f8b15 100644
--- a/pitr/agent/internal/pkg/opengauss_test.go
+++ b/pitr/agent/internal/pkg/opengauss_test.go
@@ -49,6 +49,7 @@ var _ = Describe("OpenGauss,requires opengauss environment", func() {
instance,
"full",
1,
+ 3306,
)
Expect(err).To(BeNil())
diff --git a/pitr/agent/main.go b/pitr/agent/main.go
index 56f0e02..b737a4c 100644
--- a/pitr/agent/main.go
+++ b/pitr/agent/main.go
@@ -20,6 +20,11 @@ package main
import (
"flag"
"fmt"
+ "os"
+ "os/signal"
+ "strings"
+ "syscall"
+
"github.com/apache/shardingsphere-on-cloud/pitr/agent/internal/handler"
"github.com/apache/shardingsphere-on-cloud/pitr/agent/internal/handler/middleware"
"github.com/apache/shardingsphere-on-cloud/pitr/agent/internal/pkg"
@@ -28,10 +33,6 @@ import (
"github.com/gofiber/fiber/v2"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
- "os"
- "os/signal"
- "strings"
- "syscall"
)
const (
@@ -112,7 +113,7 @@ func main() {
zap.AddStacktrace(zapcore.FatalLevel),
)
if err != nil {
- panic(fmt.Errorf("an unknown error occured in the zap-log"))
+ panic(fmt.Errorf("an unknown error occurred in the zap-log"))
}
log = logging.Init(logger)
diff --git a/pitr/agent/pkg/cmds/cmd.go b/pitr/agent/pkg/cmds/cmd.go
index dc248d2..4720020 100644
--- a/pitr/agent/pkg/cmds/cmd.go
+++ b/pitr/agent/pkg/cmds/cmd.go
@@ -20,11 +20,11 @@ package cmds
import (
"bufio"
"fmt"
- "github.com/apache/shardingsphere-on-cloud/pitr/agent/pkg/logging"
"io"
"os/exec"
"github.com/apache/shardingsphere-on-cloud/pitr/agent/internal/cons"
+ "github.com/apache/shardingsphere-on-cloud/pitr/agent/pkg/logging"
"github.com/apache/shardingsphere-on-cloud/pitr/agent/pkg/syncutils"
)
diff --git a/pitr/agent/pkg/gsutil/conn.go b/pitr/agent/pkg/gsutil/conn.go
index 4dcbdf8..72a6e8a 100644
--- a/pitr/agent/pkg/gsutil/conn.go
+++ b/pitr/agent/pkg/gsutil/conn.go
@@ -20,9 +20,10 @@ package gsutil
import (
"database/sql"
"fmt"
+ "strings"
+
_ "gitee.com/opengauss/openGauss-connector-go-pq"
"github.com/apache/shardingsphere-on-cloud/pitr/agent/internal/cons"
- "strings"
)
const defaultOGHost = "127.0.0.1"
@@ -49,7 +50,7 @@ func Open(user, password, dbName string, dbPort uint16) (*OpenGauss, error) {
db, err := sql.Open("opengauss", fmt.Sprintf(connStr, defaultOGHost, dbPort, user, password, dbName))
if err != nil {
efmt := "sql:open fail[user=%s,pwLen=%d,dbName=%s],err=%s,wrap=%w"
- return nil, fmt.Errorf(efmt, user, len(password), dbName, err, cons.DbConnectionFailed)
+ return nil, fmt.Errorf(efmt, user, len(password), dbName, err, cons.DBConnectionFailed)
}
return &OpenGauss{
@@ -63,7 +64,7 @@ func Open(user, password, dbName string, dbPort uint16) (*OpenGauss, error) {
func (og *OpenGauss) Ping() error {
if err := og.db.Ping(); err != nil {
efmt := "db ping fail[user=%s,pwLen=%d,dbName=%s],err=%s,wrap=%w"
- return fmt.Errorf(efmt, og.user, og.pwLen, og.dbName, err, cons.DbConnectionFailed)
+ return fmt.Errorf(efmt, og.user, og.pwLen, og.dbName, err, cons.DBConnectionFailed)
}
return nil
}
diff --git a/pitr/agent/pkg/logging/field.go b/pitr/agent/pkg/logging/field.go
index 2119278..e8d9e3e 100644
--- a/pitr/agent/pkg/logging/field.go
+++ b/pitr/agent/pkg/logging/field.go
@@ -40,7 +40,7 @@ const (
Stack FieldKey = "stack"
Duration FieldKey = "duration"
Path FieldKey = "path" // original routing path
- RequestUri FieldKey = "requestUri" // http requesting uri
- HttpMethod FieldKey = "httpMethod"
- HttpStatus FieldKey = "httpStatus"
+ RequestURI FieldKey = "requestUri" // http requesting uri
+ HTTPMethod FieldKey = "httpMethod"
+ HTTPStatus FieldKey = "httpStatus"
)
diff --git a/pitr/agent/pkg/logging/log.go b/pitr/agent/pkg/logging/log.go
index b2d2209..0505bd4 100644
--- a/pitr/agent/pkg/logging/log.go
+++ b/pitr/agent/pkg/logging/log.go
@@ -31,6 +31,7 @@ func Init(logger *zap.Logger) ILog {
}
func Field(k FieldKey, v string) ILog {
+ //nolint:exhaustive
m := map[FieldKey]string{k: v}
for k, v := range l.fields {
m[k] = v
diff --git a/pitr/agent/pkg/logging/zap_log.go b/pitr/agent/pkg/logging/zap_log.go
index cfda378..f0dd89b 100644
--- a/pitr/agent/pkg/logging/zap_log.go
+++ b/pitr/agent/pkg/logging/zap_log.go
@@ -32,6 +32,7 @@ func NewLog(l *zap.Logger) ILog {
}
func (z *ZapLogger) Field(k FieldKey, v string) ILog {
+ //nolint:exhaustive
m := map[FieldKey]string{k: v}
for k, v := range z.fields {
m[k] = v
diff --git a/pitr/agent/pkg/strutil/rand_string.go b/pitr/agent/pkg/strutil/rand_string.go
index 769b7b7..53056bb 100644
--- a/pitr/agent/pkg/strutil/rand_string.go
+++ b/pitr/agent/pkg/strutil/rand_string.go
@@ -18,9 +18,8 @@
package strutil
import (
- "math/rand"
+ "crypto/rand"
"strconv"
- "time"
)
const (
@@ -34,20 +33,24 @@ const (
)
func Random(n uint) string {
- rand.Seed(time.Now().UnixNano())
- bs := make([]byte, 0, n)
+ bs := make([]byte, n)
for i := uint(0); i < n; i++ {
- bs = append(bs, charSet[rand.Intn(charSize)])
+ _, _ = rand.Read(bs[i : i+1])
+ }
+ for k, v := range bs {
+ bs[k] = charSet[v%byte(charSize)]
}
return string(bs)
}
func RandomInt(n uint) int64 {
- rand.Seed(time.Now().UnixNano())
- bs := make([]byte, 0, n)
- bs = append(bs, digitSet[rand.Intn(digitSize-1)])
- for i := uint(0); i < n-1; i++ {
- bs = append(bs, digitSet[rand.Intn(digitSize)])
+ bs := make([]byte, n)
+ _, _ = rand.Read(bs[0:1])
+ for i := uint(1); i < n; i++ {
+ _, _ = rand.Read(bs[i : i+1])
+ }
+ for k, v := range bs {
+ bs[k] = digitSet[v%byte(digitSize)]
}
v, _ := strconv.ParseInt(string(bs), 10, 64)
return v
diff --git a/pitr/agent/pkg/syncutils/recover_func.go b/pitr/agent/pkg/syncutils/recover_func.go
index af49a22..147cd7e 100644
--- a/pitr/agent/pkg/syncutils/recover_func.go
+++ b/pitr/agent/pkg/syncutils/recover_func.go
@@ -27,9 +27,9 @@ func NewRecoverFuncWithErrRet(msg string, fn func() error) func() (err error) {
r := recover()
if r != nil {
if err, ok := r.(error); ok {
- err = fmt.Errorf("NewRecoverFuncWithErrRet[msg=%s],err=%s", msg, err)
+ err = fmt.Errorf("NewRecoverFuncWithErrRet[msg=%s],err=%s", msg, err) //nolint
} else {
- err = fmt.Errorf("NewRecoverFuncWithErrRet[msg=%s],recover msg=%+v", msg, r)
+ err = fmt.Errorf("NewRecoverFuncWithErrRet[msg=%s],recover msg=%+v", msg, r) //nolint
}
}
}()
diff --git a/pitr/cli/.golangci.yml b/pitr/cli/.golangci.yml
new file mode 100644
index 0000000..5b6aed2
--- /dev/null
+++ b/pitr/cli/.golangci.yml
@@ -0,0 +1,365 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+run:
+ timeout: 10m
+ skip-files:
+ - "^zz_generated.*"
+ - "_test.go"
+linters:
+ disable-all: true
+ enable:
+ # The base lints
+ - errcheck
+ - gosimple
+ - govet
+ - ineffassign
+ - staticcheck
+ - typecheck
+ - unused
+ - unused
+ - bodyclose
+ - cyclop
+ - nilerr
+ - goimports
+ - asciicheck
+ - prealloc
+ - stylecheck
+ - exportloopref
+ - rowserrcheck
+ - makezero
+ - durationcheck
+ - gosec
+ - predeclared
+ # Deprecated lints
+ - structcheck
+ - varcheck
+ - deadcode
+
+ # The advanced lints
+ - dupl
+ - exhaustive
+ - godot
+ - misspell
+ # - varnamelen
+ - gocritic
+ #- exhaustruct
+ #- nestif
+ #- wsl
+ - gocognit
+# Refers: https://gist.github.com/maratori/47a4d00457a92aa426dbd48a18776322
+linters-settings:
+ wsl:
+ # See https://github.com/bombsimon/wsl/blob/master/doc/configuration.md for documentation of available settings.
+ # These are the defaults for `golangci-lint`.
+
+ # Do strict checking when assigning from append (x = append(x, y)). If
+ # this is set to true - the append call must append either a variable
+ # assigned, called or used on the line above.
+ strict-append: true
+ # Allows assignments to be cuddled with variables used in calls on
+ # line above and calls to be cuddled with assignments of variables
+ # used in call on line above.
+ allow-assign-and-call: true
+ # Allows assignments to be cuddled with anything.
+ allow-assign-and-anything: false
+ # Allows cuddling to assignments even if they span over multiple lines.
+ allow-multiline-assign: true
+ # If the number of lines in a case block is equal to or lager than this
+ # number, the case *must* end white a newline.
+ force-case-trailing-whitespace: 0
+ # Allow blocks to end with comments.
+ allow-trailing-comment: false
+ # Allow multiple comments in the beginning of a block separated with newline.
+ allow-separated-leading-comment: false
+ # Allow multiple var/declaration statements to be cuddled.
+ allow-cuddle-declarations: false
+ # A list of call idents that everything can be cuddled with.
+ # Defaults to calls looking like locks.
+ allow-cuddle-with-calls: ["Lock", "RLock"]
+ # AllowCuddleWithRHS is a list of right hand side variables that is allowed
+ # to be cuddled with anything. Defaults to assignments or calls looking
+ # like unlocks.
+ allow-cuddle-with-rhs: ["Unlock", "RUnlock"]
+ # Causes an error when an If statement that checks an error variable doesn't
+ # cuddle with the assignment of that variable.
+ force-err-cuddling: false
+ # When force-err-cuddling is enabled this is a list of names
+ # used for error variables to check for in the conditional.
+ error-variable-names: ["err"]
+ # Causes an error if a short declaration (:=) cuddles with anything other than
+ # another short declaration.
+ # This logic overrides force-err-cuddling among others.
+ force-short-decl-cuddling: false
+ varnamelen:
+ # The longest distance, in source lines, that is being considered a "small scope".
+ # Variables used in at most this many lines will be ignored.
+ # Default: 5
+ max-distance: 6
+ # The minimum length of a variable's name that is considered "long".
+ # Variable names that are at least this long will be ignored.
+ # Default: 3
+ min-name-length: 2
+ # Check method receivers.
+ # Default: false
+ check-receiver: false
+ # Check named return values.
+ # Default: false
+ check-return: true
+ # Check type parameters.
+ # Default: false
+ check-type-param: true
+ # Ignore "ok" variables that hold the bool return value of a type assertion.
+ # Default: false
+ ignore-type-assert-ok: true
+ # Ignore "ok" variables that hold the bool return value of a map index.
+ # Default: false
+ ignore-map-index-ok: true
+ # Ignore "ok" variables that hold the bool return value of a channel receive.
+ # Default: false
+ ignore-chan-recv-ok: true
+ # Optional list of variable names that should be ignored completely.
+ # Default: []
+ ignore-names:
+ - err
+ # Optional list of variable declarations that should be ignored completely.
+ # Entries must be in one of the following forms (see below for examples):
+ # - for variables, parameters, named return values, method receivers, or type parameters:
+ # <name> <type> (<type> can also be a pointer/slice/map/chan/...)
+ # - for constants: const <name>
+ #
+ # Default: []
+ ignore-decls:
+ - c echo.Context
+ - t testing.T
+ - f *foo.Bar
+ - e error
+ - i int
+ - const C
+ - T any
+ - m map[string]int
+ prealloc:
+ # IMPORTANT: we don't recommend using this linter before doing performance profiling.
+ # For most programs usage of prealloc will be a premature optimization.
+
+ # Report pre-allocation suggestions only on simple loops that have no returns/breaks/continues/gotos in them.
+ # Default: true
+ simple: false
+ # Report pre-allocation suggestions on range loops.
+ # Default: true
+ range-loops: false
+ # Report pre-allocation suggestions on for loops.
+ # Default: false
+ for-loops: true
+ #nestif:
+ # Minimal complexity of if statements to report.
+ # Default: 5
+ # min-complexity: 4
+ misspell:
+ # Correct spellings using locale preferences for US or UK.
+ # Setting locale to US will correct the British spelling of 'colour' to 'color'.
+ # Default is to use a neutral variety of English.
+ locale: US
+ # Default: []
+ ignore-words:
+ - someword
+ godot:
+ # Comments to be checked: `declarations`, `toplevel`, or `all`.
+ # Default: declarations
+ scope: toplevel
+ # List of regexps for excluding particular comment lines from check.
+ # Default: []
+ exclude:
+ # Exclude todo and fixme comments.
+ - "^fixme:"
+ - "^todo:"
+ # Check that each sentence ends with a period.
+ # Default: true
+ period: false
+ # Check that each sentence starts with a capital letter.
+ # Default: false
+ capital: false
+ dupl:
+ # Tokens count to trigger issue.
+ # Default: 150
+ threshold: 100
+ cyclop:
+ # The maximal code complexity to report.
+ # Default: 10
+ max-complexity: 30
+ # The maximal average package complexity.
+ # If it's higher than 0.0 (float) the check is enabled
+ # Default: 0.0
+ package-average: 10.0
+ errcheck:
+ # Report about not checking of errors in type assertions: `a := b.(MyStruct)`.
+ # Such cases aren't reported by default.
+ # Default: false
+ check-type-assertions: true
+ exhaustive:
+ # Program elements to check for exhaustiveness.
+ # Default: [ switch ]
+ check:
+ - switch
+ - map
+ funlen:
+ # Checks the number of lines in a function.
+ # If lower than 0, disable the check.
+ # Default: 60
+ lines: 100
+ # Checks the number of statements in a function.
+ # If lower than 0, disable the check.
+ # Default: 40
+ statements: 50
+ gocognit:
+ # Minimal code complexity to report.
+ # Default: 30 (but we recommend 10-20)
+ min-complexity: 20
+ gocritic:
+ # Which checks should be enabled; can't be combined with 'disabled-checks'.
+ # See https://go-critic.github.io/overview#checks-overview.
+ # To check which checks are enabled run `GL_DEBUG=gocritic golangci-lint run`.
+ # By default, list of stable checks is used.
+ enabled-checks:
+ - elseif
+ - nestingReduce
+ - unnamedResult
+ # - ruleguard
+ - truncateCmp
+ - hugeparam
+ - rangevalcopy
+ - captlocal
+ - underef
+ - toomanyresultschecker
+ - rangeexprcopy
+ # Which checks should be disabled; can't be combined with 'enabled-checks'.
+ # Default: []
+ disabled-checks:
+ - regexpMust
+ # Enable multiple checks by tags, run `GL_DEBUG=gocritic golangci-lint run` to see all tags and checks.
+ # See https://github.com/go-critic/go-critic#usage -> section "Tags".
+ # Default: []
+ enabled-tags:
+ - diagnostic
+ - style
+ - performance
+ - experimental
+ - opinionated
+ disabled-tags:
+ - diagnostic
+ - style
+ - performance
+ - experimental
+ - opinionated
+ # Settings passed to gocritic.
+ # The settings key is the name of a supported gocritic checker.
+ # The list of supported checkers can be find in https://go-critic.github.io/overview.
+ settings:
+ # Must be valid enabled check name.
+ captLocal:
+ # Whether to restrict checker to params only.
+ # Default: true
+ paramsOnly: false
+ elseif:
+ # Whether to skip balanced if-else pairs.
+ # Default: true
+ skipBalanced: false
+ hugeParam:
+ # Size in bytes that makes the warning trigger.
+ # Default: 80
+ sizeThreshold: 70
+ nestingReduce:
+ # Min number of statements inside a branch to trigger a warning.
+ # Default: 5
+ bodyWidth: 4
+ rangeExprCopy:
+ # Size in bytes that makes the warning trigger.
+ # Default: 512
+ sizeThreshold: 516
+ # Whether to check test functions
+ # Default: true
+ skipTestFuncs: false
+ rangeValCopy:
+ # Size in bytes that makes the warning trigger.
+ # Default: 128
+ sizeThreshold: 32
+ # Whether to check test functions.
+ # Default: true
+ skipTestFuncs: false
+ ruleguard:
+ # Enable debug to identify which 'Where' condition was rejected.
+ # The value of the parameter is the name of a function in a ruleguard file.
+ #
+ # When a rule is evaluated:
+ # If:
+ # The Match() clause is accepted; and
+ # One of the conditions in the Where() clause is rejected,
+ # Then:
+ # ruleguard prints the specific Where() condition that was rejected.
+ #
+ # The flag is passed to the ruleguard 'debug-group' argument.
+ # Default: ""
+ debug: 'emptyDecl'
+ # Deprecated, use 'failOn' param.
+ # If set to true, identical to failOn='all', otherwise failOn=''
+ failOnError: false
+ # Determines the behavior when an error occurs while parsing ruleguard files.
+ # If flag is not set, log error and skip rule files that contain an error.
+ # If flag is set, the value must be a comma-separated list of error conditions.
+ # - 'all': fail on all errors.
+ # - 'import': ruleguard rule imports a package that cannot be found.
+ # - 'dsl': gorule file does not comply with the ruleguard DSL.
+ # Default: ""
+ failOn: dsl
+ # Comma-separated list of file paths containing ruleguard rules.
+ # If a path is relative, it is relative to the directory where the golangci-lint command is executed.
+ # The special '${configDir}' variable is substituted with the absolute directory containing the golangci config file.
+ # Glob patterns such as 'rules-*.go' may be specified.
+ # Default: ""
+ rules: '${configDir}/ruleguard/rules-*.go,${configDir}/myrule1.go'
+ # Comma-separated list of enabled groups or skip empty to enable everything.
+ # Tags can be defined with # character prefix.
+ # Default: "<all>"
+ enable: "myGroupName,#myTagName"
+ # Comma-separated list of disabled groups or skip empty to enable everything.
+ # Tags can be defined with # character prefix.
+ # Default: ""
+ disable: "myGroupName,#myTagName"
+ tooManyResultsChecker:
+ # Maximum number of results.
+ # Default: 5
+ maxResults: 10
+ truncateCmp:
+ # Whether to skip int/uint/uintptr types.
+ # Default: true
+ skipArchDependent: false
+ underef:
+ # Whether to skip (*x).method() calls where x is a pointer receiver.
+ # Default: true
+ skipRecvDeref: false
+ unnamedResult:
+ # Whether to check exported functions.
+ # Default: false
+ checkExported: true
+issues:
+ exclude-rules:
+ - path: _test\.go
+ linters:
+ - errcheck
+ - gosec
+ - rowserrcheck
+ - makezero
diff --git a/pitr/cli/Makefile b/pitr/cli/Makefile
index 5a74176..d6b27df 100644
--- a/pitr/cli/Makefile
+++ b/pitr/cli/Makefile
@@ -1,4 +1,4 @@
-.PHONY: build test
+.PHONY: build test cover lint
GOOS := $(shell go env GOOS)
@@ -8,3 +8,5 @@ test:
go test -v ./... -cover -coverprofile cover.out
cover:
go tool cover -html cover.out
+lint:
+ golangci-lint run -v --timeout 5m
diff --git a/pitr/cli/go.mod b/pitr/cli/go.mod
index 191b460..14b51d0 100644
--- a/pitr/cli/go.mod
+++ b/pitr/cli/go.mod
@@ -5,8 +5,10 @@ go 1.20
require (
bou.ke/monkey v1.0.2
gitee.com/opengauss/openGauss-connector-go-pq v1.0.4
+ github.com/DATA-DOG/go-sqlmock v1.5.0
github.com/golang/mock v1.6.0
github.com/google/uuid v1.3.0
+ github.com/jarcoal/httpmock v1.3.0
github.com/onsi/ginkgo/v2 v2.9.1
github.com/onsi/gomega v1.27.3
github.com/spf13/cobra v1.6.1
diff --git a/pitr/cli/go.sum b/pitr/cli/go.sum
index e319842..3855af1 100644
--- a/pitr/cli/go.sum
+++ b/pitr/cli/go.sum
@@ -4,6 +4,8 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT
gitee.com/opengauss/openGauss-connector-go-pq v1.0.4 h1:npfLM9/QpkmdK+XY9X2pcC2EX5gosyn/6dRDRd2sEJs=
gitee.com/opengauss/openGauss-connector-go-pq v1.0.4/go.mod h1:2UEp+ug6ls6C0pLfZgBn7VBzBntFUzxJuy+6FlQ7qyI=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
+github.com/DATA-DOG/go-sqlmock v1.5.0 h1:Shsta01QNfFxHCfpW6YH2STWB0MudeXXEWMr20OEh60=
+github.com/DATA-DOG/go-sqlmock v1.5.0/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM=
github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
@@ -52,6 +54,8 @@ github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/inconshreveable/mousetrap v1.0.1 h1:U3uMjPSQEBMNp1lFxmllqCPM6P5u/Xq7Pgzkat/bFNc=
github.com/inconshreveable/mousetrap v1.0.1/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
+github.com/jarcoal/httpmock v1.3.0 h1:2RJ8GP0IIaWwcC9Fp2BmVi8Kog3v2Hn7VXM3fTd+nuc=
+github.com/jarcoal/httpmock v1.3.0/go.mod h1:3yb8rc4BI7TCBhFY8ng0gjuLKJNquuDNiPaZjnENuYg=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=
@@ -60,6 +64,7 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
+github.com/maxatome/go-testdeep v1.12.0 h1:Ql7Go8Tg0C1D/uMMX59LAoYK7LffeJQ6X2T04nTH68g=
github.com/onsi/ginkgo/v2 v2.9.1 h1:zie5Ly042PD3bsCvsSOPvRnFwyo3rKe64TJlD6nu0mk=
github.com/onsi/ginkgo/v2 v2.9.1/go.mod h1:FEcmzVcCHl+4o9bQZVab+4dC9+j+91t2FHSzmGAPfuo=
github.com/onsi/gomega v1.27.3 h1:5VwIwnBY3vbBDOJrNtA4rVdiTZCsq9B5F12pvy1Drmk=
diff --git a/pitr/cli/internal/cmd/backup.go b/pitr/cli/internal/cmd/backup.go
index 8e7449b..5681fd8 100644
--- a/pitr/cli/internal/cmd/backup.go
+++ b/pitr/cli/internal/cmd/backup.go
@@ -49,6 +49,17 @@ var BackupCmd = &cobra.Command{
fmt.Printf("Flag: %s Value: %s\n", flag.Name, flag.Value)
})
+ // convert BackupModeStr to BackupMode
+ switch BackupModeStr {
+ case "FULL", "full":
+ BackupMode = model.BDBackModeFull
+ case "PTRACK", "ptrack":
+ BackupMode = model.DBBackModePTrack
+ }
+ if BackupMode == model.DBBackModePTrack {
+ logging.Warn("Please make sure all openGauss nodes have been set correct configuration about ptrack. You can refer to https://support.huaweicloud.com/intl/zh-cn/devg-opengauss/opengauss_devg_1362.html for more details.")
+ }
+
logging.Info(fmt.Sprintf("Default backup path: %s", pkg.DefaultRootDir()))
// Start backup
@@ -71,7 +82,7 @@ func init() {
_ = BackupCmd.MarkFlagRequired("password")
BackupCmd.Flags().StringVarP(&BackupPath, "dn-backup-path", "B", "", "openGauss data backup path")
_ = BackupCmd.MarkFlagRequired("dn-backup-path")
- BackupCmd.Flags().StringVarP(&BackupMode, "dn-backup-mode", "b", "", "openGauss data backup mode (FULL|PTRACK)")
+ BackupCmd.Flags().StringVarP(&BackupModeStr, "dn-backup-mode", "b", "", "openGauss data backup mode (FULL|PTRACK)")
_ = BackupCmd.MarkFlagRequired("dn-backup-mode")
BackupCmd.Flags().Uint8VarP(&ThreadsNum, "dn-threads-num", "j", 1, "openGauss data backup threads nums")
BackupCmd.Flags().Uint16VarP(&AgentPort, "agent-port", "a", 443, "agent server port")
@@ -88,7 +99,8 @@ func init() {
// 6. Update local backup info
// 7. Double check backups all finished
func backup() error {
- proxy, err := pkg.NewShardingSphereProxy(Username, Password, pkg.DefaultDbName, Host, Port)
+ var err error
+ proxy, err := pkg.NewShardingSphereProxy(Username, Password, pkg.DefaultDBName, Host, Port)
if err != nil {
return xerr.NewCliErr("create ss-proxy connect failed")
}
@@ -98,48 +110,65 @@ func backup() error {
return xerr.NewCliErr("create local storage failed")
}
+ defer func() {
+ if err != nil {
+ logging.Info("try to unlock cluster ...")
+ if err := proxy.Unlock(); err != nil {
+ logging.Error(fmt.Sprintf("coz backup failed, try to unlock cluster, but still failed, err:%s", err.Error()))
+ }
+ }
+ }()
+
// Step1. lock cluster
- if err := proxy.LockForBackup(); err != nil {
+ logging.Info("Starting lock cluster ...")
+ err = proxy.LockForBackup()
+ if err != nil {
return xerr.NewCliErr("lock for backup failed")
}
// Step2. Get cluster info and save local backup info
+ logging.Info("Starting export metadata ...")
lsBackup, err := exportData(proxy, ls)
if err != nil {
return xerr.NewCliErr(fmt.Sprintf("export backup data failed, err:%s", err.Error()))
}
- logging.Info(fmt.Sprintf("export backup data success, backup filename: %s", filename))
+ logging.Info(fmt.Sprintf("Export backup data success, backup filename: %s", filename))
// Step3. send backup command to agent-server.
- if err := execBackup(lsBackup); err != nil {
- // if backup failed, still need to unlock cluster.
- if err := proxy.Unlock(); err != nil {
- logging.Error(fmt.Sprintf("coz exec backup failed, try to unlock cluster, but still failed, err:%s", err.Error()))
- }
+ logging.Info("Starting backup ...")
+ err = execBackup(lsBackup)
+ if err != nil {
return xerr.NewCliErr(fmt.Sprintf("exec backup failed, err:%s", err.Error()))
}
// Step4. unlock cluster
- if err := proxy.Unlock(); err != nil {
+ logging.Info("Starting unlock cluster ...")
+ err = proxy.Unlock()
+ if err != nil {
return xerr.NewCliErr(fmt.Sprintf("unlock cluster failed, err:%s", err.Error()))
}
// Step5. update backup file
- if err := ls.WriteByJSON(filename, lsBackup); err != nil {
+ logging.Info("Starting update backup file ...")
+ err = ls.WriteByJSON(filename, lsBackup)
+ if err != nil {
return xerr.NewCliErr(fmt.Sprintf("update backup file failed, err:%s", err.Error()))
}
- // Step6. check agent server backup status
+ // Step6. check agent server backup
+ logging.Info("Starting check backup status ...")
status := checkBackupStatus(lsBackup)
- logging.Info(fmt.Sprintf("backup result:%s", status))
+ logging.Info(fmt.Sprintf("Backup result: %s", status))
// Step7. finished backup and update backup file
- if err := ls.WriteByJSON(filename, lsBackup); err != nil {
+ logging.Info("Starting update backup file ...")
+ err = ls.WriteByJSON(filename, lsBackup)
+ if err != nil {
return xerr.NewCliErr(fmt.Sprintf("update backup file failed, err: %s", err.Error()))
}
- logging.Info("backup finished")
+ logging.Info("Backup finished!")
return nil
}
@@ -166,10 +195,11 @@ func exportData(proxy pkg.IShardingSphereProxy, ls pkg.ILocalStorage) (lsBackup
contents := &model.LsBackup{
Info: &model.BackupMetaInfo{
- ID: uuid.New().String(), // generate uuid for this backup
- CSN: csn,
- StartTime: time.Now().Unix(),
- EndTime: 0,
+ ID: uuid.New().String(), // generate uuid for this backup
+ CSN: csn,
+ StartTime: time.Now().Unix(),
+ EndTime: 0,
+ BackupMode: BackupMode,
},
SsBackup: &model.SsBackup{
Status: model.SsBackupStatusWaiting, // default status of backup is model.SsBackupStatusWaiting
@@ -225,13 +255,13 @@ func execBackup(lsBackup *model.LsBackup) error {
func _execBackup(as pkg.IAgentServer, node *model.StorageNode, dnCh chan *model.DataNode) error {
in := &model.BackupIn{
- DbPort: node.Port,
- DbName: node.Database,
+ DBPort: node.Port,
+ DBName: node.Database,
Username: node.Username,
Password: node.Password,
DnBackupPath: BackupPath,
DnThreadsNum: ThreadsNum,
- DnBackupMode: model.BDBackModeFull,
+ DnBackupMode: BackupMode,
Instance: defaultInstance,
}
backupID, err := as.Backup(in)
@@ -297,10 +327,11 @@ func checkBackupStatus(lsBackup *model.LsBackup) model.BackupStatus {
}
lsBackup.SsBackup.Status = backupFinalStatus
+ lsBackup.Info.EndTime = time.Now().Unix()
return backupFinalStatus
}
-func checkStatus(as pkg.IAgentServer, sn *model.StorageNode, backupId string, status model.BackupStatus, retryTimes uint8) model.BackupStatus {
+func checkStatus(as pkg.IAgentServer, sn *model.StorageNode, backupID string, status model.BackupStatus, retryTimes uint8) model.BackupStatus {
if retryTimes+1 == 0 {
return status
}
@@ -312,18 +343,18 @@ func checkStatus(as pkg.IAgentServer, sn *model.StorageNode, backupId string, st
time.Sleep(time.Second * 2)
in := &model.ShowDetailIn{
- DbPort: sn.Port,
- DbName: sn.Database,
+ DBPort: sn.Port,
+ DBName: sn.Database,
Username: sn.Username,
Password: sn.Password,
- DnBackupId: backupId,
+ DnBackupID: backupID,
DnBackupPath: BackupPath,
Instance: defaultInstance,
}
backupInfo, err := as.ShowDetail(in)
if err != nil {
logging.Error(fmt.Sprintf("get storage node [IP:%s] backup detail from agent server failed, will retry %d times.\n%s", sn.IP, retryTimes, err.Error()))
- return checkStatus(as, sn, backupId, model.SsBackupStatusCheckError, retryTimes-1)
+ return checkStatus(as, sn, backupID, model.SsBackupStatusCheckError, retryTimes-1)
}
- return checkStatus(as, sn, backupId, backupInfo.Status, retryTimes)
+ return checkStatus(as, sn, backupID, backupInfo.Status, retryTimes)
}
diff --git a/pitr/cli/internal/cmd/cmd_suite_test.go b/pitr/cli/internal/cmd/cmd_suite_test.go
index 103c622..1551eec 100644
--- a/pitr/cli/internal/cmd/cmd_suite_test.go
+++ b/pitr/cli/internal/cmd/cmd_suite_test.go
@@ -48,6 +48,7 @@ func initLog() {
}
logging.Init(logger)
}
+
func TestCmd(t *testing.T) {
initLog()
RegisterFailHandler(Fail)
diff --git a/pitr/cli/internal/cmd/restore.go b/pitr/cli/internal/cmd/restore.go
index cfa0082..493ea61 100644
--- a/pitr/cli/internal/cmd/restore.go
+++ b/pitr/cli/internal/cmd/restore.go
@@ -89,7 +89,7 @@ func restore() error {
if err != nil {
return xerr.NewCliErr(fmt.Sprintf("new local storage failed, err:%s", err.Error()))
}
- proxy, err := pkg.NewShardingSphereProxy(Username, Password, pkg.DefaultDbName, Host, Port)
+ proxy, err := pkg.NewShardingSphereProxy(Username, Password, pkg.DefaultDBName, Host, Port)
if err != nil {
return xerr.NewCliErr(fmt.Sprintf("new ss-proxy failed, err:%s", err.Error()))
}
@@ -140,11 +140,16 @@ func checkDatabaseExist(proxy pkg.IShardingSphereProxy, bak *model.LsBackup) err
return xerr.NewCliErr(fmt.Sprintf("get cluster metadata failed:%s", err.Error()))
}
- for k, _ := range bak.SsBackup.ClusterInfo.MetaData.Databases {
+ for k := range bak.SsBackup.ClusterInfo.MetaData.Databases {
if _, ok := clusterNow.MetaData.Databases[k]; ok {
databaseNamesExist = append(databaseNamesExist, k)
}
}
+
+ if len(databaseNamesExist) == 0 {
+ return nil
+ }
+
// get user input to confirm
return getUserApproveInTerminal()
}
@@ -206,13 +211,13 @@ func execRestore(lsBackup *model.LsBackup) error {
func _execRestore(as pkg.IAgentServer, node *model.StorageNode, backupID string, failedCh chan error) {
in := &model.RestoreIn{
- DbPort: node.Port,
- DbName: node.Database,
+ DBPort: node.Port,
+ DBName: node.Database,
Username: node.Username,
Password: node.Password,
Instance: defaultInstance,
DnBackupPath: BackupPath,
- DnBackupId: backupID,
+ DnBackupID: backupID,
}
if err := as.Restore(in); err != nil {
diff --git a/pitr/cli/internal/cmd/restore_test.go b/pitr/cli/internal/cmd/restore_test.go
index f1cc01a..40194ee 100644
--- a/pitr/cli/internal/cmd/restore_test.go
+++ b/pitr/cli/internal/cmd/restore_test.go
@@ -19,6 +19,8 @@
package cmd
import (
+ "reflect"
+
"bou.ke/monkey"
"github.com/apache/shardingsphere-on-cloud/pitr/cli/internal/pkg"
mock_pkg "github.com/apache/shardingsphere-on-cloud/pitr/cli/internal/pkg/mocks"
@@ -39,7 +41,7 @@ var _ = Describe("Restore", func() {
backupRecordID string
)
Context("Restore", func() {
- proxy, _ := pkg.NewShardingSphereProxy(user, password, pkg.DefaultDbName, host, port)
+ proxy, _ := pkg.NewShardingSphereProxy(user, password, pkg.DefaultDBName, host, port)
ls, _ := pkg.NewLocalStorage(pkg.DefaultRootDir())
bak, _ := ls.ReadByID(backupRecordID)
It("restore to ss proxy should be ok", func() {
@@ -60,9 +62,9 @@ var _ = Describe("Restore", func() {
var _ = Describe("test restore", func() {
var (
proxy *mock_pkg.MockIShardingSphereProxy
- //ls *mock_pkg.MockILocalStorage
- as *mock_pkg.MockIAgentServer
- bak = &model.LsBackup{
+ ls *mock_pkg.MockILocalStorage
+ as *mock_pkg.MockIAgentServer
+ bak = &model.LsBackup{
Info: nil,
DnList: nil,
SsBackup: &model.SsBackup{
@@ -87,19 +89,27 @@ var _ = Describe("test restore", func() {
Remark: "",
}
)
+
BeforeEach(func() {
ctrl = gomock.NewController(GinkgoT())
proxy = mock_pkg.NewMockIShardingSphereProxy(ctrl)
as = mock_pkg.NewMockIAgentServer(ctrl)
- //ls = mock_pkg.NewMockILocalStorage(ctrl)
- monkey.Patch(getUserApproveInTerminal, func() error { return nil })
+ ls = mock_pkg.NewMockILocalStorage(ctrl)
+ monkey.Patch(pkg.NewShardingSphereProxy, func(user, password, database, host string, port uint16) (pkg.IShardingSphereProxy, error) {
+ return proxy, nil
+ })
+ monkey.Patch(pkg.NewLocalStorage, func(rootDir string) (pkg.ILocalStorage, error) {
+ return ls, nil
+ })
})
+
AfterEach(func() {
ctrl.Finish()
monkey.UnpatchAll()
})
It("check database if exists", func() {
+ monkey.Patch(getUserApproveInTerminal, func() error { return nil })
proxy.EXPECT().ExportMetaData()
Expect(checkDatabaseExist(proxy, bak)).To(BeNil())
})
@@ -112,6 +122,29 @@ var _ = Describe("test restore", func() {
Expect(<-failedCh).To(BeNil())
})
+ It("test exec restore main func", func() {
+ // patch ReadByID of mock ls
+ monkey.PatchInstanceMethod(reflect.TypeOf(ls), "ReadByID", func(_ *mock_pkg.MockILocalStorage, _ string) (*model.LsBackup, error) {
+ return bak, nil
+ })
+ // mock ExportMetaData and return a *ClusterInfo with bak in it
+ proxy.EXPECT().ExportMetaData().Return(bak.SsBackup.ClusterInfo, nil)
+ // mock ImportMetaData and return nil
+ proxy.EXPECT().ImportMetaData(gomock.Any()).Return(nil)
+ RecordID = "backup-id"
+ Expect(restore()).To(BeNil())
+ })
+
+ // test getUserApproveInTerminal
+ Context("test userApproveInTerminal", func() {
+ // test user abort
+ It("user abort", func() {
+ // exec getUserApproveInTerminal
+ Expect(getUserApproveInTerminal()).To(Equal(xerr.NewCliErr("User abort")))
+ })
+ // TODO test user approve, how to patch os.Stdin?
+ })
+
Context("restore data to ss proxy", func() {
It("no need to drop database", func() {
diff --git a/pitr/cli/internal/cmd/root.go b/pitr/cli/internal/cmd/root.go
index 2485cfc..7cf2648 100644
--- a/pitr/cli/internal/cmd/root.go
+++ b/pitr/cli/internal/cmd/root.go
@@ -18,6 +18,7 @@
package cmd
import (
+ "github.com/apache/shardingsphere-on-cloud/pitr/cli/internal/pkg/model"
"github.com/spf13/cobra"
)
@@ -34,8 +35,10 @@ var (
AgentPort uint16
// BackupPath openGauss data backup path
BackupPath string
+ // BackupModeStr openGauss data backup mode string (FULL or PTRACK)
+ BackupModeStr string
// BackupMode openGauss data backup mode (FULL or PTRACK)
- BackupMode string
+ BackupMode model.DBBackupMode
// ThreadsNum openGauss data backup task thread num
ThreadsNum uint8
// CSN openGauss data backup commit sequence number
diff --git a/pitr/cli/internal/cmd/show.go b/pitr/cli/internal/cmd/show.go
index b194378..045b4f7 100644
--- a/pitr/cli/internal/cmd/show.go
+++ b/pitr/cli/internal/cmd/show.go
@@ -66,7 +66,7 @@ func show() error {
return nil
}
- if err := formatRecord([]model.LsBackup{*bak}); err != nil {
+ if err := formatRecord([]*model.LsBackup{bak}); err != nil {
return err
}
return nil
@@ -83,7 +83,7 @@ func show() error {
return nil
}
- if err := formatRecord([]model.LsBackup{*bak}); err != nil {
+ if err := formatRecord([]*model.LsBackup{bak}); err != nil {
return err
}
return nil
@@ -106,7 +106,7 @@ func show() error {
return nil
}
-func formatRecord(backups []model.LsBackup, mode ...string) error {
+func formatRecord(backups []*model.LsBackup, mode ...string) error {
var m string
if len(mode) == 0 {
@@ -116,16 +116,16 @@ func formatRecord(backups []model.LsBackup, mode ...string) error {
}
switch m {
case "json":
- return formatRecordJson(backups)
+ return formatRecordJSON(backups)
case "table":
// TODO format record table
return nil
default:
- return formatRecordJson(backups)
+ return formatRecordJSON(backups)
}
}
-func formatRecordJson(backups []model.LsBackup) error {
+func formatRecordJSON(backups []*model.LsBackup) error {
var ds []string
for _, backup := range backups {
data, err := json.MarshalIndent(backup, "", "\t")
diff --git a/pitr/cli/internal/cmd/show_test.go b/pitr/cli/internal/cmd/show_test.go
index 9b13e90..9617692 100644
--- a/pitr/cli/internal/cmd/show_test.go
+++ b/pitr/cli/internal/cmd/show_test.go
@@ -91,7 +91,7 @@ var _ = Describe("Show", func() {
},
},
}
- err := formatRecord([]model.LsBackup{*bak, *bak})
+ err := formatRecord([]*model.LsBackup{bak, bak})
Expect(err).To(BeNil())
})
})
@@ -116,7 +116,9 @@ var _ = Describe("Show", func() {
})
It("no record", func() {
- ls.EXPECT().ReadAll().Return([]model.LsBackup{}, nil)
+ CSN = ""
+ RecordID = ""
+ ls.EXPECT().ReadAll().Return([]*model.LsBackup{}, nil)
Expect(show()).To(BeNil())
})
diff --git a/pitr/cli/internal/pkg/agent-server.go b/pitr/cli/internal/pkg/agent-server.go
index 5f10e57..393d14f 100644
--- a/pitr/cli/internal/pkg/agent-server.go
+++ b/pitr/cli/internal/pkg/agent-server.go
@@ -65,6 +65,7 @@ func (as *agentServer) Backup(in *model.BackupIn) (string, error) {
"content-type": "application/json",
})
r.Body(in)
+
httpCode, err := r.Send(out)
if err != nil {
efmt := "httputils.NewRequest[url=%s,body=%v,out=%v] return err=%s,wrap=%w"
@@ -72,7 +73,7 @@ func (as *agentServer) Backup(in *model.BackupIn) (string, error) {
}
if httpCode != http.StatusOK {
- return "", fmt.Errorf("unknown http status[code=%d],err=%w", httpCode, xerr.NewCliErr(xerr.InvalidHttpStatus))
+ return "", fmt.Errorf("unknown http status[code=%d],err=%w", httpCode, xerr.NewCliErr(xerr.InvalidHTTPStatus))
}
if out.Code != 0 {
@@ -100,7 +101,7 @@ func (as *agentServer) Restore(in *model.RestoreIn) error {
}
if httpCode != http.StatusOK {
- return fmt.Errorf("unknown http status[code=%d],err=%w", httpCode, xerr.NewCliErr(xerr.InvalidHttpStatus))
+ return fmt.Errorf("unknown http status[code=%d],err=%w", httpCode, xerr.NewCliErr(xerr.InvalidHTTPStatus))
}
if out.Code != 0 {
@@ -128,7 +129,7 @@ func (as *agentServer) ShowDetail(in *model.ShowDetailIn) (*model.BackupInfo, er
}
if httpCode != http.StatusOK {
- return nil, fmt.Errorf("unknown http status[code=%d],err=%w", httpCode, xerr.NewCliErr(xerr.InvalidHttpStatus))
+ return nil, fmt.Errorf("unknown http status[code=%d],err=%w", httpCode, xerr.NewCliErr(xerr.InvalidHTTPStatus))
}
if out.Code != 0 {
@@ -156,7 +157,7 @@ func (as *agentServer) ShowList(in *model.ShowListIn) ([]model.BackupInfo, error
}
if httpCode != http.StatusOK {
- return nil, fmt.Errorf("unknown http status[code=%d],err=%w", httpCode, xerr.NewCliErr(xerr.InvalidHttpStatus))
+ return nil, fmt.Errorf("unknown http status[code=%d],err=%w", httpCode, xerr.NewCliErr(xerr.InvalidHTTPStatus))
}
if out.Code != 0 {
diff --git a/pitr/cli/internal/pkg/agent-server_test.go b/pitr/cli/internal/pkg/agent-server_test.go
index 2cc9a35..1bf05f2 100644
--- a/pitr/cli/internal/pkg/agent-server_test.go
+++ b/pitr/cli/internal/pkg/agent-server_test.go
@@ -38,8 +38,8 @@ func TestAgentServer_Backup(t *testing.T) {
as := NewAgentServer("http://agent-server:18080")
backupID, err := as.Backup(&model.BackupIn{
- DbPort: 5432,
- DbName: "omm",
+ DBPort: 5432,
+ DBName: "omm",
Username: "og",
Password: "1234567890@SphereEx",
DnBackupPath: "/home/omm/data",
@@ -59,13 +59,13 @@ func TestAgentServer_Restore(t *testing.T) {
as := NewAgentServer("http://agent-server:18080")
err := as.Restore(&model.RestoreIn{
- DbPort: 5432,
- DbName: "omm",
+ DBPort: 5432,
+ DBName: "omm",
Username: "og",
Password: "1234567890@SphereEx",
DnBackupPath: "/home/omm/data",
Instance: "ins-default-0",
- DnBackupId: "RR3FIC",
+ DnBackupID: "RR3FIC",
})
if err != nil {
panic(err)
@@ -79,13 +79,13 @@ func TestAgentServer_ShowDetail(t *testing.T) {
as := NewAgentServer("http://agent-server:18080")
backupInfo, err := as.ShowDetail(&model.ShowDetailIn{
- DbPort: 5432,
- DbName: "omm",
+ DBPort: 5432,
+ DBName: "omm",
Username: "og",
Password: "1234567890@SphereEx",
DnBackupPath: "/home/omm/data",
Instance: "ins-default-0",
- DnBackupId: "RR3FIC",
+ DnBackupID: "RR3FIC",
})
if err != nil {
panic(err)
@@ -104,8 +104,8 @@ func TestAgentServer_ShowList(t *testing.T) {
as := NewAgentServer("http://agent-server:18080")
list, err := as.ShowList(&model.ShowListIn{
- DbPort: 5432,
- DbName: "omm",
+ DBPort: 5432,
+ DBName: "omm",
Username: "og",
Password: "1234567890@SphereEx",
DnBackupPath: "/home/omm/data",
diff --git a/pitr/cli/internal/pkg/local-storage.go b/pitr/cli/internal/pkg/local-storage.go
index b436740..e44c98a 100644
--- a/pitr/cli/internal/pkg/local-storage.go
+++ b/pitr/cli/internal/pkg/local-storage.go
@@ -40,7 +40,7 @@ type (
ILocalStorage interface {
WriteByJSON(name string, contents *model.LsBackup) error
GenFilename(extn Extension) string
- ReadAll() ([]model.LsBackup, error)
+ ReadAll() ([]*model.LsBackup, error)
ReadByID(id string) (*model.LsBackup, error)
ReadByCSN(csn string) (*model.LsBackup, error)
}
@@ -66,7 +66,7 @@ func NewLocalStorage(root string) (ILocalStorage, error) {
}
func DefaultRootDir() string {
- return fmt.Sprintf("%s/%s", os.Getenv("HOME"), ".pitr")
+ return fmt.Sprintf("%s/%s", os.Getenv("HOME"), ".gs_pitr")
}
func (ls *localStorage) init() error {
@@ -129,12 +129,14 @@ func (ls *localStorage) WriteByJSON(name string, contents *model.LsBackup) error
return nil
}
-func (ls *localStorage) ReadAll() ([]model.LsBackup, error) {
+func (ls *localStorage) ReadAll() ([]*model.LsBackup, error) {
entries, err := os.ReadDir(ls.backupDir)
if err != nil {
return nil, xerr.NewCliErr(fmt.Sprintf("read the dir[path:%s] failed,err=%s", ls.backupDir, err))
}
- backups := make([]model.LsBackup, 0, len(entries))
+
+ backups := make([]*model.LsBackup, 0, len(entries))
+
for _, entry := range entries {
if entry.IsDir() {
continue
@@ -157,10 +159,11 @@ func (ls *localStorage) ReadAll() ([]model.LsBackup, error) {
return nil, xerr.NewCliErr(fmt.Sprintf("read file failed,err=%s", err))
}
- b := model.LsBackup{}
- if err := json.Unmarshal(file, &b); err != nil {
+ b := &model.LsBackup{}
+ if err := json.Unmarshal(file, b); err != nil {
return nil, xerr.NewCliErr(fmt.Sprintf("invalid contents[filePath=%s],err=%s", path, err))
}
+
backups = append(backups, b)
}
return backups, nil
@@ -173,7 +176,7 @@ func (ls *localStorage) ReadByCSN(csn string) (*model.LsBackup, error) {
}
for _, v := range list {
if v.Info.CSN == csn {
- return &v, nil
+ return v, nil
}
}
return nil, xerr.NewCliErr(xerr.NotFound)
@@ -186,7 +189,7 @@ func (ls *localStorage) ReadByID(id string) (*model.LsBackup, error) {
}
for _, v := range list {
if v.Info.ID == id {
- return &v, nil
+ return v, nil
}
}
return nil, xerr.NewCliErr(xerr.NotFound)
diff --git a/pitr/cli/internal/pkg/mocks/local-storage.go b/pitr/cli/internal/pkg/mocks/local-storage.go
index 7445096..aa18261 100644
--- a/pitr/cli/internal/pkg/mocks/local-storage.go
+++ b/pitr/cli/internal/pkg/mocks/local-storage.go
@@ -67,10 +67,10 @@ func (mr *MockILocalStorageMockRecorder) GenFilename(extn interface{}) *gomock.C
}
// ReadAll mocks base method.
-func (m *MockILocalStorage) ReadAll() ([]model.LsBackup, error) {
+func (m *MockILocalStorage) ReadAll() ([]*model.LsBackup, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "ReadAll")
- ret0, _ := ret[0].([]model.LsBackup)
+ ret0, _ := ret[0].([]*model.LsBackup)
ret1, _ := ret[1].(error)
return ret0, ret1
}
diff --git a/pitr/cli/internal/pkg/model/as_backup.go b/pitr/cli/internal/pkg/model/as_backup.go
index 1f5cc35..63c45ef 100644
--- a/pitr/cli/internal/pkg/model/as_backup.go
+++ b/pitr/cli/internal/pkg/model/as_backup.go
@@ -19,8 +19,8 @@ package model
type (
BackupIn struct {
- DbPort uint16 `json:"db_port"`
- DbName string `json:"db_name"`
+ DBPort uint16 `json:"db_port"`
+ DBName string `json:"db_name"`
Username string `json:"username"`
Password string `json:"password"`
diff --git a/pitr/cli/internal/pkg/model/as_restore.go b/pitr/cli/internal/pkg/model/as_restore.go
index 015c871..2381de7 100644
--- a/pitr/cli/internal/pkg/model/as_restore.go
+++ b/pitr/cli/internal/pkg/model/as_restore.go
@@ -19,13 +19,13 @@ package model
type (
RestoreIn struct {
- DbPort uint16 `json:"db_port"`
- DbName string `json:"db_name"`
+ DBPort uint16 `json:"db_port"`
+ DBName string `json:"db_name"`
Username string `json:"username"`
Password string `json:"password"`
Instance string `json:"instance"`
DnBackupPath string `json:"dn_backup_path"`
- DnBackupId string `json:"dn_backup_id"`
+ DnBackupID string `json:"dn_backup_id"`
}
RestoreResp struct {
diff --git a/pitr/cli/internal/pkg/model/as_show.go b/pitr/cli/internal/pkg/model/as_show.go
index 8fefabf..f75c2a7 100644
--- a/pitr/cli/internal/pkg/model/as_show.go
+++ b/pitr/cli/internal/pkg/model/as_show.go
@@ -19,18 +19,18 @@ package model
type (
ShowDetailIn struct {
- DbPort uint16 `json:"db_port"`
- DbName string `json:"db_name"`
+ DBPort uint16 `json:"db_port"`
+ DBName string `json:"db_name"`
Username string `json:"username"`
Password string `json:"password"`
- DnBackupId string `json:"dn_backup_id"`
+ DnBackupID string `json:"dn_backup_id"`
DnBackupPath string `json:"dn_backup_path"`
Instance string `json:"instance"`
}
ShowListIn struct {
- DbPort uint16 `json:"db_port"`
- DbName string `json:"db_name"`
+ DBPort uint16 `json:"db_port"`
+ DBName string `json:"db_name"`
Username string `json:"username"`
Password string `json:"password"`
DnBackupPath string `json:"dn_backup_path"`
@@ -38,7 +38,7 @@ type (
}
BackupInfo struct {
- Id string `json:"dn_backup_id"`
+ ID string `json:"dn_backup_id"`
Path string `json:"dn_backup_path"`
Mode string `json:"db_backup_mode"`
Instance string `json:"instance"`
diff --git a/pitr/cli/internal/pkg/model/ls_backup.go b/pitr/cli/internal/pkg/model/ls_backup.go
index 962007c..3debe80 100644
--- a/pitr/cli/internal/pkg/model/ls_backup.go
+++ b/pitr/cli/internal/pkg/model/ls_backup.go
@@ -26,10 +26,11 @@ type (
}
BackupMetaInfo struct {
- ID string `json:"id"`
- CSN string `json:"csn"`
- StartTime int64 `json:"start_time"` // Unix time
- EndTime int64 `json:"end_time"` // Unix time
+ ID string `json:"id"`
+ CSN string `json:"csn"`
+ BackupMode DBBackupMode `json:"backup_mode"`
+ StartTime int64 `json:"start_time"` // Unix time
+ EndTime int64 `json:"end_time"` // Unix time
}
DataNode struct {
@@ -59,10 +60,6 @@ type (
}
StorageNodesInfo struct {
- StorageNodes *StorageNodes `json:"storage_nodes"`
- }
-
- StorageNodes struct {
- List []*StorageNode `json:"sharding_db"`
+ StorageNodes map[string][]*StorageNode `json:"storage_nodes"`
}
)
diff --git a/pitr/cli/internal/pkg/shardingsphere-proxy.go b/pitr/cli/internal/pkg/shardingsphere-proxy.go
index ab85c9c..5fa9f2a 100644
--- a/pitr/cli/internal/pkg/shardingsphere-proxy.go
+++ b/pitr/cli/internal/pkg/shardingsphere-proxy.go
@@ -44,7 +44,7 @@ type (
)
const (
- DefaultDbName = "postgres"
+ DefaultDBName = "postgres"
)
func NewShardingSphereProxy(user, password, dbName, host string, port uint16) (IShardingSphereProxy, error) {
@@ -103,6 +103,7 @@ func (ss *shardingSphereProxy) ExportMetaData() (*model.ClusterInfo, error) {
if err != nil {
return nil, xerr.NewCliErr(fmt.Sprintf("export meta data failure,err=%s", err))
}
+
var (
id string
createTime string
@@ -116,10 +117,15 @@ func (ss *shardingSphereProxy) ExportMetaData() (*model.ClusterInfo, error) {
return nil, xerr.NewCliErr(fmt.Sprintf("query close failure,err=%s", err))
}
}
+ if query.Err() != nil {
+ return nil, xerr.NewCliErr(fmt.Sprintf("query err=%s", query.Err()))
+ }
+
var out model.ClusterInfo
if err = json.Unmarshal([]byte(data), &out); err != nil {
return nil, fmt.Errorf("json unmarshal return err=%s", err)
}
+
out.SnapshotInfo = nil
return &out, nil
}
@@ -127,17 +133,18 @@ func (ss *shardingSphereProxy) ExportMetaData() (*model.ClusterInfo, error) {
/*
ExportStorageNodes 导出存储节点数据
-+-----------------------------+-------------------------+----------------------------------------+
-| id | create_time | data |
-+-------------------------------------------------------+----------------------------------------+
-| 734bb036-b15d-4af0-be87-237 | 2023-01-01 12:00:00 897 | {"storage_nodes":{"sharding_db":[]}} |
-+-------------------------------------------------------+----------------------------------------+
++-----------------------------+-------------------------+--------------------------------------------+
+| id | create_time | data |
++-------------------------------------------------------+--------------------------------------------+
+| 734bb036-b15d-4af0-be87-237 | 2023-01-01 12:00:00 897 | {"storage_nodes":{"xx_db":[],"xx2_db":[]}} |
++-------------------------------------------------------+--------------------------------------------+
*/
func (ss *shardingSphereProxy) ExportStorageNodes() ([]*model.StorageNode, error) {
query, err := ss.db.Query(`EXPORT STORAGE NODES;`)
if err != nil {
return nil, xerr.NewCliErr(fmt.Sprintf("export storage nodes failure,err=%s", err))
}
+
var (
id string
createTime string
@@ -152,11 +159,34 @@ func (ss *shardingSphereProxy) ExportStorageNodes() ([]*model.StorageNode, error
return nil, xerr.NewCliErr(fmt.Sprintf("query close failure,err=%s", err))
}
}
+ if query.Err() != nil {
+ return nil, xerr.NewCliErr(fmt.Sprintf("query err failure,err=%s", err))
+ }
+
out := &model.StorageNodesInfo{}
if err = json.Unmarshal([]byte(data), &out); err != nil {
return nil, fmt.Errorf("json unmarshal return err=%s", err)
}
- return out.StorageNodes.List, nil
+
+ // get all storage nodes and filter duplicate nodes
+ var storageNodes []*model.StorageNode
+
+ var tmpNodesMap = make(map[string]struct{})
+
+ for _, v := range out.StorageNodes {
+ for _, vv := range v {
+ // filter duplicate nodes
+ if _, ok := tmpNodesMap[fmt.Sprintf("%s:%d", vv.IP, vv.Port)]; ok {
+ continue
+ }
+
+ tmpNodesMap[fmt.Sprintf("%s:%d", vv.IP, vv.Port)] = struct{}{}
+
+ storageNodes = append(storageNodes, vv)
+ }
+ }
+
+ return storageNodes, nil
}
// ImportMetaData 备份数据恢复
@@ -164,10 +194,12 @@ func (ss *shardingSphereProxy) ImportMetaData(in *model.ClusterInfo) error {
if in == nil {
return xerr.NewCliErr("import meta data is nil")
}
+
marshal, err := json.Marshal(in)
if err != nil {
return xerr.NewCliErr(fmt.Sprintf("json marshal,invalid data[in=%+v]", in))
}
+
_, err = ss.db.Exec(fmt.Sprintf(`IMPORT METADATA '%s';`, marshal))
if err != nil {
return xerr.NewCliErr(fmt.Sprintf("import metadata failure,err=%s", err))
diff --git a/pitr/cli/internal/pkg/xerr/err.go b/pitr/cli/internal/pkg/xerr/err.go
index 6a09aeb..5e363d6 100644
--- a/pitr/cli/internal/pkg/xerr/err.go
+++ b/pitr/cli/internal/pkg/xerr/err.go
@@ -19,16 +19,13 @@ package xerr
import "fmt"
-type (
- service string
- err struct {
- msg string
- }
-)
+type err struct {
+ msg string
+}
const (
Unknown = "Unknown error"
- InvalidHttpStatus = "Invalid http status"
+ InvalidHTTPStatus = "Invalid http status"
NotFound = "Not found"
)
diff --git a/pitr/cli/main.go b/pitr/cli/main.go
index c20dd7f..bbf5d75 100644
--- a/pitr/cli/main.go
+++ b/pitr/cli/main.go
@@ -42,7 +42,7 @@ func main() {
zap.AddStacktrace(zapcore.FatalLevel),
)
if err != nil {
- panic(fmt.Errorf("an unknown error occured in the zap-log"))
+ panic(fmt.Errorf("an unknown error occurred in the zap-log"))
}
logging.Init(logger)
diff --git a/pitr/cli/pkg/gsutil/conn_test.go b/pitr/cli/pkg/gsutil/conn_test.go
index c0a15a1..193dd42 100644
--- a/pitr/cli/pkg/gsutil/conn_test.go
+++ b/pitr/cli/pkg/gsutil/conn_test.go
@@ -18,20 +18,41 @@
package gsutil
import (
+ "database/sql"
+
+ "bou.ke/monkey"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)
var _ = Describe("OpenGauss", func() {
Context("Connection", func() {
+ It("empty user", func() {
+ og, err := Open("", "root", "postgres", "127.0.0.1", uint16(13308))
+ Expect(err.Error()).To(Equal("user is empty"))
+ Expect(og).To(BeNil())
+ })
+
+ It("empty password", func() {
+ og, err := Open("root", "", "postgres", "127.0.0.1", uint16(13308))
+ Expect(err.Error()).To(Equal("password is empty"))
+ Expect(og).To(BeNil())
+ })
+
+ It("empty database", func() {
+ og, err := Open("root", "root", "", "127.0.0.1", uint16(13308))
+ Expect(err.Error()).To(Equal("db name is empty"))
+ Expect(og).To(BeNil())
+ })
+
It("Open and ping", func() {
- Skip("Manually exec:dependent environment")
+ monkey.Patch(sql.Open, func(driverName, dataSourceName string) (*sql.DB, error) {
+ return &sql.DB{}, nil
+ })
+ defer monkey.UnpatchAll()
og, err := Open("root", "root", "postgres", "127.0.0.1", uint16(13308))
Expect(err).To(BeNil())
Expect(og).NotTo(BeNil())
-
- err = og.Ping()
- Expect(err).To(BeNil())
})
})
})
diff --git a/pitr/cli/pkg/httputils/req.go b/pitr/cli/pkg/httputils/req.go
index a02787e..7d99079 100644
--- a/pitr/cli/pkg/httputils/req.go
+++ b/pitr/cli/pkg/httputils/req.go
@@ -97,6 +97,7 @@ func (r *req) Send(body any) (int, error) {
}
tr := &http.Transport{
+ //nolint:gosec
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
}
c := &http.Client{Transport: tr}
@@ -105,6 +106,8 @@ func (r *req) Send(body any) (int, error) {
return -1, fmt.Errorf("http request err=%w", err)
}
+ defer resp.Body.Close()
+
all, err := io.ReadAll(resp.Body)
if err != nil {
return -1, fmt.Errorf("invalid response,err=%w", err)
diff --git a/pitr/cli/pkg/logging/field.go b/pitr/cli/pkg/logging/field.go
index 2119278..0e575fa 100644
--- a/pitr/cli/pkg/logging/field.go
+++ b/pitr/cli/pkg/logging/field.go
@@ -33,14 +33,3 @@ type FieldKey string
func (f FieldKey) String() string {
return string(f)
}
-
-const (
- ErrorKey FieldKey = "error"
- RequestID FieldKey = "requestID"
- Stack FieldKey = "stack"
- Duration FieldKey = "duration"
- Path FieldKey = "path" // original routing path
- RequestUri FieldKey = "requestUri" // http requesting uri
- HttpMethod FieldKey = "httpMethod"
- HttpStatus FieldKey = "httpStatus"
-)
diff --git a/pitr/cli/pkg/stringutil/rand_string.go b/pitr/cli/pkg/stringutil/rand_string.go
index 769b7b7..f7be6c5 100644
--- a/pitr/cli/pkg/stringutil/rand_string.go
+++ b/pitr/cli/pkg/stringutil/rand_string.go
@@ -18,9 +18,8 @@
package strutil
import (
- "math/rand"
+ "crypto/rand"
"strconv"
- "time"
)
const (
@@ -34,20 +33,25 @@ const (
)
func Random(n uint) string {
- rand.Seed(time.Now().UnixNano())
- bs := make([]byte, 0, n)
+ bs := make([]byte, n)
+
for i := uint(0); i < n; i++ {
- bs = append(bs, charSet[rand.Intn(charSize)])
+ _, _ = rand.Read(bs[i : i+1])
+ }
+ for i, v := range bs {
+ bs[i] = charSet[int(v)%charSize]
}
return string(bs)
}
func RandomInt(n uint) int64 {
- rand.Seed(time.Now().UnixNano())
- bs := make([]byte, 0, n)
- bs = append(bs, digitSet[rand.Intn(digitSize-1)])
- for i := uint(0); i < n-1; i++ {
- bs = append(bs, digitSet[rand.Intn(digitSize)])
+ bs := make([]byte, n)
+ _, _ = rand.Read(bs[0:1])
+ for i := uint(1); i < n; i++ {
+ _, _ = rand.Read(bs[i : i+1])
+ }
+ for i, v := range bs {
+ bs[i] = digitSet[int(v)%digitSize]
}
v, _ := strconv.ParseInt(string(bs), 10, 64)
return v
diff --git a/pitr/cli/pkg/stringutil/rand_string_test.go b/pitr/cli/pkg/stringutil/rand_string_test.go
index f2e3720..098171b 100644
--- a/pitr/cli/pkg/stringutil/rand_string_test.go
+++ b/pitr/cli/pkg/stringutil/rand_string_test.go
@@ -17,7 +17,9 @@
package strutil
-import "testing"
+import (
+ "testing"
+)
func TestRandom(t *testing.T) {
one, two := Random(20), Random(20)
diff --git a/shardingsphere-operator/.golangci.yml b/shardingsphere-operator/.golangci.yml
new file mode 100644
index 0000000..1c0265c
--- /dev/null
+++ b/shardingsphere-operator/.golangci.yml
@@ -0,0 +1,365 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+run:
+ timeout: 10m
+ skip-files:
+ - "^zz_generated.*"
+ - "_test.go"
+linters:
+ disable-all: true
+ enable:
+ # The base lints
+ - errcheck
+ - gosimple
+ - govet
+ - ineffassign
+ - staticcheck
+ - typecheck
+ - unused
+ - unused
+ - bodyclose
+ - cyclop
+ - nilerr
+ - goimports
+ - asciicheck
+ - prealloc
+ - stylecheck
+ - exportloopref
+ - rowserrcheck
+ - makezero
+ - durationcheck
+ - gosec
+ - predeclared
+ # Deprecated lints
+ - structcheck
+ - varcheck
+ - deadcode
+
+ # The advanced lints
+ - dupl
+ - exhaustive
+ - godot
+ - misspell
+ - varnamelen
+ - gocritic
+ - gocognit
+ - nestif
+ #- wsl
+ #- exhaustruct
+# Refers: https://gist.github.com/maratori/47a4d00457a92aa426dbd48a18776322
+linters-settings:
+ wsl:
+ # See https://github.com/bombsimon/wsl/blob/master/doc/configuration.md for documentation of available settings.
+ # These are the defaults for `golangci-lint`.
+
+ # Do strict checking when assigning from append (x = append(x, y)). If
+ # this is set to true - the append call must append either a variable
+ # assigned, called or used on the line above.
+ strict-append: true
+ # Allows assignments to be cuddled with variables used in calls on
+ # line above and calls to be cuddled with assignments of variables
+ # used in call on line above.
+ allow-assign-and-call: true
+ # Allows assignments to be cuddled with anything.
+ allow-assign-and-anything: false
+ # Allows cuddling to assignments even if they span over multiple lines.
+ allow-multiline-assign: true
+ # If the number of lines in a case block is equal to or lager than this
+ # number, the case *must* end white a newline.
+ force-case-trailing-whitespace: 0
+ # Allow blocks to end with comments.
+ allow-trailing-comment: false
+ # Allow multiple comments in the beginning of a block separated with newline.
+ allow-separated-leading-comment: false
+ # Allow multiple var/declaration statements to be cuddled.
+ allow-cuddle-declarations: false
+ # A list of call idents that everything can be cuddled with.
+ # Defaults to calls looking like locks.
+ allow-cuddle-with-calls: ["Lock", "RLock"]
+ # AllowCuddleWithRHS is a list of right hand side variables that is allowed
+ # to be cuddled with anything. Defaults to assignments or calls looking
+ # like unlocks.
+ allow-cuddle-with-rhs: ["Unlock", "RUnlock"]
+ # Causes an error when an If statement that checks an error variable doesn't
+ # cuddle with the assignment of that variable.
+ force-err-cuddling: false
+ # When force-err-cuddling is enabled this is a list of names
+ # used for error variables to check for in the conditional.
+ error-variable-names: ["err"]
+ # Causes an error if a short declaration (:=) cuddles with anything other than
+ # another short declaration.
+ # This logic overrides force-err-cuddling among others.
+ force-short-decl-cuddling: false
+ varnamelen:
+ # The longest distance, in source lines, that is being considered a "small scope".
+ # Variables used in at most this many lines will be ignored.
+ # Default: 5
+ max-distance: 6
+ # The minimum length of a variable's name that is considered "long".
+ # Variable names that are at least this long will be ignored.
+ # Default: 3
+ min-name-length: 1
+ # Check method receivers.
+ # Default: false
+ check-receiver: false
+ # Check named return values.
+ # Default: false
+ check-return: true
+ # Check type parameters.
+ # Default: false
+ check-type-param: true
+ # Ignore "ok" variables that hold the bool return value of a type assertion.
+ # Default: false
+ ignore-type-assert-ok: true
+ # Ignore "ok" variables that hold the bool return value of a map index.
+ # Default: false
+ ignore-map-index-ok: true
+ # Ignore "ok" variables that hold the bool return value of a channel receive.
+ # Default: false
+ ignore-chan-recv-ok: true
+ # Optional list of variable names that should be ignored completely.
+ # Default: []
+ ignore-names:
+ - err
+ # Optional list of variable declarations that should be ignored completely.
+ # Entries must be in one of the following forms (see below for examples):
+ # - for variables, parameters, named return values, method receivers, or type parameters:
+ # <name> <type> (<type> can also be a pointer/slice/map/chan/...)
+ # - for constants: const <name>
+ #
+ # Default: []
+ ignore-decls:
+ - c echo.Context
+ - t testing.T
+ - f *foo.Bar
+ - e error
+ - i int
+ - const C
+ - T any
+ - m map[string]int
+ prealloc:
+ # IMPORTANT: we don't recommend using this linter before doing performance profiling.
+ # For most programs usage of prealloc will be a premature optimization.
+
+ # Report pre-allocation suggestions only on simple loops that have no returns/breaks/continues/gotos in them.
+ # Default: true
+ simple: false
+ # Report pre-allocation suggestions on range loops.
+ # Default: true
+ range-loops: false
+ # Report pre-allocation suggestions on for loops.
+ # Default: false
+ for-loops: true
+ nestif:
+ # Minimal complexity of if statements to report.
+ # Default: 5
+ min-complexity: 4
+ misspell:
+ # Correct spellings using locale preferences for US or UK.
+ # Setting locale to US will correct the British spelling of 'colour' to 'color'.
+ # Default is to use a neutral variety of English.
+ locale: US
+ # Default: []
+ ignore-words:
+ - someword
+ godot:
+ # Comments to be checked: `declarations`, `toplevel`, or `all`.
+ # Default: declarations
+ scope: toplevel
+ # List of regexps for excluding particular comment lines from check.
+ # Default: []
+ exclude:
+ # Exclude todo and fixme comments.
+ - "^fixme:"
+ - "^todo:"
+ # Check that each sentence ends with a period.
+ # Default: true
+ period: false
+ # Check that each sentence starts with a capital letter.
+ # Default: false
+ capital: false
+ dupl:
+ # Tokens count to trigger issue.
+ # Default: 150
+ threshold: 100
+ cyclop:
+ # The maximal code complexity to report.
+ # Default: 10
+ max-complexity: 30
+ # The maximal average package complexity.
+ # If it's higher than 0.0 (float) the check is enabled
+ # Default: 0.0
+ package-average: 10.0
+ errcheck:
+ # Report about not checking of errors in type assertions: `a := b.(MyStruct)`.
+ # Such cases aren't reported by default.
+ # Default: false
+ check-type-assertions: true
+ exhaustive:
+ # Program elements to check for exhaustiveness.
+ # Default: [ switch ]
+ check:
+ - switch
+ - map
+ funlen:
+ # Checks the number of lines in a function.
+ # If lower than 0, disable the check.
+ # Default: 60
+ lines: 100
+ # Checks the number of statements in a function.
+ # If lower than 0, disable the check.
+ # Default: 40
+ statements: 50
+ gocognit:
+ # Minimal code complexity to report.
+ # Default: 30 (but we recommend 10-20)
+ min-complexity: 20
+ gocritic:
+ # Which checks should be enabled; can't be combined with 'disabled-checks'.
+ # See https://go-critic.github.io/overview#checks-overview.
+ # To check which checks are enabled run `GL_DEBUG=gocritic golangci-lint run`.
+ # By default, list of stable checks is used.
+ enabled-checks:
+ - elseif
+ - nestingReduce
+ - unnamedResult
+ # - ruleguard
+ - truncateCmp
+ - hugeparam
+ - rangevalcopy
+ - captlocal
+ - underef
+ - toomanyresultschecker
+ - rangeexprcopy
+ # Which checks should be disabled; can't be combined with 'enabled-checks'.
+ # Default: []
+ disabled-checks:
+ - regexpMust
+ # Enable multiple checks by tags, run `GL_DEBUG=gocritic golangci-lint run` to see all tags and checks.
+ # See https://github.com/go-critic/go-critic#usage -> section "Tags".
+ # Default: []
+ enabled-tags:
+ - diagnostic
+ - style
+ - performance
+ - experimental
+ - opinionated
+ disabled-tags:
+ - diagnostic
+ - style
+ - performance
+ - experimental
+ - opinionated
+ # Settings passed to gocritic.
+ # The settings key is the name of a supported gocritic checker.
+ # The list of supported checkers can be find in https://go-critic.github.io/overview.
+ settings:
+ # Must be valid enabled check name.
+ captLocal:
+ # Whether to restrict checker to params only.
+ # Default: true
+ paramsOnly: false
+ elseif:
+ # Whether to skip balanced if-else pairs.
+ # Default: true
+ skipBalanced: false
+ hugeParam:
+ # Size in bytes that makes the warning trigger.
+ # Default: 80
+ sizeThreshold: 70
+ nestingReduce:
+ # Min number of statements inside a branch to trigger a warning.
+ # Default: 5
+ bodyWidth: 4
+ rangeExprCopy:
+ # Size in bytes that makes the warning trigger.
+ # Default: 512
+ sizeThreshold: 516
+ # Whether to check test functions
+ # Default: true
+ skipTestFuncs: false
+ rangeValCopy:
+ # Size in bytes that makes the warning trigger.
+ # Default: 128
+ sizeThreshold: 32
+ # Whether to check test functions.
+ # Default: true
+ skipTestFuncs: false
+ ruleguard:
+ # Enable debug to identify which 'Where' condition was rejected.
+ # The value of the parameter is the name of a function in a ruleguard file.
+ #
+ # When a rule is evaluated:
+ # If:
+ # The Match() clause is accepted; and
+ # One of the conditions in the Where() clause is rejected,
+ # Then:
+ # ruleguard prints the specific Where() condition that was rejected.
+ #
+ # The flag is passed to the ruleguard 'debug-group' argument.
+ # Default: ""
+ debug: 'emptyDecl'
+ # Deprecated, use 'failOn' param.
+ # If set to true, identical to failOn='all', otherwise failOn=''
+ failOnError: false
+ # Determines the behavior when an error occurs while parsing ruleguard files.
+ # If flag is not set, log error and skip rule files that contain an error.
+ # If flag is set, the value must be a comma-separated list of error conditions.
+ # - 'all': fail on all errors.
+ # - 'import': ruleguard rule imports a package that cannot be found.
+ # - 'dsl': gorule file does not comply with the ruleguard DSL.
+ # Default: ""
+ failOn: dsl
+ # Comma-separated list of file paths containing ruleguard rules.
+ # If a path is relative, it is relative to the directory where the golangci-lint command is executed.
+ # The special '${configDir}' variable is substituted with the absolute directory containing the golangci config file.
+ # Glob patterns such as 'rules-*.go' may be specified.
+ # Default: ""
+ rules: '${configDir}/ruleguard/rules-*.go,${configDir}/myrule1.go'
+ # Comma-separated list of enabled groups or skip empty to enable everything.
+ # Tags can be defined with # character prefix.
+ # Default: "<all>"
+ enable: "myGroupName,#myTagName"
+ # Comma-separated list of disabled groups or skip empty to enable everything.
+ # Tags can be defined with # character prefix.
+ # Default: ""
+ disable: "myGroupName,#myTagName"
+ tooManyResultsChecker:
+ # Maximum number of results.
+ # Default: 5
+ maxResults: 10
+ truncateCmp:
+ # Whether to skip int/uint/uintptr types.
+ # Default: true
+ skipArchDependent: false
+ underef:
+ # Whether to skip (*x).method() calls where x is a pointer receiver.
+ # Default: true
+ skipRecvDeref: false
+ unnamedResult:
+ # Whether to check exported functions.
+ # Default: false
+ checkExported: true
+issues:
+ exclude-rules:
+ - path: _test\.go
+ linters:
+ - errcheck
+ - gosec
+ - rowserrcheck
+ - makezero
diff --git a/shardingsphere-operator/Makefile b/shardingsphere-operator/Makefile
index 00096d0..3fc269a 100644
--- a/shardingsphere-operator/Makefile
+++ b/shardingsphere-operator/Makefile
@@ -111,6 +111,7 @@ $(LOCALBIN):
KUSTOMIZE ?= $(LOCALBIN)/kustomize
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
ENVTEST ?= $(LOCALBIN)/setup-envtest
+CHECK_LINT?= $(LOCALBIN)/setup-golangci-lint
## Tool Versions
KUSTOMIZE_VERSION ?= v4.5.7
@@ -131,3 +132,11 @@ $(CONTROLLER_GEN): $(LOCALBIN)
envtest: $(ENVTEST) ## Download envtest-setup locally if necessary.
$(ENVTEST): $(LOCALBIN)
GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest
+
+.PHONY: check
+check: check-lint
+
+.PHONY: check-lint
+check-lint: $(CHECK_LINT) ## Download golangci-lint-setup locally if necessary.
+$(CHECK_LINT): $(LOCALBIN)
+ GOBIN=$(LOCALBIN) CGO_ENABLED=0 golangci-lint run -v
diff --git a/shardingsphere-operator/api/v1alpha1/compute_node_types.go b/shardingsphere-operator/api/v1alpha1/compute_node_types.go
index 7e9a550..e980fcf 100644
--- a/shardingsphere-operator/api/v1alpha1/compute_node_types.go
+++ b/shardingsphere-operator/api/v1alpha1/compute_node_types.go
@@ -19,7 +19,6 @@ package v1alpha1
import (
corev1 "k8s.io/api/core/v1"
- v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
@@ -274,7 +273,7 @@ type ComputeNodeSpec struct {
// +optional
Env []corev1.EnvVar `json:"env,omitempty"`
// +optional
- Resources v1.ResourceRequirements `json:"resources,omitempty"`
+ Resources corev1.ResourceRequirements `json:"resources,omitempty"`
// +optional
PortBindings []PortBinding `json:"portBindings,omitempty" yaml:"portBinding"`
@@ -337,6 +336,7 @@ type ComputeNodeConditionType string
const (
ComputeNodeConditionInitialized ComputeNodeConditionType = "Initialized"
ComputeNodeConditionStarted ComputeNodeConditionType = "Started"
+ ComputeNodeConditionSucceed ComputeNodeConditionType = "Succeed"
ComputeNodeConditionReady ComputeNodeConditionType = "Ready"
ComputeNodeConditionUnknown ComputeNodeConditionType = "Unknown"
ComputeNodeConditionDeployed ComputeNodeConditionType = "Deployed"
diff --git a/shardingsphere-operator/api/v1alpha1/proxy_status.go b/shardingsphere-operator/api/v1alpha1/proxy_status.go
index 3064141..e70d445 100644
--- a/shardingsphere-operator/api/v1alpha1/proxy_status.go
+++ b/shardingsphere-operator/api/v1alpha1/proxy_status.go
@@ -19,7 +19,6 @@ package v1alpha1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
type PhaseStatus string
@@ -36,6 +35,7 @@ const (
ConditionDeployed ConditionType = "Deployed"
ConditionInitialized ConditionType = "Initialized"
ConditionStarted ConditionType = "Started"
+ ConditionSucceed ConditionType = "Succeed"
ConditionReady ConditionType = "Ready"
ConditionUnknown ConditionType = "Unknown"
ConditionFailed ConditionType = "Failed"
@@ -67,7 +67,7 @@ type Conditions []Condition
// | NotReady | Failed | ShardingSphere-Proxy failed to start correctly due to some problems|
type Condition struct {
- Type ConditionType `json:"type"`
- Status v1.ConditionStatus `json:"status"`
- LastUpdateTime metav1.Time `json:"lastUpdateTime,omitempty"`
+ Type ConditionType `json:"type"`
+ Status metav1.ConditionStatus `json:"status"`
+ LastUpdateTime metav1.Time `json:"lastUpdateTime,omitempty"`
}
diff --git a/shardingsphere-operator/go.mod b/shardingsphere-operator/go.mod
index 5a7967c..a1bdbe7 100644
--- a/shardingsphere-operator/go.mod
+++ b/shardingsphere-operator/go.mod
@@ -3,6 +3,7 @@ module github.com/apache/shardingsphere-on-cloud/shardingsphere-operator
go 1.19
require (
+ github.com/antlr/antlr4 v0.0.0-20181218183524-be58ebffde8e
github.com/go-logr/logr v1.2.3
github.com/onsi/ginkgo/v2 v2.8.0
github.com/onsi/gomega v1.26.0
diff --git a/shardingsphere-operator/go.sum b/shardingsphere-operator/go.sum
index e493c9f..cdcdad6 100644
--- a/shardingsphere-operator/go.sum
+++ b/shardingsphere-operator/go.sum
@@ -68,6 +68,8 @@ github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRF
github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho=
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
+github.com/antlr/antlr4 v0.0.0-20181218183524-be58ebffde8e h1:yxMh4HIdsSh2EqxUESWvzszYMNzOugRyYCeohfwNULM=
+github.com/antlr/antlr4 v0.0.0-20181218183524-be58ebffde8e/go.mod h1:T7PbCXFs94rrTttyxjbyT5+/1V8T2TYDejxUfHJjw1Y=
github.com/antlr/antlr4/runtime/Go/antlr v0.0.0-20210826220005-b48c857c3a0e/go.mod h1:F7bn7fEU90QkQ3tnmaTx3LTKLEDqnwWODIYppRQ5hnY=
github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o=
github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY=
diff --git a/shardingsphere-operator/pkg/controllers/compute_node_controller.go b/shardingsphere-operator/pkg/controllers/compute_node_controller.go
index 2cc0a86..8e72061 100644
--- a/shardingsphere-operator/pkg/controllers/compute_node_controller.go
+++ b/shardingsphere-operator/pkg/controllers/compute_node_controller.go
@@ -29,7 +29,7 @@ import (
"github.com/go-logr/logr"
appsv1 "k8s.io/api/apps/v1"
- v1 "k8s.io/api/core/v1"
+ corev1 "k8s.io/api/core/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
@@ -59,9 +59,9 @@ func (r *ComputeNodeReconciler) SetupWithManager(mgr ctrl.Manager) error {
return ctrl.NewControllerManagedBy(mgr).
For(&v1alpha1.ComputeNode{}).
Owns(&appsv1.Deployment{}).
- Owns(&v1.Pod{}).
- Owns(&v1.Service{}).
- Owns(&v1.ConfigMap{}).
+ Owns(&corev1.Pod{}).
+ Owns(&corev1.Service{}).
+ Owns(&corev1.ConfigMap{}).
Complete(r)
}
@@ -162,39 +162,85 @@ func (r *ComputeNodeReconciler) createService(ctx context.Context, cn *v1alpha1.
return err
}
-func (r *ComputeNodeReconciler) updateService(ctx context.Context, cn *v1alpha1.ComputeNode, cur *v1.Service) error {
- if cn.Spec.ServiceType == v1.ServiceTypeNodePort {
- for _, p := range cur.Spec.Ports {
- for idx := range cn.Spec.PortBindings {
- if p.Name == cn.Spec.PortBindings[idx].Name {
- if cn.Spec.PortBindings[idx].NodePort == 0 {
- cn.Spec.PortBindings[idx].NodePort = p.NodePort
- if err := r.Update(ctx, cn); err != nil {
- return err
- }
- }
- break
- }
- }
+func (r *ComputeNodeReconciler) updateService(ctx context.Context, cn *v1alpha1.ComputeNode, cur *corev1.Service) error {
+ // if cn.Spec.ServiceType == v1.ServiceTypeNodePort {
+ // for idx := range cur.Spec.Ports {
+ // for i := range cn.Spec.PortBindings {
+ // if cur.Spec.Ports[idx].Name == cn.Spec.PortBindings[i].Name {
+ // if cn.Spec.PortBindings[i].NodePort == 0 {
+ // cn.Spec.PortBindings[i].NodePort = cur.Spec.Ports[idx].NodePort
+ // if err := r.Update(ctx, cn); err != nil {
+ // return err
+ // }
+ // }
+ // break
+ // }
+ // }
+ // }
+ // }
+ // if cn.Spec.ServiceType == v1.ServiceTypeClusterIP {
+ // for idx := range cn.Spec.PortBindings {
+ // if cn.Spec.PortBindings[idx].NodePort != 0 {
+ // cn.Spec.PortBindings[idx].NodePort = 0
+ // if err := r.Update(ctx, cn); err != nil {
+ // return err
+ // }
+ // break
+ // }
+ // }
+ // }
+
+ switch cn.Spec.ServiceType {
+ case corev1.ServiceTypeClusterIP:
+ updateServiceClusterIP(cn.Spec.PortBindings)
+ if err := r.Update(ctx, cn); err != nil {
+ return err
+ }
+ case corev1.ServiceTypeExternalName:
+ fallthrough
+ case corev1.ServiceTypeLoadBalancer:
+ fallthrough
+ case corev1.ServiceTypeNodePort:
+ updateServiceNodePort(cn.Spec.PortBindings, cur.Spec.Ports)
+ if err := r.Update(ctx, cn); err != nil {
+ return err
}
}
- if cn.Spec.ServiceType == v1.ServiceTypeClusterIP {
- for idx := range cn.Spec.PortBindings {
- if cn.Spec.PortBindings[idx].NodePort != 0 {
- cn.Spec.PortBindings[idx].NodePort = 0
- if err := r.Update(ctx, cn); err != nil {
- return err
+
+ exp := reconcile.UpdateService(cn, cur)
+ return r.Update(ctx, exp)
+}
+
+func updateServiceNodePort(portBindings []v1alpha1.PortBinding, svcports []corev1.ServicePort) {
+ for idx := range svcports {
+ for i := range portBindings {
+ if svcports[idx].Name == portBindings[i].Name {
+ if portBindings[i].NodePort == 0 {
+ portBindings[i].NodePort = svcports[idx].NodePort
+ break
+ // if err := r.Update(ctx, cn); err != nil {
+ // return err
+ // }
}
break
}
}
}
+}
- exp := reconcile.UpdateService(cn, cur)
- return r.Update(ctx, exp)
+func updateServiceClusterIP(portBindings []v1alpha1.PortBinding) {
+ for idx := range portBindings {
+ if portBindings[idx].NodePort != 0 {
+ portBindings[idx].NodePort = 0
+ // if err := r.Update(ctx, cn); err != nil {
+ // return err
+ // }
+ break
+ }
+ }
}
-func (r *ComputeNodeReconciler) getServiceByNamespacedName(ctx context.Context, namespacedName types.NamespacedName) (*v1.Service, bool, error) {
+func (r *ComputeNodeReconciler) getServiceByNamespacedName(ctx context.Context, namespacedName types.NamespacedName) (*corev1.Service, bool, error) {
svc, err := r.Service.GetByNamespacedName(ctx, namespacedName)
if err != nil {
return nil, false, err
@@ -206,7 +252,7 @@ func (r *ComputeNodeReconciler) getServiceByNamespacedName(ctx context.Context,
}
func (r *ComputeNodeReconciler) createConfigMap(ctx context.Context, cn *v1alpha1.ComputeNode) error {
- cm := reconcile.NewConfigMap(cn)
+ cm := reconcile.NewCNConfigMap(cn)
err := r.Create(ctx, cm)
if err != nil && apierrors.IsAlreadyExists(err) || err == nil {
return nil
@@ -214,12 +260,12 @@ func (r *ComputeNodeReconciler) createConfigMap(ctx context.Context, cn *v1alpha
return err
}
-func (r *ComputeNodeReconciler) updateConfigMap(ctx context.Context, cn *v1alpha1.ComputeNode, cm *v1.ConfigMap) error {
+func (r *ComputeNodeReconciler) updateConfigMap(ctx context.Context, cn *v1alpha1.ComputeNode, cm *corev1.ConfigMap) error {
exp := reconcile.UpdateConfigMap(cn, cm)
return r.Update(ctx, exp)
}
-func (r *ComputeNodeReconciler) getConfigMapByNamespacedName(ctx context.Context, namespacedName types.NamespacedName) (*v1.ConfigMap, bool, error) {
+func (r *ComputeNodeReconciler) getConfigMapByNamespacedName(ctx context.Context, namespacedName types.NamespacedName) (*corev1.ConfigMap, bool, error) {
cm, err := r.ConfigMap.GetByNamespacedName(ctx, namespacedName)
if err != nil {
return nil, false, err
@@ -243,12 +289,12 @@ func (r *ComputeNodeReconciler) reconcileConfigMap(ctx context.Context, cn *v1al
}
func (r *ComputeNodeReconciler) reconcileStatus(ctx context.Context, cn *v1alpha1.ComputeNode) error {
- podlist := &v1.PodList{}
+ podlist := &corev1.PodList{}
if err := r.List(ctx, podlist, client.InNamespace(cn.Namespace), client.MatchingLabels(cn.Spec.Selector.MatchLabels)); err != nil {
return err
}
- service := &v1.Service{}
+ service := &corev1.Service{}
if err := r.Get(ctx, types.NamespacedName{
Namespace: cn.Namespace,
Name: cn.Name,
@@ -264,32 +310,46 @@ func (r *ComputeNodeReconciler) reconcileStatus(ctx context.Context, cn *v1alpha
return err
}
- status := reconcileComputeNodeStatus(*podlist, *service)
+ status := reconcileComputeNodeStatus(podlist, service)
rt.Status = *status
// TODO: Compare Status with or without modification
return r.Status().Update(ctx, rt)
}
-func getReadyProxyInstances(podlist v1.PodList) int32 {
+func getReadyProxyInstances(podlist *corev1.PodList) int32 {
var cnt int32
- for _, p := range podlist.Items {
- if p.Status.Phase == v1.PodRunning {
- for _, c := range p.Status.Conditions {
- if c.Type == v1.PodReady && c.Status == v1.ConditionTrue {
- for _, con := range p.Status.ContainerStatuses {
- if con.Name == "shardingsphere-proxy" && con.Ready {
- cnt++
- }
- }
+
+ findRunningPod := func(pod *corev1.Pod) {
+ if pod.Status.Phase != corev1.PodRunning {
+ return
+ }
+
+ if isTrueReadyPod(pod) {
+ for j := range pod.Status.ContainerStatuses {
+ if pod.Status.ContainerStatuses[j].Name == "shardingsphere-proxy" && pod.Status.ContainerStatuses[j].Ready {
+ cnt++
}
}
}
}
+
+ for idx := range podlist.Items {
+ findRunningPod(&podlist.Items[idx])
+ }
return cnt
}
-func newConditions(conditions []v1alpha1.ComputeNodeCondition, cond v1alpha1.ComputeNodeCondition) []v1alpha1.ComputeNodeCondition {
+func isTrueReadyPod(pod *corev1.Pod) bool {
+ for i := range pod.Status.Conditions {
+ if pod.Status.Conditions[i].Type == corev1.PodReady && pod.Status.Conditions[i].Status == corev1.ConditionTrue {
+ return true
+ }
+ }
+ return false
+}
+
+func newConditions(conditions []v1alpha1.ComputeNodeCondition, cond *v1alpha1.ComputeNodeCondition) []v1alpha1.ComputeNodeCondition {
if conditions == nil {
conditions = []v1alpha1.ComputeNodeCondition{}
}
@@ -298,30 +358,31 @@ func newConditions(conditions []v1alpha1.ComputeNodeCondition, cond v1alpha1.Com
}
found := false
- for idx, _ := range conditions {
- if conditions[idx].Type == cond.Type {
- conditions[idx].LastUpdateTime = cond.LastUpdateTime
- conditions[idx].Status = cond.Status
- found = true
- break
+ for idx := range conditions {
+ if conditions[idx].Type != cond.Type {
+ continue
}
+ conditions[idx].LastUpdateTime = cond.LastUpdateTime
+ conditions[idx].Status = cond.Status
+ found = true
+ break
}
if !found {
- conditions = append(conditions, cond)
+ conditions = append(conditions, *cond)
}
return conditions
}
-func updateReadyConditions(conditions []v1alpha1.ComputeNodeCondition, cond v1alpha1.ComputeNodeCondition) []v1alpha1.ComputeNodeCondition {
+func updateReadyConditions(conditions []v1alpha1.ComputeNodeCondition, cond *v1alpha1.ComputeNodeCondition) []v1alpha1.ComputeNodeCondition {
return newConditions(conditions, cond)
}
-func updateNotReadyConditions(conditions []v1alpha1.ComputeNodeCondition, cond v1alpha1.ComputeNodeCondition) []v1alpha1.ComputeNodeCondition {
+func updateNotReadyConditions(conditions []v1alpha1.ComputeNodeCondition, cond *v1alpha1.ComputeNodeCondition) []v1alpha1.ComputeNodeCondition {
cur := newConditions(conditions, cond)
- for idx, _ := range cur {
+ for idx := range cur {
if cur[idx].Type == v1alpha1.ComputeNodeConditionReady {
cur[idx].LastUpdateTime = metav1.Now()
cur[idx].Status = v1alpha1.ConditionStatusFalse
@@ -331,7 +392,7 @@ func updateNotReadyConditions(conditions []v1alpha1.ComputeNodeCondition, cond v
return cur
}
-func clusterCondition(podlist v1.PodList) v1alpha1.ComputeNodeCondition {
+func clusterCondition(podlist *corev1.PodList) v1alpha1.ComputeNodeCondition {
cond := v1alpha1.ComputeNodeCondition{}
if len(podlist.Items) == 0 {
return cond
@@ -342,6 +403,13 @@ func clusterCondition(podlist v1.PodList) v1alpha1.ComputeNodeCondition {
Status: v1alpha1.ConditionStatusTrue,
LastUpdateTime: metav1.Now(),
}
+
+ condSucceed := v1alpha1.ComputeNodeCondition{
+ Type: v1alpha1.ComputeNodeConditionSucceed,
+ Status: v1alpha1.ConditionStatusTrue,
+ LastUpdateTime: metav1.Now(),
+ }
+
condUnknown := v1alpha1.ComputeNodeCondition{
Type: v1alpha1.ComputeNodeConditionUnknown,
Status: v1alpha1.ConditionStatusTrue,
@@ -359,53 +427,55 @@ func clusterCondition(podlist v1.PodList) v1alpha1.ComputeNodeCondition {
}
//FIXME: do not capture ConditionStarted in some cases
- for _, p := range podlist.Items {
- switch p.Status.Phase {
- case v1.PodRunning:
+ for idx := range podlist.Items {
+ switch podlist.Items[idx].Status.Phase {
+ case corev1.PodSucceeded:
+ return condSucceed
+ case corev1.PodRunning:
return condStarted
- case v1.PodUnknown:
+ case corev1.PodUnknown:
return condUnknown
- case v1.PodPending:
+ case corev1.PodPending:
return condDeployed
- case v1.PodFailed:
+ case corev1.PodFailed:
return condFailed
}
}
return cond
}
-func reconcileComputeNodeStatus(podlist v1.PodList, svc v1.Service) *v1alpha1.ComputeNodeStatus {
- s := &v1alpha1.ComputeNodeStatus{}
+func reconcileComputeNodeStatus(podlist *corev1.PodList, svc *corev1.Service) *v1alpha1.ComputeNodeStatus {
+ status := &v1alpha1.ComputeNodeStatus{}
- s.Replicas = int32(len(podlist.Items))
+ status.Replicas = int32(len(podlist.Items))
readyInstances := getReadyProxyInstances(podlist)
- s.ReadyInstances = readyInstances
- if s.Replicas == 0 {
- s.Phase = v1alpha1.ComputeNodeStatusNotReady
+ status.ReadyInstances = readyInstances
+ if status.Replicas == 0 {
+ status.Phase = v1alpha1.ComputeNodeStatusNotReady
} else {
if readyInstances < miniReadyCount {
- s.Phase = v1alpha1.ComputeNodeStatusNotReady
+ status.Phase = v1alpha1.ComputeNodeStatusNotReady
} else {
- s.Phase = v1alpha1.ComputeNodeStatusReady
+ status.Phase = v1alpha1.ComputeNodeStatusReady
}
}
- if s.Phase == v1alpha1.ComputeNodeStatusReady {
- s.Conditions = updateReadyConditions(s.Conditions, v1alpha1.ComputeNodeCondition{
+ if status.Phase == v1alpha1.ComputeNodeStatusReady {
+ status.Conditions = updateReadyConditions(status.Conditions, &v1alpha1.ComputeNodeCondition{
Type: v1alpha1.ComputeNodeConditionReady,
Status: v1alpha1.ConditionStatusTrue,
LastUpdateTime: metav1.Now(),
})
} else {
cond := clusterCondition(podlist)
- s.Conditions = updateNotReadyConditions(s.Conditions, cond)
+ status.Conditions = updateNotReadyConditions(status.Conditions, &cond)
}
- s.LoadBalancer.ClusterIP = svc.Spec.ClusterIP
- s.LoadBalancer.Ingress = svc.Status.LoadBalancer.Ingress
+ status.LoadBalancer.ClusterIP = svc.Spec.ClusterIP
+ status.LoadBalancer.Ingress = svc.Status.LoadBalancer.Ingress
- return s
+ return status
}
func (r *ComputeNodeReconciler) getRuntimeComputeNode(ctx context.Context, namespacedName types.NamespacedName) (*v1alpha1.ComputeNode, error) {
diff --git a/shardingsphere-operator/pkg/controllers/compute_node_controller_test.go b/shardingsphere-operator/pkg/controllers/compute_node_controller_test.go
new file mode 100644
index 0000000..6954588
--- /dev/null
+++ b/shardingsphere-operator/pkg/controllers/compute_node_controller_test.go
@@ -0,0 +1,111 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package controllers
+
+import (
+ "testing"
+
+ v1 "k8s.io/api/core/v1"
+)
+
+func Test_GetReadyProxyInstances(t *testing.T) {
+ // create sample PodList
+ podlist := v1.PodList{
+ Items: []v1.Pod{
+ {
+ Status: v1.PodStatus{
+ Phase: v1.PodRunning,
+ Conditions: []v1.PodCondition{
+ {
+ Type: v1.PodReady,
+ Status: v1.ConditionTrue,
+ },
+ },
+ ContainerStatuses: []v1.ContainerStatus{
+ {
+ Name: "shardingsphere-proxy",
+ Ready: true,
+ },
+ },
+ },
+ },
+ {
+ Status: v1.PodStatus{
+ Phase: v1.PodRunning,
+ Conditions: []v1.PodCondition{
+ {
+ Type: v1.PodReady,
+ Status: v1.ConditionTrue,
+ },
+ },
+ ContainerStatuses: []v1.ContainerStatus{
+ {
+ Name: "another-container",
+ Ready: true,
+ },
+ },
+ },
+ },
+ {
+ Status: v1.PodStatus{
+ Phase: v1.PodRunning,
+ Conditions: []v1.PodCondition{
+ {
+ Type: v1.PodReady,
+ Status: v1.ConditionFalse,
+ },
+ },
+ ContainerStatuses: []v1.ContainerStatus{
+ {
+ Name: "shardingsphere-proxy",
+ Ready: false,
+ },
+ },
+ },
+ },
+ {
+ Status: v1.PodStatus{
+ Phase: v1.PodPending,
+ Conditions: []v1.PodCondition{
+ {
+ Type: v1.PodReady,
+ Status: v1.ConditionTrue,
+ },
+ },
+ ContainerStatuses: []v1.ContainerStatus{
+ {
+ Name: "shardingsphere-proxy",
+ Ready: true,
+ },
+ },
+ },
+ },
+ },
+ }
+
+ // expected result is 1 because only one pod has a ready shardingsphere-proxy container
+ expected := int32(1)
+
+ // call the function to get the actual result
+ actual := getReadyProxyInstances(&podlist)
+
+ // compare the expected and actual results
+ if actual != expected {
+ t.Errorf("getReadyInstances returned %d, expected %d", actual, expected)
+ }
+}
diff --git a/shardingsphere-operator/pkg/controllers/proxy_controller.go b/shardingsphere-operator/pkg/controllers/proxy_controller.go
index c970393..6bd16ff 100644
--- a/shardingsphere-operator/pkg/controllers/proxy_controller.go
+++ b/shardingsphere-operator/pkg/controllers/proxy_controller.go
@@ -40,7 +40,7 @@ import (
const (
//WaitingForReady Time selection reference kubelet restart time
WaitingForReady = 10 * time.Second
- //miniReadyCount Minimum number of replicas that can be served
+ // miniReadyCount Minimum number of replicas that can be served
miniReadyCount = 1
proxyControllerName = "proxy_controller"
@@ -66,7 +66,7 @@ type ProxyReconciler struct {
// move the current state of the cluster closer to the desired state.
func (r *ProxyReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
- logger := r.Log.WithValues(computeNodeControllerName, req.NamespacedName)
+ logger := r.Log.WithValues(proxyControllerName, req.NamespacedName)
rt, err := r.getRuntimeShardingSphereProxy(ctx, req.NamespacedName)
if apierrors.IsNotFound(err) {
@@ -111,67 +111,72 @@ func (r *ProxyReconciler) reconcile(ctx context.Context, req ctrl.Request, rt *v
}
func (r *ProxyReconciler) reconcileDeployment(ctx context.Context, namespacedName types.NamespacedName) (ctrl.Result, error) {
- ssproxy, err := r.getRuntimeShardingSphereProxy(ctx, namespacedName)
+ proxy, err := r.getRuntimeShardingSphereProxy(ctx, namespacedName)
if err != nil {
return ctrl.Result{}, err
}
deploy := &appsv1.Deployment{}
+ err = r.Get(ctx, namespacedName, deploy)
- if err := r.Get(ctx, namespacedName, deploy); err != nil {
- if !apierrors.IsNotFound(err) {
+ if apierrors.IsNotFound(err) {
+ exp := reconcile.NewDeployment(proxy)
+ if err := r.Create(ctx, exp); err != nil {
return ctrl.Result{}, err
- } else {
- exp := reconcile.NewDeployment(ssproxy)
- if err := r.Create(ctx, exp); err != nil {
- return ctrl.Result{}, err
- }
}
- } else {
- act := deploy.DeepCopy()
+ }
- exp := reconcile.UpdateDeployment(ssproxy, act)
- if err != nil {
- return ctrl.Result{}, err
- }
- if err := r.Update(ctx, exp); err != nil {
- return ctrl.Result{Requeue: true}, err
- }
+ if err != nil {
+ return ctrl.Result{}, err
+ }
+
+ act := deploy.DeepCopy()
+ exp := reconcile.UpdateDeployment(proxy, act)
+
+ if err := r.Update(ctx, exp); err != nil {
+ return ctrl.Result{Requeue: true}, err
}
return ctrl.Result{}, nil
}
func (r *ProxyReconciler) reconcileHPA(ctx context.Context, namespacedName types.NamespacedName) (ctrl.Result, error) {
- ssproxy, err := r.getRuntimeShardingSphereProxy(ctx, namespacedName)
+ proxy, err := r.getRuntimeShardingSphereProxy(ctx, namespacedName)
if err != nil {
return ctrl.Result{}, err
}
+ // Get the HPA
hpa := &autoscalingv2beta2.HorizontalPodAutoscaler{}
+ err = r.Get(ctx, namespacedName, hpa)
- if err := r.Get(ctx, namespacedName, hpa); err != nil {
- if !apierrors.IsNotFound(err) {
- return ctrl.Result{}, err
- } else {
- if ssproxy.Spec.AutomaticScaling != nil && ssproxy.Spec.AutomaticScaling.Enable {
- exp := reconcile.NewHPA(ssproxy)
- if err := r.Create(ctx, exp); err != nil {
- return ctrl.Result{}, err
- }
- }
- }
- } else {
- if ssproxy.Spec.AutomaticScaling == nil || !ssproxy.Spec.AutomaticScaling.Enable {
- if err := r.Delete(ctx, hpa); err != nil {
- return ctrl.Result{}, err
- }
- } else {
- act := hpa.DeepCopy()
- exp := reconcile.UpdateHPA(ssproxy, act)
- if err := r.Update(ctx, exp); err != nil {
+ // If the HPA doesn't exist, create it
+ if apierrors.IsNotFound(err) {
+ if proxy.Spec.AutomaticScaling != nil && proxy.Spec.AutomaticScaling.Enable {
+ exp := reconcile.NewHPA(proxy)
+ if err := r.Create(ctx, exp); err != nil {
return ctrl.Result{}, err
}
}
+ return ctrl.Result{}, nil
+ }
+
+ if err != nil {
+ return ctrl.Result{}, err
+ }
+
+ // If the HPA exists, but we don't want it, delete it
+ if proxy.Spec.AutomaticScaling == nil || !proxy.Spec.AutomaticScaling.Enable {
+ if err := r.Delete(ctx, hpa); err != nil {
+ return ctrl.Result{}, err
+ }
+ return ctrl.Result{}, nil
+ }
+
+ // If the HPA exists and we want it, update it
+ act := hpa.DeepCopy()
+ exp := reconcile.UpdateHPA(proxy, act)
+ if err := r.Update(ctx, exp); err != nil {
+ return ctrl.Result{}, err
}
return ctrl.Result{}, nil
@@ -184,24 +189,25 @@ func (r *ProxyReconciler) reconcileService(ctx context.Context, namespacedName t
}
service := &v1.Service{}
+ err = r.Get(ctx, namespacedName, service)
- if err := r.Get(ctx, namespacedName, service); err != nil {
- if !apierrors.IsNotFound(err) {
- return ctrl.Result{}, err
- } else {
- exp := reconcile.NewService(ssproxy)
- if err := r.Create(ctx, exp); err != nil {
- return ctrl.Result{}, err
- }
- }
- } else {
- act := service.DeepCopy()
- exp := reconcile.UpdateService(ssproxy, act)
- if err := r.Update(ctx, exp); err != nil {
+ if apierrors.IsNotFound(err) {
+ exp := reconcile.NewService(ssproxy)
+ if err := r.Create(ctx, exp); err != nil {
return ctrl.Result{}, err
}
}
+ if err != nil {
+ return ctrl.Result{}, err
+ }
+
+ act := service.DeepCopy()
+ exp := reconcile.UpdateService(ssproxy, act)
+ if err := r.Update(ctx, exp); err != nil {
+ return ctrl.Result{}, err
+ }
+
return ctrl.Result{}, nil
}
@@ -221,7 +227,7 @@ func (r *ProxyReconciler) reconcilePodList(ctx context.Context, namespace, name
return ctrl.Result{}, err
}
- rt.Status = reconcile.ReconcileStatus(*podList, *rt)
+ rt.Status = reconcile.ReconcileStatus(podList, rt)
// TODO: Compare Status with or without modification
if err := r.Status().Update(ctx, rt); err != nil {
diff --git a/shardingsphere-operator/pkg/controllers/proxyconfig_controller.go b/shardingsphere-operator/pkg/controllers/proxyconfig_controller.go
index 2cb41bc..cb960ab 100644
--- a/shardingsphere-operator/pkg/controllers/proxyconfig_controller.go
+++ b/shardingsphere-operator/pkg/controllers/proxyconfig_controller.go
@@ -60,7 +60,7 @@ type ProxyConfigReconciler struct {
// For more details, check Reconcile and its Result here:
// - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.11.0/pkg/reconcile
func (r *ProxyConfigReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
- logger := r.Log.WithValues(computeNodeControllerName, req.NamespacedName)
+ logger := r.Log.WithValues(proxyConfigControllerName, req.NamespacedName)
run := &shardingspherev1alpha1.ShardingSphereProxyServerConfig{}
err := r.Get(ctx, req.NamespacedName, run)
diff --git a/shardingsphere-operator/pkg/reconcile/proxy/resource.go b/shardingsphere-operator/pkg/distsql/antlr4/encrypt/Alphabet.g4
similarity index 56%
copy from shardingsphere-operator/pkg/reconcile/proxy/resource.go
copy to shardingsphere-operator/pkg/distsql/antlr4/encrypt/Alphabet.g4
index d04313f..421bb83 100644
--- a/shardingsphere-operator/pkg/reconcile/proxy/resource.go
+++ b/shardingsphere-operator/pkg/distsql/antlr4/encrypt/Alphabet.g4
@@ -15,29 +15,35 @@
* limitations under the License.
*/
-package proxy
-import (
- v1 "k8s.io/api/core/v1"
- "k8s.io/apimachinery/pkg/util/intstr"
-)
+lexer grammar Alphabet;
-const imageName = "apache/shardingsphere-proxy"
+FOR_GENERATOR: 'DO NOT MATCH ANY THING, JUST FOR GENERATOR';
-func fromInt32(val int32) intstr.IntOrString {
- return intstr.IntOrString{Type: intstr.Int, IntVal: val}
-}
-func isRunningPod(s v1.PodStatus) bool {
- return s.Phase == v1.PodRunning
-}
-
-func isReadyPod(s v1.PodStatus) bool {
- if s.ContainerStatuses != nil && len(s.ContainerStatuses) > 0 {
- return s.ContainerStatuses[0].Ready
- }
- return false
-}
-
-func isNonTerminatingPod(pod v1.Pod) bool {
- return pod.ObjectMeta.DeletionTimestamp == nil
-}
+fragment A: [Aa];
+fragment B: [Bb];
+fragment C: [Cc];
+fragment D: [Dd];
+fragment E: [Ee];
+fragment F: [Ff];
+fragment G: [Gg];
+fragment H: [Hh];
+fragment I: [Ii];
+fragment J: [Jj];
+fragment K: [Kk];
+fragment L: [Ll];
+fragment M: [Mm];
+fragment N: [Nn];
+fragment O: [Oo];
+fragment P: [Pp];
+fragment Q: [Qq];
+fragment R: [Rr];
+fragment S: [Ss];
+fragment T: [Tt];
+fragment U: [Uu];
+fragment V: [Vv];
+fragment W: [Ww];
+fragment X: [Xx];
+fragment Y: [Yy];
+fragment Z: [Zz];
+fragment UL_: '_';
diff --git a/shardingsphere-operator/pkg/reconcile/proxy/resource.go b/shardingsphere-operator/pkg/distsql/antlr4/encrypt/BaseRule.g4
similarity index 57%
copy from shardingsphere-operator/pkg/reconcile/proxy/resource.go
copy to shardingsphere-operator/pkg/distsql/antlr4/encrypt/BaseRule.g4
index d04313f..36f03f9 100644
--- a/shardingsphere-operator/pkg/reconcile/proxy/resource.go
+++ b/shardingsphere-operator/pkg/distsql/antlr4/encrypt/BaseRule.g4
@@ -14,30 +14,44 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
+grammar BaseRule;
-package proxy
+import Symbol, Keyword, Literals;
-import (
- v1 "k8s.io/api/core/v1"
- "k8s.io/apimachinery/pkg/util/intstr"
-)
+literal
+ : STRING_ | (MINUS_)? INT_ | TRUE | FALSE
+ ;
-const imageName = "apache/shardingsphere-proxy"
+algorithmDefinition
+ : TYPE LP_ NAME EQ_ algorithmTypeName (COMMA_ propertiesDefinition)? RP_
+ ;
-func fromInt32(val int32) intstr.IntOrString {
- return intstr.IntOrString{Type: intstr.Int, IntVal: val}
-}
-func isRunningPod(s v1.PodStatus) bool {
- return s.Phase == v1.PodRunning
-}
+algorithmTypeName
+ : buildinAlgorithmTypeName | STRING_
+ ;
-func isReadyPod(s v1.PodStatus) bool {
- if s.ContainerStatuses != nil && len(s.ContainerStatuses) > 0 {
- return s.ContainerStatuses[0].Ready
- }
- return false
-}
+buildinAlgorithmTypeName
+ : MD5
+ | AES
+ | RC4
+ | SM3
+ | SM4
+ | CHAR_DIGEST_LIKE
+ ;
-func isNonTerminatingPod(pod v1.Pod) bool {
- return pod.ObjectMeta.DeletionTimestamp == nil
-}
+propertiesDefinition
+ : PROPERTIES LP_ properties? RP_
+ ;
+
+properties
+ : property (COMMA_ property)*
+ ;
+
+property
+ : key=STRING_ EQ_ value=literal
+ ;
+
+tableName
+ : IDENTIFIER_
+ ;
diff --git a/shardingsphere-operator/pkg/distsql/antlr4/encrypt/Keyword.g4 b/shardingsphere-operator/pkg/distsql/antlr4/encrypt/Keyword.g4
new file mode 100644
index 0000000..1f43761
--- /dev/null
+++ b/shardingsphere-operator/pkg/distsql/antlr4/encrypt/Keyword.g4
@@ -0,0 +1,184 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+lexer grammar Keyword;
+
+import Alphabet;
+
+WS
+ : [ \t\r\n] + ->skip
+ ;
+
+CREATE
+ : C R E A T E
+ ;
+
+ALTER
+ : A L T E R
+ ;
+
+DROP
+ : D R O P
+ ;
+
+SHOW
+ : S H O W
+ ;
+
+RESOURCE
+ : R E S O U R C E
+ ;
+
+RULE
+ : R U L E
+ ;
+
+FROM
+ : F R O M
+ ;
+
+ENCRYPT
+ : E N C R Y P T
+ ;
+
+TYPE
+ : T Y P E
+ ;
+
+ENCRYPT_ALGORITHM
+ : E N C R Y P T UL_ A L G O R I T H M
+ ;
+
+ASSISTED_QUERY_ALGORITHM
+ : A S S I S T E D UL_ Q U E R Y UL_ A L G O R I T H M
+ ;
+
+LIKE_QUERY_ALGORITHM
+ : L I K E UL_ Q U E R Y UL_ A L G O R I T H M
+ ;
+
+NAME
+ : N A M E
+ ;
+
+PROPERTIES
+ : P R O P E R T I E S
+ ;
+
+COLUMN
+ : C O L U M N
+ ;
+
+RULES
+ : R U L E S
+ ;
+
+TABLE
+ : T A B L E
+ ;
+
+COLUMNS
+ : C O L U M N S
+ ;
+
+CIPHER
+ : C I P H E R
+ ;
+
+PLAIN
+ : P L A I N
+ ;
+
+ASSISTED_QUERY_COLUMN
+ : A S S I S T E D UL_ Q U E R Y UL_ C O L U M N
+ ;
+
+LIKE_QUERY_COLUMN
+ : L I K E UL_ Q U E R Y UL_ C O L U M N
+ ;
+
+QUERY_WITH_CIPHER_COLUMN
+ : Q U E R Y UL_ W I T H UL_ C I P H E R UL_ C O L U M N
+ ;
+
+TRUE
+ : T R U E
+ ;
+
+FALSE
+ : F A L S E
+ ;
+
+DATA_TYPE
+ : D A T A UL_ T Y P E
+ ;
+
+PLAIN_DATA_TYPE
+ : P L A I N UL_ D A T A UL_ T Y P E
+ ;
+
+CIPHER_DATA_TYPE
+ : C I P H E R UL_ D A T A UL_ T Y P E
+ ;
+
+ASSISTED_QUERY_DATA_TYPE
+ : A S S I S T E D UL_ Q U E R Y UL_ D A T A UL_ T Y P E
+ ;
+
+LIKE_QUERY_DATA_TYPE
+ : L I K E UL_ Q U E R Y UL_ D A T A UL_ T Y P E
+ ;
+
+IF
+ : I F
+ ;
+
+EXISTS
+ : E X I S T S
+ ;
+
+COUNT
+ : C O U N T
+ ;
+
+MD5
+ : M D [5]
+ ;
+
+AES
+ : A E S
+ ;
+
+RC4
+ : R C [4]
+ ;
+
+SM3
+ : S M [3]
+ ;
+
+SM4
+ : S M [4]
+ ;
+
+CHAR_DIGEST_LIKE
+ : C H A R UL_ D I G E S T UL_ L I K E
+ ;
+
+NOT
+ : N O T
+ ;
diff --git a/shardingsphere-operator/pkg/reconcile/proxy/resource.go b/shardingsphere-operator/pkg/distsql/antlr4/encrypt/Literals.g4
similarity index 58%
copy from shardingsphere-operator/pkg/reconcile/proxy/resource.go
copy to shardingsphere-operator/pkg/distsql/antlr4/encrypt/Literals.g4
index d04313f..c655763 100644
--- a/shardingsphere-operator/pkg/reconcile/proxy/resource.go
+++ b/shardingsphere-operator/pkg/distsql/antlr4/encrypt/Literals.g4
@@ -15,29 +15,36 @@
* limitations under the License.
*/
-package proxy
+lexer grammar Literals;
-import (
- v1 "k8s.io/api/core/v1"
- "k8s.io/apimachinery/pkg/util/intstr"
-)
+import Alphabet, Symbol;
-const imageName = "apache/shardingsphere-proxy"
+IDENTIFIER_
+ : [A-Za-z_$0-9]*?[A-Za-z_$]+?[A-Za-z_$0-9]*
+ | BQ_ ~'`'+ BQ_
+ ;
+
+STRING_
+ : (DQ_ ('\\'. | '""' | ~('"' | '\\'))* DQ_)
+ | (SQ_ ('\\'. | '\'\'' | ~('\'' | '\\'))* SQ_)
+ ;
-func fromInt32(val int32) intstr.IntOrString {
- return intstr.IntOrString{Type: intstr.Int, IntVal: val}
-}
-func isRunningPod(s v1.PodStatus) bool {
- return s.Phase == v1.PodRunning
-}
+INT_
+ : [0-9]+
+ ;
-func isReadyPod(s v1.PodStatus) bool {
- if s.ContainerStatuses != nil && len(s.ContainerStatuses) > 0 {
- return s.ContainerStatuses[0].Ready
- }
- return false
-}
+HEX_
+ : [0-9a-fA-F]
+ ;
-func isNonTerminatingPod(pod v1.Pod) bool {
- return pod.ObjectMeta.DeletionTimestamp == nil
-}
+NUMBER_
+ : INT_? DOT_? INT_ (E (PLUS_ | MINUS_)? INT_)?
+ ;
+
+HEXDIGIT_
+ : '0x' HEX_+ | 'X' SQ_ HEX_+ SQ_
+ ;
+
+BITNUM_
+ : '0b' ('0' | '1')+ | B SQ_ ('0' | '1')+ SQ_
+ ;
diff --git a/shardingsphere-operator/pkg/distsql/antlr4/encrypt/RDLStatement.g4 b/shardingsphere-operator/pkg/distsql/antlr4/encrypt/RDLStatement.g4
new file mode 100644
index 0000000..bd3f5aa
--- /dev/null
+++ b/shardingsphere-operator/pkg/distsql/antlr4/encrypt/RDLStatement.g4
@@ -0,0 +1,116 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+grammar RDLStatement;
+
+import BaseRule;
+
+createEncryptRule
+ : CREATE ENCRYPT RULE ifNotExists? encryptRuleDefinition (COMMA_ encryptRuleDefinition)*
+ ;
+
+alterEncryptRule
+ : ALTER ENCRYPT RULE encryptRuleDefinition (COMMA_ encryptRuleDefinition)*
+ ;
+
+dropEncryptRule
+ : DROP ENCRYPT RULE ifExists? tableName (COMMA_ tableName)*
+ ;
+
+encryptRuleDefinition
+ : tableName LP_ (resourceDefinition COMMA_)? COLUMNS LP_ encryptColumnDefinition (COMMA_ encryptColumnDefinition)* RP_ (COMMA_ QUERY_WITH_CIPHER_COLUMN EQ_ queryWithCipherColumn)? RP_
+ ;
+
+resourceDefinition
+ : RESOURCE EQ_ resourceName
+ ;
+
+resourceName
+ : IDENTIFIER_
+ ;
+
+encryptColumnDefinition
+ : LP_ columnDefinition (COMMA_ plainColumnDefinition)? COMMA_ cipherColumnDefinition (COMMA_ assistedQueryColumnDefinition)? (COMMA_ likeQueryColumnDefinition)? COMMA_ encryptAlgorithm (COMMA_ assistedQueryAlgorithm)? (COMMA_ likeQueryAlgorithm)? (COMMA_ QUERY_WITH_CIPHER_COLUMN EQ_ queryWithCipherColumn)? RP_
+ ;
+
+columnDefinition
+ : NAME EQ_ columnName (COMMA_ DATA_TYPE EQ_ dataType)?
+ ;
+
+columnName
+ : IDENTIFIER_
+ ;
+
+dataType
+ : STRING_
+ ;
+
+plainColumnDefinition
+ : PLAIN EQ_ plainColumnName (COMMA_ PLAIN_DATA_TYPE EQ_ dataType)?
+ ;
+
+plainColumnName
+ : IDENTIFIER_
+ ;
+
+cipherColumnDefinition
+ : CIPHER EQ_ cipherColumnName (COMMA_ CIPHER_DATA_TYPE EQ_ dataType)?
+ ;
+
+cipherColumnName
+ : IDENTIFIER_
+ ;
+
+assistedQueryColumnDefinition
+ : ASSISTED_QUERY_COLUMN EQ_ assistedQueryColumnName (COMMA_ ASSISTED_QUERY_DATA_TYPE EQ_ dataType)?
+ ;
+
+assistedQueryColumnName
+ : IDENTIFIER_
+ ;
+
+likeQueryColumnDefinition
+ : LIKE_QUERY_COLUMN EQ_ likeQueryColumnName (COMMA_ LIKE_QUERY_DATA_TYPE EQ_ dataType)?
+ ;
+
+likeQueryColumnName
+ : IDENTIFIER_
+ ;
+
+encryptAlgorithm
+ : ENCRYPT_ALGORITHM LP_ algorithmDefinition RP_
+ ;
+
+assistedQueryAlgorithm
+ : ASSISTED_QUERY_ALGORITHM LP_ algorithmDefinition RP_
+ ;
+
+likeQueryAlgorithm
+ : LIKE_QUERY_ALGORITHM LP_ algorithmDefinition RP_
+ ;
+
+queryWithCipherColumn
+ : TRUE | FALSE
+ ;
+
+ifExists
+ : IF EXISTS
+ ;
+
+ifNotExists
+ : IF NOT EXISTS
+ ;
diff --git a/shardingsphere-operator/pkg/reconcile/proxy/resource.go b/shardingsphere-operator/pkg/distsql/antlr4/encrypt/RQLStatement.g4
similarity index 58%
copy from shardingsphere-operator/pkg/reconcile/proxy/resource.go
copy to shardingsphere-operator/pkg/distsql/antlr4/encrypt/RQLStatement.g4
index d04313f..45687c5 100644
--- a/shardingsphere-operator/pkg/reconcile/proxy/resource.go
+++ b/shardingsphere-operator/pkg/distsql/antlr4/encrypt/RQLStatement.g4
@@ -15,29 +15,22 @@
* limitations under the License.
*/
-package proxy
+grammar RQLStatement;
-import (
- v1 "k8s.io/api/core/v1"
- "k8s.io/apimachinery/pkg/util/intstr"
-)
+import BaseRule;
-const imageName = "apache/shardingsphere-proxy"
+showEncryptRules
+ : SHOW ENCRYPT (TABLE tableRule | RULES) (FROM databaseName)?
+ ;
-func fromInt32(val int32) intstr.IntOrString {
- return intstr.IntOrString{Type: intstr.Int, IntVal: val}
-}
-func isRunningPod(s v1.PodStatus) bool {
- return s.Phase == v1.PodRunning
-}
+tableRule
+ : RULE tableName
+ ;
-func isReadyPod(s v1.PodStatus) bool {
- if s.ContainerStatuses != nil && len(s.ContainerStatuses) > 0 {
- return s.ContainerStatuses[0].Ready
- }
- return false
-}
+countEncryptRule
+ : COUNT ENCRYPT RULE (FROM databaseName)?
+ ;
-func isNonTerminatingPod(pod v1.Pod) bool {
- return pod.ObjectMeta.DeletionTimestamp == nil
-}
+databaseName
+ : IDENTIFIER_
+ ;
diff --git a/shardingsphere-operator/pkg/distsql/antlr4/encrypt/Symbol.g4 b/shardingsphere-operator/pkg/distsql/antlr4/encrypt/Symbol.g4
new file mode 100644
index 0000000..90dba68
--- /dev/null
+++ b/shardingsphere-operator/pkg/distsql/antlr4/encrypt/Symbol.g4
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+lexer grammar Symbol;
+
+AND_: '&&';
+OR_: '||';
+NOT_: '!';
+TILDE_: '~';
+VERTICALBAR_: '|';
+AMPERSAND_: '&';
+SIGNEDLEFTSHIFT_: '<<';
+SIGNEDRIGHTSHIFT_: '>>';
+CARET_: '^';
+MOD_: '%';
+COLON_: ':';
+PLUS_: '+';
+MINUS_: '-';
+ASTERISK_: '*';
+SLASH_: '/';
+BACKSLASH_: '\\';
+DOT_: '.';
+DOTASTERISK_: '.*';
+SAFEEQ_: '<=>';
+DEQ_: '==';
+EQ_: '=';
+NEQ_: '<>' | '!=';
+GT_: '>';
+GTE_: '>=';
+LT_: '<';
+LTE_: '<=';
+POUND_: '#';
+LP_: '(';
+RP_: ')';
+LBE_: '{';
+RBE_: '}';
+LBT_: '[';
+RBT_: ']';
+COMMA_: ',';
+DQ_: '"';
+SQ_: '\'';
+BQ_: '`';
+QUESTION_: '?';
+AT_: '@';
+SEMI_: ';';
+JSONSEPARATOR_: '->>';
+UL_: '_';
diff --git a/shardingsphere-operator/pkg/distsql/ast/rdl_ast.go b/shardingsphere-operator/pkg/distsql/ast/rdl_ast.go
new file mode 100644
index 0000000..2491ed2
--- /dev/null
+++ b/shardingsphere-operator/pkg/distsql/ast/rdl_ast.go
@@ -0,0 +1,163 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package ast
+
+// Define RDL AST
+type CreateEncryptRule struct {
+ Create string
+ Encrypt string
+ EncryptName string
+ IfNotExists *IfNotExists
+ AllEncryptRuleDefinition []*EncryptRuleDefinition
+}
+
+type AlterEncryptRule struct {
+ EncryptRuleDefinition []*EncryptRuleDefinition
+}
+
+func (alterEncryptRule *AlterEncryptRule) ToString() string {
+ return ""
+}
+
+type DropEncryptRule struct {
+ IfExists *IfExists
+ AllTableName []*CommonIdentifier
+}
+
+type IfExists struct {
+ IfExists string
+}
+
+func (dropEncryptRule *DropEncryptRule) ToString() string {
+ return ""
+}
+
+type EncryptRuleDefinition struct {
+ TableName *CommonIdentifier
+ ResourceDefinition *ResourceDefinition
+ AllEncryptColumnDefinition []*EncryptColumnDefinition
+ QueryWithCipherColumn *QueryWithCipherColumn
+}
+
+func (encryptRuleDefinition *EncryptRuleDefinition) ToString() string {
+ return ""
+}
+
+type IfNotExists struct {
+ IfNotExists string
+}
+
+func (ifNotExists IfNotExists) ToString() string {
+ return ""
+}
+
+type ResourceDefinition struct {
+ ResourceName *CommonIdentifier
+}
+
+type EncryptColumnDefinition struct {
+ ColumnDefinition *ColumnDefinition
+ PlainColumnDefinition *PlainColumnDefinition
+ CipherColumnDefinition *CipherColumnDefinition
+ AssistedQueryColumnDefinition *AssistedQueryColumnDefinition
+ LikeQueryColumnDefinition *LikeQueryColumnDefinition
+ EncryptAlgorithm *EncryptAlgorithm
+ AssistedQueryAlgorithm *AssistedQueryAlgorithm
+ LikeQueryAlgorithm *LikeQueryAlgorithm
+ QueryWithCipherColumn *QueryWithCipherColumn
+}
+
+type ColumnDefinition struct {
+ ColumnName *CommonIdentifier
+ DataType *DataType
+}
+
+type PlainColumnDefinition struct {
+ PlainColumnName *CommonIdentifier
+ DataType *DataType
+}
+
+type CipherColumnDefinition struct {
+ CipherColumnName *CommonIdentifier
+ DataType *DataType
+}
+
+type AssistedQueryColumnDefinition struct {
+ AssistedQueryColumnName *CommonIdentifier
+ DataType *DataType
+}
+
+type LikeQueryColumnDefinition struct {
+ LikeQueryColumnName *CommonIdentifier
+ DataType *DataType
+}
+
+type EncryptAlgorithm struct {
+ AlgorithmDefinition *AlgorithmDefinition
+}
+
+type AssistedQueryAlgorithm struct {
+ AlgorithmDefinition *AlgorithmDefinition
+}
+
+type AlgorithmDefinition struct {
+ AlgorithmTypeName *AlgorithmTypeName
+ PropertiesDefinition *PropertiesDefinition
+}
+
+type PropertiesDefinition struct {
+ Properties *Properties
+}
+
+type Properties struct {
+ Properties []*Property
+}
+
+type LikeQueryAlgorithm struct {
+ AlgorithmDefinition *AlgorithmDefinition
+}
+
+type QueryWithCipherColumn struct {
+ QueryWithCipherColumn string
+}
+
+type CommonIdentifier struct {
+ Identifier string
+}
+
+type Property struct {
+ Key string
+ Literal *Literal
+}
+
+type Literal struct {
+ Literal string
+}
+
+type BuildinAlgorithmTypeName struct {
+ AlgorithmTypeName string
+}
+
+type DataType struct {
+ String string
+}
+
+type AlgorithmTypeName struct {
+ BuildinAlgorithmTypeName *BuildinAlgorithmTypeName
+ String string
+}
diff --git a/shardingsphere-operator/pkg/distsql/visitor/rdl_visitor.go b/shardingsphere-operator/pkg/distsql/visitor/rdl_visitor.go
new file mode 100644
index 0000000..3adaeaa
--- /dev/null
+++ b/shardingsphere-operator/pkg/distsql/visitor/rdl_visitor.go
@@ -0,0 +1,406 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package visitor
+
+import (
+ "fmt"
+
+ "github.com/apache/shardingsphere-on-cloud/shardingsphere-operator/pkg/distsql/ast"
+ parser "github.com/apache/shardingsphere-on-cloud/shardingsphere-operator/pkg/distsql/visitor_parser/encrypt"
+)
+
+type Visitor struct {
+ parser.BaseRDLStatementVisitor
+}
+
+func (v *Visitor) VisitCreateEncryptRule(ctx *parser.CreateEncryptRuleContext) *ast.CreateEncryptRule {
+ stmt := &ast.CreateEncryptRule{}
+ stmt.Create = ctx.CREATE().GetText()
+ stmt.Encrypt = ctx.ENCRYPT().GetText()
+ stmt.EncryptName = ctx.RULE().GetText()
+
+ if ctx.IfNotExists() != nil {
+ stmt.IfNotExists = v.VisitIfNotExists(ctx.IfNotExists().(*parser.IfNotExistsContext))
+ }
+
+ if ctx.AllEncryptRuleDefinition() != nil {
+ for _, r := range ctx.AllEncryptRuleDefinition() {
+ stmt.AllEncryptRuleDefinition = append(stmt.AllEncryptRuleDefinition, v.VisitEncryptRuleDefinition(r.(*parser.EncryptRuleDefinitionContext)))
+ }
+ }
+
+ return stmt
+}
+
+func (v *Visitor) VisitIfNotExists(ctx *parser.IfNotExistsContext) *ast.IfNotExists {
+ return &ast.IfNotExists{
+ IfNotExists: fmt.Sprintf("%s %s %s", ctx.IF().GetText(), ctx.NOT().GetText(), ctx.EXISTS().GetText()),
+ }
+}
+
+func (v *Visitor) VisitIfExists(ctx *parser.IfExistsContext) *ast.IfExists {
+ return &ast.IfExists{
+ IfExists: fmt.Sprintf("%s %s", ctx.IF().GetText(), ctx.EXISTS().GetText()),
+ }
+}
+
+func (v *Visitor) VisitAlterEncryptRule(ctx *parser.AlterEncryptRuleContext) *ast.AlterEncryptRule {
+ stmt := &ast.AlterEncryptRule{}
+ if ctx.AllEncryptRuleDefinition() != nil {
+ for _, encryptRuleDefinition := range ctx.AllEncryptRuleDefinition() {
+ stmt.EncryptRuleDefinition = append(stmt.EncryptRuleDefinition, v.VisitEncryptRuleDefinition(encryptRuleDefinition.(*parser.EncryptRuleDefinitionContext)))
+ }
+ }
+ return stmt
+}
+
+func (v *Visitor) VisitDropEncryptRule(ctx *parser.DropEncryptRuleContext) *ast.DropEncryptRule {
+ stmt := &ast.DropEncryptRule{}
+
+ if ctx.IfExists() != nil {
+ stmt.IfExists = v.VisitIfExists(ctx.IfExists().(*parser.IfExistsContext))
+ }
+
+ if ctx.AllTableName() != nil {
+ for _, tableName := range ctx.AllTableName() {
+ stmt.AllTableName = append(stmt.AllTableName, v.VisitTableName(tableName.(*parser.TableNameContext)))
+ }
+ }
+ return stmt
+}
+
+func (v *Visitor) VisitEncryptRuleDefinition(ctx *parser.EncryptRuleDefinitionContext) *ast.EncryptRuleDefinition {
+ stmt := &ast.EncryptRuleDefinition{}
+
+ if ctx.TableName() != nil {
+ stmt.TableName = v.VisitTableName(ctx.TableName().(*parser.TableNameContext))
+ }
+
+ if ctx.ResourceDefinition() != nil {
+ stmt.ResourceDefinition = v.VisitResourceDefinition(ctx.ResourceDefinition().(*parser.ResourceDefinitionContext))
+ }
+
+ if ctx.AllEncryptColumnDefinition() != nil {
+ for _, column := range ctx.AllEncryptColumnDefinition() {
+ stmt.AllEncryptColumnDefinition = append(stmt.AllEncryptColumnDefinition, v.VisitEncryptColumnDefinition(column.(*parser.EncryptColumnDefinitionContext)))
+ }
+ }
+
+ if ctx.QueryWithCipherColumn() != nil {
+ stmt.QueryWithCipherColumn = v.VisitQueryWithCipherColumn(ctx.QueryWithCipherColumn().(*parser.QueryWithCipherColumnContext))
+ }
+
+ return stmt
+}
+
+func (v *Visitor) VisitQueryWithCipherColumn(ctx *parser.QueryWithCipherColumnContext) *ast.QueryWithCipherColumn {
+ stmt := &ast.QueryWithCipherColumn{}
+ switch {
+ case ctx.TRUE() != nil:
+ stmt.QueryWithCipherColumn = ctx.TRUE().GetText()
+ case ctx.FALSE() != nil:
+ stmt.QueryWithCipherColumn = ctx.FALSE().GetText()
+ }
+ return stmt
+}
+
+func (v *Visitor) VisitEncryptColumnDefinition(ctx *parser.EncryptColumnDefinitionContext) *ast.EncryptColumnDefinition {
+ stmt := &ast.EncryptColumnDefinition{}
+
+ if ctx.ColumnDefinition() != nil {
+ stmt.ColumnDefinition = v.VisitColumnDefinition(ctx.ColumnDefinition().(*parser.ColumnDefinitionContext))
+ }
+
+ if ctx.PlainColumnDefinition() != nil {
+ stmt.PlainColumnDefinition = v.VisitPlainColumnDefinition(ctx.PlainColumnDefinition().(*parser.PlainColumnDefinitionContext))
+ }
+
+ if ctx.CipherColumnDefinition() != nil {
+ stmt.CipherColumnDefinition = v.VisitCipherColumnDefinition(ctx.CipherColumnDefinition().(*parser.CipherColumnDefinitionContext))
+ }
+
+ if ctx.AssistedQueryColumnDefinition() != nil {
+ stmt.AssistedQueryColumnDefinition = v.VisitAssistedQueryColumnDefinition(ctx.AssistedQueryColumnDefinition().(*parser.AssistedQueryColumnDefinitionContext))
+ }
+
+ if ctx.LikeQueryColumnDefinition() != nil {
+ stmt.LikeQueryColumnDefinition = v.VisitLikeQueryColumnDefinition(ctx.LikeQueryColumnDefinition().(*parser.LikeQueryColumnDefinitionContext))
+ }
+
+ if ctx.EncryptAlgorithm() != nil {
+ stmt.EncryptAlgorithm = v.VisitEncryptAlgorithm(ctx.EncryptAlgorithm().(*parser.EncryptAlgorithmContext))
+ }
+
+ if ctx.AssistedQueryAlgorithm() != nil {
+ stmt.AssistedQueryAlgorithm = v.VisitAssistedQueryAlgorithm(ctx.AssistedQueryAlgorithm().(*parser.AssistedQueryAlgorithmContext))
+ }
+
+ if ctx.LikeQueryAlgorithm() != nil {
+ stmt.LikeQueryAlgorithm = v.VisitLikeQueryAlgorithm(ctx.LikeQueryAlgorithm().(*parser.LikeQueryAlgorithmContext))
+ }
+
+ if ctx.QueryWithCipherColumn() != nil {
+ stmt.QueryWithCipherColumn = v.VisitQueryWithCipherColumn(ctx.QueryWithCipherColumn().(*parser.QueryWithCipherColumnContext))
+ }
+
+ return stmt
+}
+
+func (v *Visitor) VisitPlainColumnDefinition(ctx *parser.PlainColumnDefinitionContext) *ast.PlainColumnDefinition {
+ stmt := &ast.PlainColumnDefinition{}
+ if ctx.PlainColumnName() != nil {
+ stmt.PlainColumnName = v.VisitPlainColumnName(ctx.PlainColumnName().(*parser.PlainColumnNameContext))
+ }
+
+ if ctx.DataType() != nil {
+ stmt.DataType = v.VisitDataType(ctx.DataType().(*parser.DataTypeContext))
+ }
+ return stmt
+}
+
+func (v *Visitor) VisitPlainColumnName(ctx *parser.PlainColumnNameContext) *ast.CommonIdentifier {
+ stmt := &ast.CommonIdentifier{}
+ if ctx.IDENTIFIER_() != nil {
+ stmt.Identifier = ctx.IDENTIFIER_().GetText()
+ }
+ return stmt
+}
+
+func (v *Visitor) VisitCipherColumnDefinition(ctx *parser.CipherColumnDefinitionContext) *ast.CipherColumnDefinition {
+ stmt := &ast.CipherColumnDefinition{}
+ if ctx.CipherColumnName() != nil {
+ stmt.CipherColumnName = v.VisitCipherColumnName(ctx.CipherColumnName().(*parser.CipherColumnNameContext))
+ }
+
+ if ctx.DataType() != nil {
+ stmt.DataType = v.VisitDataType(ctx.DataType().(*parser.DataTypeContext))
+ }
+
+ return stmt
+}
+
+func (v *Visitor) VisitCipherColumnName(ctx *parser.CipherColumnNameContext) *ast.CommonIdentifier {
+ stmt := &ast.CommonIdentifier{}
+ if ctx.IDENTIFIER_() != nil {
+ stmt.Identifier = ctx.IDENTIFIER_().GetText()
+ }
+ return stmt
+}
+
+func (v *Visitor) VisitAssistedQueryColumnDefinition(ctx *parser.AssistedQueryColumnDefinitionContext) *ast.AssistedQueryColumnDefinition {
+ stmt := &ast.AssistedQueryColumnDefinition{}
+ if ctx.AssistedQueryColumnName() != nil {
+ stmt.AssistedQueryColumnName = v.VisitAssistedQueryColumnName(ctx.AssistedQueryColumnName().(*parser.AssistedQueryColumnNameContext))
+ }
+
+ if ctx.DataType() != nil {
+ stmt.DataType = v.VisitDataType(ctx.DataType().(*parser.DataTypeContext))
+ }
+
+ return stmt
+}
+
+func (v *Visitor) VisitAssistedQueryColumnName(ctx *parser.AssistedQueryColumnNameContext) *ast.CommonIdentifier {
+ stmt := &ast.CommonIdentifier{}
+ if ctx.IDENTIFIER_() != nil {
+ stmt.Identifier = ctx.IDENTIFIER_().GetText()
+ }
+ return stmt
+}
+
+func (v *Visitor) VisitLikeQueryColumnDefinition(ctx *parser.LikeQueryColumnDefinitionContext) *ast.LikeQueryColumnDefinition {
+ stmt := &ast.LikeQueryColumnDefinition{}
+ if ctx.LikeQueryColumnName() != nil {
+ stmt.LikeQueryColumnName = v.VisitLikeQueryColumnName(ctx.LikeQueryColumnName().(*parser.LikeQueryColumnNameContext))
+ }
+
+ if ctx.DataType() != nil {
+ stmt.DataType = v.VisitDataType(ctx.DataType().(*parser.DataTypeContext))
+ }
+ return stmt
+}
+
+func (v *Visitor) VisitLikeQueryColumnName(ctx *parser.LikeQueryColumnNameContext) *ast.CommonIdentifier {
+ stmt := &ast.CommonIdentifier{}
+ if ctx.IDENTIFIER_() != nil {
+ stmt.Identifier = ctx.IDENTIFIER_().GetText()
+ }
+ return stmt
+}
+
+func (v *Visitor) VisitAssistedQueryAlgorithm(ctx *parser.AssistedQueryAlgorithmContext) *ast.AssistedQueryAlgorithm {
+ stmt := &ast.AssistedQueryAlgorithm{}
+ if ctx.AlgorithmDefinition() != nil {
+ stmt.AlgorithmDefinition = v.VisitAlgorithmDefinition(ctx.AlgorithmDefinition().(*parser.AlgorithmDefinitionContext))
+ }
+ return stmt
+}
+
+func (v *Visitor) VisitLikeQueryAlgorithm(ctx *parser.LikeQueryAlgorithmContext) *ast.LikeQueryAlgorithm {
+ stmt := &ast.LikeQueryAlgorithm{}
+ if ctx.AlgorithmDefinition() != nil {
+ stmt.AlgorithmDefinition = v.VisitAlgorithmDefinition(ctx.AlgorithmDefinition().(*parser.AlgorithmDefinitionContext))
+ }
+ return stmt
+}
+
+func (v *Visitor) VisitEncryptAlgorithm(ctx *parser.EncryptAlgorithmContext) *ast.EncryptAlgorithm {
+ stmt := &ast.EncryptAlgorithm{}
+ if ctx.AlgorithmDefinition() != nil {
+ stmt.AlgorithmDefinition = v.VisitAlgorithmDefinition(ctx.AlgorithmDefinition().(*parser.AlgorithmDefinitionContext))
+ }
+ return stmt
+}
+
+func (v *Visitor) VisitColumnDefinition(ctx *parser.ColumnDefinitionContext) *ast.ColumnDefinition {
+ stmt := &ast.ColumnDefinition{}
+ if ctx.ColumnName() != nil {
+ stmt.ColumnName = v.VisitColumnName(ctx.ColumnName().(*parser.ColumnNameContext))
+ }
+
+ if ctx.DataType() != nil {
+ stmt.DataType = v.VisitDataType(ctx.DataType().(*parser.DataTypeContext))
+ }
+ return stmt
+}
+
+func (v *Visitor) VisitColumnName(ctx *parser.ColumnNameContext) *ast.CommonIdentifier {
+ stmt := &ast.CommonIdentifier{}
+ if ctx.IDENTIFIER_() != nil {
+ stmt.Identifier = ctx.IDENTIFIER_().GetText()
+ }
+ return stmt
+}
+
+func (v *Visitor) VisitDataType(ctx *parser.DataTypeContext) *ast.DataType {
+ stmt := &ast.DataType{}
+ if ctx.STRING_() != nil {
+ stmt.String = ctx.STRING_().GetText()
+ }
+ return stmt
+}
+
+func (v *Visitor) VisitResourceDefinition(ctx *parser.ResourceDefinitionContext) *ast.ResourceDefinition {
+ stmt := &ast.ResourceDefinition{}
+ if ctx.ResourceName() != nil {
+ stmt.ResourceName = v.VisitResourceName(ctx.ResourceName().(*parser.ResourceNameContext))
+ }
+ return stmt
+}
+
+func (v *Visitor) VisitResourceName(ctx *parser.ResourceNameContext) *ast.CommonIdentifier {
+ stmt := &ast.CommonIdentifier{}
+ if ctx.IDENTIFIER_() != nil {
+ stmt.Identifier = ctx.IDENTIFIER_().GetText()
+ }
+ return stmt
+}
+
+func (v *Visitor) VisitLiteral(ctx *parser.LiteralContext) *ast.Literal {
+ stmt := &ast.Literal{}
+ switch {
+ case ctx.STRING_() != nil:
+ stmt.Literal = ctx.STRING_().GetText()
+ case ctx.MINUS_() != nil:
+ stmt.Literal = ctx.MINUS_().GetText()
+ case ctx.INT_() != nil:
+ stmt.Literal = ctx.INT_().GetText()
+ case ctx.TRUE() != nil:
+ stmt.Literal = ctx.TRUE().GetText()
+ case ctx.FALSE() != nil:
+ stmt.Literal = ctx.FALSE().GetText()
+ }
+ return stmt
+}
+
+func (v *Visitor) VisitAlgorithmDefinition(ctx *parser.AlgorithmDefinitionContext) *ast.AlgorithmDefinition {
+ stmt := &ast.AlgorithmDefinition{}
+ if ctx.AlgorithmTypeName() != nil {
+ stmt.AlgorithmTypeName = v.VisitAlgorithmTypeName(ctx.AlgorithmTypeName().(*parser.AlgorithmTypeNameContext))
+ }
+
+ if ctx.PropertiesDefinition() != nil {
+ stmt.PropertiesDefinition = v.VisitPropertiesDefinition(ctx.PropertiesDefinition().(*parser.PropertiesDefinitionContext))
+ }
+ return stmt
+}
+
+func (v *Visitor) VisitAlgorithmTypeName(ctx *parser.AlgorithmTypeNameContext) *ast.AlgorithmTypeName {
+ stmt := &ast.AlgorithmTypeName{}
+ switch {
+ case ctx.STRING_() != nil:
+ stmt.String = ctx.STRING_().GetText()
+ case ctx.BuildinAlgorithmTypeName() != nil:
+ stmt.BuildinAlgorithmTypeName = v.VisitBuildinAlgorithmTypeName(ctx.BuildinAlgorithmTypeName().(*parser.BuildinAlgorithmTypeNameContext))
+ }
+ return stmt
+}
+
+func (v *Visitor) VisitBuildinAlgorithmTypeName(ctx *parser.BuildinAlgorithmTypeNameContext) *ast.BuildinAlgorithmTypeName {
+ stmt := &ast.BuildinAlgorithmTypeName{}
+ switch {
+ case ctx.MD5() != nil:
+ stmt.AlgorithmTypeName = ctx.MD5().GetText()
+ case ctx.AES() != nil:
+ stmt.AlgorithmTypeName = ctx.AES().GetText()
+ case ctx.RC4() != nil:
+ stmt.AlgorithmTypeName = ctx.RC4().GetText()
+ case ctx.SM3() != nil:
+ stmt.AlgorithmTypeName = ctx.SM3().GetText()
+ case ctx.SM4() != nil:
+ stmt.AlgorithmTypeName = ctx.SM4().GetText()
+ case ctx.CHAR_DIGEST_LIKE() != nil:
+ stmt.AlgorithmTypeName = ctx.CHAR_DIGEST_LIKE().GetText()
+ }
+ return stmt
+}
+
+func (v *Visitor) VisitPropertiesDefinition(ctx *parser.PropertiesDefinitionContext) *ast.PropertiesDefinition {
+ stmt := &ast.PropertiesDefinition{}
+ if ctx.Properties() != nil {
+ stmt.Properties = v.VisitProperties(ctx.Properties().(*parser.PropertiesContext))
+ }
+ return stmt
+}
+
+func (v *Visitor) VisitProperties(ctx *parser.PropertiesContext) *ast.Properties {
+ stmt := &ast.Properties{}
+ for _, p := range ctx.AllProperty() {
+ stmt.Properties = append(stmt.Properties, v.VisitProperty(p.(*parser.PropertyContext)))
+ }
+ return stmt
+}
+
+func (v *Visitor) VisitProperty(ctx *parser.PropertyContext) *ast.Property {
+ stmt := &ast.Property{}
+ if ctx.STRING_() != nil {
+ stmt.Key = ctx.STRING_().GetText()
+ }
+ if ctx.Literal() != nil {
+ stmt.Literal = v.VisitLiteral(ctx.Literal().(*parser.LiteralContext))
+ }
+ return stmt
+}
+
+func (v *Visitor) VisitTableName(ctx *parser.TableNameContext) *ast.CommonIdentifier {
+ stmt := &ast.CommonIdentifier{}
+ if ctx.IDENTIFIER_() != nil {
+ stmt.Identifier = ctx.IDENTIFIER_().GetText()
+ }
+ return stmt
+}
diff --git a/shardingsphere-operator/pkg/distsql/visitor_parser/encrypt/rdlstatement_base_visitor.go b/shardingsphere-operator/pkg/distsql/visitor_parser/encrypt/rdlstatement_base_visitor.go
new file mode 100644
index 0000000..059a083
--- /dev/null
+++ b/shardingsphere-operator/pkg/distsql/visitor_parser/encrypt/rdlstatement_base_visitor.go
@@ -0,0 +1,154 @@
+// Code generated from encrypt_g4/RDLStatement.g4 by ANTLR 4.8. DO NOT EDIT.
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package parser // RDLStatement
+
+import "github.com/antlr/antlr4/runtime/Go/antlr"
+
+type BaseRDLStatementVisitor struct {
+ *antlr.BaseParseTreeVisitor
+}
+
+func (v *BaseRDLStatementVisitor) VisitCreateEncryptRule(ctx *CreateEncryptRuleContext) interface{} {
+ return v.VisitChildren(ctx)
+}
+
+func (v *BaseRDLStatementVisitor) VisitAlterEncryptRule(ctx *AlterEncryptRuleContext) interface{} {
+ return v.VisitChildren(ctx)
+}
+
+func (v *BaseRDLStatementVisitor) VisitDropEncryptRule(ctx *DropEncryptRuleContext) interface{} {
+ return v.VisitChildren(ctx)
+}
+
+func (v *BaseRDLStatementVisitor) VisitEncryptRuleDefinition(ctx *EncryptRuleDefinitionContext) interface{} {
+ return v.VisitChildren(ctx)
+}
+
+func (v *BaseRDLStatementVisitor) VisitResourceDefinition(ctx *ResourceDefinitionContext) interface{} {
+ return v.VisitChildren(ctx)
+}
+
+func (v *BaseRDLStatementVisitor) VisitResourceName(ctx *ResourceNameContext) interface{} {
+ return v.VisitChildren(ctx)
+}
+
+func (v *BaseRDLStatementVisitor) VisitEncryptColumnDefinition(ctx *EncryptColumnDefinitionContext) interface{} {
+ return v.VisitChildren(ctx)
+}
+
+func (v *BaseRDLStatementVisitor) VisitColumnDefinition(ctx *ColumnDefinitionContext) interface{} {
+ return v.VisitChildren(ctx)
+}
+
+func (v *BaseRDLStatementVisitor) VisitColumnName(ctx *ColumnNameContext) interface{} {
+ return v.VisitChildren(ctx)
+}
+
+func (v *BaseRDLStatementVisitor) VisitDataType(ctx *DataTypeContext) interface{} {
+ return v.VisitChildren(ctx)
+}
+
+func (v *BaseRDLStatementVisitor) VisitPlainColumnDefinition(ctx *PlainColumnDefinitionContext) interface{} {
+ return v.VisitChildren(ctx)
+}
+
+func (v *BaseRDLStatementVisitor) VisitPlainColumnName(ctx *PlainColumnNameContext) interface{} {
+ return v.VisitChildren(ctx)
+}
+
+func (v *BaseRDLStatementVisitor) VisitCipherColumnDefinition(ctx *CipherColumnDefinitionContext) interface{} {
+ return v.VisitChildren(ctx)
+}
+
+func (v *BaseRDLStatementVisitor) VisitCipherColumnName(ctx *CipherColumnNameContext) interface{} {
+ return v.VisitChildren(ctx)
+}
+
+func (v *BaseRDLStatementVisitor) VisitAssistedQueryColumnDefinition(ctx *AssistedQueryColumnDefinitionContext) interface{} {
+ return v.VisitChildren(ctx)
+}
+
+func (v *BaseRDLStatementVisitor) VisitAssistedQueryColumnName(ctx *AssistedQueryColumnNameContext) interface{} {
+ return v.VisitChildren(ctx)
+}
+
+func (v *BaseRDLStatementVisitor) VisitLikeQueryColumnDefinition(ctx *LikeQueryColumnDefinitionContext) interface{} {
+ return v.VisitChildren(ctx)
+}
+
+func (v *BaseRDLStatementVisitor) VisitLikeQueryColumnName(ctx *LikeQueryColumnNameContext) interface{} {
+ return v.VisitChildren(ctx)
+}
+
+func (v *BaseRDLStatementVisitor) VisitEncryptAlgorithm(ctx *EncryptAlgorithmContext) interface{} {
+ return v.VisitChildren(ctx)
+}
+
+func (v *BaseRDLStatementVisitor) VisitAssistedQueryAlgorithm(ctx *AssistedQueryAlgorithmContext) interface{} {
+ return v.VisitChildren(ctx)
+}
+
+func (v *BaseRDLStatementVisitor) VisitLikeQueryAlgorithm(ctx *LikeQueryAlgorithmContext) interface{} {
+ return v.VisitChildren(ctx)
+}
+
+func (v *BaseRDLStatementVisitor) VisitQueryWithCipherColumn(ctx *QueryWithCipherColumnContext) interface{} {
+ return v.VisitChildren(ctx)
+}
+
+func (v *BaseRDLStatementVisitor) VisitIfExists(ctx *IfExistsContext) interface{} {
+ return v.VisitChildren(ctx)
+}
+
+func (v *BaseRDLStatementVisitor) VisitIfNotExists(ctx *IfNotExistsContext) interface{} {
+ return v.VisitChildren(ctx)
+}
+
+func (v *BaseRDLStatementVisitor) VisitLiteral(ctx *LiteralContext) interface{} {
+ return v.VisitChildren(ctx)
+}
+
+func (v *BaseRDLStatementVisitor) VisitAlgorithmDefinition(ctx *AlgorithmDefinitionContext) interface{} {
+ return v.VisitChildren(ctx)
+}
+
+func (v *BaseRDLStatementVisitor) VisitAlgorithmTypeName(ctx *AlgorithmTypeNameContext) interface{} {
+ return v.VisitChildren(ctx)
+}
+
+func (v *BaseRDLStatementVisitor) VisitBuildinAlgorithmTypeName(ctx *BuildinAlgorithmTypeNameContext) interface{} {
+ return v.VisitChildren(ctx)
+}
+
+func (v *BaseRDLStatementVisitor) VisitPropertiesDefinition(ctx *PropertiesDefinitionContext) interface{} {
+ return v.VisitChildren(ctx)
+}
+
+func (v *BaseRDLStatementVisitor) VisitProperties(ctx *PropertiesContext) interface{} {
+ return v.VisitChildren(ctx)
+}
+
+func (v *BaseRDLStatementVisitor) VisitProperty(ctx *PropertyContext) interface{} {
+ return v.VisitChildren(ctx)
+}
+
+func (v *BaseRDLStatementVisitor) VisitTableName(ctx *TableNameContext) interface{} {
+ return v.VisitChildren(ctx)
+}
diff --git a/shardingsphere-operator/pkg/distsql/visitor_parser/encrypt/rdlstatement_lexer.go b/shardingsphere-operator/pkg/distsql/visitor_parser/encrypt/rdlstatement_lexer.go
new file mode 100644
index 0000000..52eff3b
--- /dev/null
+++ b/shardingsphere-operator/pkg/distsql/visitor_parser/encrypt/rdlstatement_lexer.go
@@ -0,0 +1,647 @@
+// Code generated from encrypt_g4/RDLStatement.g4 by ANTLR 4.8. DO NOT EDIT.
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package parser
+
+import (
+ "fmt"
+ "unicode"
+
+ "github.com/antlr/antlr4/runtime/Go/antlr"
+)
+
+// Suppress unused import error
+var _ = fmt.Printf
+var _ = unicode.IsLetter
+
+var serializedLexerAtn = []uint16{
+ 3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 2, 93, 952,
+ 8, 1, 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7,
+ 9, 7, 4, 8, 9, 8, 4, 9, 9, 9, 4, 10, 9, 10, 4, 11, 9, 11, 4, 12, 9, 12,
+ 4, 13, 9, 13, 4, 14, 9, 14, 4, 15, 9, 15, 4, 16, 9, 16, 4, 17, 9, 17, 4,
+ 18, 9, 18, 4, 19, 9, 19, 4, 20, 9, 20, 4, 21, 9, 21, 4, 22, 9, 22, 4, 23,
+ 9, 23, 4, 24, 9, 24, 4, 25, 9, 25, 4, 26, 9, 26, 4, 27, 9, 27, 4, 28, 9,
+ 28, 4, 29, 9, 29, 4, 30, 9, 30, 4, 31, 9, 31, 4, 32, 9, 32, 4, 33, 9, 33,
+ 4, 34, 9, 34, 4, 35, 9, 35, 4, 36, 9, 36, 4, 37, 9, 37, 4, 38, 9, 38, 4,
+ 39, 9, 39, 4, 40, 9, 40, 4, 41, 9, 41, 4, 42, 9, 42, 4, 43, 9, 43, 4, 44,
+ 9, 44, 4, 45, 9, 45, 4, 46, 9, 46, 4, 47, 9, 47, 4, 48, 9, 48, 4, 49, 9,
+ 49, 4, 50, 9, 50, 4, 51, 9, 51, 4, 52, 9, 52, 4, 53, 9, 53, 4, 54, 9, 54,
+ 4, 55, 9, 55, 4, 56, 9, 56, 4, 57, 9, 57, 4, 58, 9, 58, 4, 59, 9, 59, 4,
+ 60, 9, 60, 4, 61, 9, 61, 4, 62, 9, 62, 4, 63, 9, 63, 4, 64, 9, 64, 4, 65,
+ 9, 65, 4, 66, 9, 66, 4, 67, 9, 67, 4, 68, 9, 68, 4, 69, 9, 69, 4, 70, 9,
+ 70, 4, 71, 9, 71, 4, 72, 9, 72, 4, 73, 9, 73, 4, 74, 9, 74, 4, 75, 9, 75,
+ 4, 76, 9, 76, 4, 77, 9, 77, 4, 78, 9, 78, 4, 79, 9, 79, 4, 80, 9, 80, 4,
+ 81, 9, 81, 4, 82, 9, 82, 4, 83, 9, 83, 4, 84, 9, 84, 4, 85, 9, 85, 4, 86,
+ 9, 86, 4, 87, 9, 87, 4, 88, 9, 88, 4, 89, 9, 89, 4, 90, 9, 90, 4, 91, 9,
+ 91, 4, 92, 9, 92, 4, 93, 9, 93, 4, 94, 9, 94, 4, 95, 9, 95, 4, 96, 9, 96,
+ 4, 97, 9, 97, 4, 98, 9, 98, 4, 99, 9, 99, 4, 100, 9, 100, 4, 101, 9, 101,
+ 4, 102, 9, 102, 4, 103, 9, 103, 4, 104, 9, 104, 4, 105, 9, 105, 4, 106,
+ 9, 106, 4, 107, 9, 107, 4, 108, 9, 108, 4, 109, 9, 109, 4, 110, 9, 110,
+ 4, 111, 9, 111, 4, 112, 9, 112, 4, 113, 9, 113, 4, 114, 9, 114, 4, 115,
+ 9, 115, 4, 116, 9, 116, 4, 117, 9, 117, 4, 118, 9, 118, 3, 2, 3, 2, 3,
+ 2, 3, 3, 3, 3, 3, 3, 3, 4, 3, 4, 3, 5, 3, 5, 3, 6, 3, 6, 3, 7, 3, 7, 3,
+ 8, 3, 8, 3, 8, 3, 9, 3, 9, 3, 9, 3, 10, 3, 10, 3, 11, 3, 11, 3, 12, 3,
+ 12, 3, 13, 3, 13, 3, 14, 3, 14, 3, 15, 3, 15, 3, 16, 3, 16, 3, 17, 3, 17,
+ 3, 18, 3, 18, 3, 19, 3, 19, 3, 19, 3, 20, 3, 20, 3, 20, 3, 20, 3, 21, 3,
+ 21, 3, 21, 3, 22, 3, 22, 3, 23, 3, 23, 3, 23, 3, 23, 5, 23, 292, 10, 23,
+ 3, 24, 3, 24, 3, 25, 3, 25, 3, 25, 3, 26, 3, 26, 3, 27, 3, 27, 3, 27, 3,
+ 28, 3, 28, 3, 29, 3, 29, 3, 30, 3, 30, 3, 31, 3, 31, 3, 32, 3, 32, 3, 33,
+ 3, 33, 3, 34, 3, 34, 3, 35, 3, 35, 3, 36, 3, 36, 3, 37, 3, 37, 3, 38, 3,
+ 38, 3, 39, 3, 39, 3, 40, 3, 40, 3, 41, 3, 41, 3, 42, 3, 42, 3, 42, 3, 42,
+ 3, 43, 3, 43, 3, 44, 6, 44, 339, 10, 44, 13, 44, 14, 44, 340, 3, 44, 3,
+ 44, 3, 45, 3, 45, 3, 45, 3, 45, 3, 45, 3, 45, 3, 45, 3, 46, 3, 46, 3, 46,
+ 3, 46, 3, 46, 3, 46, 3, 47, 3, 47, 3, 47, 3, 47, 3, 47, 3, 48, 3, 48, 3,
+ 48, 3, 48, 3, 48, 3, 49, 3, 49, 3, 49, 3, 49, 3, 49, 3, 49, 3, 49, 3, 49,
+ 3, 49, 3, 50, 3, 50, 3, 50, 3, 50, 3, 50, 3, 51, 3, 51, 3, 51, 3, 51, 3,
+ 51, 3, 52, 3, 52, 3, 52, 3, 52, 3, 52, 3, 52, 3, 52, 3, 52, 3, 53, 3, 53,
+ 3, 53, 3, 53, 3, 53, 3, 54, 3, 54, 3, 54, 3, 54, 3, 54, 3, 54, 3, 54, 3,
+ 54, 3, 54, 3, 54, 3, 54, 3, 54, 3, 54, 3, 54, 3, 54, 3, 54, 3, 54, 3, 54,
+ 3, 55, 3, 55, 3, 55, 3, 55, 3, 55, 3, 55, 3, 55, 3, 55, 3, 55, 3, 55, 3,
+ 55, 3, 55, 3, 55, 3, 55, 3, 55, 3, 55, 3, 55, 3, 55, 3, 55, 3, 55, 3, 55,
+ 3, 55, 3, 55, 3, 55, 3, 55, 3, 56, 3, 56, 3, 56, 3, 56, 3, 56, 3, 56, 3,
+ 56, 3, 56, 3, 56, 3, 56, 3, 56, 3, 56, 3, 56, 3, 56, 3, 56, 3, 56, 3, 56,
+ 3, 56, 3, 56, 3, 56, 3, 56, 3, 57, 3, 57, 3, 57, 3, 57, 3, 57, 3, 58, 3,
+ 58, 3, 58, 3, 58, 3, 58, 3, 58, 3, 58, 3, 58, 3, 58, 3, 58, 3, 58, 3, 59,
+ 3, 59, 3, 59, 3, 59, 3, 59, 3, 59, 3, 59, 3, 60, 3, 60, 3, 60, 3, 60, 3,
+ 60, 3, 60, 3, 61, 3, 61, 3, 61, 3, 61, 3, 61, 3, 61, 3, 62, 3, 62, 3, 62,
+ 3, 62, 3, 62, 3, 62, 3, 62, 3, 62, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 3,
+ 63, 3, 63, 3, 64, 3, 64, 3, 64, 3, 64, 3, 64, 3, 64, 3, 65, 3, 65, 3, 65,
+ 3, 65, 3, 65, 3, 65, 3, 65, 3, 65, 3, 65, 3, 65, 3, 65, 3, 65, 3, 65, 3,
+ 65, 3, 65, 3, 65, 3, 65, 3, 65, 3, 65, 3, 65, 3, 65, 3, 65, 3, 66, 3, 66,
+ 3, 66, 3, 66, 3, 66, 3, 66, 3, 66, 3, 66, 3, 66, 3, 66, 3, 66, 3, 66, 3,
+ 66, 3, 66, 3, 66, 3, 66, 3, 66, 3, 66, 3, 67, 3, 67, 3, 67, 3, 67, 3, 67,
+ 3, 67, 3, 67, 3, 67, 3, 67, 3, 67, 3, 67, 3, 67, 3, 67, 3, 67, 3, 67, 3,
+ 67, 3, 67, 3, 67, 3, 67, 3, 67, 3, 67, 3, 67, 3, 67, 3, 67, 3, 67, 3, 68,
+ 3, 68, 3, 68, 3, 68, 3, 68, 3, 69, 3, 69, 3, 69, 3, 69, 3, 69, 3, 69, 3,
+ 70, 3, 70, 3, 70, 3, 70, 3, 70, 3, 70, 3, 70, 3, 70, 3, 70, 3, 70, 3, 71,
+ 3, 71, 3, 71, 3, 71, 3, 71, 3, 71, 3, 71, 3, 71, 3, 71, 3, 71, 3, 71, 3,
+ 71, 3, 71, 3, 71, 3, 71, 3, 71, 3, 72, 3, 72, 3, 72, 3, 72, 3, 72, 3, 72,
+ 3, 72, 3, 72, 3, 72, 3, 72, 3, 72, 3, 72, 3, 72, 3, 72, 3, 72, 3, 72, 3,
+ 72, 3, 73, 3, 73, 3, 73, 3, 73, 3, 73, 3, 73, 3, 73, 3, 73, 3, 73, 3, 73,
+ 3, 73, 3, 73, 3, 73, 3, 73, 3, 73, 3, 73, 3, 73, 3, 73, 3, 73, 3, 73, 3,
+ 73, 3, 73, 3, 73, 3, 73, 3, 73, 3, 74, 3, 74, 3, 74, 3, 74, 3, 74, 3, 74,
+ 3, 74, 3, 74, 3, 74, 3, 74, 3, 74, 3, 74, 3, 74, 3, 74, 3, 74, 3, 74, 3,
+ 74, 3, 74, 3, 74, 3, 74, 3, 74, 3, 75, 3, 75, 3, 75, 3, 76, 3, 76, 3, 76,
+ 3, 76, 3, 76, 3, 76, 3, 76, 3, 77, 3, 77, 3, 77, 3, 77, 3, 77, 3, 77, 3,
+ 78, 3, 78, 3, 78, 3, 78, 3, 79, 3, 79, 3, 79, 3, 79, 3, 80, 3, 80, 3, 80,
+ 3, 80, 3, 81, 3, 81, 3, 81, 3, 81, 3, 82, 3, 82, 3, 82, 3, 82, 3, 83, 3,
+ 83, 3, 83, 3, 83, 3, 83, 3, 83, 3, 83, 3, 83, 3, 83, 3, 83, 3, 83, 3, 83,
+ 3, 83, 3, 83, 3, 83, 3, 83, 3, 83, 3, 84, 3, 84, 3, 84, 3, 84, 3, 85, 3,
+ 85, 3, 85, 3, 85, 3, 85, 3, 85, 3, 85, 3, 85, 3, 85, 3, 85, 3, 85, 3, 85,
+ 3, 85, 3, 85, 3, 85, 3, 85, 3, 85, 3, 85, 3, 85, 3, 85, 3, 85, 3, 85, 3,
+ 85, 3, 85, 3, 85, 3, 85, 3, 85, 3, 85, 3, 85, 3, 85, 3, 85, 3, 85, 3, 85,
+ 3, 85, 3, 85, 3, 85, 3, 85, 3, 85, 3, 85, 3, 85, 3, 85, 3, 85, 3, 85, 3,
+ 86, 3, 86, 3, 87, 3, 87, 3, 88, 3, 88, 3, 89, 3, 89, 3, 90, 3, 90, 3, 91,
+ 3, 91, 3, 92, 3, 92, 3, 93, 3, 93, 3, 94, 3, 94, 3, 95, 3, 95, 3, 96, 3,
+ 96, 3, 97, 3, 97, 3, 98, 3, 98, 3, 99, 3, 99, 3, 100, 3, 100, 3, 101, 3,
+ 101, 3, 102, 3, 102, 3, 103, 3, 103, 3, 104, 3, 104, 3, 105, 3, 105, 3,
+ 106, 3, 106, 3, 107, 3, 107, 3, 108, 3, 108, 3, 109, 3, 109, 3, 110, 3,
+ 110, 3, 111, 3, 111, 3, 112, 7, 112, 838, 10, 112, 12, 112, 14, 112, 841,
+ 11, 112, 3, 112, 6, 112, 844, 10, 112, 13, 112, 14, 112, 845, 3, 112, 7,
+ 112, 849, 10, 112, 12, 112, 14, 112, 852, 11, 112, 3, 112, 3, 112, 6, 112,
+ 856, 10, 112, 13, 112, 14, 112, 857, 3, 112, 3, 112, 5, 112, 862, 10, 112,
+ 3, 113, 3, 113, 3, 113, 3, 113, 3, 113, 3, 113, 7, 113, 870, 10, 113, 12,
+ 113, 14, 113, 873, 11, 113, 3, 113, 3, 113, 3, 113, 3, 113, 3, 113, 3,
+ 113, 3, 113, 3, 113, 7, 113, 883, 10, 113, 12, 113, 14, 113, 886, 11, 113,
+ 3, 113, 3, 113, 5, 113, 890, 10, 113, 3, 114, 6, 114, 893, 10, 114, 13,
+ 114, 14, 114, 894, 3, 115, 3, 115, 3, 116, 5, 116, 900, 10, 116, 3, 116,
+ 5, 116, 903, 10, 116, 3, 116, 3, 116, 3, 116, 3, 116, 5, 116, 909, 10,
+ 116, 3, 116, 3, 116, 5, 116, 913, 10, 116, 3, 117, 3, 117, 3, 117, 3, 117,
+ 6, 117, 919, 10, 117, 13, 117, 14, 117, 920, 3, 117, 3, 117, 3, 117, 6,
+ 117, 926, 10, 117, 13, 117, 14, 117, 927, 3, 117, 3, 117, 5, 117, 932,
+ 10, 117, 3, 118, 3, 118, 3, 118, 3, 118, 6, 118, 938, 10, 118, 13, 118,
+ 14, 118, 939, 3, 118, 3, 118, 3, 118, 6, 118, 945, 10, 118, 13, 118, 14,
+ 118, 946, 3, 118, 3, 118, 5, 118, 951, 10, 118, 4, 839, 845, 2, 119, 3,
+ 3, 5, 4, 7, 5, 9, 6, 11, 7, 13, 8, 15, 9, 17, 10, 19, 11, 21, 12, 23, 13,
+ 25, 14, 27, 15, 29, 16, 31, 17, 33, 18, 35, 19, 37, 20, 39, 21, 41, 22,
+ 43, 23, 45, 24, 47, 25, 49, 26, 51, 27, 53, 28, 55, 29, 57, 30, 59, 31,
+ 61, 32, 63, 33, 65, 34, 67, 35, 69, 36, 71, 37, 73, 38, 75, 39, 77, 40,
+ 79, 41, 81, 42, 83, 43, 85, 44, 87, 45, 89, 46, 91, 47, 93, 48, 95, 49,
+ 97, 50, 99, 51, 101, 52, 103, 53, 105, 54, 107, 55, 109, 56, 111, 57, 113,
+ 58, 115, 59, 117, 60, 119, 61, 121, 62, 123, 63, 125, 64, 127, 65, 129,
+ 66, 131, 67, 133, 68, 135, 69, 137, 70, 139, 71, 141, 72, 143, 73, 145,
+ 74, 147, 75, 149, 76, 151, 77, 153, 78, 155, 79, 157, 80, 159, 81, 161,
+ 82, 163, 83, 165, 84, 167, 85, 169, 86, 171, 2, 173, 2, 175, 2, 177, 2,
+ 179, 2, 181, 2, 183, 2, 185, 2, 187, 2, 189, 2, 191, 2, 193, 2, 195, 2,
+ 197, 2, 199, 2, 201, 2, 203, 2, 205, 2, 207, 2, 209, 2, 211, 2, 213, 2,
+ 215, 2, 217, 2, 219, 2, 221, 2, 223, 87, 225, 88, 227, 89, 229, 90, 231,
+ 91, 233, 92, 235, 93, 3, 2, 39, 5, 2, 11, 12, 15, 15, 34, 34, 3, 2, 55,
+ 55, 3, 2, 54, 54, 3, 2, 53, 53, 4, 2, 67, 67, 99, 99, 4, 2, 68, 68, 100,
+ 100, 4, 2, 69, 69, 101, 101, 4, 2, 70, 70, 102, 102, 4, 2, 71, 71, 103,
+ 103, 4, 2, 72, 72, 104, 104, 4, 2, 73, 73, 105, 105, 4, 2, 74, 74, 106,
+ 106, 4, 2, 75, 75, 107, 107, 4, 2, 76, 76, 108, 108, 4, 2, 77, 77, 109,
+ 109, 4, 2, 78, 78, 110, 110, 4, 2, 79, 79, 111, 111, 4, 2, 80, 80, 112,
+ 112, 4, 2, 81, 81, 113, 113, 4, 2, 82, 82, 114, 114, 4, 2, 83, 83, 115,
+ 115, 4, 2, 84, 84, 116, 116, 4, 2, 85, 85, 117, 117, 4, 2, 86, 86, 118,
+ 118, 4, 2, 87, 87, 119, 119, 4, 2, 88, 88, 120, 120, 4, 2, 89, 89, 121,
+ 121, 4, 2, 90, 90, 122, 122, 4, 2, 91, 91, 123, 123, 4, 2, 92, 92, 124,
+ 124, 7, 2, 38, 38, 50, 59, 67, 92, 97, 97, 99, 124, 6, 2, 38, 38, 67, 92,
+ 97, 97, 99, 124, 3, 2, 98, 98, 4, 2, 36, 36, 94, 94, 4, 2, 41, 41, 94,
+ 94, 3, 2, 50, 59, 5, 2, 50, 59, 67, 72, 99, 104, 2, 951, 2, 3, 3, 2, 2,
+ 2, 2, 5, 3, 2, 2, 2, 2, 7, 3, 2, 2, 2, 2, 9, 3, 2, 2, 2, 2, 11, 3, 2, 2,
+ 2, 2, 13, 3, 2, 2, 2, 2, 15, 3, 2, 2, 2, 2, 17, 3, 2, 2, 2, 2, 19, 3, 2,
+ 2, 2, 2, 21, 3, 2, 2, 2, 2, 23, 3, 2, 2, 2, 2, 25, 3, 2, 2, 2, 2, 27, 3,
+ 2, 2, 2, 2, 29, 3, 2, 2, 2, 2, 31, 3, 2, 2, 2, 2, 33, 3, 2, 2, 2, 2, 35,
+ 3, 2, 2, 2, 2, 37, 3, 2, 2, 2, 2, 39, 3, 2, 2, 2, 2, 41, 3, 2, 2, 2, 2,
+ 43, 3, 2, 2, 2, 2, 45, 3, 2, 2, 2, 2, 47, 3, 2, 2, 2, 2, 49, 3, 2, 2, 2,
+ 2, 51, 3, 2, 2, 2, 2, 53, 3, 2, 2, 2, 2, 55, 3, 2, 2, 2, 2, 57, 3, 2, 2,
+ 2, 2, 59, 3, 2, 2, 2, 2, 61, 3, 2, 2, 2, 2, 63, 3, 2, 2, 2, 2, 65, 3, 2,
+ 2, 2, 2, 67, 3, 2, 2, 2, 2, 69, 3, 2, 2, 2, 2, 71, 3, 2, 2, 2, 2, 73, 3,
+ 2, 2, 2, 2, 75, 3, 2, 2, 2, 2, 77, 3, 2, 2, 2, 2, 79, 3, 2, 2, 2, 2, 81,
+ 3, 2, 2, 2, 2, 83, 3, 2, 2, 2, 2, 85, 3, 2, 2, 2, 2, 87, 3, 2, 2, 2, 2,
+ 89, 3, 2, 2, 2, 2, 91, 3, 2, 2, 2, 2, 93, 3, 2, 2, 2, 2, 95, 3, 2, 2, 2,
+ 2, 97, 3, 2, 2, 2, 2, 99, 3, 2, 2, 2, 2, 101, 3, 2, 2, 2, 2, 103, 3, 2,
+ 2, 2, 2, 105, 3, 2, 2, 2, 2, 107, 3, 2, 2, 2, 2, 109, 3, 2, 2, 2, 2, 111,
+ 3, 2, 2, 2, 2, 113, 3, 2, 2, 2, 2, 115, 3, 2, 2, 2, 2, 117, 3, 2, 2, 2,
+ 2, 119, 3, 2, 2, 2, 2, 121, 3, 2, 2, 2, 2, 123, 3, 2, 2, 2, 2, 125, 3,
+ 2, 2, 2, 2, 127, 3, 2, 2, 2, 2, 129, 3, 2, 2, 2, 2, 131, 3, 2, 2, 2, 2,
+ 133, 3, 2, 2, 2, 2, 135, 3, 2, 2, 2, 2, 137, 3, 2, 2, 2, 2, 139, 3, 2,
+ 2, 2, 2, 141, 3, 2, 2, 2, 2, 143, 3, 2, 2, 2, 2, 145, 3, 2, 2, 2, 2, 147,
+ 3, 2, 2, 2, 2, 149, 3, 2, 2, 2, 2, 151, 3, 2, 2, 2, 2, 153, 3, 2, 2, 2,
+ 2, 155, 3, 2, 2, 2, 2, 157, 3, 2, 2, 2, 2, 159, 3, 2, 2, 2, 2, 161, 3,
+ 2, 2, 2, 2, 163, 3, 2, 2, 2, 2, 165, 3, 2, 2, 2, 2, 167, 3, 2, 2, 2, 2,
+ 169, 3, 2, 2, 2, 2, 223, 3, 2, 2, 2, 2, 225, 3, 2, 2, 2, 2, 227, 3, 2,
+ 2, 2, 2, 229, 3, 2, 2, 2, 2, 231, 3, 2, 2, 2, 2, 233, 3, 2, 2, 2, 2, 235,
+ 3, 2, 2, 2, 3, 237, 3, 2, 2, 2, 5, 240, 3, 2, 2, 2, 7, 243, 3, 2, 2, 2,
+ 9, 245, 3, 2, 2, 2, 11, 247, 3, 2, 2, 2, 13, 249, 3, 2, 2, 2, 15, 251,
+ 3, 2, 2, 2, 17, 254, 3, 2, 2, 2, 19, 257, 3, 2, 2, 2, 21, 259, 3, 2, 2,
+ 2, 23, 261, 3, 2, 2, 2, 25, 263, 3, 2, 2, 2, 27, 265, 3, 2, 2, 2, 29, 267,
+ 3, 2, 2, 2, 31, 269, 3, 2, 2, 2, 33, 271, 3, 2, 2, 2, 35, 273, 3, 2, 2,
+ 2, 37, 275, 3, 2, 2, 2, 39, 278, 3, 2, 2, 2, 41, 282, 3, 2, 2, 2, 43, 285,
+ 3, 2, 2, 2, 45, 291, 3, 2, 2, 2, 47, 293, 3, 2, 2, 2, 49, 295, 3, 2, 2,
+ 2, 51, 298, 3, 2, 2, 2, 53, 300, 3, 2, 2, 2, 55, 303, 3, 2, 2, 2, 57, 305,
+ 3, 2, 2, 2, 59, 307, 3, 2, 2, 2, 61, 309, 3, 2, 2, 2, 63, 311, 3, 2, 2,
+ 2, 65, 313, 3, 2, 2, 2, 67, 315, 3, 2, 2, 2, 69, 317, 3, 2, 2, 2, 71, 319,
+ 3, 2, 2, 2, 73, 321, 3, 2, 2, 2, 75, 323, 3, 2, 2, 2, 77, 325, 3, 2, 2,
+ 2, 79, 327, 3, 2, 2, 2, 81, 329, 3, 2, 2, 2, 83, 331, 3, 2, 2, 2, 85, 335,
+ 3, 2, 2, 2, 87, 338, 3, 2, 2, 2, 89, 344, 3, 2, 2, 2, 91, 351, 3, 2, 2,
+ 2, 93, 357, 3, 2, 2, 2, 95, 362, 3, 2, 2, 2, 97, 367, 3, 2, 2, 2, 99, 376,
+ 3, 2, 2, 2, 101, 381, 3, 2, 2, 2, 103, 386, 3, 2, 2, 2, 105, 394, 3, 2,
+ 2, 2, 107, 399, 3, 2, 2, 2, 109, 417, 3, 2, 2, 2, 111, 442, 3, 2, 2, 2,
+ 113, 463, 3, 2, 2, 2, 115, 468, 3, 2, 2, 2, 117, 479, 3, 2, 2, 2, 119,
+ 486, 3, 2, 2, 2, 121, 492, 3, 2, 2, 2, 123, 498, 3, 2, 2, 2, 125, 506,
+ 3, 2, 2, 2, 127, 513, 3, 2, 2, 2, 129, 519, 3, 2, 2, 2, 131, 541, 3, 2,
+ 2, 2, 133, 559, 3, 2, 2, 2, 135, 584, 3, 2, 2, 2, 137, 589, 3, 2, 2, 2,
+ 139, 595, 3, 2, 2, 2, 141, 605, 3, 2, 2, 2, 143, 621, 3, 2, 2, 2, 145,
+ 638, 3, 2, 2, 2, 147, 663, 3, 2, 2, 2, 149, 684, 3, 2, 2, 2, 151, 687,
+ 3, 2, 2, 2, 153, 694, 3, 2, 2, 2, 155, 700, 3, 2, 2, 2, 157, 704, 3, 2,
+ 2, 2, 159, 708, 3, 2, 2, 2, 161, 712, 3, 2, 2, 2, 163, 716, 3, 2, 2, 2,
+ 165, 720, 3, 2, 2, 2, 167, 737, 3, 2, 2, 2, 169, 741, 3, 2, 2, 2, 171,
+ 784, 3, 2, 2, 2, 173, 786, 3, 2, 2, 2, 175, 788, 3, 2, 2, 2, 177, 790,
+ 3, 2, 2, 2, 179, 792, 3, 2, 2, 2, 181, 794, 3, 2, 2, 2, 183, 796, 3, 2,
+ 2, 2, 185, 798, 3, 2, 2, 2, 187, 800, 3, 2, 2, 2, 189, 802, 3, 2, 2, 2,
+ 191, 804, 3, 2, 2, 2, 193, 806, 3, 2, 2, 2, 195, 808, 3, 2, 2, 2, 197,
+ 810, 3, 2, 2, 2, 199, 812, 3, 2, 2, 2, 201, 814, 3, 2, 2, 2, 203, 816,
+ 3, 2, 2, 2, 205, 818, 3, 2, 2, 2, 207, 820, 3, 2, 2, 2, 209, 822, 3, 2,
+ 2, 2, 211, 824, 3, 2, 2, 2, 213, 826, 3, 2, 2, 2, 215, 828, 3, 2, 2, 2,
+ 217, 830, 3, 2, 2, 2, 219, 832, 3, 2, 2, 2, 221, 834, 3, 2, 2, 2, 223,
+ 861, 3, 2, 2, 2, 225, 889, 3, 2, 2, 2, 227, 892, 3, 2, 2, 2, 229, 896,
+ 3, 2, 2, 2, 231, 899, 3, 2, 2, 2, 233, 931, 3, 2, 2, 2, 235, 950, 3, 2,
+ 2, 2, 237, 238, 7, 40, 2, 2, 238, 239, 7, 40, 2, 2, 239, 4, 3, 2, 2, 2,
+ 240, 241, 7, 126, 2, 2, 241, 242, 7, 126, 2, 2, 242, 6, 3, 2, 2, 2, 243,
+ 244, 7, 35, 2, 2, 244, 8, 3, 2, 2, 2, 245, 246, 7, 128, 2, 2, 246, 10,
+ 3, 2, 2, 2, 247, 248, 7, 126, 2, 2, 248, 12, 3, 2, 2, 2, 249, 250, 7, 40,
+ 2, 2, 250, 14, 3, 2, 2, 2, 251, 252, 7, 62, 2, 2, 252, 253, 7, 62, 2, 2,
+ 253, 16, 3, 2, 2, 2, 254, 255, 7, 64, 2, 2, 255, 256, 7, 64, 2, 2, 256,
+ 18, 3, 2, 2, 2, 257, 258, 7, 96, 2, 2, 258, 20, 3, 2, 2, 2, 259, 260, 7,
+ 39, 2, 2, 260, 22, 3, 2, 2, 2, 261, 262, 7, 60, 2, 2, 262, 24, 3, 2, 2,
+ 2, 263, 264, 7, 45, 2, 2, 264, 26, 3, 2, 2, 2, 265, 266, 7, 47, 2, 2, 266,
+ 28, 3, 2, 2, 2, 267, 268, 7, 44, 2, 2, 268, 30, 3, 2, 2, 2, 269, 270, 7,
+ 49, 2, 2, 270, 32, 3, 2, 2, 2, 271, 272, 7, 94, 2, 2, 272, 34, 3, 2, 2,
+ 2, 273, 274, 7, 48, 2, 2, 274, 36, 3, 2, 2, 2, 275, 276, 7, 48, 2, 2, 276,
+ 277, 7, 44, 2, 2, 277, 38, 3, 2, 2, 2, 278, 279, 7, 62, 2, 2, 279, 280,
+ 7, 63, 2, 2, 280, 281, 7, 64, 2, 2, 281, 40, 3, 2, 2, 2, 282, 283, 7, 63,
+ 2, 2, 283, 284, 7, 63, 2, 2, 284, 42, 3, 2, 2, 2, 285, 286, 7, 63, 2, 2,
+ 286, 44, 3, 2, 2, 2, 287, 288, 7, 62, 2, 2, 288, 292, 7, 64, 2, 2, 289,
+ 290, 7, 35, 2, 2, 290, 292, 7, 63, 2, 2, 291, 287, 3, 2, 2, 2, 291, 289,
+ 3, 2, 2, 2, 292, 46, 3, 2, 2, 2, 293, 294, 7, 64, 2, 2, 294, 48, 3, 2,
+ 2, 2, 295, 296, 7, 64, 2, 2, 296, 297, 7, 63, 2, 2, 297, 50, 3, 2, 2, 2,
+ 298, 299, 7, 62, 2, 2, 299, 52, 3, 2, 2, 2, 300, 301, 7, 62, 2, 2, 301,
+ 302, 7, 63, 2, 2, 302, 54, 3, 2, 2, 2, 303, 304, 7, 37, 2, 2, 304, 56,
+ 3, 2, 2, 2, 305, 306, 7, 42, 2, 2, 306, 58, 3, 2, 2, 2, 307, 308, 7, 43,
+ 2, 2, 308, 60, 3, 2, 2, 2, 309, 310, 7, 125, 2, 2, 310, 62, 3, 2, 2, 2,
+ 311, 312, 7, 127, 2, 2, 312, 64, 3, 2, 2, 2, 313, 314, 7, 93, 2, 2, 314,
+ 66, 3, 2, 2, 2, 315, 316, 7, 95, 2, 2, 316, 68, 3, 2, 2, 2, 317, 318, 7,
+ 46, 2, 2, 318, 70, 3, 2, 2, 2, 319, 320, 7, 36, 2, 2, 320, 72, 3, 2, 2,
+ 2, 321, 322, 7, 41, 2, 2, 322, 74, 3, 2, 2, 2, 323, 324, 7, 98, 2, 2, 324,
+ 76, 3, 2, 2, 2, 325, 326, 7, 65, 2, 2, 326, 78, 3, 2, 2, 2, 327, 328, 7,
+ 66, 2, 2, 328, 80, 3, 2, 2, 2, 329, 330, 7, 61, 2, 2, 330, 82, 3, 2, 2,
+ 2, 331, 332, 7, 47, 2, 2, 332, 333, 7, 64, 2, 2, 333, 334, 7, 64, 2, 2,
+ 334, 84, 3, 2, 2, 2, 335, 336, 7, 97, 2, 2, 336, 86, 3, 2, 2, 2, 337, 339,
+ 9, 2, 2, 2, 338, 337, 3, 2, 2, 2, 339, 340, 3, 2, 2, 2, 340, 338, 3, 2,
+ 2, 2, 340, 341, 3, 2, 2, 2, 341, 342, 3, 2, 2, 2, 342, 343, 8, 44, 2, 2,
+ 343, 88, 3, 2, 2, 2, 344, 345, 5, 175, 88, 2, 345, 346, 5, 205, 103, 2,
+ 346, 347, 5, 179, 90, 2, 347, 348, 5, 171, 86, 2, 348, 349, 5, 209, 105,
+ 2, 349, 350, 5, 179, 90, 2, 350, 90, 3, 2, 2, 2, 351, 352, 5, 171, 86,
+ 2, 352, 353, 5, 193, 97, 2, 353, 354, 5, 209, 105, 2, 354, 355, 5, 179,
+ 90, 2, 355, 356, 5, 205, 103, 2, 356, 92, 3, 2, 2, 2, 357, 358, 5, 177,
+ 89, 2, 358, 359, 5, 205, 103, 2, 359, 360, 5, 199, 100, 2, 360, 361, 5,
+ 201, 101, 2, 361, 94, 3, 2, 2, 2, 362, 363, 5, 207, 104, 2, 363, 364, 5,
+ 185, 93, 2, 364, 365, 5, 199, 100, 2, 365, 366, 5, 215, 108, 2, 366, 96,
+ 3, 2, 2, 2, 367, 368, 5, 205, 103, 2, 368, 369, 5, 179, 90, 2, 369, 370,
+ 5, 207, 104, 2, 370, 371, 5, 199, 100, 2, 371, 372, 5, 211, 106, 2, 372,
+ 373, 5, 205, 103, 2, 373, 374, 5, 175, 88, 2, 374, 375, 5, 179, 90, 2,
+ 375, 98, 3, 2, 2, 2, 376, 377, 5, 205, 103, 2, 377, 378, 5, 211, 106, 2,
+ 378, 379, 5, 193, 97, 2, 379, 380, 5, 179, 90, 2, 380, 100, 3, 2, 2, 2,
+ 381, 382, 5, 181, 91, 2, 382, 383, 5, 205, 103, 2, 383, 384, 5, 199, 100,
+ 2, 384, 385, 5, 195, 98, 2, 385, 102, 3, 2, 2, 2, 386, 387, 5, 179, 90,
+ 2, 387, 388, 5, 197, 99, 2, 388, 389, 5, 175, 88, 2, 389, 390, 5, 205,
+ 103, 2, 390, 391, 5, 219, 110, 2, 391, 392, 5, 201, 101, 2, 392, 393, 5,
+ 209, 105, 2, 393, 104, 3, 2, 2, 2, 394, 395, 5, 209, 105, 2, 395, 396,
+ 5, 219, 110, 2, 396, 397, 5, 201, 101, 2, 397, 398, 5, 179, 90, 2, 398,
+ 106, 3, 2, 2, 2, 399, 400, 5, 179, 90, 2, 400, 401, 5, 197, 99, 2, 401,
+ 402, 5, 175, 88, 2, 402, 403, 5, 205, 103, 2, 403, 404, 5, 219, 110, 2,
+ 404, 405, 5, 201, 101, 2, 405, 406, 5, 209, 105, 2, 406, 407, 5, 85, 43,
+ 2, 407, 408, 5, 171, 86, 2, 408, 409, 5, 193, 97, 2, 409, 410, 5, 183,
+ 92, 2, 410, 411, 5, 199, 100, 2, 411, 412, 5, 205, 103, 2, 412, 413, 5,
+ 187, 94, 2, 413, 414, 5, 209, 105, 2, 414, 415, 5, 185, 93, 2, 415, 416,
+ 5, 195, 98, 2, 416, 108, 3, 2, 2, 2, 417, 418, 5, 171, 86, 2, 418, 419,
+ 5, 207, 104, 2, 419, 420, 5, 207, 104, 2, 420, 421, 5, 187, 94, 2, 421,
+ 422, 5, 207, 104, 2, 422, 423, 5, 209, 105, 2, 423, 424, 5, 179, 90, 2,
+ 424, 425, 5, 177, 89, 2, 425, 426, 5, 85, 43, 2, 426, 427, 5, 203, 102,
+ 2, 427, 428, 5, 211, 106, 2, 428, 429, 5, 179, 90, 2, 429, 430, 5, 205,
+ 103, 2, 430, 431, 5, 219, 110, 2, 431, 432, 5, 85, 43, 2, 432, 433, 5,
+ 171, 86, 2, 433, 434, 5, 193, 97, 2, 434, 435, 5, 183, 92, 2, 435, 436,
+ 5, 199, 100, 2, 436, 437, 5, 205, 103, 2, 437, 438, 5, 187, 94, 2, 438,
+ 439, 5, 209, 105, 2, 439, 440, 5, 185, 93, 2, 440, 441, 5, 195, 98, 2,
+ 441, 110, 3, 2, 2, 2, 442, 443, 5, 193, 97, 2, 443, 444, 5, 187, 94, 2,
+ 444, 445, 5, 191, 96, 2, 445, 446, 5, 179, 90, 2, 446, 447, 5, 85, 43,
+ 2, 447, 448, 5, 203, 102, 2, 448, 449, 5, 211, 106, 2, 449, 450, 5, 179,
+ 90, 2, 450, 451, 5, 205, 103, 2, 451, 452, 5, 219, 110, 2, 452, 453, 5,
+ 85, 43, 2, 453, 454, 5, 171, 86, 2, 454, 455, 5, 193, 97, 2, 455, 456,
+ 5, 183, 92, 2, 456, 457, 5, 199, 100, 2, 457, 458, 5, 205, 103, 2, 458,
+ 459, 5, 187, 94, 2, 459, 460, 5, 209, 105, 2, 460, 461, 5, 185, 93, 2,
+ 461, 462, 5, 195, 98, 2, 462, 112, 3, 2, 2, 2, 463, 464, 5, 197, 99, 2,
+ 464, 465, 5, 171, 86, 2, 465, 466, 5, 195, 98, 2, 466, 467, 5, 179, 90,
+ 2, 467, 114, 3, 2, 2, 2, 468, 469, 5, 201, 101, 2, 469, 470, 5, 205, 103,
+ 2, 470, 471, 5, 199, 100, 2, 471, 472, 5, 201, 101, 2, 472, 473, 5, 179,
+ 90, 2, 473, 474, 5, 205, 103, 2, 474, 475, 5, 209, 105, 2, 475, 476, 5,
+ 187, 94, 2, 476, 477, 5, 179, 90, 2, 477, 478, 5, 207, 104, 2, 478, 116,
+ 3, 2, 2, 2, 479, 480, 5, 175, 88, 2, 480, 481, 5, 199, 100, 2, 481, 482,
+ 5, 193, 97, 2, 482, 483, 5, 211, 106, 2, 483, 484, 5, 195, 98, 2, 484,
+ 485, 5, 197, 99, 2, 485, 118, 3, 2, 2, 2, 486, 487, 5, 205, 103, 2, 487,
+ 488, 5, 211, 106, 2, 488, 489, 5, 193, 97, 2, 489, 490, 5, 179, 90, 2,
+ 490, 491, 5, 207, 104, 2, 491, 120, 3, 2, 2, 2, 492, 493, 5, 209, 105,
+ 2, 493, 494, 5, 171, 86, 2, 494, 495, 5, 173, 87, 2, 495, 496, 5, 193,
+ 97, 2, 496, 497, 5, 179, 90, 2, 497, 122, 3, 2, 2, 2, 498, 499, 5, 175,
+ 88, 2, 499, 500, 5, 199, 100, 2, 500, 501, 5, 193, 97, 2, 501, 502, 5,
+ 211, 106, 2, 502, 503, 5, 195, 98, 2, 503, 504, 5, 197, 99, 2, 504, 505,
+ 5, 207, 104, 2, 505, 124, 3, 2, 2, 2, 506, 507, 5, 175, 88, 2, 507, 508,
+ 5, 187, 94, 2, 508, 509, 5, 201, 101, 2, 509, 510, 5, 185, 93, 2, 510,
+ 511, 5, 179, 90, 2, 511, 512, 5, 205, 103, 2, 512, 126, 3, 2, 2, 2, 513,
+ 514, 5, 201, 101, 2, 514, 515, 5, 193, 97, 2, 515, 516, 5, 171, 86, 2,
+ 516, 517, 5, 187, 94, 2, 517, 518, 5, 197, 99, 2, 518, 128, 3, 2, 2, 2,
+ 519, 520, 5, 171, 86, 2, 520, 521, 5, 207, 104, 2, 521, 522, 5, 207, 104,
+ 2, 522, 523, 5, 187, 94, 2, 523, 524, 5, 207, 104, 2, 524, 525, 5, 209,
+ 105, 2, 525, 526, 5, 179, 90, 2, 526, 527, 5, 177, 89, 2, 527, 528, 5,
+ 85, 43, 2, 528, 529, 5, 203, 102, 2, 529, 530, 5, 211, 106, 2, 530, 531,
+ 5, 179, 90, 2, 531, 532, 5, 205, 103, 2, 532, 533, 5, 219, 110, 2, 533,
+ 534, 5, 85, 43, 2, 534, 535, 5, 175, 88, 2, 535, 536, 5, 199, 100, 2, 536,
+ 537, 5, 193, 97, 2, 537, 538, 5, 211, 106, 2, 538, 539, 5, 195, 98, 2,
+ 539, 540, 5, 197, 99, 2, 540, 130, 3, 2, 2, 2, 541, 542, 5, 193, 97, 2,
+ 542, 543, 5, 187, 94, 2, 543, 544, 5, 191, 96, 2, 544, 545, 5, 179, 90,
+ 2, 545, 546, 5, 85, 43, 2, 546, 547, 5, 203, 102, 2, 547, 548, 5, 211,
+ 106, 2, 548, 549, 5, 179, 90, 2, 549, 550, 5, 205, 103, 2, 550, 551, 5,
+ 219, 110, 2, 551, 552, 5, 85, 43, 2, 552, 553, 5, 175, 88, 2, 553, 554,
+ 5, 199, 100, 2, 554, 555, 5, 193, 97, 2, 555, 556, 5, 211, 106, 2, 556,
+ 557, 5, 195, 98, 2, 557, 558, 5, 197, 99, 2, 558, 132, 3, 2, 2, 2, 559,
+ 560, 5, 203, 102, 2, 560, 561, 5, 211, 106, 2, 561, 562, 5, 179, 90, 2,
+ 562, 563, 5, 205, 103, 2, 563, 564, 5, 219, 110, 2, 564, 565, 5, 85, 43,
+ 2, 565, 566, 5, 215, 108, 2, 566, 567, 5, 187, 94, 2, 567, 568, 5, 209,
+ 105, 2, 568, 569, 5, 185, 93, 2, 569, 570, 5, 85, 43, 2, 570, 571, 5, 175,
+ 88, 2, 571, 572, 5, 187, 94, 2, 572, 573, 5, 201, 101, 2, 573, 574, 5,
+ 185, 93, 2, 574, 575, 5, 179, 90, 2, 575, 576, 5, 205, 103, 2, 576, 577,
+ 5, 85, 43, 2, 577, 578, 5, 175, 88, 2, 578, 579, 5, 199, 100, 2, 579, 580,
+ 5, 193, 97, 2, 580, 581, 5, 211, 106, 2, 581, 582, 5, 195, 98, 2, 582,
+ 583, 5, 197, 99, 2, 583, 134, 3, 2, 2, 2, 584, 585, 5, 209, 105, 2, 585,
+ 586, 5, 205, 103, 2, 586, 587, 5, 211, 106, 2, 587, 588, 5, 179, 90, 2,
+ 588, 136, 3, 2, 2, 2, 589, 590, 5, 181, 91, 2, 590, 591, 5, 171, 86, 2,
+ 591, 592, 5, 193, 97, 2, 592, 593, 5, 207, 104, 2, 593, 594, 5, 179, 90,
+ 2, 594, 138, 3, 2, 2, 2, 595, 596, 5, 177, 89, 2, 596, 597, 5, 171, 86,
+ 2, 597, 598, 5, 209, 105, 2, 598, 599, 5, 171, 86, 2, 599, 600, 5, 85,
+ 43, 2, 600, 601, 5, 209, 105, 2, 601, 602, 5, 219, 110, 2, 602, 603, 5,
+ 201, 101, 2, 603, 604, 5, 179, 90, 2, 604, 140, 3, 2, 2, 2, 605, 606, 5,
+ 201, 101, 2, 606, 607, 5, 193, 97, 2, 607, 608, 5, 171, 86, 2, 608, 609,
+ 5, 187, 94, 2, 609, 610, 5, 197, 99, 2, 610, 611, 5, 85, 43, 2, 611, 612,
+ 5, 177, 89, 2, 612, 613, 5, 171, 86, 2, 613, 614, 5, 209, 105, 2, 614,
+ 615, 5, 171, 86, 2, 615, 616, 5, 85, 43, 2, 616, 617, 5, 209, 105, 2, 617,
+ 618, 5, 219, 110, 2, 618, 619, 5, 201, 101, 2, 619, 620, 5, 179, 90, 2,
+ 620, 142, 3, 2, 2, 2, 621, 622, 5, 175, 88, 2, 622, 623, 5, 187, 94, 2,
+ 623, 624, 5, 201, 101, 2, 624, 625, 5, 185, 93, 2, 625, 626, 5, 179, 90,
+ 2, 626, 627, 5, 205, 103, 2, 627, 628, 5, 85, 43, 2, 628, 629, 5, 177,
+ 89, 2, 629, 630, 5, 171, 86, 2, 630, 631, 5, 209, 105, 2, 631, 632, 5,
+ 171, 86, 2, 632, 633, 5, 85, 43, 2, 633, 634, 5, 209, 105, 2, 634, 635,
+ 5, 219, 110, 2, 635, 636, 5, 201, 101, 2, 636, 637, 5, 179, 90, 2, 637,
+ 144, 3, 2, 2, 2, 638, 639, 5, 171, 86, 2, 639, 640, 5, 207, 104, 2, 640,
+ 641, 5, 207, 104, 2, 641, 642, 5, 187, 94, 2, 642, 643, 5, 207, 104, 2,
+ 643, 644, 5, 209, 105, 2, 644, 645, 5, 179, 90, 2, 645, 646, 5, 177, 89,
+ 2, 646, 647, 5, 85, 43, 2, 647, 648, 5, 203, 102, 2, 648, 649, 5, 211,
+ 106, 2, 649, 650, 5, 179, 90, 2, 650, 651, 5, 205, 103, 2, 651, 652, 5,
+ 219, 110, 2, 652, 653, 5, 85, 43, 2, 653, 654, 5, 177, 89, 2, 654, 655,
+ 5, 171, 86, 2, 655, 656, 5, 209, 105, 2, 656, 657, 5, 171, 86, 2, 657,
+ 658, 5, 85, 43, 2, 658, 659, 5, 209, 105, 2, 659, 660, 5, 219, 110, 2,
+ 660, 661, 5, 201, 101, 2, 661, 662, 5, 179, 90, 2, 662, 146, 3, 2, 2, 2,
+ 663, 664, 5, 193, 97, 2, 664, 665, 5, 187, 94, 2, 665, 666, 5, 191, 96,
+ 2, 666, 667, 5, 179, 90, 2, 667, 668, 5, 85, 43, 2, 668, 669, 5, 203, 102,
+ 2, 669, 670, 5, 211, 106, 2, 670, 671, 5, 179, 90, 2, 671, 672, 5, 205,
+ 103, 2, 672, 673, 5, 219, 110, 2, 673, 674, 5, 85, 43, 2, 674, 675, 5,
+ 177, 89, 2, 675, 676, 5, 171, 86, 2, 676, 677, 5, 209, 105, 2, 677, 678,
+ 5, 171, 86, 2, 678, 679, 5, 85, 43, 2, 679, 680, 5, 209, 105, 2, 680, 681,
+ 5, 219, 110, 2, 681, 682, 5, 201, 101, 2, 682, 683, 5, 179, 90, 2, 683,
+ 148, 3, 2, 2, 2, 684, 685, 5, 187, 94, 2, 685, 686, 5, 181, 91, 2, 686,
+ 150, 3, 2, 2, 2, 687, 688, 5, 179, 90, 2, 688, 689, 5, 217, 109, 2, 689,
+ 690, 5, 187, 94, 2, 690, 691, 5, 207, 104, 2, 691, 692, 5, 209, 105, 2,
+ 692, 693, 5, 207, 104, 2, 693, 152, 3, 2, 2, 2, 694, 695, 5, 175, 88, 2,
+ 695, 696, 5, 199, 100, 2, 696, 697, 5, 211, 106, 2, 697, 698, 5, 197, 99,
+ 2, 698, 699, 5, 209, 105, 2, 699, 154, 3, 2, 2, 2, 700, 701, 5, 195, 98,
+ 2, 701, 702, 5, 177, 89, 2, 702, 703, 9, 3, 2, 2, 703, 156, 3, 2, 2, 2,
+ 704, 705, 5, 171, 86, 2, 705, 706, 5, 179, 90, 2, 706, 707, 5, 207, 104,
+ 2, 707, 158, 3, 2, 2, 2, 708, 709, 5, 205, 103, 2, 709, 710, 5, 175, 88,
+ 2, 710, 711, 9, 4, 2, 2, 711, 160, 3, 2, 2, 2, 712, 713, 5, 207, 104, 2,
+ 713, 714, 5, 195, 98, 2, 714, 715, 9, 5, 2, 2, 715, 162, 3, 2, 2, 2, 716,
+ 717, 5, 207, 104, 2, 717, 718, 5, 195, 98, 2, 718, 719, 9, 4, 2, 2, 719,
+ 164, 3, 2, 2, 2, 720, 721, 5, 175, 88, 2, 721, 722, 5, 185, 93, 2, 722,
+ 723, 5, 171, 86, 2, 723, 724, 5, 205, 103, 2, 724, 725, 5, 85, 43, 2, 725,
+ 726, 5, 177, 89, 2, 726, 727, 5, 187, 94, 2, 727, 728, 5, 183, 92, 2, 728,
+ 729, 5, 179, 90, 2, 729, 730, 5, 207, 104, 2, 730, 731, 5, 209, 105, 2,
+ 731, 732, 5, 85, 43, 2, 732, 733, 5, 193, 97, 2, 733, 734, 5, 187, 94,
+ 2, 734, 735, 5, 191, 96, 2, 735, 736, 5, 179, 90, 2, 736, 166, 3, 2, 2,
+ 2, 737, 738, 5, 197, 99, 2, 738, 739, 5, 199, 100, 2, 739, 740, 5, 209,
+ 105, 2, 740, 168, 3, 2, 2, 2, 741, 742, 7, 70, 2, 2, 742, 743, 7, 81, 2,
+ 2, 743, 744, 7, 34, 2, 2, 744, 745, 7, 80, 2, 2, 745, 746, 7, 81, 2, 2,
+ 746, 747, 7, 86, 2, 2, 747, 748, 7, 34, 2, 2, 748, 749, 7, 79, 2, 2, 749,
+ 750, 7, 67, 2, 2, 750, 751, 7, 86, 2, 2, 751, 752, 7, 69, 2, 2, 752, 753,
+ 7, 74, 2, 2, 753, 754, 7, 34, 2, 2, 754, 755, 7, 67, 2, 2, 755, 756, 7,
+ 80, 2, 2, 756, 757, 7, 91, 2, 2, 757, 758, 7, 34, 2, 2, 758, 759, 7, 86,
+ 2, 2, 759, 760, 7, 74, 2, 2, 760, 761, 7, 75, 2, 2, 761, 762, 7, 80, 2,
+ 2, 762, 763, 7, 73, 2, 2, 763, 764, 7, 46, 2, 2, 764, 765, 7, 34, 2, 2,
+ 765, 766, 7, 76, 2, 2, 766, 767, 7, 87, 2, 2, 767, 768, 7, 85, 2, 2, 768,
+ 769, 7, 86, 2, 2, 769, 770, 7, 34, 2, 2, 770, 771, 7, 72, 2, 2, 771, 772,
+ 7, 81, 2, 2, 772, 773, 7, 84, 2, 2, 773, 774, 7, 34, 2, 2, 774, 775, 7,
+ 73, 2, 2, 775, 776, 7, 71, 2, 2, 776, 777, 7, 80, 2, 2, 777, 778, 7, 71,
+ 2, 2, 778, 779, 7, 84, 2, 2, 779, 780, 7, 67, 2, 2, 780, 781, 7, 86, 2,
+ 2, 781, 782, 7, 81, 2, 2, 782, 783, 7, 84, 2, 2, 783, 170, 3, 2, 2, 2,
+ 784, 785, 9, 6, 2, 2, 785, 172, 3, 2, 2, 2, 786, 787, 9, 7, 2, 2, 787,
+ 174, 3, 2, 2, 2, 788, 789, 9, 8, 2, 2, 789, 176, 3, 2, 2, 2, 790, 791,
+ 9, 9, 2, 2, 791, 178, 3, 2, 2, 2, 792, 793, 9, 10, 2, 2, 793, 180, 3, 2,
+ 2, 2, 794, 795, 9, 11, 2, 2, 795, 182, 3, 2, 2, 2, 796, 797, 9, 12, 2,
+ 2, 797, 184, 3, 2, 2, 2, 798, 799, 9, 13, 2, 2, 799, 186, 3, 2, 2, 2, 800,
+ 801, 9, 14, 2, 2, 801, 188, 3, 2, 2, 2, 802, 803, 9, 15, 2, 2, 803, 190,
+ 3, 2, 2, 2, 804, 805, 9, 16, 2, 2, 805, 192, 3, 2, 2, 2, 806, 807, 9, 17,
+ 2, 2, 807, 194, 3, 2, 2, 2, 808, 809, 9, 18, 2, 2, 809, 196, 3, 2, 2, 2,
+ 810, 811, 9, 19, 2, 2, 811, 198, 3, 2, 2, 2, 812, 813, 9, 20, 2, 2, 813,
+ 200, 3, 2, 2, 2, 814, 815, 9, 21, 2, 2, 815, 202, 3, 2, 2, 2, 816, 817,
+ 9, 22, 2, 2, 817, 204, 3, 2, 2, 2, 818, 819, 9, 23, 2, 2, 819, 206, 3,
+ 2, 2, 2, 820, 821, 9, 24, 2, 2, 821, 208, 3, 2, 2, 2, 822, 823, 9, 25,
+ 2, 2, 823, 210, 3, 2, 2, 2, 824, 825, 9, 26, 2, 2, 825, 212, 3, 2, 2, 2,
+ 826, 827, 9, 27, 2, 2, 827, 214, 3, 2, 2, 2, 828, 829, 9, 28, 2, 2, 829,
+ 216, 3, 2, 2, 2, 830, 831, 9, 29, 2, 2, 831, 218, 3, 2, 2, 2, 832, 833,
+ 9, 30, 2, 2, 833, 220, 3, 2, 2, 2, 834, 835, 9, 31, 2, 2, 835, 222, 3,
+ 2, 2, 2, 836, 838, 9, 32, 2, 2, 837, 836, 3, 2, 2, 2, 838, 841, 3, 2, 2,
+ 2, 839, 840, 3, 2, 2, 2, 839, 837, 3, 2, 2, 2, 840, 843, 3, 2, 2, 2, 841,
+ 839, 3, 2, 2, 2, 842, 844, 9, 33, 2, 2, 843, 842, 3, 2, 2, 2, 844, 845,
+ 3, 2, 2, 2, 845, 846, 3, 2, 2, 2, 845, 843, 3, 2, 2, 2, 846, 850, 3, 2,
+ 2, 2, 847, 849, 9, 32, 2, 2, 848, 847, 3, 2, 2, 2, 849, 852, 3, 2, 2, 2,
+ 850, 848, 3, 2, 2, 2, 850, 851, 3, 2, 2, 2, 851, 862, 3, 2, 2, 2, 852,
+ 850, 3, 2, 2, 2, 853, 855, 5, 75, 38, 2, 854, 856, 10, 34, 2, 2, 855, 854,
+ 3, 2, 2, 2, 856, 857, 3, 2, 2, 2, 857, 855, 3, 2, 2, 2, 857, 858, 3, 2,
+ 2, 2, 858, 859, 3, 2, 2, 2, 859, 860, 5, 75, 38, 2, 860, 862, 3, 2, 2,
+ 2, 861, 839, 3, 2, 2, 2, 861, 853, 3, 2, 2, 2, 862, 224, 3, 2, 2, 2, 863,
+ 871, 5, 71, 36, 2, 864, 865, 7, 94, 2, 2, 865, 870, 11, 2, 2, 2, 866, 867,
+ 7, 36, 2, 2, 867, 870, 7, 36, 2, 2, 868, 870, 10, 35, 2, 2, 869, 864, 3,
+ 2, 2, 2, 869, 866, 3, 2, 2, 2, 869, 868, 3, 2, 2, 2, 870, 873, 3, 2, 2,
+ 2, 871, 869, 3, 2, 2, 2, 871, 872, 3, 2, 2, 2, 872, 874, 3, 2, 2, 2, 873,
+ 871, 3, 2, 2, 2, 874, 875, 5, 71, 36, 2, 875, 890, 3, 2, 2, 2, 876, 884,
+ 5, 73, 37, 2, 877, 878, 7, 94, 2, 2, 878, 883, 11, 2, 2, 2, 879, 880, 7,
+ 41, 2, 2, 880, 883, 7, 41, 2, 2, 881, 883, 10, 36, 2, 2, 882, 877, 3, 2,
+ 2, 2, 882, 879, 3, 2, 2, 2, 882, 881, 3, 2, 2, 2, 883, 886, 3, 2, 2, 2,
+ 884, 882, 3, 2, 2, 2, 884, 885, 3, 2, 2, 2, 885, 887, 3, 2, 2, 2, 886,
+ 884, 3, 2, 2, 2, 887, 888, 5, 73, 37, 2, 888, 890, 3, 2, 2, 2, 889, 863,
+ 3, 2, 2, 2, 889, 876, 3, 2, 2, 2, 890, 226, 3, 2, 2, 2, 891, 893, 9, 37,
+ 2, 2, 892, 891, 3, 2, 2, 2, 893, 894, 3, 2, 2, 2, 894, 892, 3, 2, 2, 2,
+ 894, 895, 3, 2, 2, 2, 895, 228, 3, 2, 2, 2, 896, 897, 9, 38, 2, 2, 897,
+ 230, 3, 2, 2, 2, 898, 900, 5, 227, 114, 2, 899, 898, 3, 2, 2, 2, 899, 900,
+ 3, 2, 2, 2, 900, 902, 3, 2, 2, 2, 901, 903, 5, 35, 18, 2, 902, 901, 3,
+ 2, 2, 2, 902, 903, 3, 2, 2, 2, 903, 904, 3, 2, 2, 2, 904, 912, 5, 227,
+ 114, 2, 905, 908, 5, 179, 90, 2, 906, 909, 5, 25, 13, 2, 907, 909, 5, 27,
+ 14, 2, 908, 906, 3, 2, 2, 2, 908, 907, 3, 2, 2, 2, 908, 909, 3, 2, 2, 2,
+ 909, 910, 3, 2, 2, 2, 910, 911, 5, 227, 114, 2, 911, 913, 3, 2, 2, 2, 912,
+ 905, 3, 2, 2, 2, 912, 913, 3, 2, 2, 2, 913, 232, 3, 2, 2, 2, 914, 915,
+ 7, 50, 2, 2, 915, 916, 7, 122, 2, 2, 916, 918, 3, 2, 2, 2, 917, 919, 5,
+ 229, 115, 2, 918, 917, 3, 2, 2, 2, 919, 920, 3, 2, 2, 2, 920, 918, 3, 2,
+ 2, 2, 920, 921, 3, 2, 2, 2, 921, 932, 3, 2, 2, 2, 922, 923, 7, 90, 2, 2,
+ 923, 925, 5, 73, 37, 2, 924, 926, 5, 229, 115, 2, 925, 924, 3, 2, 2, 2,
+ 926, 927, 3, 2, 2, 2, 927, 925, 3, 2, 2, 2, 927, 928, 3, 2, 2, 2, 928,
+ 929, 3, 2, 2, 2, 929, 930, 5, 73, 37, 2, 930, 932, 3, 2, 2, 2, 931, 914,
+ 3, 2, 2, 2, 931, 922, 3, 2, 2, 2, 932, 234, 3, 2, 2, 2, 933, 934, 7, 50,
+ 2, 2, 934, 935, 7, 100, 2, 2, 935, 937, 3, 2, 2, 2, 936, 938, 4, 50, 51,
+ 2, 937, 936, 3, 2, 2, 2, 938, 939, 3, 2, 2, 2, 939, 937, 3, 2, 2, 2, 939,
+ 940, 3, 2, 2, 2, 940, 951, 3, 2, 2, 2, 941, 942, 5, 173, 87, 2, 942, 944,
+ 5, 73, 37, 2, 943, 945, 4, 50, 51, 2, 944, 943, 3, 2, 2, 2, 945, 946, 3,
+ 2, 2, 2, 946, 944, 3, 2, 2, 2, 946, 947, 3, 2, 2, 2, 947, 948, 3, 2, 2,
+ 2, 948, 949, 5, 73, 37, 2, 949, 951, 3, 2, 2, 2, 950, 933, 3, 2, 2, 2,
+ 950, 941, 3, 2, 2, 2, 951, 236, 3, 2, 2, 2, 26, 2, 291, 340, 839, 845,
+ 850, 857, 861, 869, 871, 882, 884, 889, 894, 899, 902, 908, 912, 920, 927,
+ 931, 939, 946, 950, 3, 8, 2, 2,
+}
+
+var lexerDeserializer = antlr.NewATNDeserializer(nil)
+var lexerAtn = lexerDeserializer.DeserializeFromUInt16(serializedLexerAtn)
+
+var lexerChannelNames = []string{
+ "DEFAULT_TOKEN_CHANNEL", "HIDDEN",
+}
+
+var lexerModeNames = []string{
+ "DEFAULT_MODE",
+}
+
+var lexerLiteralNames = []string{
+ "", "'&&'", "'||'", "'!'", "'~'", "'|'", "'&'", "'<<'", "'>>'", "'^'",
+ "'%'", "':'", "'+'", "'-'", "'*'", "'/'", "'\\'", "'.'", "'.*'", "'<=>'",
+ "'=='", "'='", "", "'>'", "'>='", "'<'", "'<='", "'#'", "'('", "')'", "'{'",
+ "'}'", "'['", "']'", "','", "'\"'", "'''", "'`'", "'?'", "'@'", "';'",
+ "'->>'", "'_'", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "", "", "", "'DO NOT MATCH ANY THING, JUST FOR GENERATOR'",
+}
+
+var lexerSymbolicNames = []string{
+ "", "AND_", "OR_", "NOT_", "TILDE_", "VERTICALBAR_", "AMPERSAND_", "SIGNEDLEFTSHIFT_",
+ "SIGNEDRIGHTSHIFT_", "CARET_", "MOD_", "COLON_", "PLUS_", "MINUS_", "ASTERISK_",
+ "SLASH_", "BACKSLASH_", "DOT_", "DOTASTERISK_", "SAFEEQ_", "DEQ_", "EQ_",
+ "NEQ_", "GT_", "GTE_", "LT_", "LTE_", "POUND_", "LP_", "RP_", "LBE_", "RBE_",
+ "LBT_", "RBT_", "COMMA_", "DQ_", "SQ_", "BQ_", "QUESTION_", "AT_", "SEMI_",
+ "JSONSEPARATOR_", "UL_", "WS", "CREATE", "ALTER", "DROP", "SHOW", "RESOURCE",
+ "RULE", "FROM", "ENCRYPT", "TYPE", "ENCRYPT_ALGORITHM", "ASSISTED_QUERY_ALGORITHM",
+ "LIKE_QUERY_ALGORITHM", "NAME", "PROPERTIES", "COLUMN", "RULES", "TABLE",
+ "COLUMNS", "CIPHER", "PLAIN", "ASSISTED_QUERY_COLUMN", "LIKE_QUERY_COLUMN",
+ "QUERY_WITH_CIPHER_COLUMN", "TRUE", "FALSE", "DATA_TYPE", "PLAIN_DATA_TYPE",
+ "CIPHER_DATA_TYPE", "ASSISTED_QUERY_DATA_TYPE", "LIKE_QUERY_DATA_TYPE",
+ "IF", "EXISTS", "COUNT", "MD5", "AES", "RC4", "SM3", "SM4", "CHAR_DIGEST_LIKE",
+ "NOT", "FOR_GENERATOR", "IDENTIFIER_", "STRING_", "INT_", "HEX_", "NUMBER_",
+ "HEXDIGIT_", "BITNUM_",
+}
+
+var lexerRuleNames = []string{
+ "AND_", "OR_", "NOT_", "TILDE_", "VERTICALBAR_", "AMPERSAND_", "SIGNEDLEFTSHIFT_",
+ "SIGNEDRIGHTSHIFT_", "CARET_", "MOD_", "COLON_", "PLUS_", "MINUS_", "ASTERISK_",
+ "SLASH_", "BACKSLASH_", "DOT_", "DOTASTERISK_", "SAFEEQ_", "DEQ_", "EQ_",
+ "NEQ_", "GT_", "GTE_", "LT_", "LTE_", "POUND_", "LP_", "RP_", "LBE_", "RBE_",
+ "LBT_", "RBT_", "COMMA_", "DQ_", "SQ_", "BQ_", "QUESTION_", "AT_", "SEMI_",
+ "JSONSEPARATOR_", "UL_", "WS", "CREATE", "ALTER", "DROP", "SHOW", "RESOURCE",
+ "RULE", "FROM", "ENCRYPT", "TYPE", "ENCRYPT_ALGORITHM", "ASSISTED_QUERY_ALGORITHM",
+ "LIKE_QUERY_ALGORITHM", "NAME", "PROPERTIES", "COLUMN", "RULES", "TABLE",
+ "COLUMNS", "CIPHER", "PLAIN", "ASSISTED_QUERY_COLUMN", "LIKE_QUERY_COLUMN",
+ "QUERY_WITH_CIPHER_COLUMN", "TRUE", "FALSE", "DATA_TYPE", "PLAIN_DATA_TYPE",
+ "CIPHER_DATA_TYPE", "ASSISTED_QUERY_DATA_TYPE", "LIKE_QUERY_DATA_TYPE",
+ "IF", "EXISTS", "COUNT", "MD5", "AES", "RC4", "SM3", "SM4", "CHAR_DIGEST_LIKE",
+ "NOT", "FOR_GENERATOR", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J",
+ "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y",
+ "Z", "IDENTIFIER_", "STRING_", "INT_", "HEX_", "NUMBER_", "HEXDIGIT_",
+ "BITNUM_",
+}
+
+type RDLStatementLexer struct {
+ *antlr.BaseLexer
+ channelNames []string
+ modeNames []string
+ // TODO: EOF string
+}
+
+var lexerDecisionToDFA = make([]*antlr.DFA, len(lexerAtn.DecisionToState))
+
+func init() {
+ for index, ds := range lexerAtn.DecisionToState {
+ lexerDecisionToDFA[index] = antlr.NewDFA(ds, index)
+ }
+}
+
+func NewRDLStatementLexer(input antlr.CharStream) *RDLStatementLexer {
+
+ l := new(RDLStatementLexer)
+
+ l.BaseLexer = antlr.NewBaseLexer(input)
+ l.Interpreter = antlr.NewLexerATNSimulator(l, lexerAtn, lexerDecisionToDFA, antlr.NewPredictionContextCache())
+
+ l.channelNames = lexerChannelNames
+ l.modeNames = lexerModeNames
+ l.RuleNames = lexerRuleNames
+ l.LiteralNames = lexerLiteralNames
+ l.SymbolicNames = lexerSymbolicNames
+ l.GrammarFileName = "RDLStatement.g4"
+ // TODO: l.EOF = antlr.TokenEOF
+
+ return l
+}
+
+// RDLStatementLexer tokens.
+const (
+ RDLStatementLexerAND_ = 1
+ RDLStatementLexerOR_ = 2
+ RDLStatementLexerNOT_ = 3
+ RDLStatementLexerTILDE_ = 4
+ RDLStatementLexerVERTICALBAR_ = 5
+ RDLStatementLexerAMPERSAND_ = 6
+ RDLStatementLexerSIGNEDLEFTSHIFT_ = 7
+ RDLStatementLexerSIGNEDRIGHTSHIFT_ = 8
+ RDLStatementLexerCARET_ = 9
+ RDLStatementLexerMOD_ = 10
+ RDLStatementLexerCOLON_ = 11
+ RDLStatementLexerPLUS_ = 12
+ RDLStatementLexerMINUS_ = 13
+ RDLStatementLexerASTERISK_ = 14
+ RDLStatementLexerSLASH_ = 15
+ RDLStatementLexerBACKSLASH_ = 16
+ RDLStatementLexerDOT_ = 17
+ RDLStatementLexerDOTASTERISK_ = 18
+ RDLStatementLexerSAFEEQ_ = 19
+ RDLStatementLexerDEQ_ = 20
+ RDLStatementLexerEQ_ = 21
+ RDLStatementLexerNEQ_ = 22
+ RDLStatementLexerGT_ = 23
+ RDLStatementLexerGTE_ = 24
+ RDLStatementLexerLT_ = 25
+ RDLStatementLexerLTE_ = 26
+ RDLStatementLexerPOUND_ = 27
+ RDLStatementLexerLP_ = 28
+ RDLStatementLexerRP_ = 29
+ RDLStatementLexerLBE_ = 30
+ RDLStatementLexerRBE_ = 31
+ RDLStatementLexerLBT_ = 32
+ RDLStatementLexerRBT_ = 33
+ RDLStatementLexerCOMMA_ = 34
+ RDLStatementLexerDQ_ = 35
+ RDLStatementLexerSQ_ = 36
+ RDLStatementLexerBQ_ = 37
+ RDLStatementLexerQUESTION_ = 38
+ RDLStatementLexerAT_ = 39
+ RDLStatementLexerSEMI_ = 40
+ RDLStatementLexerJSONSEPARATOR_ = 41
+ RDLStatementLexerUL_ = 42
+ RDLStatementLexerWS = 43
+ RDLStatementLexerCREATE = 44
+ RDLStatementLexerALTER = 45
+ RDLStatementLexerDROP = 46
+ RDLStatementLexerSHOW = 47
+ RDLStatementLexerRESOURCE = 48
+ RDLStatementLexerRULE = 49
+ RDLStatementLexerFROM = 50
+ RDLStatementLexerENCRYPT = 51
+ RDLStatementLexerTYPE = 52
+ RDLStatementLexerENCRYPT_ALGORITHM = 53
+ RDLStatementLexerASSISTED_QUERY_ALGORITHM = 54
+ RDLStatementLexerLIKE_QUERY_ALGORITHM = 55
+ RDLStatementLexerNAME = 56
+ RDLStatementLexerPROPERTIES = 57
+ RDLStatementLexerCOLUMN = 58
+ RDLStatementLexerRULES = 59
+ RDLStatementLexerTABLE = 60
+ RDLStatementLexerCOLUMNS = 61
+ RDLStatementLexerCIPHER = 62
+ RDLStatementLexerPLAIN = 63
+ RDLStatementLexerASSISTED_QUERY_COLUMN = 64
+ RDLStatementLexerLIKE_QUERY_COLUMN = 65
+ RDLStatementLexerQUERY_WITH_CIPHER_COLUMN = 66
+ RDLStatementLexerTRUE = 67
+ RDLStatementLexerFALSE = 68
+ RDLStatementLexerDATA_TYPE = 69
+ RDLStatementLexerPLAIN_DATA_TYPE = 70
+ RDLStatementLexerCIPHER_DATA_TYPE = 71
+ RDLStatementLexerASSISTED_QUERY_DATA_TYPE = 72
+ RDLStatementLexerLIKE_QUERY_DATA_TYPE = 73
+ RDLStatementLexerIF = 74
+ RDLStatementLexerEXISTS = 75
+ RDLStatementLexerCOUNT = 76
+ RDLStatementLexerMD5 = 77
+ RDLStatementLexerAES = 78
+ RDLStatementLexerRC4 = 79
+ RDLStatementLexerSM3 = 80
+ RDLStatementLexerSM4 = 81
+ RDLStatementLexerCHAR_DIGEST_LIKE = 82
+ RDLStatementLexerNOT = 83
+ RDLStatementLexerFOR_GENERATOR = 84
+ RDLStatementLexerIDENTIFIER_ = 85
+ RDLStatementLexerSTRING_ = 86
+ RDLStatementLexerINT_ = 87
+ RDLStatementLexerHEX_ = 88
+ RDLStatementLexerNUMBER_ = 89
+ RDLStatementLexerHEXDIGIT_ = 90
+ RDLStatementLexerBITNUM_ = 91
+)
diff --git a/shardingsphere-operator/pkg/distsql/visitor_parser/encrypt/rdlstatement_parser.go b/shardingsphere-operator/pkg/distsql/visitor_parser/encrypt/rdlstatement_parser.go
new file mode 100644
index 0000000..ed6697b
--- /dev/null
+++ b/shardingsphere-operator/pkg/distsql/visitor_parser/encrypt/rdlstatement_parser.go
@@ -0,0 +1,4651 @@
+// Code generated from encrypt_g4/RDLStatement.g4 by ANTLR 4.8. DO NOT EDIT.
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package parser // RDLStatement
+
+import (
+ "fmt"
+ "reflect"
+ "strconv"
+
+ "github.com/antlr/antlr4/runtime/Go/antlr"
+)
+
+// Suppress unused import errors
+var _ = fmt.Printf
+var _ = reflect.Copy
+var _ = strconv.Itoa
+
+var parserATN = []uint16{
+ 3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 3, 93, 300,
+ 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7, 9, 7,
+ 4, 8, 9, 8, 4, 9, 9, 9, 4, 10, 9, 10, 4, 11, 9, 11, 4, 12, 9, 12, 4, 13,
+ 9, 13, 4, 14, 9, 14, 4, 15, 9, 15, 4, 16, 9, 16, 4, 17, 9, 17, 4, 18, 9,
+ 18, 4, 19, 9, 19, 4, 20, 9, 20, 4, 21, 9, 21, 4, 22, 9, 22, 4, 23, 9, 23,
+ 4, 24, 9, 24, 4, 25, 9, 25, 4, 26, 9, 26, 4, 27, 9, 27, 4, 28, 9, 28, 4,
+ 29, 9, 29, 4, 30, 9, 30, 4, 31, 9, 31, 4, 32, 9, 32, 4, 33, 9, 33, 3, 2,
+ 3, 2, 3, 2, 3, 2, 5, 2, 71, 10, 2, 3, 2, 3, 2, 3, 2, 7, 2, 76, 10, 2, 12,
+ 2, 14, 2, 79, 11, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 7, 3, 87, 10,
+ 3, 12, 3, 14, 3, 90, 11, 3, 3, 4, 3, 4, 3, 4, 3, 4, 5, 4, 96, 10, 4, 3,
+ 4, 3, 4, 3, 4, 7, 4, 101, 10, 4, 12, 4, 14, 4, 104, 11, 4, 3, 5, 3, 5,
+ 3, 5, 3, 5, 3, 5, 5, 5, 111, 10, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 7, 5,
+ 118, 10, 5, 12, 5, 14, 5, 121, 11, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 5,
+ 5, 128, 10, 5, 3, 5, 3, 5, 3, 6, 3, 6, 3, 6, 3, 6, 3, 7, 3, 7, 3, 8, 3,
+ 8, 3, 8, 3, 8, 5, 8, 142, 10, 8, 3, 8, 3, 8, 3, 8, 3, 8, 5, 8, 148, 10,
+ 8, 3, 8, 3, 8, 5, 8, 152, 10, 8, 3, 8, 3, 8, 3, 8, 3, 8, 5, 8, 158, 10,
+ 8, 3, 8, 3, 8, 5, 8, 162, 10, 8, 3, 8, 3, 8, 3, 8, 3, 8, 5, 8, 168, 10,
+ 8, 3, 8, 3, 8, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 5, 9, 179, 10,
+ 9, 3, 10, 3, 10, 3, 11, 3, 11, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12,
+ 3, 12, 5, 12, 192, 10, 12, 3, 13, 3, 13, 3, 14, 3, 14, 3, 14, 3, 14, 3,
+ 14, 3, 14, 3, 14, 5, 14, 203, 10, 14, 3, 15, 3, 15, 3, 16, 3, 16, 3, 16,
+ 3, 16, 3, 16, 3, 16, 3, 16, 5, 16, 214, 10, 16, 3, 17, 3, 17, 3, 18, 3,
+ 18, 3, 18, 3, 18, 3, 18, 3, 18, 3, 18, 5, 18, 225, 10, 18, 3, 19, 3, 19,
+ 3, 20, 3, 20, 3, 20, 3, 20, 3, 20, 3, 21, 3, 21, 3, 21, 3, 21, 3, 21, 3,
+ 22, 3, 22, 3, 22, 3, 22, 3, 22, 3, 23, 3, 23, 3, 24, 3, 24, 3, 24, 3, 25,
+ 3, 25, 3, 25, 3, 25, 3, 26, 3, 26, 5, 26, 255, 10, 26, 3, 26, 3, 26, 3,
+ 26, 5, 26, 260, 10, 26, 3, 27, 3, 27, 3, 27, 3, 27, 3, 27, 3, 27, 3, 27,
+ 5, 27, 269, 10, 27, 3, 27, 3, 27, 3, 28, 3, 28, 5, 28, 275, 10, 28, 3,
+ 29, 3, 29, 3, 30, 3, 30, 3, 30, 5, 30, 282, 10, 30, 3, 30, 3, 30, 3, 31,
+ 3, 31, 3, 31, 7, 31, 289, 10, 31, 12, 31, 14, 31, 292, 11, 31, 3, 32, 3,
+ 32, 3, 32, 3, 32, 3, 33, 3, 33, 3, 33, 2, 2, 34, 2, 4, 6, 8, 10, 12, 14,
+ 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50,
+ 52, 54, 56, 58, 60, 62, 64, 2, 4, 3, 2, 69, 70, 3, 2, 79, 84, 2, 294, 2,
+ 66, 3, 2, 2, 2, 4, 80, 3, 2, 2, 2, 6, 91, 3, 2, 2, 2, 8, 105, 3, 2, 2,
+ 2, 10, 131, 3, 2, 2, 2, 12, 135, 3, 2, 2, 2, 14, 137, 3, 2, 2, 2, 16, 171,
+ 3, 2, 2, 2, 18, 180, 3, 2, 2, 2, 20, 182, 3, 2, 2, 2, 22, 184, 3, 2, 2,
+ 2, 24, 193, 3, 2, 2, 2, 26, 195, 3, 2, 2, 2, 28, 204, 3, 2, 2, 2, 30, 206,
+ 3, 2, 2, 2, 32, 215, 3, 2, 2, 2, 34, 217, 3, 2, 2, 2, 36, 226, 3, 2, 2,
+ 2, 38, 228, 3, 2, 2, 2, 40, 233, 3, 2, 2, 2, 42, 238, 3, 2, 2, 2, 44, 243,
+ 3, 2, 2, 2, 46, 245, 3, 2, 2, 2, 48, 248, 3, 2, 2, 2, 50, 259, 3, 2, 2,
+ 2, 52, 261, 3, 2, 2, 2, 54, 274, 3, 2, 2, 2, 56, 276, 3, 2, 2, 2, 58, 278,
+ 3, 2, 2, 2, 60, 285, 3, 2, 2, 2, 62, 293, 3, 2, 2, 2, 64, 297, 3, 2, 2,
+ 2, 66, 67, 7, 46, 2, 2, 67, 68, 7, 53, 2, 2, 68, 70, 7, 51, 2, 2, 69, 71,
+ 5, 48, 25, 2, 70, 69, 3, 2, 2, 2, 70, 71, 3, 2, 2, 2, 71, 72, 3, 2, 2,
+ 2, 72, 77, 5, 8, 5, 2, 73, 74, 7, 36, 2, 2, 74, 76, 5, 8, 5, 2, 75, 73,
+ 3, 2, 2, 2, 76, 79, 3, 2, 2, 2, 77, 75, 3, 2, 2, 2, 77, 78, 3, 2, 2, 2,
+ 78, 3, 3, 2, 2, 2, 79, 77, 3, 2, 2, 2, 80, 81, 7, 47, 2, 2, 81, 82, 7,
+ 53, 2, 2, 82, 83, 7, 51, 2, 2, 83, 88, 5, 8, 5, 2, 84, 85, 7, 36, 2, 2,
+ 85, 87, 5, 8, 5, 2, 86, 84, 3, 2, 2, 2, 87, 90, 3, 2, 2, 2, 88, 86, 3,
+ 2, 2, 2, 88, 89, 3, 2, 2, 2, 89, 5, 3, 2, 2, 2, 90, 88, 3, 2, 2, 2, 91,
+ 92, 7, 48, 2, 2, 92, 93, 7, 53, 2, 2, 93, 95, 7, 51, 2, 2, 94, 96, 5, 46,
+ 24, 2, 95, 94, 3, 2, 2, 2, 95, 96, 3, 2, 2, 2, 96, 97, 3, 2, 2, 2, 97,
+ 102, 5, 64, 33, 2, 98, 99, 7, 36, 2, 2, 99, 101, 5, 64, 33, 2, 100, 98,
+ 3, 2, 2, 2, 101, 104, 3, 2, 2, 2, 102, 100, 3, 2, 2, 2, 102, 103, 3, 2,
+ 2, 2, 103, 7, 3, 2, 2, 2, 104, 102, 3, 2, 2, 2, 105, 106, 5, 64, 33, 2,
+ 106, 110, 7, 30, 2, 2, 107, 108, 5, 10, 6, 2, 108, 109, 7, 36, 2, 2, 109,
+ 111, 3, 2, 2, 2, 110, 107, 3, 2, 2, 2, 110, 111, 3, 2, 2, 2, 111, 112,
+ 3, 2, 2, 2, 112, 113, 7, 63, 2, 2, 113, 114, 7, 30, 2, 2, 114, 119, 5,
+ 14, 8, 2, 115, 116, 7, 36, 2, 2, 116, 118, 5, 14, 8, 2, 117, 115, 3, 2,
+ 2, 2, 118, 121, 3, 2, 2, 2, 119, 117, 3, 2, 2, 2, 119, 120, 3, 2, 2, 2,
+ 120, 122, 3, 2, 2, 2, 121, 119, 3, 2, 2, 2, 122, 127, 7, 31, 2, 2, 123,
+ 124, 7, 36, 2, 2, 124, 125, 7, 68, 2, 2, 125, 126, 7, 23, 2, 2, 126, 128,
+ 5, 44, 23, 2, 127, 123, 3, 2, 2, 2, 127, 128, 3, 2, 2, 2, 128, 129, 3,
+ 2, 2, 2, 129, 130, 7, 31, 2, 2, 130, 9, 3, 2, 2, 2, 131, 132, 7, 50, 2,
+ 2, 132, 133, 7, 23, 2, 2, 133, 134, 5, 12, 7, 2, 134, 11, 3, 2, 2, 2, 135,
+ 136, 7, 87, 2, 2, 136, 13, 3, 2, 2, 2, 137, 138, 7, 30, 2, 2, 138, 141,
+ 5, 16, 9, 2, 139, 140, 7, 36, 2, 2, 140, 142, 5, 22, 12, 2, 141, 139, 3,
+ 2, 2, 2, 141, 142, 3, 2, 2, 2, 142, 143, 3, 2, 2, 2, 143, 144, 7, 36, 2,
+ 2, 144, 147, 5, 26, 14, 2, 145, 146, 7, 36, 2, 2, 146, 148, 5, 30, 16,
+ 2, 147, 145, 3, 2, 2, 2, 147, 148, 3, 2, 2, 2, 148, 151, 3, 2, 2, 2, 149,
+ 150, 7, 36, 2, 2, 150, 152, 5, 34, 18, 2, 151, 149, 3, 2, 2, 2, 151, 152,
+ 3, 2, 2, 2, 152, 153, 3, 2, 2, 2, 153, 154, 7, 36, 2, 2, 154, 157, 5, 38,
+ 20, 2, 155, 156, 7, 36, 2, 2, 156, 158, 5, 40, 21, 2, 157, 155, 3, 2, 2,
+ 2, 157, 158, 3, 2, 2, 2, 158, 161, 3, 2, 2, 2, 159, 160, 7, 36, 2, 2, 160,
+ 162, 5, 42, 22, 2, 161, 159, 3, 2, 2, 2, 161, 162, 3, 2, 2, 2, 162, 167,
+ 3, 2, 2, 2, 163, 164, 7, 36, 2, 2, 164, 165, 7, 68, 2, 2, 165, 166, 7,
+ 23, 2, 2, 166, 168, 5, 44, 23, 2, 167, 163, 3, 2, 2, 2, 167, 168, 3, 2,
+ 2, 2, 168, 169, 3, 2, 2, 2, 169, 170, 7, 31, 2, 2, 170, 15, 3, 2, 2, 2,
+ 171, 172, 7, 58, 2, 2, 172, 173, 7, 23, 2, 2, 173, 178, 5, 18, 10, 2, 174,
+ 175, 7, 36, 2, 2, 175, 176, 7, 71, 2, 2, 176, 177, 7, 23, 2, 2, 177, 179,
+ 5, 20, 11, 2, 178, 174, 3, 2, 2, 2, 178, 179, 3, 2, 2, 2, 179, 17, 3, 2,
+ 2, 2, 180, 181, 7, 87, 2, 2, 181, 19, 3, 2, 2, 2, 182, 183, 7, 88, 2, 2,
+ 183, 21, 3, 2, 2, 2, 184, 185, 7, 65, 2, 2, 185, 186, 7, 23, 2, 2, 186,
+ 191, 5, 24, 13, 2, 187, 188, 7, 36, 2, 2, 188, 189, 7, 72, 2, 2, 189, 190,
+ 7, 23, 2, 2, 190, 192, 5, 20, 11, 2, 191, 187, 3, 2, 2, 2, 191, 192, 3,
+ 2, 2, 2, 192, 23, 3, 2, 2, 2, 193, 194, 7, 87, 2, 2, 194, 25, 3, 2, 2,
+ 2, 195, 196, 7, 64, 2, 2, 196, 197, 7, 23, 2, 2, 197, 202, 5, 28, 15, 2,
+ 198, 199, 7, 36, 2, 2, 199, 200, 7, 73, 2, 2, 200, 201, 7, 23, 2, 2, 201,
+ 203, 5, 20, 11, 2, 202, 198, 3, 2, 2, 2, 202, 203, 3, 2, 2, 2, 203, 27,
+ 3, 2, 2, 2, 204, 205, 7, 87, 2, 2, 205, 29, 3, 2, 2, 2, 206, 207, 7, 66,
+ 2, 2, 207, 208, 7, 23, 2, 2, 208, 213, 5, 32, 17, 2, 209, 210, 7, 36, 2,
+ 2, 210, 211, 7, 74, 2, 2, 211, 212, 7, 23, 2, 2, 212, 214, 5, 20, 11, 2,
+ 213, 209, 3, 2, 2, 2, 213, 214, 3, 2, 2, 2, 214, 31, 3, 2, 2, 2, 215, 216,
+ 7, 87, 2, 2, 216, 33, 3, 2, 2, 2, 217, 218, 7, 67, 2, 2, 218, 219, 7, 23,
+ 2, 2, 219, 224, 5, 36, 19, 2, 220, 221, 7, 36, 2, 2, 221, 222, 7, 75, 2,
+ 2, 222, 223, 7, 23, 2, 2, 223, 225, 5, 20, 11, 2, 224, 220, 3, 2, 2, 2,
+ 224, 225, 3, 2, 2, 2, 225, 35, 3, 2, 2, 2, 226, 227, 7, 87, 2, 2, 227,
+ 37, 3, 2, 2, 2, 228, 229, 7, 55, 2, 2, 229, 230, 7, 30, 2, 2, 230, 231,
+ 5, 52, 27, 2, 231, 232, 7, 31, 2, 2, 232, 39, 3, 2, 2, 2, 233, 234, 7,
+ 56, 2, 2, 234, 235, 7, 30, 2, 2, 235, 236, 5, 52, 27, 2, 236, 237, 7, 31,
+ 2, 2, 237, 41, 3, 2, 2, 2, 238, 239, 7, 57, 2, 2, 239, 240, 7, 30, 2, 2,
+ 240, 241, 5, 52, 27, 2, 241, 242, 7, 31, 2, 2, 242, 43, 3, 2, 2, 2, 243,
+ 244, 9, 2, 2, 2, 244, 45, 3, 2, 2, 2, 245, 246, 7, 76, 2, 2, 246, 247,
+ 7, 77, 2, 2, 247, 47, 3, 2, 2, 2, 248, 249, 7, 76, 2, 2, 249, 250, 7, 85,
+ 2, 2, 250, 251, 7, 77, 2, 2, 251, 49, 3, 2, 2, 2, 252, 260, 7, 88, 2, 2,
+ 253, 255, 7, 15, 2, 2, 254, 253, 3, 2, 2, 2, 254, 255, 3, 2, 2, 2, 255,
+ 256, 3, 2, 2, 2, 256, 260, 7, 89, 2, 2, 257, 260, 7, 69, 2, 2, 258, 260,
+ 7, 70, 2, 2, 259, 252, 3, 2, 2, 2, 259, 254, 3, 2, 2, 2, 259, 257, 3, 2,
+ 2, 2, 259, 258, 3, 2, 2, 2, 260, 51, 3, 2, 2, 2, 261, 262, 7, 54, 2, 2,
+ 262, 263, 7, 30, 2, 2, 263, 264, 7, 58, 2, 2, 264, 265, 7, 23, 2, 2, 265,
+ 268, 5, 54, 28, 2, 266, 267, 7, 36, 2, 2, 267, 269, 5, 58, 30, 2, 268,
+ 266, 3, 2, 2, 2, 268, 269, 3, 2, 2, 2, 269, 270, 3, 2, 2, 2, 270, 271,
+ 7, 31, 2, 2, 271, 53, 3, 2, 2, 2, 272, 275, 5, 56, 29, 2, 273, 275, 7,
+ 88, 2, 2, 274, 272, 3, 2, 2, 2, 274, 273, 3, 2, 2, 2, 275, 55, 3, 2, 2,
+ 2, 276, 277, 9, 3, 2, 2, 277, 57, 3, 2, 2, 2, 278, 279, 7, 59, 2, 2, 279,
+ 281, 7, 30, 2, 2, 280, 282, 5, 60, 31, 2, 281, 280, 3, 2, 2, 2, 281, 282,
+ 3, 2, 2, 2, 282, 283, 3, 2, 2, 2, 283, 284, 7, 31, 2, 2, 284, 59, 3, 2,
+ 2, 2, 285, 290, 5, 62, 32, 2, 286, 287, 7, 36, 2, 2, 287, 289, 5, 62, 32,
+ 2, 288, 286, 3, 2, 2, 2, 289, 292, 3, 2, 2, 2, 290, 288, 3, 2, 2, 2, 290,
+ 291, 3, 2, 2, 2, 291, 61, 3, 2, 2, 2, 292, 290, 3, 2, 2, 2, 293, 294, 7,
+ 88, 2, 2, 294, 295, 7, 23, 2, 2, 295, 296, 5, 50, 26, 2, 296, 63, 3, 2,
+ 2, 2, 297, 298, 7, 87, 2, 2, 298, 65, 3, 2, 2, 2, 27, 70, 77, 88, 95, 102,
+ 110, 119, 127, 141, 147, 151, 157, 161, 167, 178, 191, 202, 213, 224, 254,
+ 259, 268, 274, 281, 290,
+}
+var deserializer = antlr.NewATNDeserializer(nil)
+var deserializedATN = deserializer.DeserializeFromUInt16(parserATN)
+
+var literalNames = []string{
+ "", "'&&'", "'||'", "'!'", "'~'", "'|'", "'&'", "'<<'", "'>>'", "'^'",
+ "'%'", "':'", "'+'", "'-'", "'*'", "'/'", "'\\'", "'.'", "'.*'", "'<=>'",
+ "'=='", "'='", "", "'>'", "'>='", "'<'", "'<='", "'#'", "'('", "')'", "'{'",
+ "'}'", "'['", "']'", "','", "'\"'", "'''", "'`'", "'?'", "'@'", "';'",
+ "'->>'", "'_'", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "", "", "", "'DO NOT MATCH ANY THING, JUST FOR GENERATOR'",
+}
+var symbolicNames = []string{
+ "", "AND_", "OR_", "NOT_", "TILDE_", "VERTICALBAR_", "AMPERSAND_", "SIGNEDLEFTSHIFT_",
+ "SIGNEDRIGHTSHIFT_", "CARET_", "MOD_", "COLON_", "PLUS_", "MINUS_", "ASTERISK_",
+ "SLASH_", "BACKSLASH_", "DOT_", "DOTASTERISK_", "SAFEEQ_", "DEQ_", "EQ_",
+ "NEQ_", "GT_", "GTE_", "LT_", "LTE_", "POUND_", "LP_", "RP_", "LBE_", "RBE_",
+ "LBT_", "RBT_", "COMMA_", "DQ_", "SQ_", "BQ_", "QUESTION_", "AT_", "SEMI_",
+ "JSONSEPARATOR_", "UL_", "WS", "CREATE", "ALTER", "DROP", "SHOW", "RESOURCE",
+ "RULE", "FROM", "ENCRYPT", "TYPE", "ENCRYPT_ALGORITHM", "ASSISTED_QUERY_ALGORITHM",
+ "LIKE_QUERY_ALGORITHM", "NAME", "PROPERTIES", "COLUMN", "RULES", "TABLE",
+ "COLUMNS", "CIPHER", "PLAIN", "ASSISTED_QUERY_COLUMN", "LIKE_QUERY_COLUMN",
+ "QUERY_WITH_CIPHER_COLUMN", "TRUE", "FALSE", "DATA_TYPE", "PLAIN_DATA_TYPE",
+ "CIPHER_DATA_TYPE", "ASSISTED_QUERY_DATA_TYPE", "LIKE_QUERY_DATA_TYPE",
+ "IF", "EXISTS", "COUNT", "MD5", "AES", "RC4", "SM3", "SM4", "CHAR_DIGEST_LIKE",
+ "NOT", "FOR_GENERATOR", "IDENTIFIER_", "STRING_", "INT_", "HEX_", "NUMBER_",
+ "HEXDIGIT_", "BITNUM_",
+}
+
+var ruleNames = []string{
+ "createEncryptRule", "alterEncryptRule", "dropEncryptRule", "encryptRuleDefinition",
+ "resourceDefinition", "resourceName", "encryptColumnDefinition", "columnDefinition",
+ "columnName", "dataType", "plainColumnDefinition", "plainColumnName", "cipherColumnDefinition",
+ "cipherColumnName", "assistedQueryColumnDefinition", "assistedQueryColumnName",
+ "likeQueryColumnDefinition", "likeQueryColumnName", "encryptAlgorithm",
+ "assistedQueryAlgorithm", "likeQueryAlgorithm", "queryWithCipherColumn",
+ "ifExists", "ifNotExists", "literal", "algorithmDefinition", "algorithmTypeName",
+ "buildinAlgorithmTypeName", "propertiesDefinition", "properties", "property",
+ "tableName",
+}
+var decisionToDFA = make([]*antlr.DFA, len(deserializedATN.DecisionToState))
+
+func init() {
+ for index, ds := range deserializedATN.DecisionToState {
+ decisionToDFA[index] = antlr.NewDFA(ds, index)
+ }
+}
+
+type RDLStatementParser struct {
+ *antlr.BaseParser
+}
+
+func NewRDLStatementParser(input antlr.TokenStream) *RDLStatementParser {
+ this := new(RDLStatementParser)
+
+ this.BaseParser = antlr.NewBaseParser(input)
+
+ this.Interpreter = antlr.NewParserATNSimulator(this, deserializedATN, decisionToDFA, antlr.NewPredictionContextCache())
+ this.RuleNames = ruleNames
+ this.LiteralNames = literalNames
+ this.SymbolicNames = symbolicNames
+ this.GrammarFileName = "RDLStatement.g4"
+
+ return this
+}
+
+// RDLStatementParser tokens.
+const (
+ RDLStatementParserEOF = antlr.TokenEOF
+ RDLStatementParserAND_ = 1
+ RDLStatementParserOR_ = 2
+ RDLStatementParserNOT_ = 3
+ RDLStatementParserTILDE_ = 4
+ RDLStatementParserVERTICALBAR_ = 5
+ RDLStatementParserAMPERSAND_ = 6
+ RDLStatementParserSIGNEDLEFTSHIFT_ = 7
+ RDLStatementParserSIGNEDRIGHTSHIFT_ = 8
+ RDLStatementParserCARET_ = 9
+ RDLStatementParserMOD_ = 10
+ RDLStatementParserCOLON_ = 11
+ RDLStatementParserPLUS_ = 12
+ RDLStatementParserMINUS_ = 13
+ RDLStatementParserASTERISK_ = 14
+ RDLStatementParserSLASH_ = 15
+ RDLStatementParserBACKSLASH_ = 16
+ RDLStatementParserDOT_ = 17
+ RDLStatementParserDOTASTERISK_ = 18
+ RDLStatementParserSAFEEQ_ = 19
+ RDLStatementParserDEQ_ = 20
+ RDLStatementParserEQ_ = 21
+ RDLStatementParserNEQ_ = 22
+ RDLStatementParserGT_ = 23
+ RDLStatementParserGTE_ = 24
+ RDLStatementParserLT_ = 25
+ RDLStatementParserLTE_ = 26
+ RDLStatementParserPOUND_ = 27
+ RDLStatementParserLP_ = 28
+ RDLStatementParserRP_ = 29
+ RDLStatementParserLBE_ = 30
+ RDLStatementParserRBE_ = 31
+ RDLStatementParserLBT_ = 32
+ RDLStatementParserRBT_ = 33
+ RDLStatementParserCOMMA_ = 34
+ RDLStatementParserDQ_ = 35
+ RDLStatementParserSQ_ = 36
+ RDLStatementParserBQ_ = 37
+ RDLStatementParserQUESTION_ = 38
+ RDLStatementParserAT_ = 39
+ RDLStatementParserSEMI_ = 40
+ RDLStatementParserJSONSEPARATOR_ = 41
+ RDLStatementParserUL_ = 42
+ RDLStatementParserWS = 43
+ RDLStatementParserCREATE = 44
+ RDLStatementParserALTER = 45
+ RDLStatementParserDROP = 46
+ RDLStatementParserSHOW = 47
+ RDLStatementParserRESOURCE = 48
+ RDLStatementParserRULE = 49
+ RDLStatementParserFROM = 50
+ RDLStatementParserENCRYPT = 51
+ RDLStatementParserTYPE = 52
+ RDLStatementParserENCRYPT_ALGORITHM = 53
+ RDLStatementParserASSISTED_QUERY_ALGORITHM = 54
+ RDLStatementParserLIKE_QUERY_ALGORITHM = 55
+ RDLStatementParserNAME = 56
+ RDLStatementParserPROPERTIES = 57
+ RDLStatementParserCOLUMN = 58
+ RDLStatementParserRULES = 59
+ RDLStatementParserTABLE = 60
+ RDLStatementParserCOLUMNS = 61
+ RDLStatementParserCIPHER = 62
+ RDLStatementParserPLAIN = 63
+ RDLStatementParserASSISTED_QUERY_COLUMN = 64
+ RDLStatementParserLIKE_QUERY_COLUMN = 65
+ RDLStatementParserQUERY_WITH_CIPHER_COLUMN = 66
+ RDLStatementParserTRUE = 67
+ RDLStatementParserFALSE = 68
+ RDLStatementParserDATA_TYPE = 69
+ RDLStatementParserPLAIN_DATA_TYPE = 70
+ RDLStatementParserCIPHER_DATA_TYPE = 71
+ RDLStatementParserASSISTED_QUERY_DATA_TYPE = 72
+ RDLStatementParserLIKE_QUERY_DATA_TYPE = 73
+ RDLStatementParserIF = 74
+ RDLStatementParserEXISTS = 75
+ RDLStatementParserCOUNT = 76
+ RDLStatementParserMD5 = 77
+ RDLStatementParserAES = 78
+ RDLStatementParserRC4 = 79
+ RDLStatementParserSM3 = 80
+ RDLStatementParserSM4 = 81
+ RDLStatementParserCHAR_DIGEST_LIKE = 82
+ RDLStatementParserNOT = 83
+ RDLStatementParserFOR_GENERATOR = 84
+ RDLStatementParserIDENTIFIER_ = 85
+ RDLStatementParserSTRING_ = 86
+ RDLStatementParserINT_ = 87
+ RDLStatementParserHEX_ = 88
+ RDLStatementParserNUMBER_ = 89
+ RDLStatementParserHEXDIGIT_ = 90
+ RDLStatementParserBITNUM_ = 91
+)
+
+// RDLStatementParser rules.
+const (
+ RDLStatementParserRULE_createEncryptRule = 0
+ RDLStatementParserRULE_alterEncryptRule = 1
+ RDLStatementParserRULE_dropEncryptRule = 2
+ RDLStatementParserRULE_encryptRuleDefinition = 3
+ RDLStatementParserRULE_resourceDefinition = 4
+ RDLStatementParserRULE_resourceName = 5
+ RDLStatementParserRULE_encryptColumnDefinition = 6
+ RDLStatementParserRULE_columnDefinition = 7
+ RDLStatementParserRULE_columnName = 8
+ RDLStatementParserRULE_dataType = 9
+ RDLStatementParserRULE_plainColumnDefinition = 10
+ RDLStatementParserRULE_plainColumnName = 11
+ RDLStatementParserRULE_cipherColumnDefinition = 12
+ RDLStatementParserRULE_cipherColumnName = 13
+ RDLStatementParserRULE_assistedQueryColumnDefinition = 14
+ RDLStatementParserRULE_assistedQueryColumnName = 15
+ RDLStatementParserRULE_likeQueryColumnDefinition = 16
+ RDLStatementParserRULE_likeQueryColumnName = 17
+ RDLStatementParserRULE_encryptAlgorithm = 18
+ RDLStatementParserRULE_assistedQueryAlgorithm = 19
+ RDLStatementParserRULE_likeQueryAlgorithm = 20
+ RDLStatementParserRULE_queryWithCipherColumn = 21
+ RDLStatementParserRULE_ifExists = 22
+ RDLStatementParserRULE_ifNotExists = 23
+ RDLStatementParserRULE_literal = 24
+ RDLStatementParserRULE_algorithmDefinition = 25
+ RDLStatementParserRULE_algorithmTypeName = 26
+ RDLStatementParserRULE_buildinAlgorithmTypeName = 27
+ RDLStatementParserRULE_propertiesDefinition = 28
+ RDLStatementParserRULE_properties = 29
+ RDLStatementParserRULE_property = 30
+ RDLStatementParserRULE_tableName = 31
+)
+
+// ICreateEncryptRuleContext is an interface to support dynamic dispatch.
+type ICreateEncryptRuleContext interface {
+ antlr.ParserRuleContext
+
+ // GetParser returns the parser.
+ GetParser() antlr.Parser
+
+ // IsCreateEncryptRuleContext differentiates from other interfaces.
+ IsCreateEncryptRuleContext()
+}
+
+type CreateEncryptRuleContext struct {
+ *antlr.BaseParserRuleContext
+ parser antlr.Parser
+}
+
+func NewEmptyCreateEncryptRuleContext() *CreateEncryptRuleContext {
+ var p = new(CreateEncryptRuleContext)
+ p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
+ p.RuleIndex = RDLStatementParserRULE_createEncryptRule
+ return p
+}
+
+func (*CreateEncryptRuleContext) IsCreateEncryptRuleContext() {}
+
+func NewCreateEncryptRuleContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *CreateEncryptRuleContext {
+ var p = new(CreateEncryptRuleContext)
+
+ p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
+
+ p.parser = parser
+ p.RuleIndex = RDLStatementParserRULE_createEncryptRule
+
+ return p
+}
+
+func (s *CreateEncryptRuleContext) GetParser() antlr.Parser { return s.parser }
+
+func (s *CreateEncryptRuleContext) CREATE() antlr.TerminalNode {
+ return s.GetToken(RDLStatementParserCREATE, 0)
+}
+
+func (s *CreateEncryptRuleContext) ENCRYPT() antlr.TerminalNode {
+ return s.GetToken(RDLStatementParserENCRYPT, 0)
+}
+
+func (s *CreateEncryptRuleContext) RULE() antlr.TerminalNode {
+ return s.GetToken(RDLStatementParserRULE, 0)
+}
+
+func (s *CreateEncryptRuleContext) AllEncryptRuleDefinition() []IEncryptRuleDefinitionContext {
+ var ts = s.GetTypedRuleContexts(reflect.TypeOf((*IEncryptRuleDefinitionContext)(nil)).Elem())
+ var tst = make([]IEncryptRuleDefinitionContext, len(ts))
+
+ for i, t := range ts {
+ if t != nil {
+ tst[i] = t.(IEncryptRuleDefinitionContext)
+ }
+ }
+
+ return tst
+}
+
+func (s *CreateEncryptRuleContext) EncryptRuleDefinition(i int) IEncryptRuleDefinitionContext {
+ var t = s.GetTypedRuleContext(reflect.TypeOf((*IEncryptRuleDefinitionContext)(nil)).Elem(), i)
+
+ if t == nil {
+ return nil
+ }
+
+ return t.(IEncryptRuleDefinitionContext)
+}
+
+func (s *CreateEncryptRuleContext) IfNotExists() IIfNotExistsContext {
+ var t = s.GetTypedRuleContext(reflect.TypeOf((*IIfNotExistsContext)(nil)).Elem(), 0)
+
+ if t == nil {
+ return nil
+ }
+
+ return t.(IIfNotExistsContext)
+}
+
+func (s *CreateEncryptRuleContext) AllCOMMA_() []antlr.TerminalNode {
+ return s.GetTokens(RDLStatementParserCOMMA_)
+}
+
+func (s *CreateEncryptRuleContext) COMMA_(i int) antlr.TerminalNode {
+ return s.GetToken(RDLStatementParserCOMMA_, i)
+}
+
+func (s *CreateEncryptRuleContext) GetRuleContext() antlr.RuleContext {
+ return s
+}
+
+func (s *CreateEncryptRuleContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
+ return antlr.TreesStringTree(s, ruleNames, recog)
+}
+
+func (s *CreateEncryptRuleContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
+ switch t := visitor.(type) {
+ case RDLStatementVisitor:
+ return t.VisitCreateEncryptRule(s)
+
+ default:
+ return t.VisitChildren(s)
+ }
+}
+
+func (p *RDLStatementParser) CreateEncryptRule() (localctx ICreateEncryptRuleContext) {
+ localctx = NewCreateEncryptRuleContext(p, p.GetParserRuleContext(), p.GetState())
+ p.EnterRule(localctx, 0, RDLStatementParserRULE_createEncryptRule)
+ var _la int
+
+ defer func() {
+ p.ExitRule()
+ }()
+
+ defer func() {
+ if err := recover(); err != nil {
+ if v, ok := err.(antlr.RecognitionException); ok {
+ localctx.SetException(v)
+ p.GetErrorHandler().ReportError(p, v)
+ p.GetErrorHandler().Recover(p, v)
+ } else {
+ panic(err)
+ }
+ }
+ }()
+
+ p.EnterOuterAlt(localctx, 1)
+ {
+ p.SetState(64)
+ p.Match(RDLStatementParserCREATE)
+ }
+ {
+ p.SetState(65)
+ p.Match(RDLStatementParserENCRYPT)
+ }
+ {
+ p.SetState(66)
+ p.Match(RDLStatementParserRULE)
+ }
+ p.SetState(68)
+ p.GetErrorHandler().Sync(p)
+ _la = p.GetTokenStream().LA(1)
+
+ if _la == RDLStatementParserIF {
+ {
+ p.SetState(67)
+ p.IfNotExists()
+ }
+
+ }
+ {
+ p.SetState(70)
+ p.EncryptRuleDefinition()
+ }
+ p.SetState(75)
+ p.GetErrorHandler().Sync(p)
+ _la = p.GetTokenStream().LA(1)
+
+ for _la == RDLStatementParserCOMMA_ {
+ {
+ p.SetState(71)
+ p.Match(RDLStatementParserCOMMA_)
+ }
+ {
+ p.SetState(72)
+ p.EncryptRuleDefinition()
+ }
+
+ p.SetState(77)
+ p.GetErrorHandler().Sync(p)
+ _la = p.GetTokenStream().LA(1)
+ }
+
+ return localctx
+}
+
+// IAlterEncryptRuleContext is an interface to support dynamic dispatch.
+type IAlterEncryptRuleContext interface {
+ antlr.ParserRuleContext
+
+ // GetParser returns the parser.
+ GetParser() antlr.Parser
+
+ // IsAlterEncryptRuleContext differentiates from other interfaces.
+ IsAlterEncryptRuleContext()
+}
+
+type AlterEncryptRuleContext struct {
+ *antlr.BaseParserRuleContext
+ parser antlr.Parser
+}
+
+func NewEmptyAlterEncryptRuleContext() *AlterEncryptRuleContext {
+ var p = new(AlterEncryptRuleContext)
+ p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
+ p.RuleIndex = RDLStatementParserRULE_alterEncryptRule
+ return p
+}
+
+func (*AlterEncryptRuleContext) IsAlterEncryptRuleContext() {}
+
+func NewAlterEncryptRuleContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *AlterEncryptRuleContext {
+ var p = new(AlterEncryptRuleContext)
+
+ p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
+
+ p.parser = parser
+ p.RuleIndex = RDLStatementParserRULE_alterEncryptRule
+
+ return p
+}
+
+func (s *AlterEncryptRuleContext) GetParser() antlr.Parser { return s.parser }
+
+func (s *AlterEncryptRuleContext) ALTER() antlr.TerminalNode {
+ return s.GetToken(RDLStatementParserALTER, 0)
+}
+
+func (s *AlterEncryptRuleContext) ENCRYPT() antlr.TerminalNode {
+ return s.GetToken(RDLStatementParserENCRYPT, 0)
+}
+
+func (s *AlterEncryptRuleContext) RULE() antlr.TerminalNode {
+ return s.GetToken(RDLStatementParserRULE, 0)
+}
+
+func (s *AlterEncryptRuleContext) AllEncryptRuleDefinition() []IEncryptRuleDefinitionContext {
+ var ts = s.GetTypedRuleContexts(reflect.TypeOf((*IEncryptRuleDefinitionContext)(nil)).Elem())
+ var tst = make([]IEncryptRuleDefinitionContext, len(ts))
+
+ for i, t := range ts {
+ if t != nil {
+ tst[i] = t.(IEncryptRuleDefinitionContext)
+ }
+ }
+
+ return tst
+}
+
+func (s *AlterEncryptRuleContext) EncryptRuleDefinition(i int) IEncryptRuleDefinitionContext {
+ var t = s.GetTypedRuleContext(reflect.TypeOf((*IEncryptRuleDefinitionContext)(nil)).Elem(), i)
+
+ if t == nil {
+ return nil
+ }
+
+ return t.(IEncryptRuleDefinitionContext)
+}
+
+func (s *AlterEncryptRuleContext) AllCOMMA_() []antlr.TerminalNode {
+ return s.GetTokens(RDLStatementParserCOMMA_)
+}
+
+func (s *AlterEncryptRuleContext) COMMA_(i int) antlr.TerminalNode {
+ return s.GetToken(RDLStatementParserCOMMA_, i)
+}
+
+func (s *AlterEncryptRuleContext) GetRuleContext() antlr.RuleContext {
+ return s
+}
+
+func (s *AlterEncryptRuleContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
+ return antlr.TreesStringTree(s, ruleNames, recog)
+}
+
+func (s *AlterEncryptRuleContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
+ switch t := visitor.(type) {
+ case RDLStatementVisitor:
+ return t.VisitAlterEncryptRule(s)
+
+ default:
+ return t.VisitChildren(s)
+ }
+}
+
+func (p *RDLStatementParser) AlterEncryptRule() (localctx IAlterEncryptRuleContext) {
+ localctx = NewAlterEncryptRuleContext(p, p.GetParserRuleContext(), p.GetState())
+ p.EnterRule(localctx, 2, RDLStatementParserRULE_alterEncryptRule)
+ var _la int
+
+ defer func() {
+ p.ExitRule()
+ }()
+
+ defer func() {
+ if err := recover(); err != nil {
+ if v, ok := err.(antlr.RecognitionException); ok {
+ localctx.SetException(v)
+ p.GetErrorHandler().ReportError(p, v)
+ p.GetErrorHandler().Recover(p, v)
+ } else {
+ panic(err)
+ }
+ }
+ }()
+
+ p.EnterOuterAlt(localctx, 1)
+ {
+ p.SetState(78)
+ p.Match(RDLStatementParserALTER)
+ }
+ {
+ p.SetState(79)
+ p.Match(RDLStatementParserENCRYPT)
+ }
+ {
+ p.SetState(80)
+ p.Match(RDLStatementParserRULE)
+ }
+ {
+ p.SetState(81)
+ p.EncryptRuleDefinition()
+ }
+ p.SetState(86)
+ p.GetErrorHandler().Sync(p)
+ _la = p.GetTokenStream().LA(1)
+
+ for _la == RDLStatementParserCOMMA_ {
+ {
+ p.SetState(82)
+ p.Match(RDLStatementParserCOMMA_)
+ }
+ {
+ p.SetState(83)
+ p.EncryptRuleDefinition()
+ }
+
+ p.SetState(88)
+ p.GetErrorHandler().Sync(p)
+ _la = p.GetTokenStream().LA(1)
+ }
+
+ return localctx
+}
+
+// IDropEncryptRuleContext is an interface to support dynamic dispatch.
+type IDropEncryptRuleContext interface {
+ antlr.ParserRuleContext
+
+ // GetParser returns the parser.
+ GetParser() antlr.Parser
+
+ // IsDropEncryptRuleContext differentiates from other interfaces.
+ IsDropEncryptRuleContext()
+}
+
+type DropEncryptRuleContext struct {
+ *antlr.BaseParserRuleContext
+ parser antlr.Parser
+}
+
+func NewEmptyDropEncryptRuleContext() *DropEncryptRuleContext {
+ var p = new(DropEncryptRuleContext)
+ p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
+ p.RuleIndex = RDLStatementParserRULE_dropEncryptRule
+ return p
+}
+
+func (*DropEncryptRuleContext) IsDropEncryptRuleContext() {}
+
+func NewDropEncryptRuleContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *DropEncryptRuleContext {
+ var p = new(DropEncryptRuleContext)
+
+ p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
+
+ p.parser = parser
+ p.RuleIndex = RDLStatementParserRULE_dropEncryptRule
+
+ return p
+}
+
+func (s *DropEncryptRuleContext) GetParser() antlr.Parser { return s.parser }
+
+func (s *DropEncryptRuleContext) DROP() antlr.TerminalNode {
+ return s.GetToken(RDLStatementParserDROP, 0)
+}
+
+func (s *DropEncryptRuleContext) ENCRYPT() antlr.TerminalNode {
+ return s.GetToken(RDLStatementParserENCRYPT, 0)
+}
+
+func (s *DropEncryptRuleContext) RULE() antlr.TerminalNode {
+ return s.GetToken(RDLStatementParserRULE, 0)
+}
+
+func (s *DropEncryptRuleContext) AllTableName() []ITableNameContext {
+ var ts = s.GetTypedRuleContexts(reflect.TypeOf((*ITableNameContext)(nil)).Elem())
+ var tst = make([]ITableNameContext, len(ts))
+
+ for i, t := range ts {
+ if t != nil {
+ tst[i] = t.(ITableNameContext)
+ }
+ }
+
+ return tst
+}
+
+func (s *DropEncryptRuleContext) TableName(i int) ITableNameContext {
+ var t = s.GetTypedRuleContext(reflect.TypeOf((*ITableNameContext)(nil)).Elem(), i)
+
+ if t == nil {
+ return nil
+ }
+
+ return t.(ITableNameContext)
+}
+
+func (s *DropEncryptRuleContext) IfExists() IIfExistsContext {
+ var t = s.GetTypedRuleContext(reflect.TypeOf((*IIfExistsContext)(nil)).Elem(), 0)
+
+ if t == nil {
+ return nil
+ }
+
+ return t.(IIfExistsContext)
+}
+
+func (s *DropEncryptRuleContext) AllCOMMA_() []antlr.TerminalNode {
+ return s.GetTokens(RDLStatementParserCOMMA_)
+}
+
+func (s *DropEncryptRuleContext) COMMA_(i int) antlr.TerminalNode {
+ return s.GetToken(RDLStatementParserCOMMA_, i)
+}
+
+func (s *DropEncryptRuleContext) GetRuleContext() antlr.RuleContext {
+ return s
+}
+
+func (s *DropEncryptRuleContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
+ return antlr.TreesStringTree(s, ruleNames, recog)
+}
+
+func (s *DropEncryptRuleContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
+ switch t := visitor.(type) {
+ case RDLStatementVisitor:
+ return t.VisitDropEncryptRule(s)
+
+ default:
+ return t.VisitChildren(s)
+ }
+}
+
+func (p *RDLStatementParser) DropEncryptRule() (localctx IDropEncryptRuleContext) {
+ localctx = NewDropEncryptRuleContext(p, p.GetParserRuleContext(), p.GetState())
+ p.EnterRule(localctx, 4, RDLStatementParserRULE_dropEncryptRule)
+ var _la int
+
+ defer func() {
+ p.ExitRule()
+ }()
+
+ defer func() {
+ if err := recover(); err != nil {
+ if v, ok := err.(antlr.RecognitionException); ok {
+ localctx.SetException(v)
+ p.GetErrorHandler().ReportError(p, v)
+ p.GetErrorHandler().Recover(p, v)
+ } else {
+ panic(err)
+ }
+ }
+ }()
+
+ p.EnterOuterAlt(localctx, 1)
+ {
+ p.SetState(89)
+ p.Match(RDLStatementParserDROP)
+ }
+ {
+ p.SetState(90)
+ p.Match(RDLStatementParserENCRYPT)
+ }
+ {
+ p.SetState(91)
+ p.Match(RDLStatementParserRULE)
+ }
+ p.SetState(93)
+ p.GetErrorHandler().Sync(p)
+ _la = p.GetTokenStream().LA(1)
+
+ if _la == RDLStatementParserIF {
+ {
+ p.SetState(92)
+ p.IfExists()
+ }
+
+ }
+ {
+ p.SetState(95)
+ p.TableName()
+ }
+ p.SetState(100)
+ p.GetErrorHandler().Sync(p)
+ _la = p.GetTokenStream().LA(1)
+
+ for _la == RDLStatementParserCOMMA_ {
+ {
+ p.SetState(96)
+ p.Match(RDLStatementParserCOMMA_)
+ }
+ {
+ p.SetState(97)
+ p.TableName()
+ }
+
+ p.SetState(102)
+ p.GetErrorHandler().Sync(p)
+ _la = p.GetTokenStream().LA(1)
+ }
+
+ return localctx
+}
+
+// IEncryptRuleDefinitionContext is an interface to support dynamic dispatch.
+type IEncryptRuleDefinitionContext interface {
+ antlr.ParserRuleContext
+
+ // GetParser returns the parser.
+ GetParser() antlr.Parser
+
+ // IsEncryptRuleDefinitionContext differentiates from other interfaces.
+ IsEncryptRuleDefinitionContext()
+}
+
+type EncryptRuleDefinitionContext struct {
+ *antlr.BaseParserRuleContext
+ parser antlr.Parser
+}
+
+func NewEmptyEncryptRuleDefinitionContext() *EncryptRuleDefinitionContext {
+ var p = new(EncryptRuleDefinitionContext)
+ p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
+ p.RuleIndex = RDLStatementParserRULE_encryptRuleDefinition
+ return p
+}
+
+func (*EncryptRuleDefinitionContext) IsEncryptRuleDefinitionContext() {}
+
+func NewEncryptRuleDefinitionContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *EncryptRuleDefinitionContext {
+ var p = new(EncryptRuleDefinitionContext)
+
+ p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
+
+ p.parser = parser
+ p.RuleIndex = RDLStatementParserRULE_encryptRuleDefinition
+
+ return p
+}
+
+func (s *EncryptRuleDefinitionContext) GetParser() antlr.Parser { return s.parser }
+
+func (s *EncryptRuleDefinitionContext) TableName() ITableNameContext {
+ var t = s.GetTypedRuleContext(reflect.TypeOf((*ITableNameContext)(nil)).Elem(), 0)
+
+ if t == nil {
+ return nil
+ }
+
+ return t.(ITableNameContext)
+}
+
+func (s *EncryptRuleDefinitionContext) AllLP_() []antlr.TerminalNode {
+ return s.GetTokens(RDLStatementParserLP_)
+}
+
+func (s *EncryptRuleDefinitionContext) LP_(i int) antlr.TerminalNode {
+ return s.GetToken(RDLStatementParserLP_, i)
+}
+
+func (s *EncryptRuleDefinitionContext) COLUMNS() antlr.TerminalNode {
+ return s.GetToken(RDLStatementParserCOLUMNS, 0)
+}
+
+func (s *EncryptRuleDefinitionContext) AllEncryptColumnDefinition() []IEncryptColumnDefinitionContext {
+ var ts = s.GetTypedRuleContexts(reflect.TypeOf((*IEncryptColumnDefinitionContext)(nil)).Elem())
+ var tst = make([]IEncryptColumnDefinitionContext, len(ts))
+
+ for i, t := range ts {
+ if t != nil {
+ tst[i] = t.(IEncryptColumnDefinitionContext)
+ }
+ }
+
+ return tst
+}
+
+func (s *EncryptRuleDefinitionContext) EncryptColumnDefinition(i int) IEncryptColumnDefinitionContext {
+ var t = s.GetTypedRuleContext(reflect.TypeOf((*IEncryptColumnDefinitionContext)(nil)).Elem(), i)
+
+ if t == nil {
+ return nil
+ }
+
+ return t.(IEncryptColumnDefinitionContext)
+}
+
+func (s *EncryptRuleDefinitionContext) AllRP_() []antlr.TerminalNode {
+ return s.GetTokens(RDLStatementParserRP_)
+}
+
+func (s *EncryptRuleDefinitionContext) RP_(i int) antlr.TerminalNode {
+ return s.GetToken(RDLStatementParserRP_, i)
+}
+
+func (s *EncryptRuleDefinitionContext) ResourceDefinition() IResourceDefinitionContext {
+ var t = s.GetTypedRuleContext(reflect.TypeOf((*IResourceDefinitionContext)(nil)).Elem(), 0)
+
+ if t == nil {
+ return nil
+ }
+
+ return t.(IResourceDefinitionContext)
+}
+
+func (s *EncryptRuleDefinitionContext) AllCOMMA_() []antlr.TerminalNode {
+ return s.GetTokens(RDLStatementParserCOMMA_)
+}
+
+func (s *EncryptRuleDefinitionContext) COMMA_(i int) antlr.TerminalNode {
+ return s.GetToken(RDLStatementParserCOMMA_, i)
+}
+
+func (s *EncryptRuleDefinitionContext) QUERY_WITH_CIPHER_COLUMN() antlr.TerminalNode {
+ return s.GetToken(RDLStatementParserQUERY_WITH_CIPHER_COLUMN, 0)
+}
+
+func (s *EncryptRuleDefinitionContext) EQ_() antlr.TerminalNode {
+ return s.GetToken(RDLStatementParserEQ_, 0)
+}
+
+func (s *EncryptRuleDefinitionContext) QueryWithCipherColumn() IQueryWithCipherColumnContext {
+ var t = s.GetTypedRuleContext(reflect.TypeOf((*IQueryWithCipherColumnContext)(nil)).Elem(), 0)
+
+ if t == nil {
+ return nil
+ }
+
+ return t.(IQueryWithCipherColumnContext)
+}
+
+func (s *EncryptRuleDefinitionContext) GetRuleContext() antlr.RuleContext {
+ return s
+}
+
+func (s *EncryptRuleDefinitionContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
+ return antlr.TreesStringTree(s, ruleNames, recog)
+}
+
+func (s *EncryptRuleDefinitionContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
+ switch t := visitor.(type) {
+ case RDLStatementVisitor:
+ return t.VisitEncryptRuleDefinition(s)
+
+ default:
+ return t.VisitChildren(s)
+ }
+}
+
+func (p *RDLStatementParser) EncryptRuleDefinition() (localctx IEncryptRuleDefinitionContext) {
+ localctx = NewEncryptRuleDefinitionContext(p, p.GetParserRuleContext(), p.GetState())
+ p.EnterRule(localctx, 6, RDLStatementParserRULE_encryptRuleDefinition)
+ var _la int
+
+ defer func() {
+ p.ExitRule()
+ }()
+
+ defer func() {
+ if err := recover(); err != nil {
+ if v, ok := err.(antlr.RecognitionException); ok {
+ localctx.SetException(v)
+ p.GetErrorHandler().ReportError(p, v)
+ p.GetErrorHandler().Recover(p, v)
+ } else {
+ panic(err)
+ }
+ }
+ }()
+
+ p.EnterOuterAlt(localctx, 1)
+ {
+ p.SetState(103)
+ p.TableName()
+ }
+ {
+ p.SetState(104)
+ p.Match(RDLStatementParserLP_)
+ }
+ p.SetState(108)
+ p.GetErrorHandler().Sync(p)
+ _la = p.GetTokenStream().LA(1)
+
+ if _la == RDLStatementParserRESOURCE {
+ {
+ p.SetState(105)
+ p.ResourceDefinition()
+ }
+ {
+ p.SetState(106)
+ p.Match(RDLStatementParserCOMMA_)
+ }
+
+ }
+ {
+ p.SetState(110)
+ p.Match(RDLStatementParserCOLUMNS)
+ }
+ {
+ p.SetState(111)
+ p.Match(RDLStatementParserLP_)
+ }
+ {
+ p.SetState(112)
+ p.EncryptColumnDefinition()
+ }
+ p.SetState(117)
+ p.GetErrorHandler().Sync(p)
+ _la = p.GetTokenStream().LA(1)
+
+ for _la == RDLStatementParserCOMMA_ {
+ {
+ p.SetState(113)
+ p.Match(RDLStatementParserCOMMA_)
+ }
+ {
+ p.SetState(114)
+ p.EncryptColumnDefinition()
+ }
+
+ p.SetState(119)
+ p.GetErrorHandler().Sync(p)
+ _la = p.GetTokenStream().LA(1)
+ }
+ {
+ p.SetState(120)
+ p.Match(RDLStatementParserRP_)
+ }
+ p.SetState(125)
+ p.GetErrorHandler().Sync(p)
+ _la = p.GetTokenStream().LA(1)
+
+ if _la == RDLStatementParserCOMMA_ {
+ {
+ p.SetState(121)
+ p.Match(RDLStatementParserCOMMA_)
+ }
+ {
+ p.SetState(122)
+ p.Match(RDLStatementParserQUERY_WITH_CIPHER_COLUMN)
+ }
+ {
+ p.SetState(123)
+ p.Match(RDLStatementParserEQ_)
+ }
+ {
+ p.SetState(124)
+ p.QueryWithCipherColumn()
+ }
+
+ }
+ {
+ p.SetState(127)
+ p.Match(RDLStatementParserRP_)
+ }
+
+ return localctx
+}
+
+// IResourceDefinitionContext is an interface to support dynamic dispatch.
+type IResourceDefinitionContext interface {
+ antlr.ParserRuleContext
+
+ // GetParser returns the parser.
+ GetParser() antlr.Parser
+
+ // IsResourceDefinitionContext differentiates from other interfaces.
+ IsResourceDefinitionContext()
+}
+
+type ResourceDefinitionContext struct {
+ *antlr.BaseParserRuleContext
+ parser antlr.Parser
+}
+
+func NewEmptyResourceDefinitionContext() *ResourceDefinitionContext {
+ var p = new(ResourceDefinitionContext)
+ p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
+ p.RuleIndex = RDLStatementParserRULE_resourceDefinition
+ return p
+}
+
+func (*ResourceDefinitionContext) IsResourceDefinitionContext() {}
+
+func NewResourceDefinitionContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ResourceDefinitionContext {
+ var p = new(ResourceDefinitionContext)
+
+ p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
+
+ p.parser = parser
+ p.RuleIndex = RDLStatementParserRULE_resourceDefinition
+
+ return p
+}
+
+func (s *ResourceDefinitionContext) GetParser() antlr.Parser { return s.parser }
+
+func (s *ResourceDefinitionContext) RESOURCE() antlr.TerminalNode {
+ return s.GetToken(RDLStatementParserRESOURCE, 0)
+}
+
+func (s *ResourceDefinitionContext) EQ_() antlr.TerminalNode {
+ return s.GetToken(RDLStatementParserEQ_, 0)
+}
+
+func (s *ResourceDefinitionContext) ResourceName() IResourceNameContext {
+ var t = s.GetTypedRuleContext(reflect.TypeOf((*IResourceNameContext)(nil)).Elem(), 0)
+
+ if t == nil {
+ return nil
+ }
+
+ return t.(IResourceNameContext)
+}
+
+func (s *ResourceDefinitionContext) GetRuleContext() antlr.RuleContext {
+ return s
+}
+
+func (s *ResourceDefinitionContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
+ return antlr.TreesStringTree(s, ruleNames, recog)
+}
+
+func (s *ResourceDefinitionContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
+ switch t := visitor.(type) {
+ case RDLStatementVisitor:
+ return t.VisitResourceDefinition(s)
+
+ default:
+ return t.VisitChildren(s)
+ }
+}
+
+func (p *RDLStatementParser) ResourceDefinition() (localctx IResourceDefinitionContext) {
+ localctx = NewResourceDefinitionContext(p, p.GetParserRuleContext(), p.GetState())
+ p.EnterRule(localctx, 8, RDLStatementParserRULE_resourceDefinition)
+
+ defer func() {
+ p.ExitRule()
+ }()
+
+ defer func() {
+ if err := recover(); err != nil {
+ if v, ok := err.(antlr.RecognitionException); ok {
+ localctx.SetException(v)
+ p.GetErrorHandler().ReportError(p, v)
+ p.GetErrorHandler().Recover(p, v)
+ } else {
+ panic(err)
+ }
+ }
+ }()
+
+ p.EnterOuterAlt(localctx, 1)
+ {
+ p.SetState(129)
+ p.Match(RDLStatementParserRESOURCE)
+ }
+ {
+ p.SetState(130)
+ p.Match(RDLStatementParserEQ_)
+ }
+ {
+ p.SetState(131)
+ p.ResourceName()
+ }
+
+ return localctx
+}
+
+// IResourceNameContext is an interface to support dynamic dispatch.
+type IResourceNameContext interface {
+ antlr.ParserRuleContext
+
+ // GetParser returns the parser.
+ GetParser() antlr.Parser
+
+ // IsResourceNameContext differentiates from other interfaces.
+ IsResourceNameContext()
+}
+
+type ResourceNameContext struct {
+ *antlr.BaseParserRuleContext
+ parser antlr.Parser
+}
+
+func NewEmptyResourceNameContext() *ResourceNameContext {
+ var p = new(ResourceNameContext)
+ p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
+ p.RuleIndex = RDLStatementParserRULE_resourceName
+ return p
+}
+
+func (*ResourceNameContext) IsResourceNameContext() {}
+
+func NewResourceNameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ResourceNameContext {
+ var p = new(ResourceNameContext)
+
+ p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
+
+ p.parser = parser
+ p.RuleIndex = RDLStatementParserRULE_resourceName
+
+ return p
+}
+
+func (s *ResourceNameContext) GetParser() antlr.Parser { return s.parser }
+
+func (s *ResourceNameContext) IDENTIFIER_() antlr.TerminalNode {
+ return s.GetToken(RDLStatementParserIDENTIFIER_, 0)
+}
+
+func (s *ResourceNameContext) GetRuleContext() antlr.RuleContext {
+ return s
+}
+
+func (s *ResourceNameContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
+ return antlr.TreesStringTree(s, ruleNames, recog)
+}
+
+func (s *ResourceNameContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
+ switch t := visitor.(type) {
+ case RDLStatementVisitor:
+ return t.VisitResourceName(s)
+
+ default:
+ return t.VisitChildren(s)
+ }
+}
+
+func (p *RDLStatementParser) ResourceName() (localctx IResourceNameContext) {
+ localctx = NewResourceNameContext(p, p.GetParserRuleContext(), p.GetState())
+ p.EnterRule(localctx, 10, RDLStatementParserRULE_resourceName)
+
+ defer func() {
+ p.ExitRule()
+ }()
+
+ defer func() {
+ if err := recover(); err != nil {
+ if v, ok := err.(antlr.RecognitionException); ok {
+ localctx.SetException(v)
+ p.GetErrorHandler().ReportError(p, v)
+ p.GetErrorHandler().Recover(p, v)
+ } else {
+ panic(err)
+ }
+ }
+ }()
+
+ p.EnterOuterAlt(localctx, 1)
+ {
+ p.SetState(133)
+ p.Match(RDLStatementParserIDENTIFIER_)
+ }
+
+ return localctx
+}
+
+// IEncryptColumnDefinitionContext is an interface to support dynamic dispatch.
+type IEncryptColumnDefinitionContext interface {
+ antlr.ParserRuleContext
+
+ // GetParser returns the parser.
+ GetParser() antlr.Parser
+
+ // IsEncryptColumnDefinitionContext differentiates from other interfaces.
+ IsEncryptColumnDefinitionContext()
+}
+
+type EncryptColumnDefinitionContext struct {
+ *antlr.BaseParserRuleContext
+ parser antlr.Parser
+}
+
+func NewEmptyEncryptColumnDefinitionContext() *EncryptColumnDefinitionContext {
+ var p = new(EncryptColumnDefinitionContext)
+ p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
+ p.RuleIndex = RDLStatementParserRULE_encryptColumnDefinition
+ return p
+}
+
+func (*EncryptColumnDefinitionContext) IsEncryptColumnDefinitionContext() {}
+
+func NewEncryptColumnDefinitionContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *EncryptColumnDefinitionContext {
+ var p = new(EncryptColumnDefinitionContext)
+
+ p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
+
+ p.parser = parser
+ p.RuleIndex = RDLStatementParserRULE_encryptColumnDefinition
+
+ return p
+}
+
+func (s *EncryptColumnDefinitionContext) GetParser() antlr.Parser { return s.parser }
+
+func (s *EncryptColumnDefinitionContext) LP_() antlr.TerminalNode {
+ return s.GetToken(RDLStatementParserLP_, 0)
+}
+
+func (s *EncryptColumnDefinitionContext) ColumnDefinition() IColumnDefinitionContext {
+ var t = s.GetTypedRuleContext(reflect.TypeOf((*IColumnDefinitionContext)(nil)).Elem(), 0)
+
+ if t == nil {
+ return nil
+ }
+
+ return t.(IColumnDefinitionContext)
+}
+
+func (s *EncryptColumnDefinitionContext) AllCOMMA_() []antlr.TerminalNode {
+ return s.GetTokens(RDLStatementParserCOMMA_)
+}
+
+func (s *EncryptColumnDefinitionContext) COMMA_(i int) antlr.TerminalNode {
+ return s.GetToken(RDLStatementParserCOMMA_, i)
+}
+
+func (s *EncryptColumnDefinitionContext) CipherColumnDefinition() ICipherColumnDefinitionContext {
+ var t = s.GetTypedRuleContext(reflect.TypeOf((*ICipherColumnDefinitionContext)(nil)).Elem(), 0)
+
+ if t == nil {
+ return nil
+ }
+
+ return t.(ICipherColumnDefinitionContext)
+}
+
+func (s *EncryptColumnDefinitionContext) EncryptAlgorithm() IEncryptAlgorithmContext {
+ var t = s.GetTypedRuleContext(reflect.TypeOf((*IEncryptAlgorithmContext)(nil)).Elem(), 0)
+
+ if t == nil {
+ return nil
+ }
+
+ return t.(IEncryptAlgorithmContext)
+}
+
+func (s *EncryptColumnDefinitionContext) RP_() antlr.TerminalNode {
+ return s.GetToken(RDLStatementParserRP_, 0)
+}
+
+func (s *EncryptColumnDefinitionContext) PlainColumnDefinition() IPlainColumnDefinitionContext {
+ var t = s.GetTypedRuleContext(reflect.TypeOf((*IPlainColumnDefinitionContext)(nil)).Elem(), 0)
+
+ if t == nil {
+ return nil
+ }
+
+ return t.(IPlainColumnDefinitionContext)
+}
+
+func (s *EncryptColumnDefinitionContext) AssistedQueryColumnDefinition() IAssistedQueryColumnDefinitionContext {
+ var t = s.GetTypedRuleContext(reflect.TypeOf((*IAssistedQueryColumnDefinitionContext)(nil)).Elem(), 0)
+
+ if t == nil {
+ return nil
+ }
+
+ return t.(IAssistedQueryColumnDefinitionContext)
+}
+
+func (s *EncryptColumnDefinitionContext) LikeQueryColumnDefinition() ILikeQueryColumnDefinitionContext {
+ var t = s.GetTypedRuleContext(reflect.TypeOf((*ILikeQueryColumnDefinitionContext)(nil)).Elem(), 0)
+
+ if t == nil {
+ return nil
+ }
+
+ return t.(ILikeQueryColumnDefinitionContext)
+}
+
+func (s *EncryptColumnDefinitionContext) AssistedQueryAlgorithm() IAssistedQueryAlgorithmContext {
+ var t = s.GetTypedRuleContext(reflect.TypeOf((*IAssistedQueryAlgorithmContext)(nil)).Elem(), 0)
+
+ if t == nil {
+ return nil
+ }
+
+ return t.(IAssistedQueryAlgorithmContext)
+}
+
+func (s *EncryptColumnDefinitionContext) LikeQueryAlgorithm() ILikeQueryAlgorithmContext {
+ var t = s.GetTypedRuleContext(reflect.TypeOf((*ILikeQueryAlgorithmContext)(nil)).Elem(), 0)
+
+ if t == nil {
+ return nil
+ }
+
+ return t.(ILikeQueryAlgorithmContext)
+}
+
+func (s *EncryptColumnDefinitionContext) QUERY_WITH_CIPHER_COLUMN() antlr.TerminalNode {
+ return s.GetToken(RDLStatementParserQUERY_WITH_CIPHER_COLUMN, 0)
+}
+
+func (s *EncryptColumnDefinitionContext) EQ_() antlr.TerminalNode {
+ return s.GetToken(RDLStatementParserEQ_, 0)
+}
+
+func (s *EncryptColumnDefinitionContext) QueryWithCipherColumn() IQueryWithCipherColumnContext {
+ var t = s.GetTypedRuleContext(reflect.TypeOf((*IQueryWithCipherColumnContext)(nil)).Elem(), 0)
+
+ if t == nil {
+ return nil
+ }
+
+ return t.(IQueryWithCipherColumnContext)
+}
+
+func (s *EncryptColumnDefinitionContext) GetRuleContext() antlr.RuleContext {
+ return s
+}
+
+func (s *EncryptColumnDefinitionContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
+ return antlr.TreesStringTree(s, ruleNames, recog)
+}
+
+func (s *EncryptColumnDefinitionContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
+ switch t := visitor.(type) {
+ case RDLStatementVisitor:
+ return t.VisitEncryptColumnDefinition(s)
+
+ default:
+ return t.VisitChildren(s)
+ }
+}
+
+func (p *RDLStatementParser) EncryptColumnDefinition() (localctx IEncryptColumnDefinitionContext) {
+ localctx = NewEncryptColumnDefinitionContext(p, p.GetParserRuleContext(), p.GetState())
+ p.EnterRule(localctx, 12, RDLStatementParserRULE_encryptColumnDefinition)
+ var _la int
+
+ defer func() {
+ p.ExitRule()
+ }()
+
+ defer func() {
+ if err := recover(); err != nil {
+ if v, ok := err.(antlr.RecognitionException); ok {
+ localctx.SetException(v)
+ p.GetErrorHandler().ReportError(p, v)
+ p.GetErrorHandler().Recover(p, v)
+ } else {
+ panic(err)
+ }
+ }
+ }()
+
+ p.EnterOuterAlt(localctx, 1)
+ {
+ p.SetState(135)
+ p.Match(RDLStatementParserLP_)
+ }
+ {
+ p.SetState(136)
+ p.ColumnDefinition()
+ }
+ p.SetState(139)
+ p.GetErrorHandler().Sync(p)
+
+ if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 8, p.GetParserRuleContext()) == 1 {
+ {
+ p.SetState(137)
+ p.Match(RDLStatementParserCOMMA_)
+ }
+ {
+ p.SetState(138)
+ p.PlainColumnDefinition()
+ }
+
+ }
+ {
+ p.SetState(141)
+ p.Match(RDLStatementParserCOMMA_)
+ }
+ {
+ p.SetState(142)
+ p.CipherColumnDefinition()
+ }
+ p.SetState(145)
+ p.GetErrorHandler().Sync(p)
+
+ if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 9, p.GetParserRuleContext()) == 1 {
+ {
+ p.SetState(143)
+ p.Match(RDLStatementParserCOMMA_)
+ }
+ {
+ p.SetState(144)
+ p.AssistedQueryColumnDefinition()
+ }
+
+ }
+ p.SetState(149)
+ p.GetErrorHandler().Sync(p)
+
+ if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 10, p.GetParserRuleContext()) == 1 {
+ {
+ p.SetState(147)
+ p.Match(RDLStatementParserCOMMA_)
+ }
+ {
+ p.SetState(148)
+ p.LikeQueryColumnDefinition()
+ }
+
+ }
+ {
+ p.SetState(151)
+ p.Match(RDLStatementParserCOMMA_)
+ }
+ {
+ p.SetState(152)
+ p.EncryptAlgorithm()
+ }
+ p.SetState(155)
+ p.GetErrorHandler().Sync(p)
+
+ if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 11, p.GetParserRuleContext()) == 1 {
+ {
+ p.SetState(153)
+ p.Match(RDLStatementParserCOMMA_)
+ }
+ {
+ p.SetState(154)
+ p.AssistedQueryAlgorithm()
+ }
+
+ }
+ p.SetState(159)
+ p.GetErrorHandler().Sync(p)
+
+ if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 12, p.GetParserRuleContext()) == 1 {
+ {
+ p.SetState(157)
+ p.Match(RDLStatementParserCOMMA_)
+ }
+ {
+ p.SetState(158)
+ p.LikeQueryAlgorithm()
+ }
+
+ }
+ p.SetState(165)
+ p.GetErrorHandler().Sync(p)
+ _la = p.GetTokenStream().LA(1)
+
+ if _la == RDLStatementParserCOMMA_ {
+ {
+ p.SetState(161)
+ p.Match(RDLStatementParserCOMMA_)
+ }
+ {
+ p.SetState(162)
+ p.Match(RDLStatementParserQUERY_WITH_CIPHER_COLUMN)
+ }
+ {
+ p.SetState(163)
+ p.Match(RDLStatementParserEQ_)
+ }
+ {
+ p.SetState(164)
+ p.QueryWithCipherColumn()
+ }
+
+ }
+ {
+ p.SetState(167)
+ p.Match(RDLStatementParserRP_)
+ }
+
+ return localctx
+}
+
+// IColumnDefinitionContext is an interface to support dynamic dispatch.
+type IColumnDefinitionContext interface {
+ antlr.ParserRuleContext
+
+ // GetParser returns the parser.
+ GetParser() antlr.Parser
+
+ // IsColumnDefinitionContext differentiates from other interfaces.
+ IsColumnDefinitionContext()
+}
+
+type ColumnDefinitionContext struct {
+ *antlr.BaseParserRuleContext
+ parser antlr.Parser
+}
+
+func NewEmptyColumnDefinitionContext() *ColumnDefinitionContext {
+ var p = new(ColumnDefinitionContext)
+ p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
+ p.RuleIndex = RDLStatementParserRULE_columnDefinition
+ return p
+}
+
+func (*ColumnDefinitionContext) IsColumnDefinitionContext() {}
+
+func NewColumnDefinitionContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ColumnDefinitionContext {
+ var p = new(ColumnDefinitionContext)
+
+ p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
+
+ p.parser = parser
+ p.RuleIndex = RDLStatementParserRULE_columnDefinition
+
+ return p
+}
+
+func (s *ColumnDefinitionContext) GetParser() antlr.Parser { return s.parser }
+
+func (s *ColumnDefinitionContext) NAME() antlr.TerminalNode {
+ return s.GetToken(RDLStatementParserNAME, 0)
+}
+
+func (s *ColumnDefinitionContext) AllEQ_() []antlr.TerminalNode {
+ return s.GetTokens(RDLStatementParserEQ_)
+}
+
+func (s *ColumnDefinitionContext) EQ_(i int) antlr.TerminalNode {
+ return s.GetToken(RDLStatementParserEQ_, i)
+}
+
+func (s *ColumnDefinitionContext) ColumnName() IColumnNameContext {
+ var t = s.GetTypedRuleContext(reflect.TypeOf((*IColumnNameContext)(nil)).Elem(), 0)
+
+ if t == nil {
+ return nil
+ }
+
+ return t.(IColumnNameContext)
+}
+
+func (s *ColumnDefinitionContext) COMMA_() antlr.TerminalNode {
+ return s.GetToken(RDLStatementParserCOMMA_, 0)
+}
+
+func (s *ColumnDefinitionContext) DATA_TYPE() antlr.TerminalNode {
+ return s.GetToken(RDLStatementParserDATA_TYPE, 0)
+}
+
+func (s *ColumnDefinitionContext) DataType() IDataTypeContext {
+ var t = s.GetTypedRuleContext(reflect.TypeOf((*IDataTypeContext)(nil)).Elem(), 0)
+
+ if t == nil {
+ return nil
+ }
+
+ return t.(IDataTypeContext)
+}
+
+func (s *ColumnDefinitionContext) GetRuleContext() antlr.RuleContext {
+ return s
+}
+
+func (s *ColumnDefinitionContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
+ return antlr.TreesStringTree(s, ruleNames, recog)
+}
+
+func (s *ColumnDefinitionContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
+ switch t := visitor.(type) {
+ case RDLStatementVisitor:
+ return t.VisitColumnDefinition(s)
+
+ default:
+ return t.VisitChildren(s)
+ }
+}
+
+func (p *RDLStatementParser) ColumnDefinition() (localctx IColumnDefinitionContext) {
+ localctx = NewColumnDefinitionContext(p, p.GetParserRuleContext(), p.GetState())
+ p.EnterRule(localctx, 14, RDLStatementParserRULE_columnDefinition)
+
+ defer func() {
+ p.ExitRule()
+ }()
+
+ defer func() {
+ if err := recover(); err != nil {
+ if v, ok := err.(antlr.RecognitionException); ok {
+ localctx.SetException(v)
+ p.GetErrorHandler().ReportError(p, v)
+ p.GetErrorHandler().Recover(p, v)
+ } else {
+ panic(err)
+ }
+ }
+ }()
+
+ p.EnterOuterAlt(localctx, 1)
+ {
+ p.SetState(169)
+ p.Match(RDLStatementParserNAME)
+ }
+ {
+ p.SetState(170)
+ p.Match(RDLStatementParserEQ_)
+ }
+ {
+ p.SetState(171)
+ p.ColumnName()
+ }
+ p.SetState(176)
+ p.GetErrorHandler().Sync(p)
+
+ if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 14, p.GetParserRuleContext()) == 1 {
+ {
+ p.SetState(172)
+ p.Match(RDLStatementParserCOMMA_)
+ }
+ {
+ p.SetState(173)
+ p.Match(RDLStatementParserDATA_TYPE)
+ }
+ {
+ p.SetState(174)
+ p.Match(RDLStatementParserEQ_)
+ }
+ {
+ p.SetState(175)
+ p.DataType()
+ }
+
+ }
+
+ return localctx
+}
+
+// IColumnNameContext is an interface to support dynamic dispatch.
+type IColumnNameContext interface {
+ antlr.ParserRuleContext
+
+ // GetParser returns the parser.
+ GetParser() antlr.Parser
+
+ // IsColumnNameContext differentiates from other interfaces.
+ IsColumnNameContext()
+}
+
+type ColumnNameContext struct {
+ *antlr.BaseParserRuleContext
+ parser antlr.Parser
+}
+
+func NewEmptyColumnNameContext() *ColumnNameContext {
+ var p = new(ColumnNameContext)
+ p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
+ p.RuleIndex = RDLStatementParserRULE_columnName
+ return p
+}
+
+func (*ColumnNameContext) IsColumnNameContext() {}
+
+func NewColumnNameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ColumnNameContext {
+ var p = new(ColumnNameContext)
+
+ p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
+
+ p.parser = parser
+ p.RuleIndex = RDLStatementParserRULE_columnName
+
+ return p
+}
+
+func (s *ColumnNameContext) GetParser() antlr.Parser { return s.parser }
+
+func (s *ColumnNameContext) IDENTIFIER_() antlr.TerminalNode {
+ return s.GetToken(RDLStatementParserIDENTIFIER_, 0)
+}
+
+func (s *ColumnNameContext) GetRuleContext() antlr.RuleContext {
+ return s
+}
+
+func (s *ColumnNameContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
+ return antlr.TreesStringTree(s, ruleNames, recog)
+}
+
+func (s *ColumnNameContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
+ switch t := visitor.(type) {
+ case RDLStatementVisitor:
+ return t.VisitColumnName(s)
+
+ default:
+ return t.VisitChildren(s)
+ }
+}
+
+func (p *RDLStatementParser) ColumnName() (localctx IColumnNameContext) {
+ localctx = NewColumnNameContext(p, p.GetParserRuleContext(), p.GetState())
+ p.EnterRule(localctx, 16, RDLStatementParserRULE_columnName)
+
+ defer func() {
+ p.ExitRule()
+ }()
+
+ defer func() {
+ if err := recover(); err != nil {
+ if v, ok := err.(antlr.RecognitionException); ok {
+ localctx.SetException(v)
+ p.GetErrorHandler().ReportError(p, v)
+ p.GetErrorHandler().Recover(p, v)
+ } else {
+ panic(err)
+ }
+ }
+ }()
+
+ p.EnterOuterAlt(localctx, 1)
+ {
+ p.SetState(178)
+ p.Match(RDLStatementParserIDENTIFIER_)
+ }
+
+ return localctx
+}
+
+// IDataTypeContext is an interface to support dynamic dispatch.
+type IDataTypeContext interface {
+ antlr.ParserRuleContext
+
+ // GetParser returns the parser.
+ GetParser() antlr.Parser
+
+ // IsDataTypeContext differentiates from other interfaces.
+ IsDataTypeContext()
+}
+
+type DataTypeContext struct {
+ *antlr.BaseParserRuleContext
+ parser antlr.Parser
+}
+
+func NewEmptyDataTypeContext() *DataTypeContext {
+ var p = new(DataTypeContext)
+ p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
+ p.RuleIndex = RDLStatementParserRULE_dataType
+ return p
+}
+
+func (*DataTypeContext) IsDataTypeContext() {}
+
+func NewDataTypeContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *DataTypeContext {
+ var p = new(DataTypeContext)
+
+ p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
+
+ p.parser = parser
+ p.RuleIndex = RDLStatementParserRULE_dataType
+
+ return p
+}
+
+func (s *DataTypeContext) GetParser() antlr.Parser { return s.parser }
+
+func (s *DataTypeContext) STRING_() antlr.TerminalNode {
+ return s.GetToken(RDLStatementParserSTRING_, 0)
+}
+
+func (s *DataTypeContext) GetRuleContext() antlr.RuleContext {
+ return s
+}
+
+func (s *DataTypeContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
+ return antlr.TreesStringTree(s, ruleNames, recog)
+}
+
+func (s *DataTypeContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
+ switch t := visitor.(type) {
+ case RDLStatementVisitor:
+ return t.VisitDataType(s)
+
+ default:
+ return t.VisitChildren(s)
+ }
+}
+
+func (p *RDLStatementParser) DataType() (localctx IDataTypeContext) {
+ localctx = NewDataTypeContext(p, p.GetParserRuleContext(), p.GetState())
+ p.EnterRule(localctx, 18, RDLStatementParserRULE_dataType)
+
+ defer func() {
+ p.ExitRule()
+ }()
+
+ defer func() {
+ if err := recover(); err != nil {
+ if v, ok := err.(antlr.RecognitionException); ok {
+ localctx.SetException(v)
+ p.GetErrorHandler().ReportError(p, v)
+ p.GetErrorHandler().Recover(p, v)
+ } else {
+ panic(err)
+ }
+ }
+ }()
+
+ p.EnterOuterAlt(localctx, 1)
+ {
+ p.SetState(180)
+ p.Match(RDLStatementParserSTRING_)
+ }
+
+ return localctx
+}
+
+// IPlainColumnDefinitionContext is an interface to support dynamic dispatch.
+type IPlainColumnDefinitionContext interface {
+ antlr.ParserRuleContext
+
+ // GetParser returns the parser.
+ GetParser() antlr.Parser
+
+ // IsPlainColumnDefinitionContext differentiates from other interfaces.
+ IsPlainColumnDefinitionContext()
+}
+
+type PlainColumnDefinitionContext struct {
+ *antlr.BaseParserRuleContext
+ parser antlr.Parser
+}
+
+func NewEmptyPlainColumnDefinitionContext() *PlainColumnDefinitionContext {
+ var p = new(PlainColumnDefinitionContext)
+ p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
+ p.RuleIndex = RDLStatementParserRULE_plainColumnDefinition
+ return p
+}
+
+func (*PlainColumnDefinitionContext) IsPlainColumnDefinitionContext() {}
+
+func NewPlainColumnDefinitionContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *PlainColumnDefinitionContext {
+ var p = new(PlainColumnDefinitionContext)
+
+ p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
+
+ p.parser = parser
+ p.RuleIndex = RDLStatementParserRULE_plainColumnDefinition
+
+ return p
+}
+
+func (s *PlainColumnDefinitionContext) GetParser() antlr.Parser { return s.parser }
+
+func (s *PlainColumnDefinitionContext) PLAIN() antlr.TerminalNode {
+ return s.GetToken(RDLStatementParserPLAIN, 0)
+}
+
+func (s *PlainColumnDefinitionContext) AllEQ_() []antlr.TerminalNode {
+ return s.GetTokens(RDLStatementParserEQ_)
+}
+
+func (s *PlainColumnDefinitionContext) EQ_(i int) antlr.TerminalNode {
+ return s.GetToken(RDLStatementParserEQ_, i)
+}
+
+func (s *PlainColumnDefinitionContext) PlainColumnName() IPlainColumnNameContext {
+ var t = s.GetTypedRuleContext(reflect.TypeOf((*IPlainColumnNameContext)(nil)).Elem(), 0)
+
+ if t == nil {
+ return nil
+ }
+
+ return t.(IPlainColumnNameContext)
+}
+
+func (s *PlainColumnDefinitionContext) COMMA_() antlr.TerminalNode {
+ return s.GetToken(RDLStatementParserCOMMA_, 0)
+}
+
+func (s *PlainColumnDefinitionContext) PLAIN_DATA_TYPE() antlr.TerminalNode {
+ return s.GetToken(RDLStatementParserPLAIN_DATA_TYPE, 0)
+}
+
+func (s *PlainColumnDefinitionContext) DataType() IDataTypeContext {
+ var t = s.GetTypedRuleContext(reflect.TypeOf((*IDataTypeContext)(nil)).Elem(), 0)
+
+ if t == nil {
+ return nil
+ }
+
+ return t.(IDataTypeContext)
+}
+
+func (s *PlainColumnDefinitionContext) GetRuleContext() antlr.RuleContext {
+ return s
+}
+
+func (s *PlainColumnDefinitionContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
+ return antlr.TreesStringTree(s, ruleNames, recog)
+}
+
+func (s *PlainColumnDefinitionContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
+ switch t := visitor.(type) {
+ case RDLStatementVisitor:
+ return t.VisitPlainColumnDefinition(s)
+
+ default:
+ return t.VisitChildren(s)
+ }
+}
+
+func (p *RDLStatementParser) PlainColumnDefinition() (localctx IPlainColumnDefinitionContext) {
+ localctx = NewPlainColumnDefinitionContext(p, p.GetParserRuleContext(), p.GetState())
+ p.EnterRule(localctx, 20, RDLStatementParserRULE_plainColumnDefinition)
+
+ defer func() {
+ p.ExitRule()
+ }()
+
+ defer func() {
+ if err := recover(); err != nil {
+ if v, ok := err.(antlr.RecognitionException); ok {
+ localctx.SetException(v)
+ p.GetErrorHandler().ReportError(p, v)
+ p.GetErrorHandler().Recover(p, v)
+ } else {
+ panic(err)
+ }
+ }
+ }()
+
+ p.EnterOuterAlt(localctx, 1)
+ {
+ p.SetState(182)
+ p.Match(RDLStatementParserPLAIN)
+ }
+ {
+ p.SetState(183)
+ p.Match(RDLStatementParserEQ_)
+ }
+ {
+ p.SetState(184)
+ p.PlainColumnName()
+ }
+ p.SetState(189)
+ p.GetErrorHandler().Sync(p)
+
+ if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 15, p.GetParserRuleContext()) == 1 {
+ {
+ p.SetState(185)
+ p.Match(RDLStatementParserCOMMA_)
+ }
+ {
+ p.SetState(186)
+ p.Match(RDLStatementParserPLAIN_DATA_TYPE)
+ }
+ {
+ p.SetState(187)
+ p.Match(RDLStatementParserEQ_)
+ }
+ {
+ p.SetState(188)
+ p.DataType()
+ }
+
+ }
+
+ return localctx
+}
+
+// IPlainColumnNameContext is an interface to support dynamic dispatch.
+type IPlainColumnNameContext interface {
+ antlr.ParserRuleContext
+
+ // GetParser returns the parser.
+ GetParser() antlr.Parser
+
+ // IsPlainColumnNameContext differentiates from other interfaces.
+ IsPlainColumnNameContext()
+}
+
+type PlainColumnNameContext struct {
+ *antlr.BaseParserRuleContext
+ parser antlr.Parser
+}
+
+func NewEmptyPlainColumnNameContext() *PlainColumnNameContext {
+ var p = new(PlainColumnNameContext)
+ p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
+ p.RuleIndex = RDLStatementParserRULE_plainColumnName
+ return p
+}
+
+func (*PlainColumnNameContext) IsPlainColumnNameContext() {}
+
+func NewPlainColumnNameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *PlainColumnNameContext {
+ var p = new(PlainColumnNameContext)
+
+ p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
+
+ p.parser = parser
+ p.RuleIndex = RDLStatementParserRULE_plainColumnName
+
+ return p
+}
+
+func (s *PlainColumnNameContext) GetParser() antlr.Parser { return s.parser }
+
+func (s *PlainColumnNameContext) IDENTIFIER_() antlr.TerminalNode {
+ return s.GetToken(RDLStatementParserIDENTIFIER_, 0)
+}
+
+func (s *PlainColumnNameContext) GetRuleContext() antlr.RuleContext {
+ return s
+}
+
+func (s *PlainColumnNameContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
+ return antlr.TreesStringTree(s, ruleNames, recog)
+}
+
+func (s *PlainColumnNameContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
+ switch t := visitor.(type) {
+ case RDLStatementVisitor:
+ return t.VisitPlainColumnName(s)
+
+ default:
+ return t.VisitChildren(s)
+ }
+}
+
+func (p *RDLStatementParser) PlainColumnName() (localctx IPlainColumnNameContext) {
+ localctx = NewPlainColumnNameContext(p, p.GetParserRuleContext(), p.GetState())
+ p.EnterRule(localctx, 22, RDLStatementParserRULE_plainColumnName)
+
+ defer func() {
+ p.ExitRule()
+ }()
+
+ defer func() {
+ if err := recover(); err != nil {
+ if v, ok := err.(antlr.RecognitionException); ok {
+ localctx.SetException(v)
+ p.GetErrorHandler().ReportError(p, v)
+ p.GetErrorHandler().Recover(p, v)
+ } else {
+ panic(err)
+ }
+ }
+ }()
+
+ p.EnterOuterAlt(localctx, 1)
+ {
+ p.SetState(191)
+ p.Match(RDLStatementParserIDENTIFIER_)
+ }
+
+ return localctx
+}
+
+// ICipherColumnDefinitionContext is an interface to support dynamic dispatch.
+type ICipherColumnDefinitionContext interface {
+ antlr.ParserRuleContext
+
+ // GetParser returns the parser.
+ GetParser() antlr.Parser
+
+ // IsCipherColumnDefinitionContext differentiates from other interfaces.
+ IsCipherColumnDefinitionContext()
+}
+
+type CipherColumnDefinitionContext struct {
+ *antlr.BaseParserRuleContext
+ parser antlr.Parser
+}
+
+func NewEmptyCipherColumnDefinitionContext() *CipherColumnDefinitionContext {
+ var p = new(CipherColumnDefinitionContext)
+ p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
+ p.RuleIndex = RDLStatementParserRULE_cipherColumnDefinition
+ return p
+}
+
+func (*CipherColumnDefinitionContext) IsCipherColumnDefinitionContext() {}
+
+func NewCipherColumnDefinitionContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *CipherColumnDefinitionContext {
+ var p = new(CipherColumnDefinitionContext)
+
+ p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
+
+ p.parser = parser
+ p.RuleIndex = RDLStatementParserRULE_cipherColumnDefinition
+
+ return p
+}
+
+func (s *CipherColumnDefinitionContext) GetParser() antlr.Parser { return s.parser }
+
+func (s *CipherColumnDefinitionContext) CIPHER() antlr.TerminalNode {
+ return s.GetToken(RDLStatementParserCIPHER, 0)
+}
+
+func (s *CipherColumnDefinitionContext) AllEQ_() []antlr.TerminalNode {
+ return s.GetTokens(RDLStatementParserEQ_)
+}
+
+func (s *CipherColumnDefinitionContext) EQ_(i int) antlr.TerminalNode {
+ return s.GetToken(RDLStatementParserEQ_, i)
+}
+
+func (s *CipherColumnDefinitionContext) CipherColumnName() ICipherColumnNameContext {
+ var t = s.GetTypedRuleContext(reflect.TypeOf((*ICipherColumnNameContext)(nil)).Elem(), 0)
+
+ if t == nil {
+ return nil
+ }
+
+ return t.(ICipherColumnNameContext)
+}
+
+func (s *CipherColumnDefinitionContext) COMMA_() antlr.TerminalNode {
+ return s.GetToken(RDLStatementParserCOMMA_, 0)
+}
+
+func (s *CipherColumnDefinitionContext) CIPHER_DATA_TYPE() antlr.TerminalNode {
+ return s.GetToken(RDLStatementParserCIPHER_DATA_TYPE, 0)
+}
+
+func (s *CipherColumnDefinitionContext) DataType() IDataTypeContext {
+ var t = s.GetTypedRuleContext(reflect.TypeOf((*IDataTypeContext)(nil)).Elem(), 0)
+
+ if t == nil {
+ return nil
+ }
+
+ return t.(IDataTypeContext)
+}
+
+func (s *CipherColumnDefinitionContext) GetRuleContext() antlr.RuleContext {
+ return s
+}
+
+func (s *CipherColumnDefinitionContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
+ return antlr.TreesStringTree(s, ruleNames, recog)
+}
+
+func (s *CipherColumnDefinitionContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
+ switch t := visitor.(type) {
+ case RDLStatementVisitor:
+ return t.VisitCipherColumnDefinition(s)
+
+ default:
+ return t.VisitChildren(s)
+ }
+}
+
+func (p *RDLStatementParser) CipherColumnDefinition() (localctx ICipherColumnDefinitionContext) {
+ localctx = NewCipherColumnDefinitionContext(p, p.GetParserRuleContext(), p.GetState())
+ p.EnterRule(localctx, 24, RDLStatementParserRULE_cipherColumnDefinition)
+
+ defer func() {
+ p.ExitRule()
+ }()
+
+ defer func() {
+ if err := recover(); err != nil {
+ if v, ok := err.(antlr.RecognitionException); ok {
+ localctx.SetException(v)
+ p.GetErrorHandler().ReportError(p, v)
+ p.GetErrorHandler().Recover(p, v)
+ } else {
+ panic(err)
+ }
+ }
+ }()
+
+ p.EnterOuterAlt(localctx, 1)
+ {
+ p.SetState(193)
+ p.Match(RDLStatementParserCIPHER)
+ }
+ {
+ p.SetState(194)
+ p.Match(RDLStatementParserEQ_)
+ }
+ {
+ p.SetState(195)
+ p.CipherColumnName()
+ }
+ p.SetState(200)
+ p.GetErrorHandler().Sync(p)
+
+ if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 16, p.GetParserRuleContext()) == 1 {
+ {
+ p.SetState(196)
+ p.Match(RDLStatementParserCOMMA_)
+ }
+ {
+ p.SetState(197)
+ p.Match(RDLStatementParserCIPHER_DATA_TYPE)
+ }
+ {
+ p.SetState(198)
+ p.Match(RDLStatementParserEQ_)
+ }
+ {
+ p.SetState(199)
+ p.DataType()
+ }
+
+ }
+
+ return localctx
+}
+
+// ICipherColumnNameContext is an interface to support dynamic dispatch.
+type ICipherColumnNameContext interface {
+ antlr.ParserRuleContext
+
+ // GetParser returns the parser.
+ GetParser() antlr.Parser
+
+ // IsCipherColumnNameContext differentiates from other interfaces.
+ IsCipherColumnNameContext()
+}
+
+type CipherColumnNameContext struct {
+ *antlr.BaseParserRuleContext
+ parser antlr.Parser
+}
+
+func NewEmptyCipherColumnNameContext() *CipherColumnNameContext {
+ var p = new(CipherColumnNameContext)
+ p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
+ p.RuleIndex = RDLStatementParserRULE_cipherColumnName
+ return p
+}
+
+func (*CipherColumnNameContext) IsCipherColumnNameContext() {}
+
+func NewCipherColumnNameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *CipherColumnNameContext {
+ var p = new(CipherColumnNameContext)
+
+ p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
+
+ p.parser = parser
+ p.RuleIndex = RDLStatementParserRULE_cipherColumnName
+
+ return p
+}
+
+func (s *CipherColumnNameContext) GetParser() antlr.Parser { return s.parser }
+
+func (s *CipherColumnNameContext) IDENTIFIER_() antlr.TerminalNode {
+ return s.GetToken(RDLStatementParserIDENTIFIER_, 0)
+}
+
+func (s *CipherColumnNameContext) GetRuleContext() antlr.RuleContext {
+ return s
+}
+
+func (s *CipherColumnNameContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
+ return antlr.TreesStringTree(s, ruleNames, recog)
+}
+
+func (s *CipherColumnNameContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
+ switch t := visitor.(type) {
+ case RDLStatementVisitor:
+ return t.VisitCipherColumnName(s)
+
+ default:
+ return t.VisitChildren(s)
+ }
+}
+
+func (p *RDLStatementParser) CipherColumnName() (localctx ICipherColumnNameContext) {
+ localctx = NewCipherColumnNameContext(p, p.GetParserRuleContext(), p.GetState())
+ p.EnterRule(localctx, 26, RDLStatementParserRULE_cipherColumnName)
+
+ defer func() {
+ p.ExitRule()
+ }()
+
+ defer func() {
+ if err := recover(); err != nil {
+ if v, ok := err.(antlr.RecognitionException); ok {
+ localctx.SetException(v)
+ p.GetErrorHandler().ReportError(p, v)
+ p.GetErrorHandler().Recover(p, v)
+ } else {
+ panic(err)
+ }
+ }
+ }()
+
+ p.EnterOuterAlt(localctx, 1)
+ {
+ p.SetState(202)
+ p.Match(RDLStatementParserIDENTIFIER_)
+ }
+
+ return localctx
+}
+
+// IAssistedQueryColumnDefinitionContext is an interface to support dynamic dispatch.
+type IAssistedQueryColumnDefinitionContext interface {
+ antlr.ParserRuleContext
+
+ // GetParser returns the parser.
+ GetParser() antlr.Parser
+
+ // IsAssistedQueryColumnDefinitionContext differentiates from other interfaces.
+ IsAssistedQueryColumnDefinitionContext()
+}
+
+type AssistedQueryColumnDefinitionContext struct {
+ *antlr.BaseParserRuleContext
+ parser antlr.Parser
+}
+
+func NewEmptyAssistedQueryColumnDefinitionContext() *AssistedQueryColumnDefinitionContext {
+ var p = new(AssistedQueryColumnDefinitionContext)
+ p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
+ p.RuleIndex = RDLStatementParserRULE_assistedQueryColumnDefinition
+ return p
+}
+
+func (*AssistedQueryColumnDefinitionContext) IsAssistedQueryColumnDefinitionContext() {}
+
+func NewAssistedQueryColumnDefinitionContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *AssistedQueryColumnDefinitionContext {
+ var p = new(AssistedQueryColumnDefinitionContext)
+
+ p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
+
+ p.parser = parser
+ p.RuleIndex = RDLStatementParserRULE_assistedQueryColumnDefinition
+
+ return p
+}
+
+func (s *AssistedQueryColumnDefinitionContext) GetParser() antlr.Parser { return s.parser }
+
+func (s *AssistedQueryColumnDefinitionContext) ASSISTED_QUERY_COLUMN() antlr.TerminalNode {
+ return s.GetToken(RDLStatementParserASSISTED_QUERY_COLUMN, 0)
+}
+
+func (s *AssistedQueryColumnDefinitionContext) AllEQ_() []antlr.TerminalNode {
+ return s.GetTokens(RDLStatementParserEQ_)
+}
+
+func (s *AssistedQueryColumnDefinitionContext) EQ_(i int) antlr.TerminalNode {
+ return s.GetToken(RDLStatementParserEQ_, i)
+}
+
+func (s *AssistedQueryColumnDefinitionContext) AssistedQueryColumnName() IAssistedQueryColumnNameContext {
+ var t = s.GetTypedRuleContext(reflect.TypeOf((*IAssistedQueryColumnNameContext)(nil)).Elem(), 0)
+
+ if t == nil {
+ return nil
+ }
+
+ return t.(IAssistedQueryColumnNameContext)
+}
+
+func (s *AssistedQueryColumnDefinitionContext) COMMA_() antlr.TerminalNode {
+ return s.GetToken(RDLStatementParserCOMMA_, 0)
+}
+
+func (s *AssistedQueryColumnDefinitionContext) ASSISTED_QUERY_DATA_TYPE() antlr.TerminalNode {
+ return s.GetToken(RDLStatementParserASSISTED_QUERY_DATA_TYPE, 0)
+}
+
+func (s *AssistedQueryColumnDefinitionContext) DataType() IDataTypeContext {
+ var t = s.GetTypedRuleContext(reflect.TypeOf((*IDataTypeContext)(nil)).Elem(), 0)
+
+ if t == nil {
+ return nil
+ }
+
+ return t.(IDataTypeContext)
+}
+
+func (s *AssistedQueryColumnDefinitionContext) GetRuleContext() antlr.RuleContext {
+ return s
+}
+
+func (s *AssistedQueryColumnDefinitionContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
+ return antlr.TreesStringTree(s, ruleNames, recog)
+}
+
+func (s *AssistedQueryColumnDefinitionContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
+ switch t := visitor.(type) {
+ case RDLStatementVisitor:
+ return t.VisitAssistedQueryColumnDefinition(s)
+
+ default:
+ return t.VisitChildren(s)
+ }
+}
+
+func (p *RDLStatementParser) AssistedQueryColumnDefinition() (localctx IAssistedQueryColumnDefinitionContext) {
+ localctx = NewAssistedQueryColumnDefinitionContext(p, p.GetParserRuleContext(), p.GetState())
+ p.EnterRule(localctx, 28, RDLStatementParserRULE_assistedQueryColumnDefinition)
+
+ defer func() {
+ p.ExitRule()
+ }()
+
+ defer func() {
+ if err := recover(); err != nil {
+ if v, ok := err.(antlr.RecognitionException); ok {
+ localctx.SetException(v)
+ p.GetErrorHandler().ReportError(p, v)
+ p.GetErrorHandler().Recover(p, v)
+ } else {
+ panic(err)
+ }
+ }
+ }()
+
+ p.EnterOuterAlt(localctx, 1)
+ {
+ p.SetState(204)
+ p.Match(RDLStatementParserASSISTED_QUERY_COLUMN)
+ }
+ {
+ p.SetState(205)
+ p.Match(RDLStatementParserEQ_)
+ }
+ {
+ p.SetState(206)
+ p.AssistedQueryColumnName()
+ }
+ p.SetState(211)
+ p.GetErrorHandler().Sync(p)
+
+ if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 17, p.GetParserRuleContext()) == 1 {
+ {
+ p.SetState(207)
+ p.Match(RDLStatementParserCOMMA_)
+ }
+ {
+ p.SetState(208)
+ p.Match(RDLStatementParserASSISTED_QUERY_DATA_TYPE)
+ }
+ {
+ p.SetState(209)
+ p.Match(RDLStatementParserEQ_)
+ }
+ {
+ p.SetState(210)
+ p.DataType()
+ }
+
+ }
+
+ return localctx
+}
+
+// IAssistedQueryColumnNameContext is an interface to support dynamic dispatch.
+type IAssistedQueryColumnNameContext interface {
+ antlr.ParserRuleContext
+
+ // GetParser returns the parser.
+ GetParser() antlr.Parser
+
+ // IsAssistedQueryColumnNameContext differentiates from other interfaces.
+ IsAssistedQueryColumnNameContext()
+}
+
+type AssistedQueryColumnNameContext struct {
+ *antlr.BaseParserRuleContext
+ parser antlr.Parser
+}
+
+func NewEmptyAssistedQueryColumnNameContext() *AssistedQueryColumnNameContext {
+ var p = new(AssistedQueryColumnNameContext)
+ p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
+ p.RuleIndex = RDLStatementParserRULE_assistedQueryColumnName
+ return p
+}
+
+func (*AssistedQueryColumnNameContext) IsAssistedQueryColumnNameContext() {}
+
+func NewAssistedQueryColumnNameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *AssistedQueryColumnNameContext {
+ var p = new(AssistedQueryColumnNameContext)
+
+ p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
+
+ p.parser = parser
+ p.RuleIndex = RDLStatementParserRULE_assistedQueryColumnName
+
+ return p
+}
+
+func (s *AssistedQueryColumnNameContext) GetParser() antlr.Parser { return s.parser }
+
+func (s *AssistedQueryColumnNameContext) IDENTIFIER_() antlr.TerminalNode {
+ return s.GetToken(RDLStatementParserIDENTIFIER_, 0)
+}
+
+func (s *AssistedQueryColumnNameContext) GetRuleContext() antlr.RuleContext {
+ return s
+}
+
+func (s *AssistedQueryColumnNameContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
+ return antlr.TreesStringTree(s, ruleNames, recog)
+}
+
+func (s *AssistedQueryColumnNameContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
+ switch t := visitor.(type) {
+ case RDLStatementVisitor:
+ return t.VisitAssistedQueryColumnName(s)
+
+ default:
+ return t.VisitChildren(s)
+ }
+}
+
+func (p *RDLStatementParser) AssistedQueryColumnName() (localctx IAssistedQueryColumnNameContext) {
+ localctx = NewAssistedQueryColumnNameContext(p, p.GetParserRuleContext(), p.GetState())
+ p.EnterRule(localctx, 30, RDLStatementParserRULE_assistedQueryColumnName)
+
+ defer func() {
+ p.ExitRule()
+ }()
+
+ defer func() {
+ if err := recover(); err != nil {
+ if v, ok := err.(antlr.RecognitionException); ok {
+ localctx.SetException(v)
+ p.GetErrorHandler().ReportError(p, v)
+ p.GetErrorHandler().Recover(p, v)
+ } else {
+ panic(err)
+ }
+ }
+ }()
+
+ p.EnterOuterAlt(localctx, 1)
+ {
+ p.SetState(213)
+ p.Match(RDLStatementParserIDENTIFIER_)
+ }
+
+ return localctx
+}
+
+// ILikeQueryColumnDefinitionContext is an interface to support dynamic dispatch.
+type ILikeQueryColumnDefinitionContext interface {
+ antlr.ParserRuleContext
+
+ // GetParser returns the parser.
+ GetParser() antlr.Parser
+
+ // IsLikeQueryColumnDefinitionContext differentiates from other interfaces.
+ IsLikeQueryColumnDefinitionContext()
+}
+
+type LikeQueryColumnDefinitionContext struct {
+ *antlr.BaseParserRuleContext
+ parser antlr.Parser
+}
+
+func NewEmptyLikeQueryColumnDefinitionContext() *LikeQueryColumnDefinitionContext {
+ var p = new(LikeQueryColumnDefinitionContext)
+ p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
+ p.RuleIndex = RDLStatementParserRULE_likeQueryColumnDefinition
+ return p
+}
+
+func (*LikeQueryColumnDefinitionContext) IsLikeQueryColumnDefinitionContext() {}
+
+func NewLikeQueryColumnDefinitionContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *LikeQueryColumnDefinitionContext {
+ var p = new(LikeQueryColumnDefinitionContext)
+
+ p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
+
+ p.parser = parser
+ p.RuleIndex = RDLStatementParserRULE_likeQueryColumnDefinition
+
+ return p
+}
+
+func (s *LikeQueryColumnDefinitionContext) GetParser() antlr.Parser { return s.parser }
+
+func (s *LikeQueryColumnDefinitionContext) LIKE_QUERY_COLUMN() antlr.TerminalNode {
+ return s.GetToken(RDLStatementParserLIKE_QUERY_COLUMN, 0)
+}
+
+func (s *LikeQueryColumnDefinitionContext) AllEQ_() []antlr.TerminalNode {
+ return s.GetTokens(RDLStatementParserEQ_)
+}
+
+func (s *LikeQueryColumnDefinitionContext) EQ_(i int) antlr.TerminalNode {
+ return s.GetToken(RDLStatementParserEQ_, i)
+}
+
+func (s *LikeQueryColumnDefinitionContext) LikeQueryColumnName() ILikeQueryColumnNameContext {
+ var t = s.GetTypedRuleContext(reflect.TypeOf((*ILikeQueryColumnNameContext)(nil)).Elem(), 0)
+
+ if t == nil {
+ return nil
+ }
+
+ return t.(ILikeQueryColumnNameContext)
+}
+
+func (s *LikeQueryColumnDefinitionContext) COMMA_() antlr.TerminalNode {
+ return s.GetToken(RDLStatementParserCOMMA_, 0)
+}
+
+func (s *LikeQueryColumnDefinitionContext) LIKE_QUERY_DATA_TYPE() antlr.TerminalNode {
+ return s.GetToken(RDLStatementParserLIKE_QUERY_DATA_TYPE, 0)
+}
+
+func (s *LikeQueryColumnDefinitionContext) DataType() IDataTypeContext {
+ var t = s.GetTypedRuleContext(reflect.TypeOf((*IDataTypeContext)(nil)).Elem(), 0)
+
+ if t == nil {
+ return nil
+ }
+
+ return t.(IDataTypeContext)
+}
+
+func (s *LikeQueryColumnDefinitionContext) GetRuleContext() antlr.RuleContext {
+ return s
+}
+
+func (s *LikeQueryColumnDefinitionContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
+ return antlr.TreesStringTree(s, ruleNames, recog)
+}
+
+func (s *LikeQueryColumnDefinitionContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
+ switch t := visitor.(type) {
+ case RDLStatementVisitor:
+ return t.VisitLikeQueryColumnDefinition(s)
+
+ default:
+ return t.VisitChildren(s)
+ }
+}
+
+func (p *RDLStatementParser) LikeQueryColumnDefinition() (localctx ILikeQueryColumnDefinitionContext) {
+ localctx = NewLikeQueryColumnDefinitionContext(p, p.GetParserRuleContext(), p.GetState())
+ p.EnterRule(localctx, 32, RDLStatementParserRULE_likeQueryColumnDefinition)
+
+ defer func() {
+ p.ExitRule()
+ }()
+
+ defer func() {
+ if err := recover(); err != nil {
+ if v, ok := err.(antlr.RecognitionException); ok {
+ localctx.SetException(v)
+ p.GetErrorHandler().ReportError(p, v)
+ p.GetErrorHandler().Recover(p, v)
+ } else {
+ panic(err)
+ }
+ }
+ }()
+
+ p.EnterOuterAlt(localctx, 1)
+ {
+ p.SetState(215)
+ p.Match(RDLStatementParserLIKE_QUERY_COLUMN)
+ }
+ {
+ p.SetState(216)
+ p.Match(RDLStatementParserEQ_)
+ }
+ {
+ p.SetState(217)
+ p.LikeQueryColumnName()
+ }
+ p.SetState(222)
+ p.GetErrorHandler().Sync(p)
+
+ if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 18, p.GetParserRuleContext()) == 1 {
+ {
+ p.SetState(218)
+ p.Match(RDLStatementParserCOMMA_)
+ }
+ {
+ p.SetState(219)
+ p.Match(RDLStatementParserLIKE_QUERY_DATA_TYPE)
+ }
+ {
+ p.SetState(220)
+ p.Match(RDLStatementParserEQ_)
+ }
+ {
+ p.SetState(221)
+ p.DataType()
+ }
+
+ }
+
+ return localctx
+}
+
+// ILikeQueryColumnNameContext is an interface to support dynamic dispatch.
+type ILikeQueryColumnNameContext interface {
+ antlr.ParserRuleContext
+
+ // GetParser returns the parser.
+ GetParser() antlr.Parser
+
+ // IsLikeQueryColumnNameContext differentiates from other interfaces.
+ IsLikeQueryColumnNameContext()
+}
+
+type LikeQueryColumnNameContext struct {
+ *antlr.BaseParserRuleContext
+ parser antlr.Parser
+}
+
+func NewEmptyLikeQueryColumnNameContext() *LikeQueryColumnNameContext {
+ var p = new(LikeQueryColumnNameContext)
+ p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
+ p.RuleIndex = RDLStatementParserRULE_likeQueryColumnName
+ return p
+}
+
+func (*LikeQueryColumnNameContext) IsLikeQueryColumnNameContext() {}
+
+func NewLikeQueryColumnNameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *LikeQueryColumnNameContext {
+ var p = new(LikeQueryColumnNameContext)
+
+ p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
+
+ p.parser = parser
+ p.RuleIndex = RDLStatementParserRULE_likeQueryColumnName
+
+ return p
+}
+
+func (s *LikeQueryColumnNameContext) GetParser() antlr.Parser { return s.parser }
+
+func (s *LikeQueryColumnNameContext) IDENTIFIER_() antlr.TerminalNode {
+ return s.GetToken(RDLStatementParserIDENTIFIER_, 0)
+}
+
+func (s *LikeQueryColumnNameContext) GetRuleContext() antlr.RuleContext {
+ return s
+}
+
+func (s *LikeQueryColumnNameContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
+ return antlr.TreesStringTree(s, ruleNames, recog)
+}
+
+func (s *LikeQueryColumnNameContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
+ switch t := visitor.(type) {
+ case RDLStatementVisitor:
+ return t.VisitLikeQueryColumnName(s)
+
+ default:
+ return t.VisitChildren(s)
+ }
+}
+
+func (p *RDLStatementParser) LikeQueryColumnName() (localctx ILikeQueryColumnNameContext) {
+ localctx = NewLikeQueryColumnNameContext(p, p.GetParserRuleContext(), p.GetState())
+ p.EnterRule(localctx, 34, RDLStatementParserRULE_likeQueryColumnName)
+
+ defer func() {
+ p.ExitRule()
+ }()
+
+ defer func() {
+ if err := recover(); err != nil {
+ if v, ok := err.(antlr.RecognitionException); ok {
+ localctx.SetException(v)
+ p.GetErrorHandler().ReportError(p, v)
+ p.GetErrorHandler().Recover(p, v)
+ } else {
+ panic(err)
+ }
+ }
+ }()
+
+ p.EnterOuterAlt(localctx, 1)
+ {
+ p.SetState(224)
+ p.Match(RDLStatementParserIDENTIFIER_)
+ }
+
+ return localctx
+}
+
+// IEncryptAlgorithmContext is an interface to support dynamic dispatch.
+type IEncryptAlgorithmContext interface {
+ antlr.ParserRuleContext
+
+ // GetParser returns the parser.
+ GetParser() antlr.Parser
+
+ // IsEncryptAlgorithmContext differentiates from other interfaces.
+ IsEncryptAlgorithmContext()
+}
+
+type EncryptAlgorithmContext struct {
+ *antlr.BaseParserRuleContext
+ parser antlr.Parser
+}
+
+func NewEmptyEncryptAlgorithmContext() *EncryptAlgorithmContext {
+ var p = new(EncryptAlgorithmContext)
+ p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
+ p.RuleIndex = RDLStatementParserRULE_encryptAlgorithm
+ return p
+}
+
+func (*EncryptAlgorithmContext) IsEncryptAlgorithmContext() {}
+
+func NewEncryptAlgorithmContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *EncryptAlgorithmContext {
+ var p = new(EncryptAlgorithmContext)
+
+ p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
+
+ p.parser = parser
+ p.RuleIndex = RDLStatementParserRULE_encryptAlgorithm
+
+ return p
+}
+
+func (s *EncryptAlgorithmContext) GetParser() antlr.Parser { return s.parser }
+
+func (s *EncryptAlgorithmContext) ENCRYPT_ALGORITHM() antlr.TerminalNode {
+ return s.GetToken(RDLStatementParserENCRYPT_ALGORITHM, 0)
+}
+
+func (s *EncryptAlgorithmContext) LP_() antlr.TerminalNode {
+ return s.GetToken(RDLStatementParserLP_, 0)
+}
+
+func (s *EncryptAlgorithmContext) AlgorithmDefinition() IAlgorithmDefinitionContext {
+ var t = s.GetTypedRuleContext(reflect.TypeOf((*IAlgorithmDefinitionContext)(nil)).Elem(), 0)
+
+ if t == nil {
+ return nil
+ }
+
+ return t.(IAlgorithmDefinitionContext)
+}
+
+func (s *EncryptAlgorithmContext) RP_() antlr.TerminalNode {
+ return s.GetToken(RDLStatementParserRP_, 0)
+}
+
+func (s *EncryptAlgorithmContext) GetRuleContext() antlr.RuleContext {
+ return s
+}
+
+func (s *EncryptAlgorithmContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
+ return antlr.TreesStringTree(s, ruleNames, recog)
+}
+
+func (s *EncryptAlgorithmContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
+ switch t := visitor.(type) {
+ case RDLStatementVisitor:
+ return t.VisitEncryptAlgorithm(s)
+
+ default:
+ return t.VisitChildren(s)
+ }
+}
+
+func (p *RDLStatementParser) EncryptAlgorithm() (localctx IEncryptAlgorithmContext) {
+ localctx = NewEncryptAlgorithmContext(p, p.GetParserRuleContext(), p.GetState())
+ p.EnterRule(localctx, 36, RDLStatementParserRULE_encryptAlgorithm)
+
+ defer func() {
+ p.ExitRule()
+ }()
+
+ defer func() {
+ if err := recover(); err != nil {
+ if v, ok := err.(antlr.RecognitionException); ok {
+ localctx.SetException(v)
+ p.GetErrorHandler().ReportError(p, v)
+ p.GetErrorHandler().Recover(p, v)
+ } else {
+ panic(err)
+ }
+ }
+ }()
+
+ p.EnterOuterAlt(localctx, 1)
+ {
+ p.SetState(226)
+ p.Match(RDLStatementParserENCRYPT_ALGORITHM)
+ }
+ {
+ p.SetState(227)
+ p.Match(RDLStatementParserLP_)
+ }
+ {
+ p.SetState(228)
+ p.AlgorithmDefinition()
+ }
+ {
+ p.SetState(229)
+ p.Match(RDLStatementParserRP_)
+ }
+
+ return localctx
+}
+
+// IAssistedQueryAlgorithmContext is an interface to support dynamic dispatch.
+type IAssistedQueryAlgorithmContext interface {
+ antlr.ParserRuleContext
+
+ // GetParser returns the parser.
+ GetParser() antlr.Parser
+
+ // IsAssistedQueryAlgorithmContext differentiates from other interfaces.
+ IsAssistedQueryAlgorithmContext()
+}
+
+type AssistedQueryAlgorithmContext struct {
+ *antlr.BaseParserRuleContext
+ parser antlr.Parser
+}
+
+func NewEmptyAssistedQueryAlgorithmContext() *AssistedQueryAlgorithmContext {
+ var p = new(AssistedQueryAlgorithmContext)
+ p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
+ p.RuleIndex = RDLStatementParserRULE_assistedQueryAlgorithm
+ return p
+}
+
+func (*AssistedQueryAlgorithmContext) IsAssistedQueryAlgorithmContext() {}
+
+func NewAssistedQueryAlgorithmContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *AssistedQueryAlgorithmContext {
+ var p = new(AssistedQueryAlgorithmContext)
+
+ p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
+
+ p.parser = parser
+ p.RuleIndex = RDLStatementParserRULE_assistedQueryAlgorithm
+
+ return p
+}
+
+func (s *AssistedQueryAlgorithmContext) GetParser() antlr.Parser { return s.parser }
+
+func (s *AssistedQueryAlgorithmContext) ASSISTED_QUERY_ALGORITHM() antlr.TerminalNode {
+ return s.GetToken(RDLStatementParserASSISTED_QUERY_ALGORITHM, 0)
+}
+
+func (s *AssistedQueryAlgorithmContext) LP_() antlr.TerminalNode {
+ return s.GetToken(RDLStatementParserLP_, 0)
+}
+
+func (s *AssistedQueryAlgorithmContext) AlgorithmDefinition() IAlgorithmDefinitionContext {
+ var t = s.GetTypedRuleContext(reflect.TypeOf((*IAlgorithmDefinitionContext)(nil)).Elem(), 0)
+
+ if t == nil {
+ return nil
+ }
+
+ return t.(IAlgorithmDefinitionContext)
+}
+
+func (s *AssistedQueryAlgorithmContext) RP_() antlr.TerminalNode {
+ return s.GetToken(RDLStatementParserRP_, 0)
+}
+
+func (s *AssistedQueryAlgorithmContext) GetRuleContext() antlr.RuleContext {
+ return s
+}
+
+func (s *AssistedQueryAlgorithmContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
+ return antlr.TreesStringTree(s, ruleNames, recog)
+}
+
+func (s *AssistedQueryAlgorithmContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
+ switch t := visitor.(type) {
+ case RDLStatementVisitor:
+ return t.VisitAssistedQueryAlgorithm(s)
+
+ default:
+ return t.VisitChildren(s)
+ }
+}
+
+func (p *RDLStatementParser) AssistedQueryAlgorithm() (localctx IAssistedQueryAlgorithmContext) {
+ localctx = NewAssistedQueryAlgorithmContext(p, p.GetParserRuleContext(), p.GetState())
+ p.EnterRule(localctx, 38, RDLStatementParserRULE_assistedQueryAlgorithm)
+
+ defer func() {
+ p.ExitRule()
+ }()
+
+ defer func() {
+ if err := recover(); err != nil {
+ if v, ok := err.(antlr.RecognitionException); ok {
+ localctx.SetException(v)
+ p.GetErrorHandler().ReportError(p, v)
+ p.GetErrorHandler().Recover(p, v)
+ } else {
+ panic(err)
+ }
+ }
+ }()
+
+ p.EnterOuterAlt(localctx, 1)
+ {
+ p.SetState(231)
+ p.Match(RDLStatementParserASSISTED_QUERY_ALGORITHM)
+ }
+ {
+ p.SetState(232)
+ p.Match(RDLStatementParserLP_)
+ }
+ {
+ p.SetState(233)
+ p.AlgorithmDefinition()
+ }
+ {
+ p.SetState(234)
+ p.Match(RDLStatementParserRP_)
+ }
+
+ return localctx
+}
+
+// ILikeQueryAlgorithmContext is an interface to support dynamic dispatch.
+type ILikeQueryAlgorithmContext interface {
+ antlr.ParserRuleContext
+
+ // GetParser returns the parser.
+ GetParser() antlr.Parser
+
+ // IsLikeQueryAlgorithmContext differentiates from other interfaces.
+ IsLikeQueryAlgorithmContext()
+}
+
+type LikeQueryAlgorithmContext struct {
+ *antlr.BaseParserRuleContext
+ parser antlr.Parser
+}
+
+func NewEmptyLikeQueryAlgorithmContext() *LikeQueryAlgorithmContext {
+ var p = new(LikeQueryAlgorithmContext)
+ p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
+ p.RuleIndex = RDLStatementParserRULE_likeQueryAlgorithm
+ return p
+}
+
+func (*LikeQueryAlgorithmContext) IsLikeQueryAlgorithmContext() {}
+
+func NewLikeQueryAlgorithmContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *LikeQueryAlgorithmContext {
+ var p = new(LikeQueryAlgorithmContext)
+
+ p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
+
+ p.parser = parser
+ p.RuleIndex = RDLStatementParserRULE_likeQueryAlgorithm
+
+ return p
+}
+
+func (s *LikeQueryAlgorithmContext) GetParser() antlr.Parser { return s.parser }
+
+func (s *LikeQueryAlgorithmContext) LIKE_QUERY_ALGORITHM() antlr.TerminalNode {
+ return s.GetToken(RDLStatementParserLIKE_QUERY_ALGORITHM, 0)
+}
+
+func (s *LikeQueryAlgorithmContext) LP_() antlr.TerminalNode {
+ return s.GetToken(RDLStatementParserLP_, 0)
+}
+
+func (s *LikeQueryAlgorithmContext) AlgorithmDefinition() IAlgorithmDefinitionContext {
+ var t = s.GetTypedRuleContext(reflect.TypeOf((*IAlgorithmDefinitionContext)(nil)).Elem(), 0)
+
+ if t == nil {
+ return nil
+ }
+
+ return t.(IAlgorithmDefinitionContext)
+}
+
+func (s *LikeQueryAlgorithmContext) RP_() antlr.TerminalNode {
+ return s.GetToken(RDLStatementParserRP_, 0)
+}
+
+func (s *LikeQueryAlgorithmContext) GetRuleContext() antlr.RuleContext {
+ return s
+}
+
+func (s *LikeQueryAlgorithmContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
+ return antlr.TreesStringTree(s, ruleNames, recog)
+}
+
+func (s *LikeQueryAlgorithmContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
+ switch t := visitor.(type) {
+ case RDLStatementVisitor:
+ return t.VisitLikeQueryAlgorithm(s)
+
+ default:
+ return t.VisitChildren(s)
+ }
+}
+
+func (p *RDLStatementParser) LikeQueryAlgorithm() (localctx ILikeQueryAlgorithmContext) {
+ localctx = NewLikeQueryAlgorithmContext(p, p.GetParserRuleContext(), p.GetState())
+ p.EnterRule(localctx, 40, RDLStatementParserRULE_likeQueryAlgorithm)
+
+ defer func() {
+ p.ExitRule()
+ }()
+
+ defer func() {
+ if err := recover(); err != nil {
+ if v, ok := err.(antlr.RecognitionException); ok {
+ localctx.SetException(v)
+ p.GetErrorHandler().ReportError(p, v)
+ p.GetErrorHandler().Recover(p, v)
+ } else {
+ panic(err)
+ }
+ }
+ }()
+
+ p.EnterOuterAlt(localctx, 1)
+ {
+ p.SetState(236)
+ p.Match(RDLStatementParserLIKE_QUERY_ALGORITHM)
+ }
+ {
+ p.SetState(237)
+ p.Match(RDLStatementParserLP_)
+ }
+ {
+ p.SetState(238)
+ p.AlgorithmDefinition()
+ }
+ {
+ p.SetState(239)
+ p.Match(RDLStatementParserRP_)
+ }
+
+ return localctx
+}
+
+// IQueryWithCipherColumnContext is an interface to support dynamic dispatch.
+type IQueryWithCipherColumnContext interface {
+ antlr.ParserRuleContext
+
+ // GetParser returns the parser.
+ GetParser() antlr.Parser
+
+ // IsQueryWithCipherColumnContext differentiates from other interfaces.
+ IsQueryWithCipherColumnContext()
+}
+
+type QueryWithCipherColumnContext struct {
+ *antlr.BaseParserRuleContext
+ parser antlr.Parser
+}
+
+func NewEmptyQueryWithCipherColumnContext() *QueryWithCipherColumnContext {
+ var p = new(QueryWithCipherColumnContext)
+ p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
+ p.RuleIndex = RDLStatementParserRULE_queryWithCipherColumn
+ return p
+}
+
+func (*QueryWithCipherColumnContext) IsQueryWithCipherColumnContext() {}
+
+func NewQueryWithCipherColumnContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *QueryWithCipherColumnContext {
+ var p = new(QueryWithCipherColumnContext)
+
+ p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
+
+ p.parser = parser
+ p.RuleIndex = RDLStatementParserRULE_queryWithCipherColumn
+
+ return p
+}
+
+func (s *QueryWithCipherColumnContext) GetParser() antlr.Parser { return s.parser }
+
+func (s *QueryWithCipherColumnContext) TRUE() antlr.TerminalNode {
+ return s.GetToken(RDLStatementParserTRUE, 0)
+}
+
+func (s *QueryWithCipherColumnContext) FALSE() antlr.TerminalNode {
+ return s.GetToken(RDLStatementParserFALSE, 0)
+}
+
+func (s *QueryWithCipherColumnContext) GetRuleContext() antlr.RuleContext {
+ return s
+}
+
+func (s *QueryWithCipherColumnContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
+ return antlr.TreesStringTree(s, ruleNames, recog)
+}
+
+func (s *QueryWithCipherColumnContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
+ switch t := visitor.(type) {
+ case RDLStatementVisitor:
+ return t.VisitQueryWithCipherColumn(s)
+
+ default:
+ return t.VisitChildren(s)
+ }
+}
+
+func (p *RDLStatementParser) QueryWithCipherColumn() (localctx IQueryWithCipherColumnContext) {
+ localctx = NewQueryWithCipherColumnContext(p, p.GetParserRuleContext(), p.GetState())
+ p.EnterRule(localctx, 42, RDLStatementParserRULE_queryWithCipherColumn)
+ var _la int
+
+ defer func() {
+ p.ExitRule()
+ }()
+
+ defer func() {
+ if err := recover(); err != nil {
+ if v, ok := err.(antlr.RecognitionException); ok {
+ localctx.SetException(v)
+ p.GetErrorHandler().ReportError(p, v)
+ p.GetErrorHandler().Recover(p, v)
+ } else {
+ panic(err)
+ }
+ }
+ }()
+
+ p.EnterOuterAlt(localctx, 1)
+ {
+ p.SetState(241)
+ _la = p.GetTokenStream().LA(1)
+
+ if !(_la == RDLStatementParserTRUE || _la == RDLStatementParserFALSE) {
+ p.GetErrorHandler().RecoverInline(p)
+ } else {
+ p.GetErrorHandler().ReportMatch(p)
+ p.Consume()
+ }
+ }
+
+ return localctx
+}
+
+// IIfExistsContext is an interface to support dynamic dispatch.
+type IIfExistsContext interface {
+ antlr.ParserRuleContext
+
+ // GetParser returns the parser.
+ GetParser() antlr.Parser
+
+ // IsIfExistsContext differentiates from other interfaces.
+ IsIfExistsContext()
+}
+
+type IfExistsContext struct {
+ *antlr.BaseParserRuleContext
+ parser antlr.Parser
+}
+
+func NewEmptyIfExistsContext() *IfExistsContext {
+ var p = new(IfExistsContext)
+ p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
+ p.RuleIndex = RDLStatementParserRULE_ifExists
+ return p
+}
+
+func (*IfExistsContext) IsIfExistsContext() {}
+
+func NewIfExistsContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *IfExistsContext {
+ var p = new(IfExistsContext)
+
+ p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
+
+ p.parser = parser
+ p.RuleIndex = RDLStatementParserRULE_ifExists
+
+ return p
+}
+
+func (s *IfExistsContext) GetParser() antlr.Parser { return s.parser }
+
+func (s *IfExistsContext) IF() antlr.TerminalNode {
+ return s.GetToken(RDLStatementParserIF, 0)
+}
+
+func (s *IfExistsContext) EXISTS() antlr.TerminalNode {
+ return s.GetToken(RDLStatementParserEXISTS, 0)
+}
+
+func (s *IfExistsContext) GetRuleContext() antlr.RuleContext {
+ return s
+}
+
+func (s *IfExistsContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
+ return antlr.TreesStringTree(s, ruleNames, recog)
+}
+
+func (s *IfExistsContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
+ switch t := visitor.(type) {
+ case RDLStatementVisitor:
+ return t.VisitIfExists(s)
+
+ default:
+ return t.VisitChildren(s)
+ }
+}
+
+func (p *RDLStatementParser) IfExists() (localctx IIfExistsContext) {
+ localctx = NewIfExistsContext(p, p.GetParserRuleContext(), p.GetState())
+ p.EnterRule(localctx, 44, RDLStatementParserRULE_ifExists)
+
+ defer func() {
+ p.ExitRule()
+ }()
+
+ defer func() {
+ if err := recover(); err != nil {
+ if v, ok := err.(antlr.RecognitionException); ok {
+ localctx.SetException(v)
+ p.GetErrorHandler().ReportError(p, v)
+ p.GetErrorHandler().Recover(p, v)
+ } else {
+ panic(err)
+ }
+ }
+ }()
+
+ p.EnterOuterAlt(localctx, 1)
+ {
+ p.SetState(243)
+ p.Match(RDLStatementParserIF)
+ }
+ {
+ p.SetState(244)
+ p.Match(RDLStatementParserEXISTS)
+ }
+
+ return localctx
+}
+
+// IIfNotExistsContext is an interface to support dynamic dispatch.
+type IIfNotExistsContext interface {
+ antlr.ParserRuleContext
+
+ // GetParser returns the parser.
+ GetParser() antlr.Parser
+
+ // IsIfNotExistsContext differentiates from other interfaces.
+ IsIfNotExistsContext()
+}
+
+type IfNotExistsContext struct {
+ *antlr.BaseParserRuleContext
+ parser antlr.Parser
+}
+
+func NewEmptyIfNotExistsContext() *IfNotExistsContext {
+ var p = new(IfNotExistsContext)
+ p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
+ p.RuleIndex = RDLStatementParserRULE_ifNotExists
+ return p
+}
+
+func (*IfNotExistsContext) IsIfNotExistsContext() {}
+
+func NewIfNotExistsContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *IfNotExistsContext {
+ var p = new(IfNotExistsContext)
+
+ p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
+
+ p.parser = parser
+ p.RuleIndex = RDLStatementParserRULE_ifNotExists
+
+ return p
+}
+
+func (s *IfNotExistsContext) GetParser() antlr.Parser { return s.parser }
+
+func (s *IfNotExistsContext) IF() antlr.TerminalNode {
+ return s.GetToken(RDLStatementParserIF, 0)
+}
+
+func (s *IfNotExistsContext) NOT() antlr.TerminalNode {
+ return s.GetToken(RDLStatementParserNOT, 0)
+}
+
+func (s *IfNotExistsContext) EXISTS() antlr.TerminalNode {
+ return s.GetToken(RDLStatementParserEXISTS, 0)
+}
+
+func (s *IfNotExistsContext) GetRuleContext() antlr.RuleContext {
+ return s
+}
+
+func (s *IfNotExistsContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
+ return antlr.TreesStringTree(s, ruleNames, recog)
+}
+
+func (s *IfNotExistsContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
+ switch t := visitor.(type) {
+ case RDLStatementVisitor:
+ return t.VisitIfNotExists(s)
+
+ default:
+ return t.VisitChildren(s)
+ }
+}
+
+func (p *RDLStatementParser) IfNotExists() (localctx IIfNotExistsContext) {
+ localctx = NewIfNotExistsContext(p, p.GetParserRuleContext(), p.GetState())
+ p.EnterRule(localctx, 46, RDLStatementParserRULE_ifNotExists)
+
+ defer func() {
+ p.ExitRule()
+ }()
+
+ defer func() {
+ if err := recover(); err != nil {
+ if v, ok := err.(antlr.RecognitionException); ok {
+ localctx.SetException(v)
+ p.GetErrorHandler().ReportError(p, v)
+ p.GetErrorHandler().Recover(p, v)
+ } else {
+ panic(err)
+ }
+ }
+ }()
+
+ p.EnterOuterAlt(localctx, 1)
+ {
+ p.SetState(246)
+ p.Match(RDLStatementParserIF)
+ }
+ {
+ p.SetState(247)
+ p.Match(RDLStatementParserNOT)
+ }
+ {
+ p.SetState(248)
+ p.Match(RDLStatementParserEXISTS)
+ }
+
+ return localctx
+}
+
+// ILiteralContext is an interface to support dynamic dispatch.
+type ILiteralContext interface {
+ antlr.ParserRuleContext
+
+ // GetParser returns the parser.
+ GetParser() antlr.Parser
+
+ // IsLiteralContext differentiates from other interfaces.
+ IsLiteralContext()
+}
+
+type LiteralContext struct {
+ *antlr.BaseParserRuleContext
+ parser antlr.Parser
+}
+
+func NewEmptyLiteralContext() *LiteralContext {
+ var p = new(LiteralContext)
+ p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
+ p.RuleIndex = RDLStatementParserRULE_literal
+ return p
+}
+
+func (*LiteralContext) IsLiteralContext() {}
+
+func NewLiteralContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *LiteralContext {
+ var p = new(LiteralContext)
+
+ p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
+
+ p.parser = parser
+ p.RuleIndex = RDLStatementParserRULE_literal
+
+ return p
+}
+
+func (s *LiteralContext) GetParser() antlr.Parser { return s.parser }
+
... 2760 lines suppressed ...