Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: enable revive linter rule unused-receiver (#2001)

Yilong Li8140130a760c
diff --git a/.golangci.yaml b/.golangci.yaml
index 3d77b31053..2ad55ec4c5 100644
--- a/.golangci.yaml
+++ b/.golangci.yaml
@@ -67,8 +67,6 @@ linters-settings:
- name: early-return
disabled: true
# TODO(dragonly): Remove the rules below in the following PRs.
- - name: unused-receiver
- disabled: true
- name: unhandled-error
disabled: true
- name: if-return
diff --git a/plugin/advisor/mysql/advisor_column_no_null.go b/plugin/advisor/mysql/advisor_column_no_null.go
index 5901c1a2a1..22a0334304 100644
--- a/plugin/advisor/mysql/advisor_column_no_null.go
+++ b/plugin/advisor/mysql/advisor_column_no_null.go
@@ -22,7 +22,7 @@ type ColumnNoNullAdvisor struct {
}
// Check checks for column no NULL value.
-func (adv *ColumnNoNullAdvisor) Check(ctx advisor.Context, statement string) ([]advisor.Advice, error) {
+func (*ColumnNoNullAdvisor) Check(ctx advisor.Context, statement string) ([]advisor.Advice, error) {
root, errAdvice := parseStatement(statement, ctx.Charset, ctx.Collation)
if errAdvice != nil {
return errAdvice, nil
@@ -116,7 +116,7 @@ func (v *columnNoNullChecker) Enter(in ast.Node) (ast.Node, bool) {
}
// Leave implements the ast.Visitor interface.
-func (v *columnNoNullChecker) Leave(in ast.Node) (ast.Node, bool) {
+func (*columnNoNullChecker) Leave(in ast.Node) (ast.Node, bool) {
return in, true
}
diff --git a/plugin/advisor/mysql/advisor_column_required.go b/plugin/advisor/mysql/advisor_column_required.go
index 4034efce52..554097d5a0 100644
--- a/plugin/advisor/mysql/advisor_column_required.go
+++ b/plugin/advisor/mysql/advisor_column_required.go
@@ -24,7 +24,7 @@ type ColumnRequirementAdvisor struct {
}
// Check checks for the column requirement.
-func (adv *ColumnRequirementAdvisor) Check(ctx advisor.Context, statement string) ([]advisor.Advice, error) {
+func (*ColumnRequirementAdvisor) Check(ctx advisor.Context, statement string) ([]advisor.Advice, error) {
root, errAdvice := parseStatement(statement, ctx.Charset, ctx.Collation)
if errAdvice != nil {
return errAdvice, nil
@@ -101,7 +101,7 @@ func (v *columnRequirementChecker) Enter(in ast.Node) (ast.Node, bool) {
}
// Leave implements the ast.Visitor interface.
-func (v *columnRequirementChecker) Leave(in ast.Node) (ast.Node, bool) {
+func (*columnRequirementChecker) Leave(in ast.Node) (ast.Node, bool) {
return in, true
}
diff --git a/plugin/advisor/mysql/advisor_database_drop_empty_db.go b/plugin/advisor/mysql/advisor_database_drop_empty_db.go
index c07304249b..02656ebb88 100644
--- a/plugin/advisor/mysql/advisor_database_drop_empty_db.go
+++ b/plugin/advisor/mysql/advisor_database_drop_empty_db.go
@@ -23,7 +23,7 @@ type DatabaseAllowDropIfEmptyAdvisor struct {
}
// Check checks for drop table naming convention.
-func (adv *DatabaseAllowDropIfEmptyAdvisor) Check(ctx advisor.Context, statement string) ([]advisor.Advice, error) {
+func (*DatabaseAllowDropIfEmptyAdvisor) Check(ctx advisor.Context, statement string) ([]advisor.Advice, error) {
root, errAdvice := parseStatement(statement, ctx.Charset, ctx.Collation)
if errAdvice != nil {
return errAdvice, nil
@@ -84,6 +84,6 @@ func (v *allowDropEmptyDBChecker) Enter(in ast.Node) (ast.Node, bool) {
}
// Leave implements the ast.Visitor interface.
-func (v *allowDropEmptyDBChecker) Leave(in ast.Node) (ast.Node, bool) {
+func (*allowDropEmptyDBChecker) Leave(in ast.Node) (ast.Node, bool) {
return in, true
}
diff --git a/plugin/advisor/mysql/advisor_migration_compatibility.go b/plugin/advisor/mysql/advisor_migration_compatibility.go
index d8e6c41c11..3c6e688c18 100644
--- a/plugin/advisor/mysql/advisor_migration_compatibility.go
+++ b/plugin/advisor/mysql/advisor_migration_compatibility.go
@@ -23,7 +23,7 @@ type CompatibilityAdvisor struct {
}
// Check checks schema backward compatibility.
-func (adv *CompatibilityAdvisor) Check(ctx advisor.Context, statement string) ([]advisor.Advice, error) {
+func (*CompatibilityAdvisor) Check(ctx advisor.Context, statement string) ([]advisor.Advice, error) {
root, errAdvice := parseStatement(statement, ctx.Charset, ctx.Collation)
if errAdvice != nil {
return errAdvice, nil
@@ -159,6 +159,6 @@ func (v *compatibilityChecker) Enter(in ast.Node) (ast.Node, bool) {
}
// Leave implements the ast.Visitor interface.
-func (v *compatibilityChecker) Leave(in ast.Node) (ast.Node, bool) {
+func (*compatibilityChecker) Leave(in ast.Node) (ast.Node, bool) {
return in, true
}
diff --git a/plugin/advisor/mysql/advisor_naming_column.go b/plugin/advisor/mysql/advisor_naming_column.go
index 8de36d0894..57255a9314 100644
--- a/plugin/advisor/mysql/advisor_naming_column.go
+++ b/plugin/advisor/mysql/advisor_naming_column.go
@@ -23,7 +23,7 @@ type NamingColumnConventionAdvisor struct {
}
// Check checks for column naming convention.
-func (adv *NamingColumnConventionAdvisor) Check(ctx advisor.Context, statement string) ([]advisor.Advice, error) {
+func (*NamingColumnConventionAdvisor) Check(ctx advisor.Context, statement string) ([]advisor.Advice, error) {
root, errAdvice := parseStatement(statement, ctx.Charset, ctx.Collation)
if errAdvice != nil {
return errAdvice, nil
@@ -124,6 +124,6 @@ func (v *namingColumnConventionChecker) Enter(in ast.Node) (ast.Node, bool) {
}
// Leave implements the ast.Visitor interface.
-func (v *namingColumnConventionChecker) Leave(in ast.Node) (ast.Node, bool) {
+func (*namingColumnConventionChecker) Leave(in ast.Node) (ast.Node, bool) {
return in, true
}
diff --git a/plugin/advisor/mysql/advisor_naming_foreign_key_convention.go b/plugin/advisor/mysql/advisor_naming_foreign_key_convention.go
index dcc3939c69..3403938f7f 100644
--- a/plugin/advisor/mysql/advisor_naming_foreign_key_convention.go
+++ b/plugin/advisor/mysql/advisor_naming_foreign_key_convention.go
@@ -23,7 +23,7 @@ type NamingFKConventionAdvisor struct {
}
// Check checks for foreign key naming convention.
-func (check *NamingFKConventionAdvisor) Check(ctx advisor.Context, statement string) ([]advisor.Advice, error) {
+func (*NamingFKConventionAdvisor) Check(ctx advisor.Context, statement string) ([]advisor.Advice, error) {
root, errAdvice := parseStatement(statement, ctx.Charset, ctx.Collation)
if errAdvice != nil {
return errAdvice, nil
@@ -107,12 +107,12 @@ func (checker *namingFKConventionChecker) Enter(in ast.Node) (ast.Node, bool) {
}
// Leave implements the ast.Visitor interface.
-func (checker *namingFKConventionChecker) Leave(in ast.Node) (ast.Node, bool) {
+func (*namingFKConventionChecker) Leave(in ast.Node) (ast.Node, bool) {
return in, true
}
// getMetaDataList returns the list of foreign key with meta data.
-func (checker *namingFKConventionChecker) getMetaDataList(in ast.Node) []*indexMetaData {
+func (*namingFKConventionChecker) getMetaDataList(in ast.Node) []*indexMetaData {
var res []*indexMetaData
switch node := in.(type) {
diff --git a/plugin/advisor/mysql/advisor_naming_index_convention.go b/plugin/advisor/mysql/advisor_naming_index_convention.go
index 2d57986ff6..8b61b22967 100644
--- a/plugin/advisor/mysql/advisor_naming_index_convention.go
+++ b/plugin/advisor/mysql/advisor_naming_index_convention.go
@@ -25,7 +25,7 @@ type NamingIndexConventionAdvisor struct {
}
// Check checks for index naming convention.
-func (check *NamingIndexConventionAdvisor) Check(ctx advisor.Context, statement string) ([]advisor.Advice, error) {
+func (*NamingIndexConventionAdvisor) Check(ctx advisor.Context, statement string) ([]advisor.Advice, error) {
root, errAdvice := parseStatement(statement, ctx.Charset, ctx.Collation)
if errAdvice != nil {
return errAdvice, nil
@@ -111,7 +111,7 @@ func (checker *namingIndexConventionChecker) Enter(in ast.Node) (ast.Node, bool)
}
// Leave implements the ast.Visitor interface.
-func (checker *namingIndexConventionChecker) Leave(in ast.Node) (ast.Node, bool) {
+func (*namingIndexConventionChecker) Leave(in ast.Node) (ast.Node, bool) {
return in, true
}
diff --git a/plugin/advisor/mysql/advisor_naming_table.go b/plugin/advisor/mysql/advisor_naming_table.go
index 50b5d8aa50..50c353a59f 100644
--- a/plugin/advisor/mysql/advisor_naming_table.go
+++ b/plugin/advisor/mysql/advisor_naming_table.go
@@ -23,7 +23,7 @@ type NamingTableConventionAdvisor struct {
}
// Check checks for table naming convention.
-func (adv *NamingTableConventionAdvisor) Check(ctx advisor.Context, statement string) ([]advisor.Advice, error) {
+func (*NamingTableConventionAdvisor) Check(ctx advisor.Context, statement string) ([]advisor.Advice, error) {
root, errAdvice := parseStatement(statement, ctx.Charset, ctx.Collation)
if errAdvice != nil {
return errAdvice, nil
@@ -111,6 +111,6 @@ func (v *namingTableConventionChecker) Enter(in ast.Node) (ast.Node, bool) {
}
// Leave implements the ast.Visitor interface.
-func (v *namingTableConventionChecker) Leave(in ast.Node) (ast.Node, bool) {
+func (*namingTableConventionChecker) Leave(in ast.Node) (ast.Node, bool) {
return in, true
}
diff --git a/plugin/advisor/mysql/advisor_naming_unique_key_convention.go b/plugin/advisor/mysql/advisor_naming_unique_key_convention.go
index 7f6c021c49..115c011af1 100644
--- a/plugin/advisor/mysql/advisor_naming_unique_key_convention.go
+++ b/plugin/advisor/mysql/advisor_naming_unique_key_convention.go
@@ -24,7 +24,7 @@ type NamingUKConventionAdvisor struct {
}
// Check checks for index naming convention.
-func (check *NamingUKConventionAdvisor) Check(ctx advisor.Context, statement string) ([]advisor.Advice, error) {
+func (*NamingUKConventionAdvisor) Check(ctx advisor.Context, statement string) ([]advisor.Advice, error) {
root, errAdvice := parseStatement(statement, ctx.Charset, ctx.Collation)
if errAdvice != nil {
return errAdvice, nil
@@ -109,7 +109,7 @@ func (checker *namingUKConventionChecker) Enter(in ast.Node) (ast.Node, bool) {
}
// Leave implements the ast.Visitor interface.
-func (checker *namingUKConventionChecker) Leave(in ast.Node) (ast.Node, bool) {
+func (*namingUKConventionChecker) Leave(in ast.Node) (ast.Node, bool) {
return in, true
}
diff --git a/plugin/advisor/mysql/advisor_stmt_no_leading_wildcard_like.go b/plugin/advisor/mysql/advisor_stmt_no_leading_wildcard_like.go
index 3d174df143..9bf4ab2aa2 100644
--- a/plugin/advisor/mysql/advisor_stmt_no_leading_wildcard_like.go
+++ b/plugin/advisor/mysql/advisor_stmt_no_leading_wildcard_like.go
@@ -27,7 +27,7 @@ type NoLeadingWildcardLikeAdvisor struct {
}
// Check checks for no leading wildcard LIKE.
-func (adv *NoLeadingWildcardLikeAdvisor) Check(ctx advisor.Context, statement string) ([]advisor.Advice, error) {
+func (*NoLeadingWildcardLikeAdvisor) Check(ctx advisor.Context, statement string) ([]advisor.Advice, error) {
root, errAdvice := parseStatement(statement, ctx.Charset, ctx.Collation)
if errAdvice != nil {
return errAdvice, nil
@@ -93,6 +93,6 @@ func (v *noLeadingWildcardLikeChecker) Enter(in ast.Node) (ast.Node, bool) {
}
// Leave implements the ast.Visitor interface.
-func (v *noLeadingWildcardLikeChecker) Leave(in ast.Node) (ast.Node, bool) {
+func (*noLeadingWildcardLikeChecker) Leave(in ast.Node) (ast.Node, bool) {
return in, true
}
diff --git a/plugin/advisor/mysql/advisor_stmt_no_select_all.go b/plugin/advisor/mysql/advisor_stmt_no_select_all.go
index 5159072e47..109750105e 100644
--- a/plugin/advisor/mysql/advisor_stmt_no_select_all.go
+++ b/plugin/advisor/mysql/advisor_stmt_no_select_all.go
@@ -22,7 +22,7 @@ type NoSelectAllAdvisor struct {
}
// Check checks for no "select *".
-func (adv *NoSelectAllAdvisor) Check(ctx advisor.Context, statement string) ([]advisor.Advice, error) {
+func (*NoSelectAllAdvisor) Check(ctx advisor.Context, statement string) ([]advisor.Advice, error) {
root, errAdvice := parseStatement(statement, ctx.Charset, ctx.Collation)
if errAdvice != nil {
return errAdvice, nil
@@ -79,6 +79,6 @@ func (v *noSelectAllChecker) Enter(in ast.Node) (ast.Node, bool) {
}
// Leave implements the ast.Visitor interface.
-func (v *noSelectAllChecker) Leave(in ast.Node) (ast.Node, bool) {
+func (*noSelectAllChecker) Leave(in ast.Node) (ast.Node, bool) {
return in, true
}
diff --git a/plugin/advisor/mysql/advisor_stmt_where_required.go b/plugin/advisor/mysql/advisor_stmt_where_required.go
index 3b82d4b73e..dc48f25842 100644
--- a/plugin/advisor/mysql/advisor_stmt_where_required.go
+++ b/plugin/advisor/mysql/advisor_stmt_where_required.go
@@ -23,7 +23,7 @@ type WhereRequirementAdvisor struct {
}
// Check checks for the WHERE clause requirement.
-func (adv *WhereRequirementAdvisor) Check(ctx advisor.Context, statement string) ([]advisor.Advice, error) {
+func (*WhereRequirementAdvisor) Check(ctx advisor.Context, statement string) ([]advisor.Advice, error) {
root, errAdvice := parseStatement(statement, ctx.Charset, ctx.Collation)
if errAdvice != nil {
return errAdvice, nil
@@ -93,6 +93,6 @@ func (v *whereRequirementChecker) Enter(in ast.Node) (ast.Node, bool) {
}
// Leave implements the ast.Visitor interface.
-func (v *whereRequirementChecker) Leave(in ast.Node) (ast.Node, bool) {
+func (*whereRequirementChecker) Leave(in ast.Node) (ast.Node, bool) {
return in, true
}
diff --git a/plugin/advisor/mysql/advisor_syntax.go b/plugin/advisor/mysql/advisor_syntax.go
index 946ae1d3dd..bb43355144 100644
--- a/plugin/advisor/mysql/advisor_syntax.go
+++ b/plugin/advisor/mysql/advisor_syntax.go
@@ -18,7 +18,7 @@ type SyntaxAdvisor struct {
}
// Check parses the given statement and checks for warnings and errors.
-func (adv *SyntaxAdvisor) Check(ctx advisor.Context, statement string) ([]advisor.Advice, error) {
+func (*SyntaxAdvisor) Check(ctx advisor.Context, statement string) ([]advisor.Advice, error) {
p := newParser()
_, warns, err := p.Parse(statement, ctx.Charset, ctx.Collation)
diff --git a/plugin/advisor/mysql/advisor_table_drop_naming_convention.go b/plugin/advisor/mysql/advisor_table_drop_naming_convention.go
index 5001e00429..1b56609dd5 100644
--- a/plugin/advisor/mysql/advisor_table_drop_naming_convention.go
+++ b/plugin/advisor/mysql/advisor_table_drop_naming_convention.go
@@ -23,7 +23,7 @@ type TableDropNamingConventionAdvisor struct {
}
// Check checks for drop table naming convention.
-func (adv *TableDropNamingConventionAdvisor) Check(ctx advisor.Context, statement string) ([]advisor.Advice, error) {
+func (*TableDropNamingConventionAdvisor) Check(ctx advisor.Context, statement string) ([]advisor.Advice, error) {
root, errAdvice := parseStatement(statement, ctx.Charset, ctx.Collation)
if errAdvice != nil {
return errAdvice, nil
@@ -84,6 +84,6 @@ func (v *namingDropTableConventionChecker) Enter(in ast.Node) (ast.Node, bool) {
}
// Leave implements the ast.Visitor interface.
-func (v *namingDropTableConventionChecker) Leave(in ast.Node) (ast.Node, bool) {
+func (*namingDropTableConventionChecker) Leave(in ast.Node) (ast.Node, bool) {
return in, true
}
diff --git a/plugin/advisor/mysql/advisor_table_no_fk.go b/plugin/advisor/mysql/advisor_table_no_fk.go
index 6a2b75cd0e..c977ece836 100644
--- a/plugin/advisor/mysql/advisor_table_no_fk.go
+++ b/plugin/advisor/mysql/advisor_table_no_fk.go
@@ -22,7 +22,7 @@ type TableNoFKAdvisor struct {
}
// Check checks table disallow foreign key.
-func (adv *TableNoFKAdvisor) Check(ctx advisor.Context, statement string) ([]advisor.Advice, error) {
+func (*TableNoFKAdvisor) Check(ctx advisor.Context, statement string) ([]advisor.Advice, error) {
root, errAdvice := parseStatement(statement, ctx.Charset, ctx.Collation)
if errAdvice != nil {
return errAdvice, nil
@@ -90,6 +90,6 @@ func (checker *tableNoFKChecker) Enter(in ast.Node) (ast.Node, bool) {
}
// Leave implements the ast.Visitor interface.
-func (checker *tableNoFKChecker) Leave(in ast.Node) (ast.Node, bool) {
+func (*tableNoFKChecker) Leave(in ast.Node) (ast.Node, bool) {
return in, true
}
diff --git a/plugin/advisor/mysql/advisor_table_require_pk.go b/plugin/advisor/mysql/advisor_table_require_pk.go
index 970ff28c28..93c27c1b06 100644
--- a/plugin/advisor/mysql/advisor_table_require_pk.go
+++ b/plugin/advisor/mysql/advisor_table_require_pk.go
@@ -28,7 +28,7 @@ type TableRequirePKAdvisor struct {
}
// Check checks table requires PK.
-func (adv *TableRequirePKAdvisor) Check(ctx advisor.Context, statement string) ([]advisor.Advice, error) {
+func (*TableRequirePKAdvisor) Check(ctx advisor.Context, statement string) ([]advisor.Advice, error) {
root, errAdvice := parseStatement(statement, ctx.Charset, ctx.Collation)
if errAdvice != nil {
return errAdvice, nil
@@ -110,7 +110,7 @@ func (v *tableRequirePKChecker) Enter(in ast.Node) (ast.Node, bool) {
}
// Leave implements the ast.Visitor interface.
-func (v *tableRequirePKChecker) Leave(in ast.Node) (ast.Node, bool) {
+func (*tableRequirePKChecker) Leave(in ast.Node) (ast.Node, bool) {
return in, true
}
diff --git a/plugin/advisor/mysql/advisor_use_innodb.go b/plugin/advisor/mysql/advisor_use_innodb.go
index 17604c1045..2ee2e3e905 100644
--- a/plugin/advisor/mysql/advisor_use_innodb.go
+++ b/plugin/advisor/mysql/advisor_use_innodb.go
@@ -28,7 +28,7 @@ type UseInnoDBAdvisor struct {
}
// Check checks for using InnoDB engine.
-func (adv *UseInnoDBAdvisor) Check(ctx advisor.Context, statement string) ([]advisor.Advice, error) {
+func (*UseInnoDBAdvisor) Check(ctx advisor.Context, statement string) ([]advisor.Advice, error) {
root, errAdvice := parseStatement(statement, ctx.Charset, ctx.Collation)
if errAdvice != nil {
return errAdvice, nil
@@ -125,6 +125,6 @@ func (v *useInnoDBChecker) Enter(in ast.Node) (ast.Node, bool) {
}
// Leave implements the ast.Visitor interface.
-func (v *useInnoDBChecker) Leave(in ast.Node) (ast.Node, bool) {
+func (*useInnoDBChecker) Leave(in ast.Node) (ast.Node, bool) {
return in, true
}
diff --git a/plugin/advisor/pg/advisor_column_no_null.go b/plugin/advisor/pg/advisor_column_no_null.go
index 5d8807f360..5c7d18d75e 100644
--- a/plugin/advisor/pg/advisor_column_no_null.go
+++ b/plugin/advisor/pg/advisor_column_no_null.go
@@ -23,7 +23,7 @@ type ColumnNoNullAdvisor struct {
}
// Check checks for column no NULL value.
-func (adv *ColumnNoNullAdvisor) Check(ctx advisor.Context, statement string) ([]advisor.Advice, error) {
+func (*ColumnNoNullAdvisor) Check(ctx advisor.Context, statement string) ([]advisor.Advice, error) {
stmts, errAdvice := parseStatement(statement)
if errAdvice != nil {
return errAdvice, nil
diff --git a/plugin/advisor/pg/advisor_naming_column.go b/plugin/advisor/pg/advisor_naming_column.go
index fbbe882e5f..f31fb77a18 100644
--- a/plugin/advisor/pg/advisor_naming_column.go
+++ b/plugin/advisor/pg/advisor_naming_column.go
@@ -22,7 +22,7 @@ type NamingColumnConventionAdvisor struct {
}
// Check checks for column naming convention.
-func (adv *NamingColumnConventionAdvisor) Check(ctx advisor.Context, statement string) ([]advisor.Advice, error) {
+func (*NamingColumnConventionAdvisor) Check(ctx advisor.Context, statement string) ([]advisor.Advice, error) {
stmts, errAdvice := parseStatement(statement)
if errAdvice != nil {
return errAdvice, nil
diff --git a/plugin/advisor/pg/advisor_naming_foreign_key_convention.go b/plugin/advisor/pg/advisor_naming_foreign_key_convention.go
index 37172b6a63..fa9590cda3 100644
--- a/plugin/advisor/pg/advisor_naming_foreign_key_convention.go
+++ b/plugin/advisor/pg/advisor_naming_foreign_key_convention.go
@@ -23,7 +23,7 @@ type NamingFKConventionAdvisor struct {
}
// Check checks for foreign key naming convention.
-func (check *NamingFKConventionAdvisor) Check(ctx advisor.Context, statement string) ([]advisor.Advice, error) {
+func (*NamingFKConventionAdvisor) Check(ctx advisor.Context, statement string) ([]advisor.Advice, error) {
root, errAdvice := parseStatement(statement)
if errAdvice != nil {
return errAdvice, nil
@@ -115,7 +115,7 @@ func (checker *namingFKConventionChecker) Visit(in ast.Node) ast.Visitor {
}
// getMetaDataList returns the list of foreign key with metadata.
-func (checker *namingFKConventionChecker) getMetaDataList(in ast.Node) []*indexMetaData {
+func (*namingFKConventionChecker) getMetaDataList(in ast.Node) []*indexMetaData {
var res []*indexMetaData
switch node := in.(type) {
case *ast.CreateTableStmt:
diff --git a/plugin/advisor/pg/advisor_naming_table.go b/plugin/advisor/pg/advisor_naming_table.go
index 17dc049c54..3046fdcc92 100644
--- a/plugin/advisor/pg/advisor_naming_table.go
+++ b/plugin/advisor/pg/advisor_naming_table.go
@@ -22,7 +22,7 @@ type NamingTableConventionAdvisor struct {
}
// Check checks for table naming convention.
-func (adv *NamingTableConventionAdvisor) Check(ctx advisor.Context, statement string) ([]advisor.Advice, error) {
+func (*NamingTableConventionAdvisor) Check(ctx advisor.Context, statement string) ([]advisor.Advice, error) {
stmts, errAdvice := parseStatement(statement)
if errAdvice != nil {
return errAdvice, nil
diff --git a/plugin/advisor/pg/advisor_naming_unique_key_convention.go b/plugin/advisor/pg/advisor_naming_unique_key_convention.go
index a29448d1db..4753a3340c 100644
--- a/plugin/advisor/pg/advisor_naming_unique_key_convention.go
+++ b/plugin/advisor/pg/advisor_naming_unique_key_convention.go
@@ -23,7 +23,7 @@ type NamingUKConventionAdvisor struct {
}
// Check checks for unique key naming convention.
-func (check *NamingUKConventionAdvisor) Check(ctx advisor.Context, statement string) ([]advisor.Advice, error) {
+func (*NamingUKConventionAdvisor) Check(ctx advisor.Context, statement string) ([]advisor.Advice, error) {
root, errAdvice := parseStatement(statement)
if errAdvice != nil {
return errAdvice, nil
diff --git a/plugin/advisor/pg/advisor_syntax.go b/plugin/advisor/pg/advisor_syntax.go
index d539ec7d38..007792d110 100644
--- a/plugin/advisor/pg/advisor_syntax.go
+++ b/plugin/advisor/pg/advisor_syntax.go
@@ -17,7 +17,7 @@ type SyntaxAdvisor struct {
}
// Check parses the given statement and checks for errors.
-func (adv *SyntaxAdvisor) Check(_ advisor.Context, statement string) ([]advisor.Advice, error) {
+func (*SyntaxAdvisor) Check(_ advisor.Context, statement string) ([]advisor.Advice, error) {
var res []advisor.Advice
if _, errAdvice := parseStatement(statement); errAdvice != nil {
for _, advice := range errAdvice {
diff --git a/plugin/advisor/pg/advisor_table_require_pk.go b/plugin/advisor/pg/advisor_table_require_pk.go
index 55e11aa374..e250f96034 100644
--- a/plugin/advisor/pg/advisor_table_require_pk.go
+++ b/plugin/advisor/pg/advisor_table_require_pk.go
@@ -19,7 +19,7 @@ type TableRequirePKAdvisor struct {
}
// Check parses the given statement and checks for errors.
-func (adv *TableRequirePKAdvisor) Check(ctx advisor.Context, statement string) ([]advisor.Advice, error) {
+func (*TableRequirePKAdvisor) Check(ctx advisor.Context, statement string) ([]advisor.Advice, error) {
stmts, errAdvice := parseStatement(statement)
if errAdvice != nil {
return errAdvice, nil
diff --git a/plugin/db/clickhouse/dump.go b/plugin/db/clickhouse/dump.go
index 5f50ecd134..5aaf2c458b 100644
--- a/plugin/db/clickhouse/dump.go
+++ b/plugin/db/clickhouse/dump.go
@@ -215,6 +215,6 @@ func (driver *Driver) Restore(ctx context.Context, sc *bufio.Scanner) (err error
}
// RestoreTx restores the database in the given transaction.
-func (driver *Driver) RestoreTx(context.Context, *sql.Tx, *bufio.Scanner) error {
+func (*Driver) RestoreTx(context.Context, *sql.Tx, *bufio.Scanner) error {
return fmt.Errorf("Unimplemented")
}
diff --git a/plugin/db/mysql/dump.go b/plugin/db/mysql/dump.go
index c4f23dd98c..341df3e043 100644
--- a/plugin/db/mysql/dump.go
+++ b/plugin/db/mysql/dump.go
@@ -669,7 +669,7 @@ func (driver *Driver) Restore(ctx context.Context, sc *bufio.Scanner) (err error
}
defer txn.Rollback()
- if err := driver.restoreTx(ctx, txn, sc); err != nil {
+ if err := restoreTx(ctx, txn, sc); err != nil {
return err
}
@@ -681,11 +681,11 @@ func (driver *Driver) Restore(ctx context.Context, sc *bufio.Scanner) (err error
}
// RestoreTx restores a database in the given transaction.
-func (driver *Driver) RestoreTx(ctx context.Context, tx *sql.Tx, sc *bufio.Scanner) error {
- return driver.restoreTx(ctx, tx, sc)
+func (*Driver) RestoreTx(ctx context.Context, tx *sql.Tx, sc *bufio.Scanner) error {
+ return restoreTx(ctx, tx, sc)
}
-func (driver *Driver) restoreTx(ctx context.Context, tx *sql.Tx, sc *bufio.Scanner) error {
+func restoreTx(ctx context.Context, tx *sql.Tx, sc *bufio.Scanner) error {
fnExecuteStmt := func(stmt string) error {
if _, err := tx.ExecContext(ctx, stmt); err != nil {
return err
diff --git a/plugin/db/pg/dump.go b/plugin/db/pg/dump.go
index 4e3e809c5c..3f98c90c9f 100644
--- a/plugin/db/pg/dump.go
+++ b/plugin/db/pg/dump.go
@@ -156,6 +156,6 @@ func (driver *Driver) Restore(ctx context.Context, sc *bufio.Scanner) (err error
}
// RestoreTx restores the database in the given transaction.
-func (driver *Driver) RestoreTx(context.Context, *sql.Tx, *bufio.Scanner) error {
+func (*Driver) RestoreTx(context.Context, *sql.Tx, *bufio.Scanner) error {
return fmt.Errorf("Unimplemented")
}
diff --git a/plugin/db/snowflake/dump.go b/plugin/db/snowflake/dump.go
index 1f4cbb0883..8925f0e80b 100644
--- a/plugin/db/snowflake/dump.go
+++ b/plugin/db/snowflake/dump.go
@@ -164,6 +164,6 @@ func (driver *Driver) Restore(ctx context.Context, sc *bufio.Scanner) (err error
}
// RestoreTx restores the database in the given transaction.
-func (driver *Driver) RestoreTx(context.Context, *sql.Tx, *bufio.Scanner) error {
+func (*Driver) RestoreTx(context.Context, *sql.Tx, *bufio.Scanner) error {
return fmt.Errorf("Unimplemented")
}
diff --git a/plugin/parser/engine/pg/parser.go b/plugin/parser/engine/pg/parser.go
index 4eb6003bf9..b1c106c056 100644
--- a/plugin/parser/engine/pg/parser.go
+++ b/plugin/parser/engine/pg/parser.go
@@ -21,7 +21,7 @@ type PostgreSQLParser struct {
}
// Parse implements the parser.Parser interface.
-func (p *PostgreSQLParser) Parse(_ parser.Context, statement string) ([]ast.Node, error) {
+func (*PostgreSQLParser) Parse(_ parser.Context, statement string) ([]ast.Node, error) {
res, err := pgquery.Parse(statement)
if err != nil {
return nil, err
diff --git a/plugin/vcs/github/github.go b/plugin/vcs/github/github.go
index 298963b118..b4ba2a71e1 100644
--- a/plugin/vcs/github/github.go
+++ b/plugin/vcs/github/github.go
@@ -48,7 +48,7 @@ func newProvider(config vcs.ProviderConfig) vcs.Provider {
}
// APIURL returns the API URL path of GitHub.
-func (p *Provider) APIURL(string) string {
+func (*Provider) APIURL(string) string {
return apiURL
}
diff --git a/server/debug.go b/server/debug.go
index 48d8dba83b..b7015d41e5 100644
--- a/server/debug.go
+++ b/server/debug.go
@@ -11,9 +11,7 @@ import (
)
func (s *Server) registerDebugRoutes(g *echo.Group) {
- g.GET("/debug", func(c echo.Context) error {
- return s.currentDebugState(c)
- })
+ g.GET("/debug", currentDebugState)
g.PATCH("/debug", func(c echo.Context) error {
var debugPatch api.DebugPatch
@@ -29,11 +27,11 @@ func (s *Server) registerDebugRoutes(g *echo.Group) {
s.e.Debug = debugPatch.IsDebug
- return s.currentDebugState(c)
+ return currentDebugState(c)
})
}
-func (s *Server) currentDebugState(c echo.Context) error {
+func currentDebugState(c echo.Context) error {
c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)
if err := jsonapi.MarshalPayload(c.Response().Writer, &api.Debug{IsDebug: log.EnabledLevel(zap.DebugLevel)}); err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to marshal debug info response").SetInternal(err)
diff --git a/server/openapi.go b/server/openapi.go
index 400a9bc2af..abd245e794 100644
--- a/server/openapi.go
+++ b/server/openapi.go
@@ -24,7 +24,7 @@ type catalogService struct{}
// GetDatabase is the API message in catalog.
// We will not connect to the user's database in the early version of sql check api.
-func (c *catalogService) GetDatabase(_ context.Context) (*catalog.Database, error) {
+func (*catalogService) GetDatabase(_ context.Context) (*catalog.Database, error) {
return nil, nil
}
diff --git a/server/project.go b/server/project.go
index 721f6828d2..b154c9dfe8 100644
--- a/server/project.go
+++ b/server/project.go
@@ -261,8 +261,8 @@ func (s *Server) registerProjectRoutes(g *echo.Group) {
ctx,
common.OauthContext{
AccessToken: repositoryCreate.AccessToken,
- // We use s.refreshTokenNoop() because the repository isn't created yet.
- Refresher: s.refreshTokenNoop(),
+ // We use refreshTokenNoop() because the repository isn't created yet.
+ Refresher: refreshTokenNoop(),
},
vcs.InstanceURL,
repositoryCreate.ExternalID,
@@ -600,7 +600,7 @@ func (s *Server) refreshToken(ctx context.Context, repositoryID int) common.Toke
}
// refreshToken is a no-op token refresher. It should be used when the repository isn't created yet.
-func (s *Server) refreshTokenNoop() common.TokenRefresher {
+func refreshTokenNoop() common.TokenRefresher {
return func(newToken, newRefreshToken string, expiresTs int64) error {
return nil
}
diff --git a/server/server.go b/server/server.go
index f6002eb875..b6985ec0c1 100644
--- a/server/server.go
+++ b/server/server.go
@@ -177,7 +177,7 @@ func NewServer(ctx context.Context, prof Profile) (*Server, error) {
storeInstance := store.New(storeDB, cacheService)
s.store = storeInstance
- config, err := s.initSetting(ctx, storeInstance)
+ config, err := getInitSetting(ctx, storeInstance)
if err != nil {
return nil, fmt.Errorf("failed to init config: %w", err)
}
@@ -371,7 +371,7 @@ func (s *Server) initMetricReporter(workspaceID string) {
}
}
-func (s *Server) initSetting(ctx context.Context, store *store.Store) (*config, error) {
+func getInitSetting(ctx context.Context, store *store.Store) (*config, error) {
// initial branding
_, err := store.CreateSettingIfNotExist(ctx, &api.SettingCreate{
CreatorID: api.SystemBotID,
diff --git a/server/task_check_executor_database_connect.go b/server/task_check_executor_database_connect.go
index 598850c880..d2898e36cf 100644
--- a/server/task_check_executor_database_connect.go
+++ b/server/task_check_executor_database_connect.go
@@ -18,7 +18,7 @@ type TaskCheckDatabaseConnectExecutor struct {
}
// Run will run the task check database connector executor once.
-func (exec *TaskCheckDatabaseConnectExecutor) Run(ctx context.Context, server *Server, taskCheckRun *api.TaskCheckRun) (result []api.TaskCheckResult, err error) {
+func (*TaskCheckDatabaseConnectExecutor) Run(ctx context.Context, server *Server, taskCheckRun *api.TaskCheckRun) (result []api.TaskCheckResult, err error) {
task, err := server.store.GetTaskByID(ctx, taskCheckRun.TaskID)
if err != nil {
return []api.TaskCheckResult{}, common.WithError(common.Internal, err)
diff --git a/server/task_check_executor_ghost_sync.go b/server/task_check_executor_ghost_sync.go
index 2a4c2f1f40..8a43f2b367 100644
--- a/server/task_check_executor_ghost_sync.go
+++ b/server/task_check_executor_ghost_sync.go
@@ -21,7 +21,7 @@ type TaskCheckGhostSyncExecutor struct {
}
// Run will run the task check database connector executor once.
-func (exec *TaskCheckGhostSyncExecutor) Run(ctx context.Context, server *Server, taskCheckRun *api.TaskCheckRun) (result []api.TaskCheckResult, err error) {
+func (*TaskCheckGhostSyncExecutor) Run(ctx context.Context, server *Server, taskCheckRun *api.TaskCheckRun) (result []api.TaskCheckResult, err error) {
// gh-ost dry run could panic.
// It may be bytebase who panicked, but that's rare. So
// capture the error and send it into the result list.
diff --git a/server/task_check_executor_migration_schema.go b/server/task_check_executor_migration_schema.go
index f6a2200f91..14540633f4 100644
--- a/server/task_check_executor_migration_schema.go
+++ b/server/task_check_executor_migration_schema.go
@@ -18,7 +18,7 @@ type TaskCheckMigrationSchemaExecutor struct {
}
// Run will run the task check migration schema executor once.
-func (exec *TaskCheckMigrationSchemaExecutor) Run(ctx context.Context, server *Server, taskCheckRun *api.TaskCheckRun) (result []api.TaskCheckResult, err error) {
+func (*TaskCheckMigrationSchemaExecutor) Run(ctx context.Context, server *Server, taskCheckRun *api.TaskCheckRun) (result []api.TaskCheckResult, err error) {
task, err := server.store.GetTaskByID(ctx, taskCheckRun.TaskID)
if err != nil {
return []api.TaskCheckResult{}, common.WithError(common.Internal, err)
diff --git a/server/task_check_executor_statement_advisor_composite.go b/server/task_check_executor_statement_advisor_composite.go
index 461fa11d8d..dd251e5e1a 100644
--- a/server/task_check_executor_statement_advisor_composite.go
+++ b/server/task_check_executor_statement_advisor_composite.go
@@ -26,7 +26,7 @@ type TaskCheckStatementAdvisorCompositeExecutor struct {
}
// Run will run the task check statement advisor composite executor once, and run its sub-advisor one-by-one.
-func (exec *TaskCheckStatementAdvisorCompositeExecutor) Run(ctx context.Context, server *Server, taskCheckRun *api.TaskCheckRun) (result []api.TaskCheckResult, err error) {
+func (*TaskCheckStatementAdvisorCompositeExecutor) Run(ctx context.Context, server *Server, taskCheckRun *api.TaskCheckRun) (result []api.TaskCheckResult, err error) {
if taskCheckRun.Type != api.TaskCheckDatabaseStatementAdvise {
return nil, common.Errorf(common.Invalid, "invalid check statement advisor composite type: %v", taskCheckRun.Type)
}
diff --git a/server/task_check_executor_statement_advisor_simple.go b/server/task_check_executor_statement_advisor_simple.go
index 1755f44de8..170b358ed0 100644
--- a/server/task_check_executor_statement_advisor_simple.go
+++ b/server/task_check_executor_statement_advisor_simple.go
@@ -20,7 +20,7 @@ type TaskCheckStatementAdvisorSimpleExecutor struct {
}
// Run will run the task check statement advisor executor once.
-func (exec *TaskCheckStatementAdvisorSimpleExecutor) Run(_ context.Context, _ *Server, taskCheckRun *api.TaskCheckRun) (result []api.TaskCheckResult, err error) {
+func (*TaskCheckStatementAdvisorSimpleExecutor) Run(_ context.Context, _ *Server, taskCheckRun *api.TaskCheckRun) (result []api.TaskCheckResult, err error) {
payload := &api.TaskCheckDatabaseStatementAdvisePayload{}
if err := json.Unmarshal([]byte(taskCheckRun.Payload), payload); err != nil {
return nil, common.Errorf(common.Invalid, "invalid check statement advise payload: %w", err)
diff --git a/server/task_check_executor_timing.go b/server/task_check_executor_timing.go
index 1d0488c109..38fccbe8f5 100644
--- a/server/task_check_executor_timing.go
+++ b/server/task_check_executor_timing.go
@@ -22,7 +22,7 @@ type TaskCheckTimingExecutor struct {
const dataFormat = "2006-01-02 15:04:05"
// Run will run the task check timing executor once.
-func (exec *TaskCheckTimingExecutor) Run(_ context.Context, _ *Server, taskCheckRun *api.TaskCheckRun) (result []api.TaskCheckResult, err error) {
+func (*TaskCheckTimingExecutor) Run(_ context.Context, _ *Server, taskCheckRun *api.TaskCheckRun) (result []api.TaskCheckResult, err error) {
payload := &api.TaskCheckEarliestAllowedTimePayload{}
if err := json.Unmarshal([]byte(taskCheckRun.Payload), payload); err != nil {
return []api.TaskCheckResult{}, common.Errorf(common.Invalid, "invalid check timing payload: %w", err)
diff --git a/server/task_executor_data_update.go b/server/task_executor_data_update.go
index 65aa51b68f..43557a5992 100644
--- a/server/task_executor_data_update.go
+++ b/server/task_executor_data_update.go
@@ -21,8 +21,7 @@ type DataUpdateTaskExecutor struct {
}
// RunOnce will run the data update (DML) task executor once.
-func (exec *DataUpdateTaskExecutor) RunOnce(ctx context.Context, server *Server, task *api.Task) (terminated bool, result *api.TaskRunResultPayload, err error) {
- defer atomic.StoreInt32(&exec.completed, 1)
+func (*DataUpdateTaskExecutor) RunOnce(ctx context.Context, server *Server, task *api.Task) (terminated bool, result *api.TaskRunResultPayload, err error) {
payload := &api.TaskDatabaseDataUpdatePayload{}
if err := json.Unmarshal([]byte(task.Payload), payload); err != nil {
return true, nil, fmt.Errorf("invalid database data update payload: %w", err)
@@ -37,6 +36,6 @@ func (exec *DataUpdateTaskExecutor) IsCompleted() bool {
}
// GetProgress returns the task progress.
-func (exec *DataUpdateTaskExecutor) GetProgress() api.Progress {
+func (*DataUpdateTaskExecutor) GetProgress() api.Progress {
return api.Progress{}
}
diff --git a/server/task_executor_database_backup.go b/server/task_executor_database_backup.go
index 3801214d1b..81ee86f28f 100644
--- a/server/task_executor_database_backup.go
+++ b/server/task_executor_database_backup.go
@@ -29,7 +29,7 @@ func (exec *DatabaseBackupTaskExecutor) IsCompleted() bool {
}
// GetProgress returns the task progress.
-func (exec *DatabaseBackupTaskExecutor) GetProgress() api.Progress {
+func (*DatabaseBackupTaskExecutor) GetProgress() api.Progress {
return api.Progress{}
}
@@ -80,7 +80,7 @@ func (exec *DatabaseBackupTaskExecutor) RunOnce(ctx context.Context, server *Ser
}
// backupDatabase will take a backup of a database.
-func (exec *DatabaseBackupTaskExecutor) backupDatabase(ctx context.Context, instance *api.Instance, databaseName string, backup *api.Backup, dataDir, pgInstanceDir string) (string, error) {
+func (*DatabaseBackupTaskExecutor) backupDatabase(ctx context.Context, instance *api.Instance, databaseName string, backup *api.Backup, dataDir, pgInstanceDir string) (string, error) {
driver, err := getAdminDatabaseDriver(ctx, instance, databaseName, pgInstanceDir)
if err != nil {
return "", err
diff --git a/server/task_executor_database_create.go b/server/task_executor_database_create.go
index 2d3e1bac73..9033aed7fe 100644
--- a/server/task_executor_database_create.go
+++ b/server/task_executor_database_create.go
@@ -30,7 +30,7 @@ func (exec *DatabaseCreateTaskExecutor) IsCompleted() bool {
}
// GetProgress returns the task progress.
-func (exec *DatabaseCreateTaskExecutor) GetProgress() api.Progress {
+func (*DatabaseCreateTaskExecutor) GetProgress() api.Progress {
return api.Progress{}
}
diff --git a/server/task_executor_database_restore.go b/server/task_executor_database_restore.go
index 5dd57c195d..fd23f3fa64 100644
--- a/server/task_executor_database_restore.go
+++ b/server/task_executor_database_restore.go
@@ -34,7 +34,7 @@ func (exec *DatabaseRestoreTaskExecutor) IsCompleted() bool {
}
// GetProgress returns the task progress.
-func (exec *DatabaseRestoreTaskExecutor) GetProgress() api.Progress {
+func (*DatabaseRestoreTaskExecutor) GetProgress() api.Progress {
return api.Progress{}
}
@@ -123,7 +123,7 @@ func (exec *DatabaseRestoreTaskExecutor) RunOnce(ctx context.Context, server *Se
}
// restoreDatabase will restore the database from a backup.
-func (exec *DatabaseRestoreTaskExecutor) restoreDatabase(ctx context.Context, instance *api.Instance, databaseName string, backup *api.Backup, dataDir, pgInstanceDir string) error {
+func (*DatabaseRestoreTaskExecutor) restoreDatabase(ctx context.Context, instance *api.Instance, databaseName string, backup *api.Backup, dataDir, pgInstanceDir string) error {
driver, err := getAdminDatabaseDriver(ctx, instance, databaseName, pgInstanceDir)
if err != nil {
return err
diff --git a/server/task_executor_default.go b/server/task_executor_default.go
index befc030b61..a1c6aecf76 100644
--- a/server/task_executor_default.go
+++ b/server/task_executor_default.go
@@ -34,6 +34,6 @@ func (exec *DefaultTaskExecutor) IsCompleted() bool {
}
// GetProgress returns the task progress.
-func (exec *DefaultTaskExecutor) GetProgress() api.Progress {
+func (*DefaultTaskExecutor) GetProgress() api.Progress {
return api.Progress{}
}
diff --git a/server/task_executor_pitr_cutover.go b/server/task_executor_pitr_cutover.go
index 8bbee2fc46..317fd962c1 100644
--- a/server/task_executor_pitr_cutover.go
+++ b/server/task_executor_pitr_cutover.go
@@ -82,7 +82,7 @@ func (exec *PITRCutoverTaskExecutor) IsCompleted() bool {
}
// GetProgress returns the task progress.
-func (exec *PITRCutoverTaskExecutor) GetProgress() api.Progress {
+func (*PITRCutoverTaskExecutor) GetProgress() api.Progress {
return api.Progress{}
}
@@ -90,7 +90,7 @@ func (exec *PITRCutoverTaskExecutor) GetProgress() api.Progress {
// 1. Swap the current and PITR database.
// 2. Create a backup with type PITR. The backup is scheduled asynchronously.
// We must check the possible failed/ongoing PITR type backup in the recovery process.
-func (exec *PITRCutoverTaskExecutor) pitrCutover(ctx context.Context, task *api.Task, server *Server, issue *api.Issue) (terminated bool, result *api.TaskRunResultPayload, err error) {
+func (*PITRCutoverTaskExecutor) pitrCutover(ctx context.Context, task *api.Task, server *Server, issue *api.Issue) (terminated bool, result *api.TaskRunResultPayload, err error) {
driver, err := getAdminDatabaseDriver(ctx, task.Instance, "", "" /* pgInstanceDir */)
if err != nil {
return true, nil, err
diff --git a/server/task_executor_pitr_restore.go b/server/task_executor_pitr_restore.go
index 412a14f078..66a2a33aca 100644
--- a/server/task_executor_pitr_restore.go
+++ b/server/task_executor_pitr_restore.go
@@ -66,7 +66,7 @@ func (exec *PITRRestoreTaskExecutor) IsCompleted() bool {
}
// GetProgress returns the task progress.
-func (exec *PITRRestoreTaskExecutor) GetProgress() api.Progress {
+func (*PITRRestoreTaskExecutor) GetProgress() api.Progress {
return api.Progress{}
}
diff --git a/server/task_executor_schema_update.go b/server/task_executor_schema_update.go
index 1ce6f53b8b..6fb4fa99fa 100644
--- a/server/task_executor_schema_update.go
+++ b/server/task_executor_schema_update.go
@@ -36,6 +36,6 @@ func (exec *SchemaUpdateTaskExecutor) IsCompleted() bool {
}
// GetProgress returns the task progress.
-func (exec *SchemaUpdateTaskExecutor) GetProgress() api.Progress {
+func (*SchemaUpdateTaskExecutor) GetProgress() api.Progress {
return api.Progress{}
}
diff --git a/server/task_executor_schema_update_ghost_cutover.go b/server/task_executor_schema_update_ghost_cutover.go
index 3c40c05779..37b3c62dcc 100644
--- a/server/task_executor_schema_update_ghost_cutover.go
+++ b/server/task_executor_schema_update_ghost_cutover.go
@@ -138,6 +138,6 @@ func (exec *SchemaUpdateGhostCutoverTaskExecutor) IsCompleted() bool {
}
// GetProgress returns the task progress.
-func (exec *SchemaUpdateGhostCutoverTaskExecutor) GetProgress() api.Progress {
+func (*SchemaUpdateGhostCutoverTaskExecutor) GetProgress() api.Progress {
return api.Progress{}
}
diff --git a/server/task_executor_schema_update_ghost_sync.go b/server/task_executor_schema_update_ghost_sync.go
index 1cda782706..54fd7329a6 100644
--- a/server/task_executor_schema_update_ghost_sync.go
+++ b/server/task_executor_schema_update_ghost_sync.go
@@ -45,7 +45,7 @@ func (exec *SchemaUpdateGhostSyncTaskExecutor) IsCompleted() bool {
}
// GetProgress returns the task progress.
-func (exec *SchemaUpdateGhostSyncTaskExecutor) GetProgress() api.Progress {
+func (*SchemaUpdateGhostSyncTaskExecutor) GetProgress() api.Progress {
return api.Progress{}
}
diff --git a/server/webhook.go b/server/webhook.go
index 3455203d09..e0dfaea047 100644
--- a/server/webhook.go
+++ b/server/webhook.go
@@ -380,7 +380,7 @@ func (s *Server) createSchemaUpdateIssue(ctx context.Context, repository *api.Re
return string(createContext), nil
}
-func (s *Server) createTenantSchemaUpdateIssue(mi *db.MigrationInfo, vcsPushEvent vcs.PushEvent, statement string) (string, error) {
+func createTenantSchemaUpdateIssue(mi *db.MigrationInfo, vcsPushEvent vcs.PushEvent, statement string) (string, error) {
// We don't take environment for tenant mode project because the databases needing schema update are determined by database name and deployment configuration.
if mi.Environment != "" {
return "", fmt.Errorf("environment isn't accepted in schema update for tenant mode project")
@@ -525,7 +525,7 @@ func (s *Server) createIssueFromPushEvent(ctx context.Context, repo *api.Reposit
if !s.feature(api.FeatureMultiTenancy) {
return "", false, echo.NewHTTPError(http.StatusForbidden, api.FeatureMultiTenancy.AccessErrorMessage())
}
- createContext, err = s.createTenantSchemaUpdateIssue(mi, pushEvent, content)
+ createContext, err = createTenantSchemaUpdateIssue(mi, pushEvent, content)
} else {
createContext, err = s.createSchemaUpdateIssue(ctx, repo, mi, pushEvent, fileEscaped, content)
}
diff --git a/store/backup.go b/store/backup.go
index 30b34c104c..fcbc86627f 100644
--- a/store/backup.go
+++ b/store/backup.go
@@ -404,7 +404,7 @@ func (s *Store) upsertBackupSettingRaw(ctx context.Context, upsert *api.BackupSe
}
// createBackupImpl creates a new backup.
-func (s *Store) createBackupImpl(ctx context.Context, tx *sql.Tx, create *api.BackupCreate) (*backupRaw, error) {
+func (*Store) createBackupImpl(ctx context.Context, tx *sql.Tx, create *api.BackupCreate) (*backupRaw, error) {
// Insert row into backup.
query := `
INSERT INTO backup (
@@ -455,7 +455,7 @@ func (s *Store) createBackupImpl(ctx context.Context, tx *sql.Tx, create *api.Ba
return &backupRaw, nil
}
-func (s *Store) findBackupImpl(ctx context.Context, tx *sql.Tx, find *api.BackupFind) ([]*backupRaw, error) {
+func (*Store) findBackupImpl(ctx context.Context, tx *sql.Tx, find *api.BackupFind) ([]*backupRaw, error) {
// Build WHERE clause.
where, args := []string{"1 = 1"}, []interface{}{}
if v := find.ID; v != nil {
@@ -532,7 +532,7 @@ func (s *Store) findBackupImpl(ctx context.Context, tx *sql.Tx, find *api.Backup
}
// patchBackupImpl updates a backup by ID. Returns the new state of the backup after update.
-func (s *Store) patchBackupImpl(ctx context.Context, tx *sql.Tx, patch *api.BackupPatch) (*backupRaw, error) {
+func (*Store) patchBackupImpl(ctx context.Context, tx *sql.Tx, patch *api.BackupPatch) (*backupRaw, error) {
// Build UPDATE clause.
set, args := []string{}, []interface{}{}
set, args = append(set, fmt.Sprintf("updater_id = $%d", len(args)+1)), append(args, patch.UpdaterID)
diff --git a/store/bookmark.go b/store/bookmark.go
index ece2d60fff..cba300de61 100644
--- a/store/bookmark.go
+++ b/store/bookmark.go
@@ -180,7 +180,7 @@ func (s *Store) DeleteBookmark(ctx context.Context, delete *api.BookmarkDelete)
}
defer tx.PTx.Rollback()
- if err := deleteBookmarkImpl(ctx, tx.PTx, delete); err != nil {
+ if err := s.deleteBookmarkImpl(ctx, tx.PTx, delete); err != nil {
return FormatError(err)
}
@@ -281,7 +281,7 @@ func findBookmarkImpl(ctx context.Context, tx *sql.Tx, find *api.BookmarkFind) (
}
// deleteBookmarkImpl permanently deletes a bookmark by ID.
-func deleteBookmarkImpl(ctx context.Context, tx *sql.Tx, delete *api.BookmarkDelete) error {
+func (*Store) deleteBookmarkImpl(ctx context.Context, tx *sql.Tx, delete *api.BookmarkDelete) error {
// Remove row from database.
result, err := tx.ExecContext(ctx, `DELETE FROM bookmark WHERE id = $1`, delete.ID)
if err != nil {
diff --git a/store/column.go b/store/column.go
index 149b078a6a..ca1542f0b1 100644
--- a/store/column.go
+++ b/store/column.go
@@ -75,7 +75,7 @@ func generateColumnActions(oldColumnList []*api.Column, columnList []db.Column,
}
// createColumnImpl creates a new column.
-func (s *Store) createColumnImpl(ctx context.Context, tx *sql.Tx, create *api.ColumnCreate) (*api.Column, error) {
+func (*Store) createColumnImpl(ctx context.Context, tx *sql.Tx, create *api.ColumnCreate) (*api.Column, error) {
defaultStr := sql.NullString{}
if create.Default != nil {
defaultStr = sql.NullString{
@@ -145,7 +145,7 @@ func (s *Store) createColumnImpl(ctx context.Context, tx *sql.Tx, create *api.Co
return &column, nil
}
-func (s *Store) findColumnImpl(ctx context.Context, tx *sql.Tx, find *api.ColumnFind) ([]*api.Column, error) {
+func (*Store) findColumnImpl(ctx context.Context, tx *sql.Tx, find *api.ColumnFind) ([]*api.Column, error) {
// Build WHERE clause.
where, args := []string{"1 = 1"}, []interface{}{}
if v := find.ID; v != nil {
@@ -227,7 +227,7 @@ func (s *Store) findColumnImpl(ctx context.Context, tx *sql.Tx, find *api.Column
}
// deleteColumnImpl deletes columns.
-func deleteColumnImpl(ctx context.Context, tx *sql.Tx, delete *api.ColumnDelete) error {
+func (*Store) deleteColumnImpl(ctx context.Context, tx *sql.Tx, delete *api.ColumnDelete) error {
if _, err := tx.ExecContext(ctx, `DELETE FROM col WHERE id = $1`, delete.ID); err != nil {
return FormatError(err)
}
diff --git a/store/data_source.go b/store/data_source.go
index 71c3f16e58..d42c505a58 100644
--- a/store/data_source.go
+++ b/store/data_source.go
@@ -233,7 +233,7 @@ func (s *Store) patchDataSourceRaw(ctx context.Context, patch *api.DataSourcePat
}
// createDataSourceImpl creates a new dataSource.
-func (s *Store) createDataSourceImpl(ctx context.Context, tx *sql.Tx, create *api.DataSourceCreate) (*dataSourceRaw, error) {
+func (*Store) createDataSourceImpl(ctx context.Context, tx *sql.Tx, create *api.DataSourceCreate) (*dataSourceRaw, error) {
// Insert row into dataSource.
query := `
INSERT INTO data_source (
@@ -289,7 +289,7 @@ func (s *Store) createDataSourceImpl(ctx context.Context, tx *sql.Tx, create *ap
return &dataSourceRaw, nil
}
-func (s *Store) findDataSourceImpl(ctx context.Context, tx *sql.Tx, find *api.DataSourceFind) ([]*dataSourceRaw, error) {
+func (*Store) findDataSourceImpl(ctx context.Context, tx *sql.Tx, find *api.DataSourceFind) ([]*dataSourceRaw, error) {
// Build WHERE clause.
where, args := []string{"1 = 1"}, []interface{}{}
if v := find.ID; v != nil {
@@ -363,7 +363,7 @@ func (s *Store) findDataSourceImpl(ctx context.Context, tx *sql.Tx, find *api.Da
}
// patchDataSourceImpl updates a dataSource by ID. Returns the new state of the dataSource after update.
-func (s *Store) patchDataSourceImpl(ctx context.Context, tx *sql.Tx, patch *api.DataSourcePatch) (*dataSourceRaw, error) {
+func (*Store) patchDataSourceImpl(ctx context.Context, tx *sql.Tx, patch *api.DataSourcePatch) (*dataSourceRaw, error) {
// Build UPDATE clause.
set, args := []string{"updater_id = $1"}, []interface{}{patch.UpdaterID}
if v := patch.Username; v != nil {
diff --git a/store/database.go b/store/database.go
index 7166ad0533..d98a9db540 100644
--- a/store/database.go
+++ b/store/database.go
@@ -441,7 +441,7 @@ func (s *Store) patchDatabaseRaw(ctx context.Context, patch *api.DatabasePatch)
}
// createDatabaseImpl creates a new database.
-func (s *Store) createDatabaseImpl(ctx context.Context, tx *sql.Tx, create *api.DatabaseCreate) (*databaseRaw, error) {
+func (*Store) createDatabaseImpl(ctx context.Context, tx *sql.Tx, create *api.DatabaseCreate) (*databaseRaw, error) {
// Insert row into database.
query := `
INSERT INTO db (
@@ -505,7 +505,7 @@ func (s *Store) createDatabaseImpl(ctx context.Context, tx *sql.Tx, create *api.
return &databaseRaw, nil
}
-func (s *Store) findDatabaseImpl(ctx context.Context, tx *sql.Tx, find *api.DatabaseFind) ([]*databaseRaw, error) {
+func (*Store) findDatabaseImpl(ctx context.Context, tx *sql.Tx, find *api.DatabaseFind) ([]*databaseRaw, error) {
// Build WHERE clause.
where, args := []string{"1 = 1"}, []interface{}{}
if v := find.ID; v != nil {
@@ -589,7 +589,7 @@ func (s *Store) findDatabaseImpl(ctx context.Context, tx *sql.Tx, find *api.Data
}
// patchDatabaseImpl updates a database by ID. Returns the new state of the database after update.
-func (s *Store) patchDatabaseImpl(ctx context.Context, tx *sql.Tx, patch *api.DatabasePatch) (*databaseRaw, error) {
+func (*Store) patchDatabaseImpl(ctx context.Context, tx *sql.Tx, patch *api.DatabasePatch) (*databaseRaw, error) {
// Build UPDATE clause.
set, args := []string{"updater_id = $1"}, []interface{}{patch.UpdaterID}
if v := patch.ProjectID; v != nil {
diff --git a/store/deploy.go b/store/deploy.go
index 2c4eba5c2a..d503348119 100644
--- a/store/deploy.go
+++ b/store/deploy.go
@@ -201,7 +201,7 @@ func (s *Store) getDeploymentConfigImpl(ctx context.Context, find *api.Deploymen
}
}
-func (s *Store) upsertDeploymentConfigImpl(ctx context.Context, tx *sql.Tx, upsert *api.DeploymentConfigUpsert) (*deploymentConfigRaw, error) {
+func (*Store) upsertDeploymentConfigImpl(ctx context.Context, tx *sql.Tx, upsert *api.DeploymentConfigUpsert) (*deploymentConfigRaw, error) {
if upsert.Payload == "" {
upsert.Payload = "{}"
}
diff --git a/store/environment.go b/store/environment.go
index aa13a59549..833946d818 100644
--- a/store/environment.go
+++ b/store/environment.go
@@ -236,7 +236,7 @@ func (s *Store) patchEnvironmentRaw(ctx context.Context, patch *api.EnvironmentP
}
// createEnvironmentImpl creates a new environment.
-func (s *Store) createEnvironmentImpl(ctx context.Context, tx *sql.Tx, create *api.EnvironmentCreate) (*environmentRaw, error) {
+func (Store) createEnvironmentImpl(ctx context.Context, tx *sql.Tx, create *api.EnvironmentCreate) (*environmentRaw, error) {
var order int
// The order is the MAX(order) + 1
if err := tx.QueryRowContext(ctx, `
@@ -286,7 +286,7 @@ func (s *Store) createEnvironmentImpl(ctx context.Context, tx *sql.Tx, create *a
return &envRaw, nil
}
-func (s *Store) findEnvironmentImpl(ctx context.Context, tx *sql.Tx, find *api.EnvironmentFind) ([]*environmentRaw, error) {
+func (*Store) findEnvironmentImpl(ctx context.Context, tx *sql.Tx, find *api.EnvironmentFind) ([]*environmentRaw, error) {
// Build WHERE clause.
where, args := []string{"1 = 1"}, []interface{}{}
if v := find.ID; v != nil {
@@ -345,7 +345,7 @@ func (s *Store) findEnvironmentImpl(ctx context.Context, tx *sql.Tx, find *api.E
}
// patchEnvironmentImpl updates a environment by ID. Returns the new state of the environment after update.
-func (s *Store) patchEnvironmentImpl(ctx context.Context, tx *sql.Tx, patch *api.EnvironmentPatch) (*environmentRaw, error) {
+func (*Store) patchEnvironmentImpl(ctx context.Context, tx *sql.Tx, patch *api.EnvironmentPatch) (*environmentRaw, error) {
// Build UPDATE clause.
set, args := []string{"updater_id = $1"}, []interface{}{patch.UpdaterID}
if v := patch.RowStatus; v != nil {
diff --git a/store/extension.go b/store/extension.go
index 60ccc9428b..4b6c83c033 100644
--- a/store/extension.go
+++ b/store/extension.go
@@ -94,7 +94,7 @@ func (s *Store) SetDBExtensionList(ctx context.Context, schema *db.Schema, datab
deletes, creates := generateDBExtensionActions(oldDBExtensionRawList, schema.ExtensionList, databaseID)
for _, d := range deletes {
- if err := deleteDBExtensionImpl(ctx, tx.PTx, d); err != nil {
+ if err := s.deleteDBExtensionImpl(ctx, tx.PTx, d); err != nil {
return err
}
}
@@ -197,7 +197,7 @@ func (s *Store) findDBExtensionRaw(ctx context.Context, find *api.DBExtensionFin
}
// createDBExtensionImpl creates a new DBExtension.
-func (s *Store) createDBExtensionImpl(ctx context.Context, tx *sql.Tx, create *api.DBExtensionCreate) (*dbExtensionRaw, error) {
+func (*Store) createDBExtensionImpl(ctx context.Context, tx *sql.Tx, create *api.DBExtensionCreate) (*dbExtensionRaw, error) {
// Insert row into db_extension.
query := `
INSERT INTO db_extension (
@@ -245,7 +245,7 @@ func (s *Store) createDBExtensionImpl(ctx context.Context, tx *sql.Tx, create *a
return &dbExtensionRaw, nil
}
-func (s *Store) findDBExtensionImpl(ctx context.Context, tx *sql.Tx, find *api.DBExtensionFind) ([]*dbExtensionRaw, error) {
+func (*Store) findDBExtensionImpl(ctx context.Context, tx *sql.Tx, find *api.DBExtensionFind) ([]*dbExtensionRaw, error) {
// Build WHERE clause.
where, args := []string{"1 = 1"}, []interface{}{}
if v := find.ID; v != nil {
@@ -306,7 +306,7 @@ func (s *Store) findDBExtensionImpl(ctx context.Context, tx *sql.Tx, find *api.D
}
// deleteDBExtensionImpl permanently deletes DBExtensions from a database.
-func deleteDBExtensionImpl(ctx context.Context, tx *sql.Tx, delete *api.DBExtensionDelete) error {
+func (*Store) deleteDBExtensionImpl(ctx context.Context, tx *sql.Tx, delete *api.DBExtensionDelete) error {
// Remove row from database.
if _, err := tx.ExecContext(ctx, `DELETE FROM db_extension WHERE id = $1`, delete.ID); err != nil {
return FormatError(err)
diff --git a/store/issue.go b/store/issue.go
index 2b17fdd014..0134a0e29a 100644
--- a/store/issue.go
+++ b/store/issue.go
@@ -469,7 +469,7 @@ func (s *Store) patchIssueRaw(ctx context.Context, patch *api.IssuePatch) (*issu
}
// createIssueImpl creates a new issue.
-func (s *Store) createIssueImpl(ctx context.Context, tx *sql.Tx, create *api.IssueCreate) (*issueRaw, error) {
+func (*Store) createIssueImpl(ctx context.Context, tx *sql.Tx, create *api.IssueCreate) (*issueRaw, error) {
if create.Payload == "" {
create.Payload = "{}"
}
@@ -523,7 +523,7 @@ func (s *Store) createIssueImpl(ctx context.Context, tx *sql.Tx, create *api.Iss
return &issueRaw, nil
}
-func (s *Store) findIssueImpl(ctx context.Context, tx *sql.Tx, find *api.IssueFind) ([]*issueRaw, error) {
+func (*Store) findIssueImpl(ctx context.Context, tx *sql.Tx, find *api.IssueFind) ([]*issueRaw, error) {
// Build WHERE clause.
where, args := []string{"1 = 1"}, []interface{}{}
if v := find.ID; v != nil {
@@ -609,7 +609,7 @@ func (s *Store) findIssueImpl(ctx context.Context, tx *sql.Tx, find *api.IssueFi
}
// patchIssueImpl updates a issue by ID. Returns the new state of the issue after update.
-func (s *Store) patchIssueImpl(ctx context.Context, tx *sql.Tx, patch *api.IssuePatch) (*issueRaw, error) {
+func (*Store) patchIssueImpl(ctx context.Context, tx *sql.Tx, patch *api.IssuePatch) (*issueRaw, error) {
// Build UPDATE clause.
set, args := []string{"updater_id = $1"}, []interface{}{patch.UpdaterID}
if v := patch.Name; v != nil {
diff --git a/store/issue_subscriber.go b/store/issue_subscriber.go
index 74bb289756..93ea9fb03f 100644
--- a/store/issue_subscriber.go
+++ b/store/issue_subscriber.go
@@ -64,7 +64,7 @@ func (s *Store) DeleteIssueSubscriber(ctx context.Context, delete *api.IssueSubs
}
defer tx.PTx.Rollback()
- if err := deleteIssueSubscriberImpl(ctx, tx.PTx, delete); err != nil {
+ if err := s.deleteIssueSubscriberImpl(ctx, tx.PTx, delete); err != nil {
return FormatError(err)
}
@@ -198,7 +198,7 @@ func findIssueSubscriberImpl(ctx context.Context, tx *sql.Tx, find *api.IssueSub
}
// deleteIssueSubscriberImpl permanently deletes a issueSubscriber by ID.
-func deleteIssueSubscriberImpl(ctx context.Context, tx *sql.Tx, delete *api.IssueSubscriberDelete) error {
+func (*Store) deleteIssueSubscriberImpl(ctx context.Context, tx *sql.Tx, delete *api.IssueSubscriberDelete) error {
// Remove row from database.
if _, err := tx.ExecContext(ctx, `DELETE FROM issue_subscriber WHERE issue_id = $1 AND subscriber_id = $2`, delete.IssueID, delete.SubscriberID); err != nil {
return FormatError(err)
diff --git a/store/label.go b/store/label.go
index 51031e498d..5771a26c27 100644
--- a/store/label.go
+++ b/store/label.go
@@ -266,7 +266,7 @@ func (s *Store) findLabelKeyRaw(ctx context.Context, find *api.LabelKeyFind) ([]
return ret, nil
}
-func (s *Store) findLabelKeyImpl(ctx context.Context, tx *sql.Tx, find *api.LabelKeyFind) ([]*labelKeyRaw, error) {
+func (*Store) findLabelKeyImpl(ctx context.Context, tx *sql.Tx, find *api.LabelKeyFind) ([]*labelKeyRaw, error) {
// Build WHERE clause.
where, args := []string{"1 = 1"}, []interface{}{}
if v := find.RowStatus; v != nil {
@@ -416,7 +416,7 @@ func (s *Store) patchLabelKeyRaw(ctx context.Context, patch *api.LabelKeyPatch)
return labelKeyRaw, nil
}
-func (s *Store) upsertLabelValueImpl(ctx context.Context, tx *sql.Tx, upsert labelValueUpsert) error {
+func (*Store) upsertLabelValueImpl(ctx context.Context, tx *sql.Tx, upsert labelValueUpsert) error {
// Upsert row into label_value
if _, err := tx.ExecContext(ctx, `
INSERT INTO label_value (
@@ -463,7 +463,7 @@ func (s *Store) findDatabaseLabelRaw(ctx context.Context, find *api.DatabaseLabe
return databaseLabelList, nil
}
-func (s *Store) findDatabaseLabelsImpl(ctx context.Context, tx *sql.Tx, find *api.DatabaseLabelFind) ([]*databaseLabelRaw, error) {
+func (*Store) findDatabaseLabelsImpl(ctx context.Context, tx *sql.Tx, find *api.DatabaseLabelFind) ([]*databaseLabelRaw, error) {
// Build WHERE clause.
where, args := []string{"1 = 1"}, []interface{}{}
if v := find.ID; v != nil {
@@ -522,7 +522,7 @@ func (s *Store) findDatabaseLabelsImpl(ctx context.Context, tx *sql.Tx, find *ap
return ret, nil
}
-func (s *Store) upsertDatabaseLabelImpl(ctx context.Context, tx *sql.Tx, upsert *api.DatabaseLabelUpsert) (*databaseLabelRaw, error) {
+func (*Store) upsertDatabaseLabelImpl(ctx context.Context, tx *sql.Tx, upsert *api.DatabaseLabelUpsert) (*databaseLabelRaw, error) {
// Upsert row into db_label
query := `
INSERT INTO db_label (
diff --git a/store/pipeline.go b/store/pipeline.go
index 211e6dbea7..a038f21e77 100644
--- a/store/pipeline.go
+++ b/store/pipeline.go
@@ -196,7 +196,7 @@ func (s *Store) findPipelineRaw(ctx context.Context, find *api.PipelineFind) ([]
}
defer tx.PTx.Rollback()
- list, err := findPipelineImpl(ctx, tx.PTx, find)
+ list, err := s.findPipelineImpl(ctx, tx.PTx, find)
if err != nil {
return nil, err
}
@@ -232,7 +232,7 @@ func (s *Store) getPipelineRaw(ctx context.Context, find *api.PipelineFind) (*pi
}
defer tx.PTx.Rollback()
- pipelineRawList, err := findPipelineImpl(ctx, tx.PTx, find)
+ pipelineRawList, err := s.findPipelineImpl(ctx, tx.PTx, find)
if err != nil {
return nil, err
}
@@ -274,7 +274,7 @@ func (s *Store) patchPipelineRaw(ctx context.Context, patch *api.PipelinePatch)
}
// createPipelineImpl creates a new pipeline.
-func (s *Store) createPipelineImpl(ctx context.Context, tx *sql.Tx, create *api.PipelineCreate) (*pipelineRaw, error) {
+func (*Store) createPipelineImpl(ctx context.Context, tx *sql.Tx, create *api.PipelineCreate) (*pipelineRaw, error) {
query := `
INSERT INTO pipeline (
creator_id,
@@ -307,7 +307,7 @@ func (s *Store) createPipelineImpl(ctx context.Context, tx *sql.Tx, create *api.
return &pipelineRaw, nil
}
-func findPipelineImpl(ctx context.Context, tx *sql.Tx, find *api.PipelineFind) ([]*pipelineRaw, error) {
+func (*Store) findPipelineImpl(ctx context.Context, tx *sql.Tx, find *api.PipelineFind) ([]*pipelineRaw, error) {
// Build WHERE clause.
where, args := []string{"1 = 1"}, []interface{}{}
if v := find.ID; v != nil {
@@ -361,7 +361,7 @@ func findPipelineImpl(ctx context.Context, tx *sql.Tx, find *api.PipelineFind) (
}
// patchPipelineImpl updates a pipeline by ID. Returns the new state of the pipeline after update.
-func (s *Store) patchPipelineImpl(ctx context.Context, tx *sql.Tx, patch *api.PipelinePatch) (*pipelineRaw, error) {
+func (*Store) patchPipelineImpl(ctx context.Context, tx *sql.Tx, patch *api.PipelinePatch) (*pipelineRaw, error) {
// Build UPDATE clause.
set, args := []string{"updater_id = $1"}, []interface{}{patch.UpdaterID}
if v := patch.Status; v != nil {
diff --git a/store/policy.go b/store/policy.go
index 4f9fac6b8d..62a5377b85 100644
--- a/store/policy.go
+++ b/store/policy.go
@@ -109,7 +109,7 @@ func (s *Store) DeletePolicy(ctx context.Context, delete *api.PolicyDelete) erro
return &common.Error{Code: common.Invalid, Err: fmt.Errorf("failed to delete policy with PolicyDelete[%+v], expect 'ARCHIVED' row_status", delete)}
}
- if err := deletePolicyImpl(ctx, tx.PTx, delete); err != nil {
+ if err := s.deletePolicyImpl(ctx, tx.PTx, delete); err != nil {
return FormatError(err)
}
@@ -439,7 +439,7 @@ func upsertPolicyImpl(ctx context.Context, tx *sql.Tx, upsert *api.PolicyUpsert)
}
// deletePolicyImpl deletes an existing ARCHIVED policy by id and type.
-func deletePolicyImpl(ctx context.Context, tx *sql.Tx, delete *api.PolicyDelete) error {
+func (*Store) deletePolicyImpl(ctx context.Context, tx *sql.Tx, delete *api.PolicyDelete) error {
// Remove row from policy.
if _, err := tx.ExecContext(ctx, `
DELETE FROM policy
diff --git a/store/project_member.go b/store/project_member.go
index 73d4467daf..34eb4c13d3 100644
--- a/store/project_member.go
+++ b/store/project_member.go
@@ -122,7 +122,7 @@ func (s *Store) DeleteProjectMember(ctx context.Context, delete *api.ProjectMemb
}
defer tx.PTx.Rollback()
- if err := deleteProjectMemberImpl(ctx, tx.PTx, delete); err != nil {
+ if err := s.deleteProjectMemberImpl(ctx, tx.PTx, delete); err != nil {
return FormatError(err)
}
@@ -369,7 +369,7 @@ func (s *Store) batchUpdateProjectMemberRaw(ctx context.Context, batchUpdate *ap
ID: deletedMember.ID,
DeleterID: batchUpdate.UpdaterID,
}
- if err := deleteProjectMemberImpl(ctx, tx.PTx, memberDelete); err != nil {
+ if err := s.deleteProjectMemberImpl(ctx, tx.PTx, memberDelete); err != nil {
return nil, nil, FormatError(err)
}
deletedMemberRawList = append(deletedMemberRawList, deletedMember)
@@ -545,7 +545,7 @@ func patchProjectMemberImpl(ctx context.Context, tx *sql.Tx, patch *api.ProjectM
}
// deleteProjectMemberImpl permanently deletes a projectMember by ID.
-func deleteProjectMemberImpl(ctx context.Context, tx *sql.Tx, delete *api.ProjectMemberDelete) error {
+func (*Store) deleteProjectMemberImpl(ctx context.Context, tx *sql.Tx, delete *api.ProjectMemberDelete) error {
// Remove row from database.
if _, err := tx.ExecContext(ctx, `DELETE FROM project_member WHERE id = $1`, delete.ID); err != nil {
return FormatError(err)
diff --git a/store/project_webhook.go b/store/project_webhook.go
index b381c79a58..5643c3141e 100644
--- a/store/project_webhook.go
+++ b/store/project_webhook.go
@@ -125,7 +125,7 @@ func (s *Store) DeleteProjectWebhook(ctx context.Context, delete *api.ProjectWeb
}
defer tx.PTx.Rollback()
- if err := deleteProjectWebhookImpl(ctx, tx.PTx, delete); err != nil {
+ if err := s.deleteProjectWebhookImpl(ctx, tx.PTx, delete); err != nil {
return FormatError(err)
}
@@ -411,7 +411,7 @@ func patchProjectWebhookImpl(ctx context.Context, tx *sql.Tx, patch *api.Project
}
// deleteProjectWebhookImpl permanently deletes a projectWebhook by ID.
-func deleteProjectWebhookImpl(ctx context.Context, tx *sql.Tx, delete *api.ProjectWebhookDelete) error {
+func (*Store) deleteProjectWebhookImpl(ctx context.Context, tx *sql.Tx, delete *api.ProjectWebhookDelete) error {
// Remove row from database.
if _, err := tx.ExecContext(ctx, `DELETE FROM project_webhook WHERE id = $1`, delete.ID); err != nil {
return FormatError(err)
diff --git a/store/stage.go b/store/stage.go
index 7db0c91bbb..80633e19a7 100644
--- a/store/stage.go
+++ b/store/stage.go
@@ -180,7 +180,7 @@ func (s *Store) findStageRaw(ctx context.Context, find *api.StageFind) ([]*stage
}
// createStageImpl creates a new stage.
-func (s *Store) createStageImpl(ctx context.Context, tx *sql.Tx, create *api.StageCreate) (*stageRaw, error) {
+func (*Store) createStageImpl(ctx context.Context, tx *sql.Tx, create *api.StageCreate) (*stageRaw, error) {
query := `
INSERT INTO stage (
creator_id,
@@ -217,7 +217,7 @@ func (s *Store) createStageImpl(ctx context.Context, tx *sql.Tx, create *api.Sta
return &stageRaw, nil
}
-func (s *Store) findStageImpl(ctx context.Context, tx *sql.Tx, find *api.StageFind) ([]*stageRaw, error) {
+func (*Store) findStageImpl(ctx context.Context, tx *sql.Tx, find *api.StageFind) ([]*stageRaw, error) {
// Build WHERE clause.
where, args := []string{"1 = 1"}, []interface{}{}
if v := find.ID; v != nil {
diff --git a/store/table.go b/store/table.go
index a61659eede..acfb285337 100644
--- a/store/table.go
+++ b/store/table.go
@@ -117,7 +117,7 @@ func (s *Store) SetTableList(ctx context.Context, schema *db.Schema, databaseID
}
creates, patches, deletes := generateTableActions(oldTableRawList, schema.TableList, databaseID)
for _, d := range deletes {
- if err := deleteTableImpl(ctx, tx.PTx, d); err != nil {
+ if err := s.deleteTableImpl(ctx, tx.PTx, d); err != nil {
return err
}
}
@@ -157,7 +157,7 @@ func (s *Store) SetTableList(ctx context.Context, schema *db.Schema, databaseID
}
deletes, creates := generateColumnActions(columnList, table.ColumnList, databaseID, tableID)
for _, d := range deletes {
- if err := deleteColumnImpl(ctx, tx.PTx, d); err != nil {
+ if err := s.deleteColumnImpl(ctx, tx.PTx, d); err != nil {
return err
}
}
@@ -175,7 +175,7 @@ func (s *Store) SetTableList(ctx context.Context, schema *db.Schema, databaseID
}
idxDeletes, idxCreates := generateIndexActions(indexList, table.IndexList, databaseID, tableID)
for _, d := range idxDeletes {
- if err := deleteIndexImpl(ctx, tx.PTx, d); err != nil {
+ if err := s.deleteIndexImpl(ctx, tx.PTx, d); err != nil {
return err
}
}
@@ -329,7 +329,7 @@ func (s *Store) getTableRaw(ctx context.Context, find *api.TableFind) (*tableRaw
}
// createTableImpl creates a new table.
-func (s *Store) createTableImpl(ctx context.Context, tx *sql.Tx, create *api.TableCreate) (*tableRaw, error) {
+func (*Store) createTableImpl(ctx context.Context, tx *sql.Tx, create *api.TableCreate) (*tableRaw, error) {
// Insert row into table.
query := `
INSERT INTO tbl (
@@ -396,7 +396,7 @@ func (s *Store) createTableImpl(ctx context.Context, tx *sql.Tx, create *api.Tab
}
// patchTableImpl patches a table.
-func (s *Store) patchTableImpl(ctx context.Context, tx *sql.Tx, patch *api.TablePatch) (*tableRaw, error) {
+func (*Store) patchTableImpl(ctx context.Context, tx *sql.Tx, patch *api.TablePatch) (*tableRaw, error) {
var tableRaw tableRaw
// Execute update query with RETURNING.
if err := tx.QueryRowContext(ctx, `
@@ -440,7 +440,7 @@ func (s *Store) patchTableImpl(ctx context.Context, tx *sql.Tx, patch *api.Table
return &tableRaw, nil
}
-func (s *Store) findTableImpl(ctx context.Context, tx *sql.Tx, find *api.TableFind) ([]*tableRaw, error) {
+func (*Store) findTableImpl(ctx context.Context, tx *sql.Tx, find *api.TableFind) ([]*tableRaw, error) {
// Build WHERE clause.
where, args := []string{"1 = 1"}, []interface{}{}
if v := find.ID; v != nil {
@@ -515,7 +515,7 @@ func (s *Store) findTableImpl(ctx context.Context, tx *sql.Tx, find *api.TableFi
}
// deleteTableImpl permanently deletes tables from a database.
-func deleteTableImpl(ctx context.Context, tx *sql.Tx, delete *api.TableDelete) error {
+func (*Store) deleteTableImpl(ctx context.Context, tx *sql.Tx, delete *api.TableDelete) error {
// Remove row from database.
if _, err := tx.ExecContext(ctx, `DELETE FROM tbl WHERE id = $1`, delete.ID); err != nil {
return FormatError(err)
diff --git a/store/table_index.go b/store/table_index.go
index 07d74694c7..002d434384 100644
--- a/store/table_index.go
+++ b/store/table_index.go
@@ -344,7 +344,7 @@ func (s *Store) findIndexImpl(ctx context.Context, tx *sql.Tx, find *api.IndexFi
}
// deleteIndexImpl deletes an index.
-func deleteIndexImpl(ctx context.Context, tx *sql.Tx, delete *api.IndexDelete) error {
+func (*Store) deleteIndexImpl(ctx context.Context, tx *sql.Tx, delete *api.IndexDelete) error {
if _, err := tx.ExecContext(ctx, `DELETE FROM idx WHERE id = $1`, delete.ID); err != nil {
return FormatError(err)
}
diff --git a/store/task.go b/store/task.go
index a356a6524c..99ba7a833b 100644
--- a/store/task.go
+++ b/store/task.go
@@ -378,7 +378,7 @@ func (s *Store) patchTaskRawStatus(ctx context.Context, patch *api.TaskStatusPat
}
// createTaskImpl creates a new task.
-func (s *Store) createTaskImpl(ctx context.Context, tx *sql.Tx, create *api.TaskCreate) (*taskRaw, error) {
+func (*Store) createTaskImpl(ctx context.Context, tx *sql.Tx, create *api.TaskCreate) (*taskRaw, error) {
var row *sql.Row
if create.Payload == "" {
@@ -573,7 +573,7 @@ func (s *Store) findTaskImpl(ctx context.Context, tx *sql.Tx, find *api.TaskFind
}
// patchTaskImpl updates a task by ID. Returns the new state of the task after update.
-func (s *Store) patchTaskImpl(ctx context.Context, tx *sql.Tx, patch *api.TaskPatch) (*taskRaw, error) {
+func (*Store) patchTaskImpl(ctx context.Context, tx *sql.Tx, patch *api.TaskPatch) (*taskRaw, error) {
// Build UPDATE clause.
set, args := []string{"updater_id = $1"}, []interface{}{patch.UpdaterID}
if v := patch.DatabaseID; v != nil {
diff --git a/store/task_check_run.go b/store/task_check_run.go
index 217cd03807..c202eec3cf 100644
--- a/store/task_check_run.go
+++ b/store/task_check_run.go
@@ -189,7 +189,7 @@ func (s *Store) createTaskCheckRunRawIfNeeded(ctx context.Context, create *api.T
}
// createTaskCheckRunImpl creates a new taskCheckRun.
-func (s *Store) createTaskCheckRunImpl(ctx context.Context, tx *sql.Tx, create *api.TaskCheckRunCreate) (*taskCheckRunRaw, error) {
+func (*Store) createTaskCheckRunImpl(ctx context.Context, tx *sql.Tx, create *api.TaskCheckRunCreate) (*taskCheckRunRaw, error) {
if create.Payload == "" {
create.Payload = "{}"
}
@@ -283,7 +283,7 @@ func (s *Store) patchTaskCheckRunRawStatus(ctx context.Context, patch *api.TaskC
}
// patchTaskCheckRunStatusImpl updates a taskCheckRun status. Returns the new state of the taskCheckRun after update.
-func (s *Store) patchTaskCheckRunStatusImpl(ctx context.Context, tx *sql.Tx, patch *api.TaskCheckRunStatusPatch) (*taskCheckRunRaw, error) {
+func (*Store) patchTaskCheckRunStatusImpl(ctx context.Context, tx *sql.Tx, patch *api.TaskCheckRunStatusPatch) (*taskCheckRunRaw, error) {
// Build UPDATE clause.
if patch.Result == "" {
patch.Result = "{}"
@@ -329,7 +329,7 @@ func (s *Store) patchTaskCheckRunStatusImpl(ctx context.Context, tx *sql.Tx, pat
return &taskCheckRunRaw, nil
}
-func (s *Store) findTaskCheckRunImpl(ctx context.Context, tx *sql.Tx, find *api.TaskCheckRunFind) ([]*taskCheckRunRaw, error) {
+func (*Store) findTaskCheckRunImpl(ctx context.Context, tx *sql.Tx, find *api.TaskCheckRunFind) ([]*taskCheckRunRaw, error) {
// Build WHERE clause.
where, args := []string{"1 = 1"}, []interface{}{}
if v := find.ID; v != nil {
diff --git a/store/task_run.go b/store/task_run.go
index 752d38b961..023f758f94 100644
--- a/store/task_run.go
+++ b/store/task_run.go
@@ -61,7 +61,7 @@ func (raw *taskRunRaw) toTaskRun() *api.TaskRun {
}
// createTaskRunImpl creates a new taskRun.
-func (s *Store) createTaskRunImpl(ctx context.Context, tx *sql.Tx, create *api.TaskRunCreate) (*taskRunRaw, error) {
+func (*Store) createTaskRunImpl(ctx context.Context, tx *sql.Tx, create *api.TaskRunCreate) (*taskRunRaw, error) {
if create.Payload == "" {
create.Payload = "{}"
}
@@ -125,7 +125,7 @@ func (s *Store) getTaskRunRawTx(ctx context.Context, tx *sql.Tx, find *api.TaskR
}
// patchTaskRunStatusImpl updates a taskRun status. Returns the new state of the taskRun after update.
-func (s *Store) patchTaskRunStatusImpl(ctx context.Context, tx *sql.Tx, patch *api.TaskRunStatusPatch) (*taskRunRaw, error) {
+func (*Store) patchTaskRunStatusImpl(ctx context.Context, tx *sql.Tx, patch *api.TaskRunStatusPatch) (*taskRunRaw, error) {
// Build UPDATE clause.
set, args := []string{"updater_id = $1"}, []interface{}{patch.UpdaterID}
set, args = append(set, "status = $2"), append(args, patch.Status)
@@ -183,7 +183,7 @@ func (s *Store) patchTaskRunStatusImpl(ctx context.Context, tx *sql.Tx, patch *a
return &taskRunRaw, nil
}
-func (s *Store) findTaskRunImpl(ctx context.Context, tx *sql.Tx, find *api.TaskRunFind) ([]*taskRunRaw, error) {
+func (*Store) findTaskRunImpl(ctx context.Context, tx *sql.Tx, find *api.TaskRunFind) ([]*taskRunRaw, error) {
// Build WHERE clause.
where, args := []string{"1 = 1"}, []interface{}{}
if v := find.ID; v != nil {
diff --git a/store/vcs.go b/store/vcs.go
index cac7896159..eb13ca61ba 100644
--- a/store/vcs.go
+++ b/store/vcs.go
@@ -231,7 +231,7 @@ func (s *Store) deleteVCSRaw(ctx context.Context, delete *api.VCSDelete) error {
}
defer tx.PTx.Rollback()
- if err := deleteVCSImpl(ctx, tx.PTx, delete); err != nil {
+ if err := s.deleteVCSImpl(ctx, tx.PTx, delete); err != nil {
return FormatError(err)
}
@@ -398,7 +398,7 @@ func patchVCSImpl(ctx context.Context, tx *sql.Tx, patch *api.VCSPatch) (*vcsRaw
}
// deleteVCSImpl permanently deletes a vcs by ID.
-func deleteVCSImpl(ctx context.Context, tx *sql.Tx, delete *api.VCSDelete) error {
+func (*Store) deleteVCSImpl(ctx context.Context, tx *sql.Tx, delete *api.VCSDelete) error {
// Remove row from database.
if _, err := tx.ExecContext(ctx, `DELETE FROM vcs WHERE id = $1`, delete.ID); err != nil {
return FormatError(err)
diff --git a/store/view.go b/store/view.go
index d61877500b..dac9bd2c64 100644
--- a/store/view.go
+++ b/store/view.go
@@ -87,7 +87,7 @@ func (s *Store) SetViewList(ctx context.Context, schema *db.Schema, databaseID i
deletes, creates := generateViewActions(oldViewRawList, schema.ViewList, databaseID)
for _, d := range deletes {
- if err := deleteViewImpl(ctx, tx.PTx, d); err != nil {
+ if err := s.deleteViewImpl(ctx, tx.PTx, d); err != nil {
return err
}
}
@@ -191,7 +191,7 @@ func (s *Store) findViewRaw(ctx context.Context, find *api.ViewFind) ([]*viewRaw
}
// createViewImpl creates a new view.
-func (s *Store) createViewImpl(ctx context.Context, tx *sql.Tx, create *api.ViewCreate) (*viewRaw, error) {
+func (*Store) createViewImpl(ctx context.Context, tx *sql.Tx, create *api.ViewCreate) (*viewRaw, error) {
// Insert row into view.
query := `
INSERT INTO vw (
@@ -236,7 +236,7 @@ func (s *Store) createViewImpl(ctx context.Context, tx *sql.Tx, create *api.View
return &viewRaw, nil
}
-func (s *Store) findViewImpl(ctx context.Context, tx *sql.Tx, find *api.ViewFind) ([]*viewRaw, error) {
+func (*Store) findViewImpl(ctx context.Context, tx *sql.Tx, find *api.ViewFind) ([]*viewRaw, error) {
// Build WHERE clause.
where, args := []string{"1 = 1"}, []interface{}{}
if v := find.ID; v != nil {
@@ -298,7 +298,7 @@ func (s *Store) findViewImpl(ctx context.Context, tx *sql.Tx, find *api.ViewFind
}
// deleteViewImpl permanently deletes views from a database.
-func deleteViewImpl(ctx context.Context, tx *sql.Tx, delete *api.ViewDelete) error {
+func (*Store) deleteViewImpl(ctx context.Context, tx *sql.Tx, delete *api.ViewDelete) error {
// Remove row from database.
if _, err := tx.ExecContext(ctx, `DELETE FROM vw WHERE id = $1`, delete.ID); err != nil {
return FormatError(err)
diff --git a/tests/tests.go b/tests/tests.go
index d50b2bc3f5..0d79a4d77c 100644
--- a/tests/tests.go
+++ b/tests/tests.go
@@ -357,7 +357,7 @@ func (ctl *controller) Login() error {
}
// provisionSQLiteInstance provisions a SQLite instance (a directory).
-func (ctl *controller) provisionSQLiteInstance(rootDir, name string) (string, error) {
+func (*controller) provisionSQLiteInstance(rootDir, name string) (string, error) {
p := path.Join(rootDir, name)
if err := os.MkdirAll(p, os.ModePerm); err != nil {
return "", fmt.Errorf("failed to make directory %q, error: %w", p, err)
@@ -1373,7 +1373,7 @@ func (ctl *controller) deletePolicy(policyDelete api.PolicyDelete) error {
// schemaReviewTaskCheckRunFinished will return schema review task check result for next task.
// If the schema review task check is not done, return nil, false, nil.
-func (ctl *controller) schemaReviewTaskCheckRunFinished(issue *api.Issue) ([]api.TaskCheckResult, bool, error) {
+func (*controller) schemaReviewTaskCheckRunFinished(issue *api.Issue) ([]api.TaskCheckResult, bool, error) {
var result []api.TaskCheckResult
var latestTs int64
for _, stage := range issue.Pipeline.StageList {