Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
chore: enable linter godot (#2003)
Yilong Li7902b9a8497d
diff --git a/.golangci.yaml b/.golangci.yamlindex 79d8caa181..3d77b31053 100644--- a/.golangci.yaml+++ b/.golangci.yaml@@ -10,6 +10,7 @@ linters:- sqlclosecheck- rowserrcheck- nilerr+ - godot# golangci-lint run --exclude="Rollback,logger.Sync,pgInstance.Stop"issues:diff --git a/api/activity.go b/api/activity.goindex 14228b2a2f..73aeccbd47 100644--- a/api/activity.go+++ b/api/activity.go@@ -30,7 +30,7 @@ const (// ActivityPipelineTaskEarliestAllowedTimeUpdate is the type for updating pipeline task the earliest allowed time.ActivityPipelineTaskEarliestAllowedTimeUpdate ActivityType = "bb.pipeline.task.general.earliest-allowed-time.update"- // Member related+ // Member related.// ActivityMemberCreate is the type for creating members.ActivityMemberCreate ActivityType = "bb.member.create"@@ -41,7 +41,7 @@ const (// ActivityMemberDeactivate is the type for deactivating members.ActivityMemberDeactivate ActivityType = "bb.member.deactivate"- // Project related+ // Project related.// ActivityProjectRepositoryPush is the type for pushing repositories.ActivityProjectRepositoryPush ActivityType = "bb.project.repository.push"@@ -54,12 +54,12 @@ const (// ActivityProjectMemberRoleUpdate is the type for updating project member roles.ActivityProjectMemberRoleUpdate ActivityType = "bb.project.member.role.update"- // SQL Editor related+ // SQL Editor related.// ActivitySQLEditorQuery is the type for executing query.ActivitySQLEditorQuery ActivityType = "bb.sql-editor.query"- // Database related+ // Database related.// ActivityDatabaseRecoveryPITRDone is the type for performing PITR on the database successfully.ActivityDatabaseRecoveryPITRDone ActivityType = "bb.database.recovery.pitr.done"diff --git a/api/actuator.go b/api/actuator.goindex a45e64ced7..c8706c411f 100644--- a/api/actuator.go+++ b/api/actuator.go@@ -1,7 +1,7 @@package api// ServerInfo is the API message for server info.-// Actuator concept is similar to the Spring Boot Actuator+// Actuator concept is similar to the Spring Boot Actuator.type ServerInfo struct {Version string `json:"version"`GitCommit string `json:"gitCommit"`diff --git a/api/api_dependency_gate.go b/api/api_dependency_gate.goindex 9f7b09e67e..d87efd5735 100644--- a/api/api_dependency_gate.go+++ b/api/api_dependency_gate.go@@ -8,7 +8,7 @@ package api// 1. the plugin package should NOT depend on the api package as the plugin package should be self-contained.import (- // dependency gate+ // dependency gate._ "github.com/bytebase/bytebase/plugin/advisor"_ "github.com/bytebase/bytebase/plugin/db"_ "github.com/bytebase/bytebase/plugin/metric"diff --git a/api/backup.go b/api/backup.goindex 58ad77003d..d69acd3b78 100644--- a/api/backup.go+++ b/api/backup.go@@ -96,10 +96,10 @@ type Backup struct {Payload BackupPayload `jsonapi:"attr,payload"`}-// ZapBackupArray is a helper to format zap.Array+// ZapBackupArray is a helper to format zap.Array.type ZapBackupArray []*Backup-// MarshalLogArray implements the zapcore.ArrayMarshaler interface+// MarshalLogArray implements the zapcore.ArrayMarshaler interface.func (backups ZapBackupArray) MarshalLogArray(arr zapcore.ArrayEncoder) error {for _, backup := range backups {payload, err := json.Marshal(backup.Payload)diff --git a/api/database.go b/api/database.goindex 1155c53e45..3ca3d6fa9c 100644--- a/api/database.go+++ b/api/database.go@@ -11,7 +11,7 @@ const (DefaultCharactorSetName = "utf8mb4"// DefaultCollationName is the default collation name.// Use utf8mb4_general_ci instead of the new MySQL 8.0.1 default utf8mb4_0900_ai_ci- // because the former is compatible with more other MySQL flavors (e.g. MariaDB)+ // because the former is compatible with more other MySQL flavors (e.g. MariaDB).DefaultCollationName = "utf8mb4_general_ci")diff --git a/api/instance.go b/api/instance.goindex 1930a7733f..e2bdd7cd79 100644--- a/api/instance.go+++ b/api/instance.go@@ -137,7 +137,7 @@ type InstanceMigration struct {}// MigrationHistory is stored in the instance instead of our own data file, so the field-// format is a bit different from the standard format+// format is a bit different from the standard format.type MigrationHistory struct {ID int `jsonapi:"primary,migrationHistory"`diff --git a/api/issue.go b/api/issue.goindex 14c803bcd6..3d0b664c4c 100644--- a/api/issue.go+++ b/api/issue.go@@ -162,7 +162,7 @@ type UpdateSchemaContext struct {VCSPushEvent *vcs.PushEvent}-// UpdateSchemaGhostDetail is the detail of updating database schema using gh-ost+// UpdateSchemaGhostDetail is the detail of updating database schema using gh-ost.type UpdateSchemaGhostDetail struct {// DatabaseID is the ID of a database.DatabaseID int `json:"databaseId"`diff --git a/api/label.go b/api/label.goindex df67cd6349..8c3a291531 100644--- a/api/label.go+++ b/api/label.go@@ -12,9 +12,9 @@ const (DatabaseLabelSizeMax = 4labelLengthMax = 63- // LocationLabelKey is the label key for location+ // LocationLabelKey is the label key for location.LocationLabelKey = "bb.location"- // TenantLabelKey is the label key for tenant+ // TenantLabelKey is the label key for tenant.TenantLabelKey = "bb.tenant")diff --git a/api/plan.go b/api/plan.goindex 6ef55cc596..77bd5adaa6 100644--- a/api/plan.go+++ b/api/plan.go@@ -31,12 +31,12 @@ func (p PlanType) String() string {type FeatureType stringconst (- // Change Workflow+ // Change Workflow.// FeatureSchemaDrift detects if there occurs schema drift.// See https://bytebase.com/docs/features/drift-detectionFeatureSchemaDrift FeatureType = "bb.feature.schema-drift"- // FeatureTaskScheduleTime allows user to run task at a scheduled time+ // FeatureTaskScheduleTime allows user to run task at a scheduled time.FeatureTaskScheduleTime FeatureType = "bb.feature.task-schedule-time"// FeatureMultiTenancy allows user to enable tenant mode for the project.//@@ -70,7 +70,7 @@ const (// FeaturePITR allows user to perform point-in-time recovery for databases.FeaturePITR FeatureType = "bb.feature.pitr"- // Policy Control+ // Policy Control.// FeatureApprovalPolicy allows user to specify approval policy for the environment//@@ -87,12 +87,12 @@ const (// e.g. One can configure rules for database schema or SQL query.FeatureSQLReviewPolicy FeatureType = "bb.feature.sql-review"- // Admin & Security+ // Admin & Security.// FeatureRBAC enables RBAC.//// - Workspace level RBAC- // - Project level RBAC+ // - Project level RBAC.FeatureRBAC FeatureType = "bb.feature.rbac"// Feature3rdPartyAuth allows user to authenticate (login) and authorize (sync project member)@@ -100,7 +100,7 @@ const (// Currently, we only support GitLab EE/CE auth.Feature3rdPartyAuth FeatureType = "bb.feature.3rd-party-auth"- // Branding+ // Branding.// FeatureBranding enables customized branding.//@@ -108,7 +108,7 @@ const (FeatureBranding FeatureType = "bb.feature.branding")-// Name returns a readable name of the feature+// Name returns a readable name of the feature.func (e FeatureType) Name() string {switch e {case FeatureSchemaDrift:@@ -158,7 +158,7 @@ func (e FeatureType) minimumSupportedPlan() PlanType {return ENTERPRISE}-// FeatureMatrix is a map from the a particular feature to the respective enablement of a particular plan+// FeatureMatrix is a map from the a particular feature to the respective enablement of a particular plan.var FeatureMatrix = map[FeatureType][3]bool{"bb.feature.schema-drift": {false, true, true},"bb.feature.task-schedule-time": {false, true, true},diff --git a/api/policy.go b/api/policy.goindex 64ee335a45..dacb49d423 100644--- a/api/policy.go+++ b/api/policy.go@@ -114,7 +114,7 @@ type PolicyDelete struct {Type PolicyType}-// PipelineApprovalPolicy is the policy configuration for pipeline approval+// PipelineApprovalPolicy is the policy configuration for pipeline approval.type PipelineApprovalPolicy struct {Value PipelineApprovalValue `json:"value"`}diff --git a/api/project.go b/api/project.goindex 4f6babe32e..8bc794aeba 100644--- a/api/project.go+++ b/api/project.go@@ -130,7 +130,7 @@ var (// TenantToken is the token for tenant.TenantToken = "{{TENANT}}"- // boolean indicates whether it's an required or optional token+ // boolean indicates whether it's an required or optional token.repositoryFilePathTemplateTokens = map[string]bool{"{{VERSION}}": true,DBNameToken: true,diff --git a/api/project_member.go b/api/project_member.goindex 4f166ba70e..02f7445fe2 100644--- a/api/project_member.go+++ b/api/project_member.go@@ -19,7 +19,7 @@ const (ProjectRoleProviderGitHubCom ProjectRoleProvider = "GITHUB_COM")-// ProjectRoleProviderPayload is the payload for role provider+// ProjectRoleProviderPayload is the payload for role provider.type ProjectRoleProviderPayload struct {VCSRole string `json:"vcsRole"`LastSyncTs int64 `json:"lastSyncTs"`diff --git a/api/task_check_run.go b/api/task_check_run.goindex bf684e2467..87241245fd 100644--- a/api/task_check_run.go+++ b/api/task_check_run.go@@ -180,7 +180,7 @@ type TaskCheckRunStatusPatch struct {Result string}-// ConvertToAdvisorDBType will convert db type into advisor db type+// ConvertToAdvisorDBType will convert db type into advisor db type.func ConvertToAdvisorDBType(dbType db.Type) (advisor.DBType, error) {switch dbType {case db.MySQL:diff --git a/api/task_dag.go b/api/task_dag.goindex 8eecef060c..ae3539cdf3 100644--- a/api/task_dag.go+++ b/api/task_dag.go@@ -2,7 +2,7 @@ package api// TaskDAG describes task dependency relationship.// FromTaskID blocks ToTaskID-// It's rather DAGEdge than DAG+// It's rather DAGEdge than DAG.type TaskDAG struct {ID intdiff --git a/api/vcs.go b/api/vcs.goindex bcd73d006a..98ba59e7b0 100644--- a/api/vcs.go+++ b/api/vcs.go@@ -80,7 +80,7 @@ type VCSDelete struct {DeleterID int}-// ExternalRepository is the API message for external repository+// ExternalRepository is the API message for external repository.type ExternalRepository struct {ID int64 `jsonapi:"primary,id"`Name string `jsonapi:"attr,name"`diff --git a/bin/bb/cmd/migrate_test.go b/bin/bb/cmd/migrate_test.goindex aefca4b39c..2714568dd8 100644--- a/bin/bb/cmd/migrate_test.go+++ b/bin/bb/cmd/migrate_test.go@@ -10,7 +10,7 @@ import ("github.com/bytebase/bytebase/resources/mysql""github.com/stretchr/testify/require"- // embed expected output+ // embed expected output._ "embed")diff --git a/bin/bb/cmd/version.go b/bin/bb/cmd/version.goindex 5b0de5a792..b5700c1961 100644--- a/bin/bb/cmd/version.go+++ b/bin/bb/cmd/version.go@@ -6,7 +6,7 @@ import ("github.com/spf13/cobra")-// These should be set via go build -ldflags -X 'xxxx'+// These should be set via go build -ldflags -X 'xxxx'.var version = "development"var goversion = "unknown"var gitcommit = "unknown"diff --git a/bin/bb/main.go b/bin/bb/main.goindex e224dc0ea5..d89d35c4f6 100644--- a/bin/bb/main.go+++ b/bin/bb/main.go@@ -6,9 +6,9 @@ import ("github.com/bytebase/bytebase/bin/bb/cmd"- // Register mysql driver+ // Register mysql driver._ "github.com/bytebase/bytebase/plugin/db/mysql"- // Register postgres driver+ // Register postgres driver._ "github.com/bytebase/bytebase/plugin/db/pg")diff --git a/bin/server/cmd/root.go b/bin/server/cmd/root.goindex 6e57dcc1d6..e1c0f323b3 100644--- a/bin/server/cmd/root.go+++ b/bin/server/cmd/root.go@@ -36,11 +36,11 @@ import (// Register postgresql advisor._ "github.com/bytebase/bytebase/plugin/advisor/pg"- // Register postgres parser driver+ // Register postgres parser driver._ "github.com/bytebase/bytebase/plugin/parser/engine/pg")-// -----------------------------------Global constant BEGIN----------------------------------------+// -----------------------------------Global constant BEGIN----------------------------------------.const (// greetingBanner is the greeting banner.@@ -72,7 +72,7 @@ ________________________________________________________________________________// -----------------------------------Global constant END-------------------------------------------// -----------------------------------Command Line Config BEGIN------------------------------------+// -----------------------------------Command Line Config BEGIN------------------------------------.var (flags struct {// Used for Bytebase command line configdiff --git a/bin/server/cmd/version.go b/bin/server/cmd/version.goindex 3ec3afb21e..6d631e4f2e 100644--- a/bin/server/cmd/version.go+++ b/bin/server/cmd/version.go@@ -6,7 +6,7 @@ import ("github.com/spf13/cobra")-// These should be set via go build -ldflags -X 'xxxx'+// These should be set via go build -ldflags -X 'xxxx'.var version = "development"var goversion = "unknown"var gitcommit = "unknown"diff --git a/common/error.go b/common/error.goindex dc137a7261..a7c0764e72 100644--- a/common/error.go+++ b/common/error.go@@ -10,7 +10,7 @@ type Code int// Application error codes.const (- // 0 ~ 99 general error+ // 0 ~ 99 general error.Ok Code = 0Internal Code = 1NotAuthorized Code = 2@@ -19,12 +19,12 @@ const (Conflict Code = 5NotImplemented Code = 6- // 101 ~ 199 db error+ // 101 ~ 199 db error.DbConnectionFailure Code = 101DbExecutionError Code = 102// 201 db migration error- // Db migration is a core feature, so we separate it from the db error+ // Db migration is a core feature, so we separate it from the db error.MigrationSchemaMissing Code = 201MigrationAlreadyApplied Code = 202MigrationOutOfOrder Code = 203@@ -32,7 +32,7 @@ const (MigrationPending Code = 205MigrationFailed Code = 206- // 301 task error+ // 301 task error.TaskTimingNotAllowed Code = 301)diff --git a/common/oauth.go b/common/oauth.goindex 6d1cae8fc8..bbacbe85f7 100644--- a/common/oauth.go+++ b/common/oauth.go@@ -3,7 +3,7 @@ package common// TokenRefresher is a function refreshes the oauth token and updates the repository.type TokenRefresher func(token, refreshToken string, expiresTs int64) error-// OauthContext encapsulated the oauth info+// OauthContext encapsulated the oauth info.type OauthContext struct {ClientID stringClientSecret stringdiff --git a/metric/collector/database_count.go b/metric/collector/database_count.goindex f99960d067..19821f5354 100644--- a/metric/collector/database_count.go+++ b/metric/collector/database_count.go@@ -16,14 +16,14 @@ type databaseCountCollector struct {store *store.Store}-// NewDatabaseCountCollector creates a new instance of databaseCountCollector+// NewDatabaseCountCollector creates a new instance of databaseCountCollector.func NewDatabaseCountCollector(store *store.Store) metric.Collector {return &databaseCountCollector{store: store,}}-// Collect will collect the metric for database+// Collect will collect the metric for database.func (c *databaseCountCollector) Collect(ctx context.Context) ([]*metric.Metric, error) {var res []*metric.Metricdiff --git a/metric/collector/instance_count.go b/metric/collector/instance_count.goindex a3aa6d67bf..1fc44bfc11 100644--- a/metric/collector/instance_count.go+++ b/metric/collector/instance_count.go@@ -17,14 +17,14 @@ type instanceCountCollector struct {store *store.Store}-// NewInstanceCountCollector creates a new instance of instanceCollector+// NewInstanceCountCollector creates a new instance of instanceCollector.func NewInstanceCountCollector(store *store.Store) metric.Collector {return &instanceCountCollector{store: store,}}-// Collect will collect the metric for instance+// Collect will collect the metric for instance.func (c *instanceCountCollector) Collect(ctx context.Context) ([]*metric.Metric, error) {var res []*metric.Metricdiff --git a/metric/collector/issue_count.go b/metric/collector/issue_count.goindex bbc8e6282f..38cba6a2b1 100644--- a/metric/collector/issue_count.go+++ b/metric/collector/issue_count.go@@ -15,14 +15,14 @@ type issueCountCollector struct {store *store.Store}-// NewIssueCountCollector creates a new instance of issueCollector+// NewIssueCountCollector creates a new instance of issueCollector.func NewIssueCountCollector(store *store.Store) metric.Collector {return &issueCountCollector{store: store,}}-// Collect will collect the metric for issue+// Collect will collect the metric for issue.func (c *issueCountCollector) Collect(ctx context.Context) ([]*metric.Metric, error) {var res []*metric.Metricdiff --git a/metric/collector/member_count.go b/metric/collector/member_count.goindex babf0d4697..2ce6acc413 100644--- a/metric/collector/member_count.go+++ b/metric/collector/member_count.go@@ -15,14 +15,14 @@ type memberCountCollector struct {store *store.Store}-// NewMemberCountCollector creates a new instance of memberCountCollector+// NewMemberCountCollector creates a new instance of memberCountCollector.func NewMemberCountCollector(store *store.Store) metric.Collector {return &memberCountCollector{store: store,}}-// Collect will collect the metric for issue+// Collect will collect the metric for issue.func (c *memberCountCollector) Collect(ctx context.Context) ([]*metric.Metric, error) {var res []*metric.Metricdiff --git a/metric/collector/policy_count.go b/metric/collector/policy_count.goindex f63dae868a..d0458ba7d6 100644--- a/metric/collector/policy_count.go+++ b/metric/collector/policy_count.go@@ -17,14 +17,14 @@ type policyCountCollector struct {store *store.Store}-// NewPolicyCountCollector creates a new instance of policyCollector+// NewPolicyCountCollector creates a new instance of policyCollector.func NewPolicyCountCollector(store *store.Store) metric.Collector {return &policyCountCollector{store: store,}}-// Collect will collect the metric for policy+// Collect will collect the metric for policy.func (c *policyCountCollector) Collect(ctx context.Context) ([]*metric.Metric, error) {var res []*metric.Metricdiff --git a/metric/collector/project_count.go b/metric/collector/project_count.goindex bf849724f7..260630e212 100644--- a/metric/collector/project_count.go+++ b/metric/collector/project_count.go@@ -15,14 +15,14 @@ type projectCountCollector struct {store *store.Store}-// NewProjectCountCollector creates a new instance of projectCollector+// NewProjectCountCollector creates a new instance of projectCollector.func NewProjectCountCollector(store *store.Store) metric.Collector {return &projectCountCollector{store: store,}}-// Collect will collect the metric for project+// Collect will collect the metric for project.func (c *projectCountCollector) Collect(ctx context.Context) ([]*metric.Metric, error) {var res []*metric.Metricdiff --git a/metric/collector/sheet_count.go b/metric/collector/sheet_count.goindex 3abe24967e..1adc1d8ec7 100644--- a/metric/collector/sheet_count.go+++ b/metric/collector/sheet_count.go@@ -15,14 +15,14 @@ type sheetCountCollector struct {store *store.Store}-// NewSheetCountCollector creates a new instance of sheetCountCollector+// NewSheetCountCollector creates a new instance of sheetCountCollector.func NewSheetCountCollector(store *store.Store) metric.Collector {return &sheetCountCollector{store: store,}}-// Collect will collect the metric for sheet+// Collect will collect the metric for sheet.func (c *sheetCountCollector) Collect(ctx context.Context) ([]*metric.Metric, error) {var res []*metric.Metricdiff --git a/metric/metric.go b/metric/metric.goindex 75c495184f..61c454a907 100644--- a/metric/metric.go+++ b/metric/metric.go@@ -7,29 +7,29 @@ import ()const (- // InstanceCountMetricName is the metric name for instance count+ // InstanceCountMetricName is the metric name for instance count.InstanceCountMetricName metric.Name = "bb.instance.count"- // IssueCountMetricName is the metric name for issue count+ // IssueCountMetricName is the metric name for issue count.IssueCountMetricName metric.Name = "bb.issue.count"- // PolicyCountMetricName is the metric name for policy count+ // PolicyCountMetricName is the metric name for policy count.PolicyCountMetricName metric.Name = "bb.policy.count"- // ProjectCountMetricName is the metric name for project count+ // ProjectCountMetricName is the metric name for project count.ProjectCountMetricName metric.Name = "bb.project.count"- // TaskCountMetricName is the metric name for task count+ // TaskCountMetricName is the metric name for task count.TaskCountMetricName metric.Name = "bb.task.count"- // DatabaseCountMetricName is the metric name for database count+ // DatabaseCountMetricName is the metric name for database count.DatabaseCountMetricName metric.Name = "bb.database.count"- // SheetCountMetricName is the metric name for sheet count+ // SheetCountMetricName is the metric name for sheet count.SheetCountMetricName metric.Name = "bb.sheet.count"- // MemberCountMetricName is the metric name for member count+ // MemberCountMetricName is the metric name for member count.MemberCountMetricName metric.Name = "bb.member.count"- // OpenAPIMetricName is the metric name for OpenAPI+ // OpenAPIMetricName is the metric name for OpenAPI.OpenAPIMetricName metric.Name = "bb.api.call"- // SQLAdviseAPIMetricName is the metric name for SQL check API+ // SQLAdviseAPIMetricName is the metric name for SQL check API.SQLAdviseAPIMetricName metric.Name = "bb.api.sql.advise")-// InstanceCountMetric is the API message for bb.instance.count+// InstanceCountMetric is the API message for bb.instance.count.type InstanceCountMetric struct {Engine db.TypeEnvironmentID int@@ -37,14 +37,14 @@ type InstanceCountMetric struct {Count int}-// IssueCountMetric is the API message for bb.issue.count+// IssueCountMetric is the API message for bb.issue.count.type IssueCountMetric struct {Type api.IssueTypeStatus api.IssueStatusCount int}-// ProjectCountMetric is the API message for project count metric+// ProjectCountMetric is the API message for project count metric.type ProjectCountMetric struct {TenantMode api.ProjectTenantModeWorkflowType api.ProjectWorkflowType@@ -52,7 +52,7 @@ type ProjectCountMetric struct {Count int}-// PolicyCountMetric is the API message for policy count metric+// PolicyCountMetric is the API message for policy count metric.type PolicyCountMetric struct {Type api.PolicyTypeValue string@@ -60,21 +60,21 @@ type PolicyCountMetric struct {Count int}-// TaskCountMetric is the API message for task count metric+// TaskCountMetric is the API message for task count metric.type TaskCountMetric struct {Type api.TaskTypeStatus api.TaskStatusCount int}-// DatabaseCountMetric is the API message for database count metric+// DatabaseCountMetric is the API message for database count metric.type DatabaseCountMetric struct {BackupPlanPolicySchedule *api.BackupPlanPolicyScheduleBackupSettingEnabled *bool // nil if BackupPlanPolicyScheduleUnsetCount int}-// SheetCountMetric is the API message for sheet count metric+// SheetCountMetric is the API message for sheet count metric.type SheetCountMetric struct {RowStatus api.RowStatusVisibility api.SheetVisibility@@ -83,7 +83,7 @@ type SheetCountMetric struct {Count int}-// MemberCountMetric is the API message for member count metric+// MemberCountMetric is the API message for member count metric.type MemberCountMetric struct {Count intRole api.Rolediff --git a/plugin/advisor/advisor.go b/plugin/advisor/advisor.goindex 546af7f25b..3e2d081e1e 100644--- a/plugin/advisor/advisor.go+++ b/plugin/advisor/advisor.go@@ -44,7 +44,7 @@ const (// Fake is a fake advisor type for testing.Fake Type = "bb.plugin.advisor.fake"- // MySQL Advisor+ // MySQL Advisor.// MySQLSyntax is an advisor type for MySQL syntax.MySQLSyntax Type = "bb.plugin.advisor.mysql.syntax"@@ -97,7 +97,7 @@ const (// MySQLDatabaseAllowDropIfEmpty is an advisor type for MySQL only allow drop empty database.MySQLDatabaseAllowDropIfEmpty Type = "bb.plugin.advisor.mysql.database.drop-empty-database"- // PostgreSQL Advisor+ // PostgreSQL Advisor.// PostgreSQLSyntax is an advisor type for PostgreSQL syntax.PostgreSQLSyntax Type = "bb.plugin.advisor.postgresql.syntax"diff --git a/plugin/advisor/code.go b/plugin/advisor/code.goindex b52e42cd94..d1c38b92f0 100644--- a/plugin/advisor/code.go+++ b/plugin/advisor/code.go@@ -9,7 +9,7 @@ const (Internal Code = 1NotFound Code = 2- // 101 ~ 199 compatibility error code+ // 101 ~ 199 compatibility error code.CompatibilityDropDatabase Code = 101CompatibilityRenameTable Code = 102CompatibilityDropTable Code = 103@@ -22,37 +22,37 @@ const (CompatibilityAlterCheck Code = 110CompatibilityAlterColumn Code = 111- // 201 ~ 299 statement error code+ // 201 ~ 299 statement error code.StatementSyntaxError Code = 201StatementNoWhere Code = 202StatementSelectAll Code = 203StatementLeadingWildcardLike Code = 204// 301 ~ 399 naming error code- // 301 table naming advisor error code+ // 301 table naming advisor error code.NamingTableConventionMismatch Code = 301- // 302 column naming advisor error code+ // 302 column naming advisor error code.NamingColumnConventionMismatch Code = 302- // 303 index naming advisor error code+ // 303 index naming advisor error code.NamingIndexConventionMismatch Code = 303- // 304 unique key naming advisor error code+ // 304 unique key naming advisor error code.NamingUKConventionMismatch Code = 304- // 305 foreign key naming advisor error code+ // 305 foreign key naming advisor error code.NamingFKConventionMismatch Code = 305- // 401 ~ 499 column error code+ // 401 ~ 499 column error code.NoRequiredColumn Code = 401ColumnCanNotNull Code = 402- // 501 engine error code+ // 501 engine error code.NotInnoDBEngine Code = 501- // 601 ~ 699 table rule advisor error code+ // 601 ~ 699 table rule advisor error code.TableNoPK Code = 601TableHasFK Code = 602TableDropNamingConventionMismatch Code = 603- // 701 ~ 799 database advisor error code+ // 701 ~ 799 database advisor error code.DatabaseNotEmpty Code = 701NotCurrentDatabase Code = 702)diff --git a/plugin/advisor/mysql/advisor_column_no_null.go b/plugin/advisor/mysql/advisor_column_no_null.goindex b6fc95776a..5901c1a2a1 100644--- a/plugin/advisor/mysql/advisor_column_no_null.go+++ b/plugin/advisor/mysql/advisor_column_no_null.go@@ -63,7 +63,7 @@ type columnName struct {columnName string}-// Enter implements the ast.Visitor interface+// Enter implements the ast.Visitor interface.func (v *columnNoNullChecker) Enter(in ast.Node) (ast.Node, bool) {var columns []columnNameswitch node := in.(type) {@@ -115,7 +115,7 @@ func (v *columnNoNullChecker) Enter(in ast.Node) (ast.Node, bool) {return in, false}-// Leave implements the ast.Visitor interface+// Leave implements the ast.Visitor interface.func (v *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.goindex adc6e24288..4034efce52 100644--- a/plugin/advisor/mysql/advisor_column_required.go+++ b/plugin/advisor/mysql/advisor_column_required.go@@ -64,7 +64,7 @@ type columnRequirementChecker struct {tables tableState}-// Enter implements the ast.Visitor interface+// Enter implements the ast.Visitor interface.func (v *columnRequirementChecker) Enter(in ast.Node) (ast.Node, bool) {switch node := in.(type) {// CREATE TABLE@@ -100,7 +100,7 @@ func (v *columnRequirementChecker) Enter(in ast.Node) (ast.Node, bool) {return in, false}-// Leave implements the ast.Visitor interface+// Leave implements the ast.Visitor interface.func (v *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.goindex fc0e9d4583..c07304249b 100644--- a/plugin/advisor/mysql/advisor_database_drop_empty_db.go+++ b/plugin/advisor/mysql/advisor_database_drop_empty_db.go@@ -61,7 +61,7 @@ type allowDropEmptyDBChecker struct {database *catalog.Database}-// Enter implements the ast.Visitor interface+// Enter implements the ast.Visitor interface.func (v *allowDropEmptyDBChecker) Enter(in ast.Node) (ast.Node, bool) {if node, ok := in.(*ast.DropDatabaseStmt); ok {if v.database.Name != node.Name {@@ -83,7 +83,7 @@ func (v *allowDropEmptyDBChecker) Enter(in ast.Node) (ast.Node, bool) {return in, false}-// Leave implements the ast.Visitor interface+// Leave implements the ast.Visitor interface.func (v *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.goindex 76e3f5af0e..d8e6c41c11 100644--- a/plugin/advisor/mysql/advisor_migration_compatibility.go+++ b/plugin/advisor/mysql/advisor_migration_compatibility.go@@ -59,7 +59,7 @@ type compatibilityChecker struct {title string}-// Enter implements the ast.Visitor interface+// Enter implements the ast.Visitor interface.func (v *compatibilityChecker) Enter(in ast.Node) (ast.Node, bool) {code := advisor.Okswitch node := in.(type) {@@ -158,7 +158,7 @@ func (v *compatibilityChecker) Enter(in ast.Node) (ast.Node, bool) {return in, false}-// Leave implements the ast.Visitor interface+// Leave implements the ast.Visitor interface.func (v *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.goindex 7d4678d71e..8de36d0894 100644--- a/plugin/advisor/mysql/advisor_naming_column.go+++ b/plugin/advisor/mysql/advisor_naming_column.go@@ -70,7 +70,7 @@ type namingColumnConventionChecker struct {tables tableState}-// Enter implements the ast.Visitor interface+// Enter implements the ast.Visitor interface.func (v *namingColumnConventionChecker) Enter(in ast.Node) (ast.Node, bool) {var columnList []stringvar tableName string@@ -123,7 +123,7 @@ func (v *namingColumnConventionChecker) Enter(in ast.Node) (ast.Node, bool) {return in, false}-// Leave implements the ast.Visitor interface+// Leave implements the ast.Visitor interface.func (v *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.goindex 419273c68c..dcc3939c69 100644--- a/plugin/advisor/mysql/advisor_naming_foreign_key_convention.go+++ b/plugin/advisor/mysql/advisor_naming_foreign_key_convention.go@@ -70,7 +70,7 @@ type namingFKConventionChecker struct {templateList []string}-// Enter implements the ast.Visitor interface+// Enter implements the ast.Visitor interface.func (checker *namingFKConventionChecker) Enter(in ast.Node) (ast.Node, bool) {indexDataList := checker.getMetaDataList(in)@@ -106,7 +106,7 @@ func (checker *namingFKConventionChecker) Enter(in ast.Node) (ast.Node, bool) {return in, false}-// Leave implements the ast.Visitor interface+// Leave implements the ast.Visitor interface.func (checker *namingFKConventionChecker) Leave(in ast.Node) (ast.Node, bool) {return in, true}diff --git a/plugin/advisor/mysql/advisor_naming_index_convention.go b/plugin/advisor/mysql/advisor_naming_index_convention.goindex 17f74a78c7..2d57986ff6 100644--- a/plugin/advisor/mysql/advisor_naming_index_convention.go+++ b/plugin/advisor/mysql/advisor_naming_index_convention.go@@ -74,7 +74,7 @@ type namingIndexConventionChecker struct {database *catalog.Database}-// Enter implements the ast.Visitor interface+// Enter implements the ast.Visitor interface.func (checker *namingIndexConventionChecker) Enter(in ast.Node) (ast.Node, bool) {indexDataList := checker.getMetaDataList(in)@@ -110,7 +110,7 @@ func (checker *namingIndexConventionChecker) Enter(in ast.Node) (ast.Node, bool)return in, false}-// Leave implements the ast.Visitor interface+// Leave implements the ast.Visitor interface.func (checker *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.goindex 71239d0866..50b5d8aa50 100644--- a/plugin/advisor/mysql/advisor_naming_table.go+++ b/plugin/advisor/mysql/advisor_naming_table.go@@ -66,7 +66,7 @@ type namingTableConventionChecker struct {maxLength int}-// Enter implements the ast.Visitor interface+// Enter implements the ast.Visitor interface.func (v *namingTableConventionChecker) Enter(in ast.Node) (ast.Node, bool) {var tableNames []stringswitch node := in.(type) {@@ -110,7 +110,7 @@ func (v *namingTableConventionChecker) Enter(in ast.Node) (ast.Node, bool) {return in, false}-// Leave implements the ast.Visitor interface+// Leave implements the ast.Visitor interface.func (v *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.goindex 9420c4051d..7f6c021c49 100644--- a/plugin/advisor/mysql/advisor_naming_unique_key_convention.go+++ b/plugin/advisor/mysql/advisor_naming_unique_key_convention.go@@ -72,7 +72,7 @@ type namingUKConventionChecker struct {database *catalog.Database}-// Enter implements the ast.Visitor interface+// Enter implements the ast.Visitor interface.func (checker *namingUKConventionChecker) Enter(in ast.Node) (ast.Node, bool) {indexDataList := checker.getMetaDataList(in)@@ -108,7 +108,7 @@ func (checker *namingUKConventionChecker) Enter(in ast.Node) (ast.Node, bool) {return in, false}-// Leave implements the ast.Visitor interface+// Leave implements the ast.Visitor interface.func (checker *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.goindex 16b0adaec0..3d174df143 100644--- a/plugin/advisor/mysql/advisor_stmt_no_leading_wildcard_like.go+++ b/plugin/advisor/mysql/advisor_stmt_no_leading_wildcard_like.go@@ -73,7 +73,7 @@ type noLeadingWildcardLikeChecker struct {leadingWildcardLike bool}-// Enter implements the ast.Visitor interface+// Enter implements the ast.Visitor interface.func (v *noLeadingWildcardLikeChecker) Enter(in ast.Node) (ast.Node, bool) {if node, ok := in.(*ast.PatternLikeExpr); !v.leadingWildcardLike && ok {pattern, err := restoreNode(node.Pattern, format.RestoreStringWithoutCharset)@@ -92,7 +92,7 @@ func (v *noLeadingWildcardLikeChecker) Enter(in ast.Node) (ast.Node, bool) {return in, false}-// Leave implements the ast.Visitor interface+// Leave implements the ast.Visitor interface.func (v *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.goindex cacf1e076a..5159072e47 100644--- a/plugin/advisor/mysql/advisor_stmt_no_select_all.go+++ b/plugin/advisor/mysql/advisor_stmt_no_select_all.go@@ -59,7 +59,7 @@ type noSelectAllChecker struct {text string}-// Enter implements the ast.Visitor interface+// Enter implements the ast.Visitor interface.func (v *noSelectAllChecker) Enter(in ast.Node) (ast.Node, bool) {if node, ok := in.(*ast.SelectStmt); ok {for _, field := range node.Fields.Fields {@@ -78,7 +78,7 @@ func (v *noSelectAllChecker) Enter(in ast.Node) (ast.Node, bool) {return in, false}-// Leave implements the ast.Visitor interface+// Leave implements the ast.Visitor interface.func (v *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.goindex 3950e23e25..3b82d4b73e 100644--- a/plugin/advisor/mysql/advisor_stmt_where_required.go+++ b/plugin/advisor/mysql/advisor_stmt_where_required.go@@ -60,7 +60,7 @@ type whereRequirementChecker struct {text string}-// Enter implements the ast.Visitor interface+// Enter implements the ast.Visitor interface.func (v *whereRequirementChecker) Enter(in ast.Node) (ast.Node, bool) {code := advisor.Okswitch node := in.(type) {@@ -92,7 +92,7 @@ func (v *whereRequirementChecker) Enter(in ast.Node) (ast.Node, bool) {return in, false}-// Leave implements the ast.Visitor interface+// Leave implements the ast.Visitor interface.func (v *whereRequirementChecker) Leave(in ast.Node) (ast.Node, bool) {return in, true}diff --git a/plugin/advisor/mysql/advisor_table_drop_naming_convention.go b/plugin/advisor/mysql/advisor_table_drop_naming_convention.goindex 8b5e6b3e44..5001e00429 100644--- a/plugin/advisor/mysql/advisor_table_drop_naming_convention.go+++ b/plugin/advisor/mysql/advisor_table_drop_naming_convention.go@@ -65,7 +65,7 @@ type namingDropTableConventionChecker struct {format *regexp.Regexp}-// Enter implements the ast.Visitor interface+// Enter implements the ast.Visitor interface.func (v *namingDropTableConventionChecker) Enter(in ast.Node) (ast.Node, bool) {if node, ok := in.(*ast.DropTableStmt); ok {for _, table := range node.Tables {@@ -83,7 +83,7 @@ func (v *namingDropTableConventionChecker) Enter(in ast.Node) (ast.Node, bool) {return in, false}-// Leave implements the ast.Visitor interface+// Leave implements the ast.Visitor interface.func (v *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.goindex 0d7f109756..6a2b75cd0e 100644--- a/plugin/advisor/mysql/advisor_table_no_fk.go+++ b/plugin/advisor/mysql/advisor_table_no_fk.go@@ -59,7 +59,7 @@ type tableNoFKChecker struct {title string}-// Enter implements the ast.Visitor interface+// Enter implements the ast.Visitor interface.func (checker *tableNoFKChecker) Enter(in ast.Node) (ast.Node, bool) {switch node := in.(type) {case *ast.CreateTableStmt:@@ -89,7 +89,7 @@ func (checker *tableNoFKChecker) Enter(in ast.Node) (ast.Node, bool) {return in, false}-// Leave implements the ast.Visitor interface+// Leave implements the ast.Visitor interface.func (checker *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.goindex d3e4da2582..970ff28c28 100644--- a/plugin/advisor/mysql/advisor_table_require_pk.go+++ b/plugin/advisor/mysql/advisor_table_require_pk.go@@ -60,7 +60,7 @@ type tableRequirePKChecker struct {database *catalog.Database}-// Enter implements the ast.Visitor interface+// Enter implements the ast.Visitor interface.func (v *tableRequirePKChecker) Enter(in ast.Node) (ast.Node, bool) {switch node := in.(type) {// CREATE TABLE@@ -109,7 +109,7 @@ func (v *tableRequirePKChecker) Enter(in ast.Node) (ast.Node, bool) {return in, false}-// Leave implements the ast.Visitor interface+// Leave implements the ast.Visitor interface.func (v *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.goindex 34e6e60759..17604c1045 100644--- a/plugin/advisor/mysql/advisor_use_innodb.go+++ b/plugin/advisor/mysql/advisor_use_innodb.go@@ -65,7 +65,7 @@ type useInnoDBChecker struct {title string}-// Enter implements the ast.Visitor interface+// Enter implements the ast.Visitor interface.func (v *useInnoDBChecker) Enter(in ast.Node) (ast.Node, bool) {code := advisor.Okswitch node := in.(type) {@@ -124,7 +124,7 @@ func (v *useInnoDBChecker) Enter(in ast.Node) (ast.Node, bool) {return in, false}-// Leave implements the ast.Visitor interface+// Leave implements the ast.Visitor interface.func (v *useInnoDBChecker) Leave(in ast.Node) (ast.Node, bool) {return in, true}diff --git a/plugin/advisor/pg/advisor_naming_foreign_key_convention.go b/plugin/advisor/pg/advisor_naming_foreign_key_convention.goindex 2d09391c50..37172b6a63 100644--- a/plugin/advisor/pg/advisor_naming_foreign_key_convention.go+++ b/plugin/advisor/pg/advisor_naming_foreign_key_convention.go@@ -78,7 +78,7 @@ type indexMetaData struct {metaData map[string]string}-// Visit implements ast.Visitor interface+// Visit implements ast.Visitor interface.func (checker *namingFKConventionChecker) Visit(in ast.Node) ast.Visitor {indexDataList := checker.getMetaDataList(in)diff --git a/plugin/advisor/pg/advisor_naming_unique_key_convention.go b/plugin/advisor/pg/advisor_naming_unique_key_convention.goindex 433835d345..a29448d1db 100644--- a/plugin/advisor/pg/advisor_naming_unique_key_convention.go+++ b/plugin/advisor/pg/advisor_naming_unique_key_convention.go@@ -74,7 +74,7 @@ type namingUKConventionChecker struct {database *catalog.Database}-// Visit implements ast.Visitor interface+// Visit implements ast.Visitor interface.func (checker *namingUKConventionChecker) Visit(in ast.Node) ast.Visitor {indexDataList := checker.getMetaDataList(in)@@ -217,7 +217,7 @@ func (checker *namingUKConventionChecker) getUniqueKeyMetadata(schemaName stringreturn nil}-// findIndex returns index found in catalogs, nil if not found+// findIndex returns index found in catalogs, nil if not found.func (checker *namingUKConventionChecker) findIndex(schemaName string, tableName string, indexName string) (string, []*catalog.Index) {return checker.database.FindIndex(&catalog.IndexFind{SchemaName: normalizeSchemaName(schemaName),diff --git a/plugin/advisor/pg/utils.go b/plugin/advisor/pg/utils.goindex f9ccfaed42..cd01c5a7c4 100644--- a/plugin/advisor/pg/utils.go+++ b/plugin/advisor/pg/utils.go@@ -5,7 +5,7 @@ import ()const (- // PostgreSQLPublicSchema is the string for PostgreSQL public schema+ // PostgreSQLPublicSchema is the string for PostgreSQL public schema.PostgreSQLPublicSchema = "public")diff --git a/plugin/advisor/sql_review.go b/plugin/advisor/sql_review.goindex a29a12aa2d..8a8dc9970e 100644--- a/plugin/advisor/sql_review.go+++ b/plugin/advisor/sql_review.go@@ -35,7 +35,7 @@ const (// SchemaRuleTableNaming enforce the table name format.SchemaRuleTableNaming SQLReviewRuleType = "naming.table"- // SchemaRuleColumnNaming enforce the column name format+ // SchemaRuleColumnNaming enforce the column name format.SchemaRuleColumnNaming SQLReviewRuleType = "naming.column"// SchemaRuleUKNaming enforce the unique key name format.SchemaRuleUKNaming SQLReviewRuleType = "naming.index.uk"@@ -69,17 +69,17 @@ const (// SchemaRuleDropEmptyDatabase enforce the MySQL and TiDB support check if the database is empty before users drop it.SchemaRuleDropEmptyDatabase SQLReviewRuleType = "database.drop-empty-database"- // TableNameTemplateToken is the token for table name+ // TableNameTemplateToken is the token for table name.TableNameTemplateToken = "{{table}}"- // ColumnListTemplateToken is the token for column name list+ // ColumnListTemplateToken is the token for column name list.ColumnListTemplateToken = "{{column_list}}"- // ReferencingTableNameTemplateToken is the token for referencing table name+ // ReferencingTableNameTemplateToken is the token for referencing table name.ReferencingTableNameTemplateToken = "{{referencing_table}}"- // ReferencingColumnNameTemplateToken is the token for referencing column name+ // ReferencingColumnNameTemplateToken is the token for referencing column name.ReferencingColumnNameTemplateToken = "{{referencing_column}}"- // ReferencedTableNameTemplateToken is the token for referenced table name+ // ReferencedTableNameTemplateToken is the token for referenced table name.ReferencedTableNameTemplateToken = "{{referenced_table}}"- // ReferencedColumnNameTemplateToken is the token for referenced column name+ // ReferencedColumnNameTemplateToken is the token for referenced column name.ReferencedColumnNameTemplateToken = "{{referenced_column}}"// defaultNameLengthLimit is the default length limit for naming rules.@@ -87,7 +87,7 @@ const ()var (- // TemplateNamingTokens is the mapping for rule type to template token+ // TemplateNamingTokens is the mapping for rule type to template token.TemplateNamingTokens = map[SQLReviewRuleType]map[string]bool{SchemaRuleIDXNaming: {TableNameTemplateToken: true,@@ -188,7 +188,7 @@ func UnamrshalNamingRulePayloadAsRegexp(payload string) (*regexp.Regexp, int, er// UnmarshalNamingRulePayloadAsTemplate will unmarshal payload to NamingRulePayload and extract all the template keys.// For example, "hard_code_{{table}}_{{column}}_end" will return-// "hard_code_{{table}}_{{column}}_end", ["{{table}}", "{{column}}"]+// "hard_code_{{table}}_{{column}}_end", ["{{table}}", "{{column}}"].func UnmarshalNamingRulePayloadAsTemplate(ruleType SQLReviewRuleType, payload string) (string, []string, int, error) {var nr NamingRulePayloadif err := json.Unmarshal([]byte(payload), &nr); err != nil {diff --git a/plugin/db/clickhouse/dump.go b/plugin/db/clickhouse/dump.goindex 25fb4075d6..5f50ecd134 100644--- a/plugin/db/clickhouse/dump.go+++ b/plugin/db/clickhouse/dump.go@@ -12,7 +12,7 @@ import ("github.com/bytebase/bytebase/plugin/db/util")-// Dump and restore+// Dump and restore.const (databaseHeaderFmt = "" +"--\n" +diff --git a/plugin/db/driver.go b/plugin/db/driver.goindex ba9c939492..a59920182c 100644--- a/plugin/db/driver.go+++ b/plugin/db/driver.go@@ -31,7 +31,7 @@ const (// TiDB is the database type for TiDB.TiDB Type = "TIDB"- // BytebaseDatabase is the database installed in the controlled database server+ // BytebaseDatabase is the database installed in the controlled database server.BytebaseDatabase = "bytebase")@@ -436,7 +436,7 @@ func Register(dbType Type, f driverFunc) {drivers[dbType] = f}-// Open opens a database specified by its database driver type and connection config+// Open opens a database specified by its database driver type and connection config.func Open(ctx context.Context, dbType Type, driverConfig DriverConfig, connectionConfig ConnectionConfig, connCtx ConnectionContext) (Driver, error) {driversMu.RLock()f, ok := drivers[dbType]diff --git a/plugin/db/mysql/dump.go b/plugin/db/mysql/dump.goindex cdd7d83044..c4f23dd98c 100644--- a/plugin/db/mysql/dump.go+++ b/plugin/db/mysql/dump.go@@ -19,7 +19,7 @@ import ("github.com/bytebase/bytebase/plugin/db/util")-// Dump and restore+// Dump and restore.const (databaseHeaderFmt = "" +"--\n" +diff --git a/plugin/db/mysql/restore.go b/plugin/db/mysql/restore.goindex 4a67ede90c..d14c6d3cc1 100644--- a/plugin/db/mysql/restore.go+++ b/plugin/db/mysql/restore.go@@ -37,7 +37,7 @@ import ()const (- // MaxDatabaseNameLength is the allowed max database name length in MySQL+ // MaxDatabaseNameLength is the allowed max database name length in MySQL.MaxDatabaseNameLength = 64// Variable lower_case_table_names related.@@ -52,7 +52,7 @@ const (LetterCaseOnDiskLowerCaseCmp = 2)-// BinlogFile is the metadata of the MySQL binlog file+// BinlogFile is the metadata of the MySQL binlog file.type BinlogFile struct {Name stringSize int64@@ -69,10 +69,10 @@ func newBinlogFile(name string, size int64) (BinlogFile, error) {return BinlogFile{Name: name, Size: size, Seq: seq}, nil}-// ZapBinlogFiles is a helper to format zap.Array+// ZapBinlogFiles is a helper to format zap.Array.type ZapBinlogFiles []BinlogFile-// MarshalLogArray implements the zapcore.ArrayMarshaler interface+// MarshalLogArray implements the zapcore.ArrayMarshaler interface.func (files ZapBinlogFiles) MarshalLogArray(arr zapcore.ArrayEncoder) error {for _, file := range files {arr.AppendString(fmt.Sprintf("%s[%d]", file.Name, file.Size))@@ -472,14 +472,14 @@ func databaseExists(ctx context.Context, conn *sql.Conn, database string) (bool,}// Composes a pitr database name that we use as the target database for full backup recovery and binlog recovery.-// For example, getPITRDatabaseName("dbfoo", 1653018005) -> "dbfoo_pitr_1653018005"+// For example, getPITRDatabaseName("dbfoo", 1653018005) -> "dbfoo_pitr_1653018005".func getPITRDatabaseName(database string, suffixTs int64) string {suffix := fmt.Sprintf("pitr_%d", suffixTs)return getSafeName(database, suffix)}// Composes a database name that we use as the target database for swapping out the original database.-// For example, getPITROldDatabaseName("dbfoo", 1653018005) -> "dbfoo_pitr_1653018005_old"+// For example, getPITROldDatabaseName("dbfoo", 1653018005) -> "dbfoo_pitr_1653018005_old".func getPITROldDatabaseName(database string, suffixTs int64) string {suffix := fmt.Sprintf("pitr_%d_old", suffixTs)return getSafeName(database, suffix)@@ -869,7 +869,7 @@ func (driver *Driver) getBinlogEventPositionAtOrAfterTs(ctx context.Context, bin}// getBinlogNameSeq returns the numeric extension to the binary log base name by using split the dot.-// For example: ("binlog.000001") => 1, ("binlog000001") => err+// For example: ("binlog.000001") => 1, ("binlog000001") => err.func getBinlogNameSeq(name string) (int64, error) {s := strings.Split(name, ".")if len(s) != 2 {@@ -887,7 +887,7 @@ func getSafeName(baseName, suffix string) string {return fmt.Sprintf("%s_%s", baseName[0:len(baseName)-extraCharacters], suffix)}-// checks the MySQL version is >=8.0+// checks the MySQL version is >=8.0.func checkVersionForPITR(version string) error {v, err := semver.Parse(version)if err != nil {diff --git a/plugin/db/pg/pg.go b/plugin/db/pg/pg.goindex 9286491346..29c9911465 100644--- a/plugin/db/pg/pg.go+++ b/plugin/db/pg/pg.go@@ -8,7 +8,7 @@ import ("strings"// Import pg driver.- // init() in pgx/v4/stdlib will register it's pgx driver+ // init() in pgx/v4/stdlib will register it's pgx driver._ "github.com/jackc/pgx/v4/stdlib""github.com/bytebase/bytebase/common"diff --git a/plugin/db/snowflake/dump.go b/plugin/db/snowflake/dump.goindex 132297d1e3..1f4cbb0883 100644--- a/plugin/db/snowflake/dump.go+++ b/plugin/db/snowflake/dump.go@@ -11,7 +11,7 @@ import ("github.com/bytebase/bytebase/plugin/db/util")-// Dump and restore+// Dump and restore.const (databaseHeaderFmt = "" +"--\n" +diff --git a/plugin/db/util/driverutil.go b/plugin/db/util/driverutil.goindex ddc26dda1b..8063ca774e 100644--- a/plugin/db/util/driverutil.go+++ b/plugin/db/util/driverutil.go@@ -468,7 +468,7 @@ func FindMigrationHistoryList(ctx context.Context, findMigrationHistoryListQueryreturn migrationHistoryList, nil}-// FormatError formats schema migration errors+// FormatError formats schema migration errors.func FormatError(err error) error {if err == nil {return nil@@ -483,7 +483,7 @@ func FormatError(err error) error {return err}-// NonSemanticPrefix is the prefix for non-semantic version+// NonSemanticPrefix is the prefix for non-semantic version.const NonSemanticPrefix = "0000.0000.0000-"// ToStoredVersion converts semantic or non-semantic version to stored version format.diff --git a/plugin/metric/segment/reporter.go b/plugin/metric/segment/reporter.goindex 0ba7067482..d74d26cb89 100644--- a/plugin/metric/segment/reporter.go+++ b/plugin/metric/segment/reporter.go@@ -17,11 +17,11 @@ type reporter struct {}const (- // metricValueField is the property key for value+ // metricValueField is the property key for value.metricValueField = "value")-// NewReporter creates a new instance of segment+// NewReporter creates a new instance of segment.func NewReporter(key string, identifier string) metric.Reporter {client := analytics.New(key)diff --git a/plugin/parser/error.go b/plugin/parser/error.goindex 1f7fa19097..c046adec3b 100644--- a/plugin/parser/error.go+++ b/plugin/parser/error.go@@ -11,7 +11,7 @@ type ConvertError struct {err error}-// Error implements the error interface+// Error implements the error interface.func (e *ConvertError) Error() string {return e.err.Error()}diff --git a/plugin/vcs/vcs.go b/plugin/vcs/vcs.goindex 3ac07ab9c5..2cbb0556c9 100644--- a/plugin/vcs/vcs.go+++ b/plugin/vcs/vcs.go@@ -244,7 +244,7 @@ func Register(vcsType Type, f providerFunc) {providers[vcsType] = f}-// Get returns a vcs provider specified by its vcs type+// Get returns a vcs provider specified by its vcs type.func Get(vcsType Type, providerConfig ProviderConfig) Provider {providerMu.RLock()f, ok := providers[vcsType]diff --git a/plugin/webhook/webhook.go b/plugin/webhook/webhook.goindex 0521984f1a..2dfc2ef1e6 100644--- a/plugin/webhook/webhook.go+++ b/plugin/webhook/webhook.go@@ -34,7 +34,7 @@ const (WebhookError Level = "ERROR")-// Issue object of issue+// Issue object of issue.type Issue struct {ID int `json:"id"`Name string `json:"name"`@@ -43,7 +43,7 @@ type Issue struct {Description string `json:"description"`}-// Project object of project+// Project object of project.type Project struct {ID int `json:"id"`Name string `json:"name"`diff --git a/resources/mysql/mysql.go b/resources/mysql/mysql.goindex d35f8fce7a..6acce2b5c5 100644--- a/resources/mysql/mysql.go+++ b/resources/mysql/mysql.go@@ -17,7 +17,7 @@ import ("github.com/bytebase/bytebase/resources/utils"- // install mysql driver+ // install mysql driver._ "github.com/go-sql-driver/mysql")diff --git a/resources/mysqlutil/mysqlutil.go b/resources/mysqlutil/mysqlutil.goindex 4aa2c29079..4d6c5bb478 100644--- a/resources/mysqlutil/mysqlutil.go+++ b/resources/mysqlutil/mysqlutil.go@@ -16,9 +16,9 @@ import (type binaryName stringconst (- // MySQL is the name of mysql binary+ // MySQL is the name of mysql binary.MySQL binaryName = "mysql"- // MySQLBinlog is the name of mysqlbinlog binary+ // MySQLBinlog is the name of mysqlbinlog binary.MySQLBinlog binaryName = "mysqlbinlog")@@ -111,7 +111,7 @@ func Install(resourceDir string) (*Instance, error) {}, nil}-// install installs mysqlutil in resourceDir+// install installs mysqlutil in resourceDir.func install(resourceDir, mysqlutilDir, tarName, version string) error {tmpDir := path.Join(resourceDir, fmt.Sprintf("tmp-%s", version))if err := os.RemoveAll(tmpDir); err != nil {diff --git a/server/anomaly_scanner.go b/server/anomaly_scanner.goindex 9395097dab..2c104328a1 100644--- a/server/anomaly_scanner.go+++ b/server/anomaly_scanner.go@@ -20,7 +20,7 @@ const (anomalyScanInterval = time.Duration(10) * time.Minute)-// NewAnomalyScanner creates a anomaly scanner+// NewAnomalyScanner creates a anomaly scanner.func NewAnomalyScanner(server *Server) *AnomalyScanner {return &AnomalyScanner{diff --git a/server/cache.go b/server/cache.goindex ac2d1b585f..977c701280 100644--- a/server/cache.go+++ b/server/cache.go@@ -11,7 +11,7 @@ import ()var (- // 32 MiB+ // 32 MiB.cacheSize = 1024 * 1024 * 32_ api.CacheService = (*CacheService)(nil))diff --git a/server/config.go b/server/config.goindex 7fde1f74c3..48d2da5321 100644--- a/server/config.go+++ b/server/config.go@@ -7,11 +7,11 @@ import ()const (- // secretLength is the length for the secret used to sign the JWT auto token+ // secretLength is the length for the secret used to sign the JWT auto token.secretLength = 32)-// retrieved via the SettingService upon startup+// retrieved via the SettingService upon startup.type config struct {// secret used to sign the JWT auth tokensecret stringdiff --git a/server/issue.go b/server/issue.goindex d11ff496db..ba44d69392 100644--- a/server/issue.go+++ b/server/issue.go@@ -934,7 +934,7 @@ func getUpdateTask(database *api.Database, migrationType db.MigrationType, vcsPu}, nil}-// creates PITR TaskCreate list and dependency+// creates PITR TaskCreate list and dependency.func createPITRTaskList(database *api.Database, projectID int, taskStatus api.TaskStatus, targetTs int64) ([]api.TaskCreate, []api.TaskIndexDAG, error) {var taskCreateList []api.TaskCreate@@ -980,7 +980,7 @@ func createPITRTaskList(database *api.Database, projectID int, taskStatus api.Tareturn taskCreateList, taskIndexDAGList, nil}-// creates gh-ost TaskCreate list and dependency+// creates gh-ost TaskCreate list and dependency.func createGhostTaskList(database *api.Database, vcsPushEvent *vcs.PushEvent, detail *api.UpdateSchemaGhostDetail, schemaVersion string, taskStatus api.TaskStatus) ([]api.TaskCreate, []api.TaskIndexDAG, error) {var taskCreateList []api.TaskCreate// task "sync"diff --git a/server/jwt.go b/server/jwt.goindex f396f1fb5f..157cca0a86 100644--- a/server/jwt.go+++ b/server/jwt.go@@ -20,7 +20,7 @@ const (accessTokenAudienceFmt = "bb.user.access.%s"refreshTokenAudienceFmt = "bb.user.refresh.%s"- // Cookie section+ // Cookie section.accessTokenCookieName = "access-token"refreshTokenCookieName = "refresh-token"@@ -28,7 +28,7 @@ const (// have 1 version. But it will be used to maintain backward compatibility if we change the signing mechanism.keyID = "v1"- // Expiration section+ // Expiration section.refreshThresholdDuration = 1 * time.HouraccessTokenDuration = 24 * time.HourrefreshTokenDuration = 7 * 24 * time.Hour@@ -36,7 +36,7 @@ const (// cookie expires, thus the client would always logout first before attempting to make a request with the expired jwt.// Suppose we have a valid refresh token, we will refresh the token in 2 cases:// 1. The access token is about to expire in <<refreshThresholdDuration>>- // 2. The access token has already expired, we refresh the token so that the ongoing request can pass through+ // 2. The access token has already expired, we refresh the token so that the ongoing request can pass through.cookieExpDuration = refreshTokenDuration - 1*time.Minute// Context sectiondiff --git a/server/openapi.go b/server/openapi.goindex ea3ac9f114..400a9bc2af 100644--- a/server/openapi.go+++ b/server/openapi.go@@ -23,7 +23,7 @@ var (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+// 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) {return nil, nil}@@ -47,7 +47,7 @@ func (s *Server) registerOpenAPIRoutes(g *echo.Group) {// @Success 200 {array} advisor.Advice// @Failure 400 {object} echo.HTTPError// @Failure 500 {object} echo.HTTPError-// @Router /sql/advise [get]+// @Router /sql/advise [get].func (s *Server) sqlCheckController(c echo.Context) error {envName := c.QueryParams().Get("environment")if envName == "" {diff --git a/server/pipeline.go b/server/pipeline.goindex fcbcf966ab..f28dbbca75 100644--- a/server/pipeline.go+++ b/server/pipeline.go@@ -7,7 +7,7 @@ import ()// ScheduleNextTaskIfNeeded tries to schedule the next task if needed.-// Returns nil if no task applicable can be scheduled+// Returns nil if no task applicable can be scheduled.func (s *Server) ScheduleNextTaskIfNeeded(ctx context.Context, pipeline *api.Pipeline) (*api.Task, error) {for _, stage := range pipeline.StageList {for _, task := range stage.TaskList {diff --git a/server/server.go b/server/server.goindex 4bd120c6aa..f6002eb875 100644--- a/server/server.go+++ b/server/server.go@@ -35,7 +35,7 @@ import ("github.com/bytebase/bytebase/store")-// openAPIPrefix is the API prefix for Bytebase OpenAPI+// openAPIPrefix is the API prefix for Bytebase OpenAPI.const openAPIPrefix = "/v1"// Server is the Bytebase server.diff --git a/server/task_executor.go b/server/task_executor.goindex 7ec30d8aa0..11ee7b7fce 100644--- a/server/task_executor.go+++ b/server/task_executor.go@@ -31,7 +31,7 @@ type TaskExecutor interface {IsCompleted() bool}-// RunTaskExecutorOnce wraps a TaskExecutor.RunOnce call with panic recovery+// RunTaskExecutorOnce wraps a TaskExecutor.RunOnce call with panic recovery.func RunTaskExecutorOnce(ctx context.Context, exec TaskExecutor, server *Server, task *api.Task) (terminated bool, result *api.TaskRunResultPayload, err error) {defer func() {if r := recover(); r != nil {diff --git a/server/task_executor_database_backup.go b/server/task_executor_database_backup.goindex 1f93dd6d62..0f9416a098 100644--- a/server/task_executor_database_backup.go+++ b/server/task_executor_database_backup.go@@ -23,7 +23,7 @@ type DatabaseBackupTaskExecutor struct {completed int32}-// IsCompleted tells the scheduler if the task execution has completed+// IsCompleted tells the scheduler if the task execution has completed.func (exec *DatabaseBackupTaskExecutor) IsCompleted() bool {return atomic.LoadInt32(&exec.completed) == 1}diff --git a/server/task_executor_database_create.go b/server/task_executor_database_create.goindex 22d6c365d2..9bf2fc311b 100644--- a/server/task_executor_database_create.go+++ b/server/task_executor_database_create.go@@ -24,7 +24,7 @@ type DatabaseCreateTaskExecutor struct {completed int32}-// IsCompleted tells the scheduler if the task execution has completed+// IsCompleted tells the scheduler if the task execution has completed.func (exec *DatabaseCreateTaskExecutor) IsCompleted() bool {return atomic.LoadInt32(&exec.completed) == 1}diff --git a/server/task_executor_database_restore.go b/server/task_executor_database_restore.goindex a767464f8d..78983085b7 100644--- a/server/task_executor_database_restore.go+++ b/server/task_executor_database_restore.go@@ -28,7 +28,7 @@ type DatabaseRestoreTaskExecutor struct {completed int32}-// IsCompleted tells the scheduler if the task execution has completed+// IsCompleted tells the scheduler if the task execution has completed.func (exec *DatabaseRestoreTaskExecutor) IsCompleted() bool {return atomic.LoadInt32(&exec.completed) == 1}@@ -117,7 +117,7 @@ func (exec *DatabaseRestoreTaskExecutor) RunOnce(ctx context.Context, server *Se}, nil}-// restoreDatabase will restore the database from a backup+// 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 {driver, err := getAdminDatabaseDriver(ctx, instance, databaseName, pgInstanceDir)if err != nil {@@ -146,7 +146,7 @@ func (exec *DatabaseRestoreTaskExecutor) restoreDatabase(ctx context.Context, in// createBranchMigrationHistory creates a migration history with "BRANCH" type. We choose NOT to copy over// all migration history from source database because that might be expensive (e.g. we may use restore to// create many ephemeral databases from backup for testing purpose)-// Returns migration history id and the version on success+// Returns migration history id and the version on success.func createBranchMigrationHistory(ctx context.Context, server *Server, sourceDatabase, targetDatabase *api.Database, backup *api.Backup, task *api.Task) (int64, string, error) {targetDriver, err := getAdminDatabaseDriver(ctx, targetDatabase.Instance, targetDatabase.Name, server.pgInstanceDir)if err != nil {diff --git a/server/task_executor_default.go b/server/task_executor_default.goindex 0df1ccc5c7..4a45967c20 100644--- a/server/task_executor_default.go+++ b/server/task_executor_default.go@@ -28,7 +28,7 @@ func (exec *DefaultTaskExecutor) RunOnce(_ context.Context, _ *Server, task *apireturn true, &api.TaskRunResultPayload{Detail: fmt.Sprintf("No-op task %s", task.Name)}, nil}-// IsCompleted tells the scheduler if the task execution has completed+// IsCompleted tells the scheduler if the task execution has completed.func (exec *DefaultTaskExecutor) IsCompleted() bool {return atomic.LoadInt32(&exec.completed) == 1}diff --git a/server/task_executor_pitr_cutover.go b/server/task_executor_pitr_cutover.goindex f447ba9ab8..5902560461 100644--- a/server/task_executor_pitr_cutover.go+++ b/server/task_executor_pitr_cutover.go@@ -76,7 +76,7 @@ func (exec *PITRCutoverTaskExecutor) RunOnce(ctx context.Context, server *Serverreturn terminated, result, nil}-// IsCompleted tells the scheduler if the task execution has completed+// IsCompleted tells the scheduler if the task execution has completed.func (exec *PITRCutoverTaskExecutor) IsCompleted() bool {return atomic.LoadInt32(&exec.completed) == 1}diff --git a/server/task_executor_pitr_restore.go b/server/task_executor_pitr_restore.goindex 8948a1c5f7..719e04b821 100644--- a/server/task_executor_pitr_restore.go+++ b/server/task_executor_pitr_restore.go@@ -60,7 +60,7 @@ func (exec *PITRRestoreTaskExecutor) RunOnce(ctx context.Context, server *Server}, nil}-// IsCompleted tells the scheduler if the task execution has completed+// IsCompleted tells the scheduler if the task execution has completed.func (exec *PITRRestoreTaskExecutor) IsCompleted() bool {return atomic.LoadInt32(&exec.completed) == 1}diff --git a/server/task_executor_schema_update.go b/server/task_executor_schema_update.goindex 09f48d7dbe..b8a206505f 100644--- a/server/task_executor_schema_update.go+++ b/server/task_executor_schema_update.go@@ -30,7 +30,7 @@ func (exec *SchemaUpdateTaskExecutor) RunOnce(ctx context.Context, server *Servereturn runMigration(ctx, server, task, payload.MigrationType, payload.Statement, payload.SchemaVersion, payload.VCSPushEvent)}-// IsCompleted tells the scheduler if the task execution has completed+// IsCompleted tells the scheduler if the task execution has completed.func (exec *SchemaUpdateTaskExecutor) IsCompleted() bool {return atomic.LoadInt32(&exec.completed) == 1}diff --git a/server/task_executor_schema_update_ghost_cutover.go b/server/task_executor_schema_update_ghost_cutover.goindex 8bba584335..b2bc0a370d 100644--- a/server/task_executor_schema_update_ghost_cutover.go+++ b/server/task_executor_schema_update_ghost_cutover.go@@ -132,7 +132,7 @@ func cutover(ctx context.Context, server *Server, task *api.Task, statement, schreturn postMigration(ctx, server, task, vcsPushEvent, mi, migrationID, schema)}-// IsCompleted tells the scheduler if the task execution has completed+// IsCompleted tells the scheduler if the task execution has completed.func (exec *SchemaUpdateGhostCutoverTaskExecutor) IsCompleted() bool {return atomic.LoadInt32(&exec.completed) == 1}diff --git a/server/task_executor_schema_update_ghost_sync.go b/server/task_executor_schema_update_ghost_sync.goindex 183c69a256..1a80d40dee 100644--- a/server/task_executor_schema_update_ghost_sync.go+++ b/server/task_executor_schema_update_ghost_sync.go@@ -39,7 +39,7 @@ func (exec *SchemaUpdateGhostSyncTaskExecutor) RunOnce(ctx context.Context, servreturn runGhostMigration(ctx, server, task, payload.Statement)}-// IsCompleted tells the scheduler if the task execution has completed+// IsCompleted tells the scheduler if the task execution has completed.func (exec *SchemaUpdateGhostSyncTaskExecutor) IsCompleted() bool {return atomic.LoadInt32(&exec.completed) == 1}diff --git a/server/task_scheduler.go b/server/task_scheduler.goindex 36cb7eee31..04e2343191 100644--- a/server/task_scheduler.go+++ b/server/task_scheduler.go@@ -222,7 +222,7 @@ func (s *TaskScheduler) Register(taskType api.TaskType, executorGetter func() Tas.executorGetters[taskType] = executorGetter}-// canScheduleTask checks if the task can be scheduled, i.e. change the task status from PENDING to RUNNING+// canScheduleTask checks if the task can be scheduled, i.e. change the task status from PENDING to RUNNING.func (s *TaskScheduler) canScheduleTask(ctx context.Context, task *api.Task) (bool, error) {blocked, err := s.isTaskBlocked(ctx, task)if err != nil {@@ -293,7 +293,7 @@ func (s *TaskScheduler) canScheduleTask(ctx context.Context, task *api.Task) (bo// ScheduleIfNeeded schedules the task if// 1. its required check does not contain error in the latest run-// 2. it has no blocking tasks+// 2. it has no blocking tasks.func (s *TaskScheduler) ScheduleIfNeeded(ctx context.Context, task *api.Task) (*api.Task, error) {schedule, err := s.canScheduleTask(ctx, task)if err != nil {diff --git a/store/activity.go b/store/activity.goindex 9971199f79..f5592546f4 100644--- a/store/activity.go+++ b/store/activity.go@@ -53,7 +53,7 @@ func (raw *activityRaw) toActivity() *api.Activity {}}-// CreateActivity creates an instance of Activity+// CreateActivity creates an instance of Activity.func (s *Store) CreateActivity(ctx context.Context, create *api.ActivityCreate) (*api.Activity, error) {activityRaw, err := s.createActivityRaw(ctx, create)if err != nil {@@ -66,7 +66,7 @@ func (s *Store) CreateActivity(ctx context.Context, create *api.ActivityCreate)return activity, nil}-// GetActivityByID gets an instance of Activity+// GetActivityByID gets an instance of Activity.func (s *Store) GetActivityByID(ctx context.Context, id int) (*api.Activity, error) {activityRaw, err := s.getActivityRawByID(ctx, id)if err != nil {@@ -82,7 +82,7 @@ func (s *Store) GetActivityByID(ctx context.Context, id int) (*api.Activity, errreturn activity, nil}-// FindActivity finds a list of Activity instances+// FindActivity finds a list of Activity instances.func (s *Store) FindActivity(ctx context.Context, find *api.ActivityFind) ([]*api.Activity, error) {activityRawList, err := s.findActivityRaw(ctx, find)if err != nil {@@ -99,7 +99,7 @@ func (s *Store) FindActivity(ctx context.Context, find *api.ActivityFind) ([]*apreturn activityList, nil}-// PatchActivity patches an instance of Activity+// PatchActivity patches an instance of Activity.func (s *Store) PatchActivity(ctx context.Context, patch *api.ActivityPatch) (*api.Activity, error) {activityRaw, err := s.patchActivityRaw(ctx, patch)if err != nil {diff --git a/store/anomaly.go b/store/anomaly.goindex 8e34319372..d5fd1b1d82 100644--- a/store/anomaly.go+++ b/store/anomaly.go@@ -56,7 +56,7 @@ func (raw *anomalyRaw) toAnomaly() *api.Anomaly {}}-// UpsertActiveAnomaly upserts an instance of anomaly+// UpsertActiveAnomaly upserts an instance of anomaly.func (s *Store) UpsertActiveAnomaly(ctx context.Context, upsert *api.AnomalyUpsert) (*api.Anomaly, error) {anomalyRaw, err := s.upsertActiveAnomalyRaw(ctx, upsert)if err != nil {@@ -69,7 +69,7 @@ func (s *Store) UpsertActiveAnomaly(ctx context.Context, upsert *api.AnomalyUpsereturn anomaly, nil}-// FindAnomaly finds a list of Anomaly instances+// FindAnomaly finds a list of Anomaly instances.func (s *Store) FindAnomaly(ctx context.Context, find *api.AnomalyFind) ([]*api.Anomaly, error) {anomalyRawList, err := s.findAnomalyRaw(ctx, find)if err != nil {@@ -335,7 +335,7 @@ type anomalyPatch struct {Payload string}-// patchAnomalyImpl patches an anomaly+// patchAnomalyImpl patches an anomaly.func patchAnomalyImpl(ctx context.Context, tx *sql.Tx, patch *anomalyPatch) (*anomalyRaw, error) {// Build UPDATE clause.if patch.Payload == "" {diff --git a/store/backup.go b/store/backup.goindex 4dc6dfd89a..30b34c104c 100644--- a/store/backup.go+++ b/store/backup.go@@ -113,7 +113,7 @@ func (raw *backupSettingRaw) toBackupSetting() *api.BackupSetting {}}-// CreateBackup creates an instance of Backup+// CreateBackup creates an instance of Backup.func (s *Store) CreateBackup(ctx context.Context, create *api.BackupCreate) (*api.Backup, error) {backupRaw, err := s.createBackupRaw(ctx, create)if err != nil {@@ -126,7 +126,7 @@ func (s *Store) CreateBackup(ctx context.Context, create *api.BackupCreate) (*apreturn backup, nil}-// GetBackupByID gets an instance of Backup by ID+// GetBackupByID gets an instance of Backup by ID.func (s *Store) GetBackupByID(ctx context.Context, id int) (*api.Backup, error) {backupRaw, err := s.getBackupRawByID(ctx, id)if err != nil {@@ -142,7 +142,7 @@ func (s *Store) GetBackupByID(ctx context.Context, id int) (*api.Backup, error)return backupSetting, nil}-// FindBackup finds a list of Backup instances+// FindBackup finds a list of Backup instances.func (s *Store) FindBackup(ctx context.Context, find *api.BackupFind) ([]*api.Backup, error) {backupRawList, err := s.findBackupRaw(ctx, find)if err != nil {@@ -159,7 +159,7 @@ func (s *Store) FindBackup(ctx context.Context, find *api.BackupFind) ([]*api.Bareturn backupList, nil}-// PatchBackup patches an instance of Backup+// PatchBackup patches an instance of Backup.func (s *Store) PatchBackup(ctx context.Context, patch *api.BackupPatch) (*api.Backup, error) {backupRaw, err := s.patchBackupRaw(ctx, patch)if err != nil {@@ -189,7 +189,7 @@ func (s *Store) FindBackupSetting(ctx context.Context, find api.BackupSettingFinreturn backupSettingList, nil}-// GetBackupSettingByDatabaseID gets an instance of BackupSetting by ID+// GetBackupSettingByDatabaseID gets an instance of BackupSetting by ID.func (s *Store) GetBackupSettingByDatabaseID(ctx context.Context, id int) (*api.BackupSetting, error) {backupSettingRaw, err := s.getBackupSettingRaw(ctx, &api.BackupSettingFind{DatabaseID: &id})if err != nil {@@ -205,7 +205,7 @@ func (s *Store) GetBackupSettingByDatabaseID(ctx context.Context, id int) (*api.return backupSetting, nil}-// UpsertBackupSetting upserts an instance of backup setting+// UpsertBackupSetting upserts an instance of backup setting.func (s *Store) UpsertBackupSetting(ctx context.Context, upsert *api.BackupSettingUpsert) (*api.BackupSetting, error) {backupSettingRaw, err := s.upsertBackupSettingRaw(ctx, upsert)if err != nil {@@ -218,7 +218,7 @@ func (s *Store) UpsertBackupSetting(ctx context.Context, upsert *api.BackupSettireturn backup, nil}-// FindBackupSettingsMatch finds a list of backup setting instances with match conditions+// FindBackupSettingsMatch finds a list of backup setting instances with match conditions.func (s *Store) FindBackupSettingsMatch(ctx context.Context, match *api.BackupSettingsMatch) ([]*api.BackupSetting, error) {backupSettingRawList, err := s.findBackupSettingsMatchImpl(ctx, match)if err != nil {@@ -239,7 +239,7 @@ func (s *Store) FindBackupSettingsMatch(ctx context.Context, match *api.BackupSe// private functions//-// composeBackup composes an instance of Backup by backupRaw+// composeBackup composes an instance of Backup by backupRaw.func (s *Store) composeBackup(ctx context.Context, raw *backupRaw) (*api.Backup, error) {backup := raw.toBackup()diff --git a/store/bookmark.go b/store/bookmark.goindex 0802a8bf87..ece2d60fff 100644--- a/store/bookmark.go+++ b/store/bookmark.go@@ -44,7 +44,7 @@ func (raw *bookmarkRaw) toBookmark() *api.Bookmark {}}-// CreateBookmark creates an instance of Bookmark+// CreateBookmark creates an instance of Bookmark.func (s *Store) CreateBookmark(ctx context.Context, create *api.BookmarkCreate) (*api.Bookmark, error) {bookmarkRaw, err := s.createBookmarkRaw(ctx, create)if err != nil {@@ -57,7 +57,7 @@ func (s *Store) CreateBookmark(ctx context.Context, create *api.BookmarkCreate)return bookmark, nil}-// GetBookmarkByID gets an instance of Bookmark+// GetBookmarkByID gets an instance of Bookmark.func (s *Store) GetBookmarkByID(ctx context.Context, id int) (*api.Bookmark, error) {find := &api.BookmarkFind{ID: &id}bookmarkRaw, err := s.getBookmarkRaw(ctx, find)@@ -74,7 +74,7 @@ func (s *Store) GetBookmarkByID(ctx context.Context, id int) (*api.Bookmark, errreturn bookmark, nil}-// FindBookmark finds a list of Bookmark instances+// FindBookmark finds a list of Bookmark instances.func (s *Store) FindBookmark(ctx context.Context, find *api.BookmarkFind) ([]*api.Bookmark, error) {bookmarkRawList, err := s.findBookmarkRaw(ctx, find)if err != nil {diff --git a/store/data_source.go b/store/data_source.goindex 9106da72b6..71c3f16e58 100644--- a/store/data_source.go+++ b/store/data_source.go@@ -75,7 +75,7 @@ func (s *Store) CreateDataSource(ctx context.Context, create *api.DataSourceCreareturn dataSource, nil}-// GetDataSource gets an instance of DataSource+// GetDataSource gets an instance of DataSource.func (s *Store) GetDataSource(ctx context.Context, find *api.DataSourceFind) (*api.DataSource, error) {dataSourceRaw, err := s.getDataSourceRaw(ctx, find)if err != nil {@@ -91,7 +91,7 @@ func (s *Store) GetDataSource(ctx context.Context, find *api.DataSourceFind) (*areturn dataSource, nil}-// FindDataSource finds a list of DataSource instances+// FindDataSource finds a list of DataSource instances.func (s *Store) FindDataSource(ctx context.Context, find *api.DataSourceFind) ([]*api.DataSource, error) {dataSourceRawList, err := s.findDataSourceRaw(ctx, find)if err != nil {@@ -108,7 +108,7 @@ func (s *Store) FindDataSource(ctx context.Context, find *api.DataSourceFind) ([return dataSourceList, nil}-// PatchDataSource patches an instance of DataSource+// PatchDataSource patches an instance of DataSource.func (s *Store) PatchDataSource(ctx context.Context, patch *api.DataSourcePatch) (*api.DataSource, error) {dataSourceRaw, err := s.patchDataSourceRaw(ctx, patch)if err != nil {diff --git a/store/database.go b/store/database.goindex cac9f3a26e..7166ad0533 100644--- a/store/database.go+++ b/store/database.go@@ -65,7 +65,7 @@ func (raw *databaseRaw) toDatabase() *api.Database {}}-// CreateDatabase creates an instance of Database+// CreateDatabase creates an instance of Database.func (s *Store) CreateDatabase(ctx context.Context, create *api.DatabaseCreate) (*api.Database, error) {databaseRaw, err := s.createDatabaseRaw(ctx, create)if err != nil {@@ -78,7 +78,7 @@ func (s *Store) CreateDatabase(ctx context.Context, create *api.DatabaseCreate)return database, nil}-// FindDatabase finds a list of Database instances+// FindDatabase finds a list of Database instances.func (s *Store) FindDatabase(ctx context.Context, find *api.DatabaseFind) ([]*api.Database, error) {databaseRawList, err := s.findDatabaseRaw(ctx, find)if err != nil {@@ -108,7 +108,7 @@ func (s *Store) FindDatabase(ctx context.Context, find *api.DatabaseFind) ([]*apreturn databaseList, nil}-// GetDatabase gets an instance of Database+// GetDatabase gets an instance of Database.func (s *Store) GetDatabase(ctx context.Context, find *api.DatabaseFind) (*api.Database, error) {databaseRaw, err := s.getDatabaseRaw(ctx, find)if err != nil {@@ -124,7 +124,7 @@ func (s *Store) GetDatabase(ctx context.Context, find *api.DatabaseFind) (*api.Dreturn database, nil}-// PatchDatabase patches an instance of Database+// PatchDatabase patches an instance of Database.func (s *Store) PatchDatabase(ctx context.Context, patch *api.DatabasePatch) (*api.Database, error) {databaseRaw, err := s.patchDatabaseRaw(ctx, patch)if err != nil {@@ -137,7 +137,7 @@ func (s *Store) PatchDatabase(ctx context.Context, patch *api.DatabasePatch) (*areturn database, nil}-// CountDatabaseGroupByBackupScheduleAndEnabled counts database, group by backup schedule and enabled+// CountDatabaseGroupByBackupScheduleAndEnabled counts database, group by backup schedule and enabled.func (s *Store) CountDatabaseGroupByBackupScheduleAndEnabled(ctx context.Context) ([]*metric.DatabaseCountMetric, error) {tx, err := s.db.BeginTx(ctx, nil)if err != nil {diff --git a/store/deploy.go b/store/deploy.goindex c9c1861bc4..2c4eba5c2a 100644--- a/store/deploy.go+++ b/store/deploy.go@@ -50,7 +50,7 @@ func (raw *deploymentConfigRaw) toDeploymentConfig() *api.DeploymentConfig {}}-// GetDeploymentConfigByProjectID gets an instance of DeploymentConfig+// GetDeploymentConfigByProjectID gets an instance of DeploymentConfig.func (s *Store) GetDeploymentConfigByProjectID(ctx context.Context, projectID int) (*api.DeploymentConfig, error) {deploymentConfigRaw, err := s.getDeploymentConfigImpl(ctx, &api.DeploymentConfigFind{ProjectID: &projectID})if err != nil {@@ -66,7 +66,7 @@ func (s *Store) GetDeploymentConfigByProjectID(ctx context.Context, projectID inreturn deploymentConfig, nil}-// UpsertDeploymentConfig upserts an instance of DeploymentConfig+// UpsertDeploymentConfig upserts an instance of DeploymentConfig.func (s *Store) UpsertDeploymentConfig(ctx context.Context, upsert *api.DeploymentConfigUpsert) (*api.DeploymentConfig, error) {deploymentConfigRaw, err := s.upsertDeploymentConfigRaw(ctx, upsert)if err != nil {diff --git a/store/environment.go b/store/environment.goindex 13ed48b100..aa13a59549 100644--- a/store/environment.go+++ b/store/environment.go@@ -44,7 +44,7 @@ func (raw *environmentRaw) toEnvironment() *api.Environment {}}-// CreateEnvironment creates an instance of Environment+// CreateEnvironment creates an instance of Environment.func (s *Store) CreateEnvironment(ctx context.Context, create *api.EnvironmentCreate) (*api.Environment, error) {environmentRaw, err := s.createEnvironmentRaw(ctx, create)if err != nil {@@ -57,7 +57,7 @@ func (s *Store) CreateEnvironment(ctx context.Context, create *api.EnvironmentCrreturn environment, nil}-// FindEnvironment finds a list of Environment instances+// FindEnvironment finds a list of Environment instances.func (s *Store) FindEnvironment(ctx context.Context, find *api.EnvironmentFind) ([]*api.Environment, error) {environmentRawList, err := s.findEnvironmentRaw(ctx, find)if err != nil {@@ -74,7 +74,7 @@ func (s *Store) FindEnvironment(ctx context.Context, find *api.EnvironmentFind)return environmentList, nil}-// PatchEnvironment patches an instance of Environment+// PatchEnvironment patches an instance of Environment.func (s *Store) PatchEnvironment(ctx context.Context, patch *api.EnvironmentPatch) (*api.Environment, error) {environmentRaw, err := s.patchEnvironmentRaw(ctx, patch)if err != nil {@@ -87,7 +87,7 @@ func (s *Store) PatchEnvironment(ctx context.Context, patch *api.EnvironmentPatcreturn environment, nil}-// GetEnvironmentByID gets an instance of Environment by ID+// GetEnvironmentByID gets an instance of Environment by ID.func (s *Store) GetEnvironmentByID(ctx context.Context, id int) (*api.Environment, error) {envRaw, err := s.getEnvironmentByIDRaw(ctx, id)if err != nil {diff --git a/store/extension.go b/store/extension.goindex 69c335addd..60ccc9428b 100644--- a/store/extension.go+++ b/store/extension.go@@ -55,7 +55,7 @@ func (raw *dbExtensionRaw) toDBExtension() *api.DBExtension {}}-// FindDBExtension finds a list of dbExtension instances+// FindDBExtension finds a list of dbExtension instances.func (s *Store) FindDBExtension(ctx context.Context, find *api.DBExtensionFind) ([]*api.DBExtension, error) {dbExtensionRawList, err := s.findDBExtensionRaw(ctx, find)if err != nil {@@ -112,7 +112,7 @@ func (s *Store) SetDBExtensionList(ctx context.Context, schema *db.Schema, datab}//-// private functions+// private functions.//func generateDBExtensionActions(oldDBExtensionRawList []*dbExtensionRaw, extensionList []db.Extension, databaseID int) ([]*api.DBExtensionDelete, []*api.DBExtensionCreate) {var newDBExtensionList []*api.DBExtensionCreatediff --git a/store/inbox.go b/store/inbox.goindex f4dec3aaf8..26bcc6bfa3 100644--- a/store/inbox.go+++ b/store/inbox.go@@ -32,7 +32,7 @@ func (raw *inboxRaw) toInbox() *api.Inbox {}}-// CreateInbox creates an instance of Inbox+// CreateInbox creates an instance of Inbox.func (s *Store) CreateInbox(ctx context.Context, create *api.InboxCreate) (*api.Inbox, error) {inboxRaw, err := s.createInboxRaw(ctx, create)if err != nil {@@ -45,7 +45,7 @@ func (s *Store) CreateInbox(ctx context.Context, create *api.InboxCreate) (*api.return inbox, nil}-// GetInboxByID gets an instance of Inbox+// GetInboxByID gets an instance of Inbox.func (s *Store) GetInboxByID(ctx context.Context, id int) (*api.Inbox, error) {find := &api.InboxFind{ID: &id}inboxRaw, err := s.getInboxRawByID(ctx, find)@@ -62,7 +62,7 @@ func (s *Store) GetInboxByID(ctx context.Context, id int) (*api.Inbox, error) {return inbox, nil}-// FindInbox finds a list of Inbox instances+// FindInbox finds a list of Inbox instances.func (s *Store) FindInbox(ctx context.Context, find *api.InboxFind) ([]*api.Inbox, error) {inboxRawList, err := s.findInboxRaw(ctx, find)if err != nil {@@ -79,7 +79,7 @@ func (s *Store) FindInbox(ctx context.Context, find *api.InboxFind) ([]*api.Inboreturn inboxList, nil}-// PatchInbox patches an instance of Inbox+// PatchInbox patches an instance of Inbox.func (s *Store) PatchInbox(ctx context.Context, patch *api.InboxPatch) (*api.Inbox, error) {inboxRaw, err := s.patchInboxRaw(ctx, patch)if err != nil {@@ -92,7 +92,7 @@ func (s *Store) PatchInbox(ctx context.Context, patch *api.InboxPatch) (*api.Inbreturn inbox, nil}-// FindInboxSummary returns the inbox summary for a particular principal+// FindInboxSummary returns the inbox summary for a particular principal.func (s *Store) FindInboxSummary(ctx context.Context, principalID int) (*api.InboxSummary, error) {tx, err := s.db.BeginTx(ctx, nil)if err != nil {@@ -128,7 +128,7 @@ func (s *Store) FindInboxSummary(ctx context.Context, principalID int) (*api.Inb// private function//-// composeInbox composes an instance of Inbox by inboxRaw+// composeInbox composes an instance of Inbox by inboxRaw.func (s *Store) composeInbox(ctx context.Context, raw *inboxRaw) (*api.Inbox, error) {inbox := raw.toInbox()diff --git a/store/instance.go b/store/instance.goindex ac4d6592dc..db76b73c66 100644--- a/store/instance.go+++ b/store/instance.go@@ -62,7 +62,7 @@ func (raw *instanceRaw) toInstance() *api.Instance {}}-// CreateInstance creates an instance of Instance+// CreateInstance creates an instance of Instance.func (s *Store) CreateInstance(ctx context.Context, create *api.InstanceCreate) (*api.Instance, error) {instanceRaw, err := s.createInstanceRaw(ctx, create)if err != nil {@@ -75,7 +75,7 @@ func (s *Store) CreateInstance(ctx context.Context, create *api.InstanceCreate)return instance, nil}-// GetInstanceByID gets an instance of Instance+// GetInstanceByID gets an instance of Instance.func (s *Store) GetInstanceByID(ctx context.Context, id int) (*api.Instance, error) {find := &api.InstanceFind{ID: &id}instanceRaw, err := s.getInstanceRaw(ctx, find)@@ -92,7 +92,7 @@ func (s *Store) GetInstanceByID(ctx context.Context, id int) (*api.Instance, errreturn instance, nil}-// FindInstance finds a list of Instance instances+// FindInstance finds a list of Instance instances.func (s *Store) FindInstance(ctx context.Context, find *api.InstanceFind) ([]*api.Instance, error) {instanceRawList, err := s.findInstanceRaw(ctx, find)if err != nil {@@ -109,7 +109,7 @@ func (s *Store) FindInstance(ctx context.Context, find *api.InstanceFind) ([]*apreturn instanceList, nil}-// PatchInstance patches an instance of Instance+// PatchInstance patches an instance of Instance.func (s *Store) PatchInstance(ctx context.Context, patch *api.InstancePatch) (*api.Instance, error) {instanceRaw, err := s.patchInstanceRaw(ctx, patch)if err != nil {@@ -245,7 +245,7 @@ func (s *Store) FindInstanceWithDatabaseBackupEnabled(ctx context.Context, enginreturn instanceList, nil}-// GetInstanceAdminPasswordByID gets admin password of instance+// GetInstanceAdminPasswordByID gets admin password of instance.func (s *Store) GetInstanceAdminPasswordByID(ctx context.Context, instanceID int) (string, error) {dataSourceFind := &api.DataSourceFind{InstanceID: &instanceID,diff --git a/store/issue.go b/store/issue.goindex 81779711f1..2b17fdd014 100644--- a/store/issue.go+++ b/store/issue.go@@ -64,7 +64,7 @@ func (raw *issueRaw) toIssue() *api.Issue {}}-// CreateIssue creates an instance of Issue+// CreateIssue creates an instance of Issue.func (s *Store) CreateIssue(ctx context.Context, create *api.IssueCreate) (*api.Issue, error) {issueRaw, err := s.createIssueRaw(ctx, create)if err != nil {@@ -77,7 +77,7 @@ func (s *Store) CreateIssue(ctx context.Context, create *api.IssueCreate) (*api.return issue, nil}-// GetIssueByID gets an instance of Issue+// GetIssueByID gets an instance of Issue.func (s *Store) GetIssueByID(ctx context.Context, id int) (*api.Issue, error) {find := &api.IssueFind{ID: &id}issueRaw, err := s.getIssueRaw(ctx, find)@@ -94,7 +94,7 @@ func (s *Store) GetIssueByID(ctx context.Context, id int) (*api.Issue, error) {return issue, nil}-// GetIssueByPipelineID gets an instance of Issue+// GetIssueByPipelineID gets an instance of Issue.func (s *Store) GetIssueByPipelineID(ctx context.Context, id int) (*api.Issue, error) {find := &api.IssueFind{PipelineID: &id}issueRaw, err := s.getIssueRaw(ctx, find)@@ -111,7 +111,7 @@ func (s *Store) GetIssueByPipelineID(ctx context.Context, id int) (*api.Issue, ereturn issue, nil}-// FindIssue finds a list of Issue instances+// FindIssue finds a list of Issue instances.func (s *Store) FindIssue(ctx context.Context, find *api.IssueFind) ([]*api.Issue, error) {issueRawList, err := s.findIssueRaw(ctx, find)if err != nil {@@ -128,7 +128,7 @@ func (s *Store) FindIssue(ctx context.Context, find *api.IssueFind) ([]*api.Issureturn issueList, nil}-// PatchIssue patches an instance of Issue+// PatchIssue patches an instance of Issue.func (s *Store) PatchIssue(ctx context.Context, patch *api.IssuePatch) (*api.Issue, error) {issueRaw, err := s.patchIssueRaw(ctx, patch)if err != nil {@@ -178,7 +178,7 @@ func (s *Store) CountIssueGroupByTypeAndStatus(ctx context.Context) ([]*metric.I}// CreateIssueValidateOnly creates an issue for validation purpose-// Do NOT write to the database+// Do NOT write to the database.func (s *Store) CreateIssueValidateOnly(ctx context.Context, pipeline *api.Pipeline, create *api.IssueCreate, creatorID int) (*api.Issue, error) {issue := &api.Issue{CreatorID: creatorID,@@ -203,7 +203,7 @@ func (s *Store) CreateIssueValidateOnly(ctx context.Context, pipeline *api.Pipel}// CreatePipelineValidateOnly creates a pipeline for validation purpose-// Do NOT write to the database+// Do NOT write to the database.func (s *Store) CreatePipelineValidateOnly(ctx context.Context, create *api.PipelineCreate, creatorID int) (*api.Pipeline, error) {// We cannot emit ID or use default zero by following https://google.aip.dev/163, otherwise// jsonapi resource relationships will collide different resources into the same bucket.@@ -322,7 +322,7 @@ func (s *Store) composeIssueValidateOnly(ctx context.Context, issue *api.Issue)return nil}-// Note: MUST keep in sync with composeIssueValidateOnly+// Note: MUST keep in sync with composeIssueValidateOnly.func (s *Store) composeIssue(ctx context.Context, raw *issueRaw) (*api.Issue, error) {issue := raw.toIssue()diff --git a/store/issue_subscriber.go b/store/issue_subscriber.goindex 233b3f346f..74bb289756 100644--- a/store/issue_subscriber.go+++ b/store/issue_subscriber.go@@ -26,7 +26,7 @@ func (raw *issueSubscriberRaw) toIssueSubscriber() *api.IssueSubscriber {}}-// CreateIssueSubscriber creates an instance of IssueSubscriber+// CreateIssueSubscriber creates an instance of IssueSubscriber.func (s *Store) CreateIssueSubscriber(ctx context.Context, create *api.IssueSubscriberCreate) (*api.IssueSubscriber, error) {issueSubRaw, err := s.createIssueSubscriberRaw(ctx, create)if err != nil {@@ -39,7 +39,7 @@ func (s *Store) CreateIssueSubscriber(ctx context.Context, create *api.IssueSubsreturn issueSub, nil}-// FindIssueSubscriber finds a list of IssueSubscriber instances+// FindIssueSubscriber finds a list of IssueSubscriber instances.func (s *Store) FindIssueSubscriber(ctx context.Context, find *api.IssueSubscriberFind) ([]*api.IssueSubscriber, error) {issueSubRawList, err := s.findIssueSubscriberRaw(ctx, find)if err != nil {diff --git a/store/label.go b/store/label.goindex 32a8d9f2d1..51031e498d 100644--- a/store/label.go+++ b/store/label.go@@ -157,7 +157,7 @@ func (s *Store) SetDatabaseLabelList(ctx context.Context, labelList []*api.Datab}-// FindLabelKey finds a list of LabelKey instances+// FindLabelKey finds a list of LabelKey instances.func (s *Store) FindLabelKey(ctx context.Context, find *api.LabelKeyFind) ([]*api.LabelKey, error) {labelKeyRawList, err := s.findLabelKeyRaw(ctx, find)if err != nil {@@ -174,7 +174,7 @@ func (s *Store) FindLabelKey(ctx context.Context, find *api.LabelKeyFind) ([]*apreturn labelKeyList, nil}-// PatchLabelKey patches an instance of LabelKey+// PatchLabelKey patches an instance of LabelKey.func (s *Store) PatchLabelKey(ctx context.Context, patch *api.LabelKeyPatch) (*api.LabelKey, error) {labelKeyRaw, err := s.patchLabelKeyRaw(ctx, patch)if err != nil {@@ -187,7 +187,7 @@ func (s *Store) PatchLabelKey(ctx context.Context, patch *api.LabelKeyPatch) (*areturn labelKey, nil}-// FindDatabaseLabel finds a list of DatabaseLabel instances+// FindDatabaseLabel finds a list of DatabaseLabel instances.func (s *Store) FindDatabaseLabel(ctx context.Context, find *api.DatabaseLabelFind) ([]*api.DatabaseLabel, error) {labelKeyRawList, err := s.findDatabaseLabelRaw(ctx, find)if err != nil {@@ -208,7 +208,7 @@ func (s *Store) FindDatabaseLabel(ctx context.Context, find *api.DatabaseLabelFi// private functions//-// composeLabelKey composes an instance of LabelKey by labelKeyRaw+// composeLabelKey composes an instance of LabelKey by labelKeyRaw.func (s *Store) composeLabelKey(ctx context.Context, raw *labelKeyRaw) (*api.LabelKey, error) {labelKey := raw.toLabelKey()@@ -227,7 +227,7 @@ func (s *Store) composeLabelKey(ctx context.Context, raw *labelKeyRaw) (*api.Labreturn labelKey, nil}-// composeDatabaseLabel composes an instance of DatabaseLabel by databaseLabelRaw+// composeDatabaseLabel composes an instance of DatabaseLabel by databaseLabelRaw.func (s *Store) composeDatabaseLabel(ctx context.Context, raw *databaseLabelRaw) (*api.DatabaseLabel, error) {databaseLabel := raw.toDatabaseLabel()diff --git a/store/member.go b/store/member.goindex f1b02ad1f5..be98d42762 100644--- a/store/member.go+++ b/store/member.go@@ -49,7 +49,7 @@ func (raw *memberRaw) toMember() *api.Member {}}-// CreateMember creates an instance of Member+// CreateMember creates an instance of Member.func (s *Store) CreateMember(ctx context.Context, create *api.MemberCreate) (*api.Member, error) {memberRaw, err := s.createMemberRaw(ctx, create)if err != nil {@@ -62,7 +62,7 @@ func (s *Store) CreateMember(ctx context.Context, create *api.MemberCreate) (*apreturn member, nil}-// FindMember finds a list of Member instances+// FindMember finds a list of Member instances.func (s *Store) FindMember(ctx context.Context, find *api.MemberFind) ([]*api.Member, error) {memberRawList, err := s.findMemberRaw(ctx, find)if err != nil {@@ -79,7 +79,7 @@ func (s *Store) FindMember(ctx context.Context, find *api.MemberFind) ([]*api.Mereturn memberList, nil}-// GetMemberByPrincipalID gets an instance of Member+// GetMemberByPrincipalID gets an instance of Member.func (s *Store) GetMemberByPrincipalID(ctx context.Context, id int) (*api.Member, error) {find := &api.MemberFind{PrincipalID: &id}memberRaw, err := s.getMemberRaw(ctx, find)@@ -96,7 +96,7 @@ func (s *Store) GetMemberByPrincipalID(ctx context.Context, id int) (*api.Memberreturn member, nil}-// GetMemberByID gets an instance of Member+// GetMemberByID gets an instance of Member.func (s *Store) GetMemberByID(ctx context.Context, id int) (*api.Member, error) {find := &api.MemberFind{ID: &id}memberRaw, err := s.getMemberRaw(ctx, find)@@ -113,7 +113,7 @@ func (s *Store) GetMemberByID(ctx context.Context, id int) (*api.Member, error)return member, nil}-// PatchMember patches an instance of Member+// PatchMember patches an instance of Member.func (s *Store) PatchMember(ctx context.Context, patch *api.MemberPatch) (*api.Member, error) {memberRaw, err := s.patchMemberRaw(ctx, patch)if err != nil {@@ -270,7 +270,7 @@ func (s *Store) patchMemberRaw(ctx context.Context, patch *api.MemberPatch) (*mereturn member, nil}-// composeMember composes an instance of Member by memberRaw+// composeMember composes an instance of Member by memberRaw.func (s *Store) composeMember(ctx context.Context, raw *memberRaw) (*api.Member, error) {member := raw.toMember()diff --git a/store/metadb.go b/store/metadb.goindex 7755e83390..5f0dd121a2 100644--- a/store/metadb.go+++ b/store/metadb.go@@ -13,7 +13,7 @@ import ("go.uber.org/zap")-// MetadataDB abstracts the underlying Postgres instance+// MetadataDB abstracts the underlying Postgres instance.type MetadataDB struct {mode common.ReleaseModedemoDataDir string@@ -28,7 +28,7 @@ type MetadataDB struct {pgStarted bool}-// NewMetadataDBWithEmbedPg install postgres in `datadir` returns an instance of MetadataDB+// NewMetadataDBWithEmbedPg install postgres in `datadir` returns an instance of MetadataDB.func NewMetadataDBWithEmbedPg(pgInstance *postgres.Instance, pgUser, demoDataDir string, mode common.ReleaseMode) *MetadataDB {return &MetadataDB{mode: mode,@@ -39,7 +39,7 @@ func NewMetadataDBWithEmbedPg(pgInstance *postgres.Instance, pgUser, demoDataDir}}-// NewMetadataDBWithExternalPg constructs a new MetadataDB instance pointing to an external Postgres instance+// NewMetadataDBWithExternalPg constructs a new MetadataDB instance pointing to an external Postgres instance.func NewMetadataDBWithExternalPg(pgInstance *postgres.Instance, pgURL, demoDataDir string, mode common.ReleaseMode) *MetadataDB {return &MetadataDB{mode: mode,@@ -50,7 +50,7 @@ func NewMetadataDBWithExternalPg(pgInstance *postgres.Instance, pgURL, demoDataD}}-// Connect connects to the underlying Postgres instance+// Connect connects to the underlying Postgres instance.func (m *MetadataDB) Connect(datastorePort int, readonly bool, version string) (*DB, error) {if m.embed {return m.connectEmbed(datastorePort, m.pgUser, readonly, m.demoDataDir, version, m.mode)@@ -59,7 +59,7 @@ func (m *MetadataDB) Connect(datastorePort int, readonly bool, version string) (}-// connectEmbed starts the embed postgres server and returns an instance of store.DB+// connectEmbed starts the embed postgres server and returns an instance of store.DB.func (m *MetadataDB) connectEmbed(datastorePort int, pgUser string, readonly bool, demoDataDir, version string, mode common.ReleaseMode) (*DB, error) {if err := m.pgInstance.Start(datastorePort, os.Stderr, os.Stderr); err != nil {return nil, err@@ -79,7 +79,7 @@ func (m *MetadataDB) connectEmbed(datastorePort int, pgUser string, readonly booreturn db, nil}-// connectExternal returns an instance of store.DB+// connectExternal returns an instance of store.DB.func (m *MetadataDB) connectExternal(readonly bool, version string) (*DB, error) {u, err := url.Parse(m.pgURL)if err != nil {@@ -145,7 +145,7 @@ func (m *MetadataDB) connectExternal(readonly bool, version string) (*DB, error)return db, nil}-// Close will stop postgres server if using embed postgres+// Close will stop postgres server if using embed postgres.func (m *MetadataDB) Close() error {if !m.pgStarted {return nildiff --git a/store/pg_engine.go b/store/pg_engine.goindex 7f380f97f2..e22ba43b93 100644--- a/store/pg_engine.go+++ b/store/pg_engine.go@@ -219,7 +219,7 @@ func getLatestVersion(ctx context.Context, d dbdriver.Driver, database string) (return nil, fmt.Errorf("failed to find a successful migration history")}-// setupDemoData loads the setupDemoData data for testing+// setupDemoData loads the setupDemoData data for testing.func (db *DB) setupDemoData() error {if db.demoDataDir == "" {log.Debug("Skip setting up demo data. Demo data directory not specified.")diff --git a/store/pipeline.go b/store/pipeline.goindex f6ee205753..211e6dbea7 100644--- a/store/pipeline.go+++ b/store/pipeline.go@@ -46,7 +46,7 @@ func (raw *pipelineRaw) toPipeline() *api.Pipeline {}}-// CreatePipeline creates an instance of Pipeline+// CreatePipeline creates an instance of Pipeline.func (s *Store) CreatePipeline(ctx context.Context, create *api.PipelineCreate) (*api.Pipeline, error) {pipelineRaw, err := s.createPipelineRaw(ctx, create)if err != nil {@@ -59,7 +59,7 @@ func (s *Store) CreatePipeline(ctx context.Context, create *api.PipelineCreate)return pipeline, nil}-// GetPipelineByID gets an instance of Pipeline+// GetPipelineByID gets an instance of Pipeline.func (s *Store) GetPipelineByID(ctx context.Context, id int) (*api.Pipeline, error) {find := &api.PipelineFind{ID: &id}pipelineRaw, err := s.getPipelineRaw(ctx, find)@@ -76,7 +76,7 @@ func (s *Store) GetPipelineByID(ctx context.Context, id int) (*api.Pipeline, errreturn pipeline, nil}-// FindPipeline finds a list of Pipeline instances+// FindPipeline finds a list of Pipeline instances.func (s *Store) FindPipeline(ctx context.Context, find *api.PipelineFind, returnOnErr bool) ([]*api.Pipeline, error) {pipelineRawList, err := s.findPipelineRaw(ctx, find)if err != nil {@@ -100,7 +100,7 @@ func (s *Store) FindPipeline(ctx context.Context, find *api.PipelineFind, returnreturn pipelineList, nil}-// PatchPipeline patches an instance of Pipeline+// PatchPipeline patches an instance of Pipeline.func (s *Store) PatchPipeline(ctx context.Context, patch *api.PipelinePatch) (*api.Pipeline, error) {pipelineRaw, err := s.patchPipelineRaw(ctx, patch)if err != nil {@@ -139,7 +139,7 @@ func (s *Store) composePipelineValidateOnly(ctx context.Context, pipeline *api.Preturn nil}-// Note: MUST keep in sync with composePipelineValidateOnly+// Note: MUST keep in sync with composePipelineValidateOnly.func (s *Store) composePipeline(ctx context.Context, raw *pipelineRaw) (*api.Pipeline, error) {pipeline := raw.toPipeline()diff --git a/store/policy.go b/store/policy.goindex ee61809a25..4f9fac6b8d 100644--- a/store/policy.go+++ b/store/policy.go@@ -53,7 +53,7 @@ func (raw *policyRaw) toPolicy() *api.Policy {}}-// UpsertPolicy upserts an instance of Policy+// UpsertPolicy upserts an instance of Policy.func (s *Store) UpsertPolicy(ctx context.Context, upsert *api.PolicyUpsert) (*api.Policy, error) {policyRaw, err := s.upsertPolicyRaw(ctx, upsert)if err != nil {@@ -66,7 +66,7 @@ func (s *Store) UpsertPolicy(ctx context.Context, upsert *api.PolicyUpsert) (*apreturn policy, nil}-// GetPolicy gets a policy+// GetPolicy gets a policy.func (s *Store) GetPolicy(ctx context.Context, find *api.PolicyFind) (*api.Policy, error) {policyRaw, err := s.getPolicyRaw(ctx, find)if err != nil {diff --git a/store/principal.go b/store/principal.goindex 235e020d71..8a8e2e0207 100644--- a/store/principal.go+++ b/store/principal.go@@ -52,7 +52,7 @@ func (raw *principalRaw) toPrincipal() *api.Principal {}}-// CreatePrincipal creates an instance of Principal+// CreatePrincipal creates an instance of Principal.func (s *Store) CreatePrincipal(ctx context.Context, create *api.PrincipalCreate) (*api.Principal, error) {principalRaw, err := s.createPrincipalRaw(ctx, create)if err != nil {@@ -64,7 +64,7 @@ func (s *Store) CreatePrincipal(ctx context.Context, create *api.PrincipalCreatereturn principal, nil}-// GetPrincipalList gets a list of Principal instances+// GetPrincipalList gets a list of Principal instances.func (s *Store) GetPrincipalList(ctx context.Context) ([]*api.Principal, error) {principalRawList, err := s.findPrincipalRawList(ctx)if err != nil {@@ -81,7 +81,7 @@ func (s *Store) GetPrincipalList(ctx context.Context) ([]*api.Principal, error)return principalList, nil}-// GetPrincipalByEmail gets an instance of Principal+// GetPrincipalByEmail gets an instance of Principal.func (s *Store) GetPrincipalByEmail(ctx context.Context, email string) (*api.Principal, error) {find := &api.PrincipalFind{Email: &email}principalRaw, err := s.getPrincipalRaw(ctx, find)@@ -98,7 +98,7 @@ func (s *Store) GetPrincipalByEmail(ctx context.Context, email string) (*api.Prireturn principal, nil}-// PatchPrincipal patches an instance of Principal+// PatchPrincipal patches an instance of Principal.func (s *Store) PatchPrincipal(ctx context.Context, patch *api.PrincipalPatch) (*api.Principal, error) {principalRaw, err := s.patchPrincipalRaw(ctx, patch)if err != nil {@@ -111,7 +111,7 @@ func (s *Store) PatchPrincipal(ctx context.Context, patch *api.PrincipalPatch) (return principal, nil}-// GetPrincipalByID gets an instance of Principal by ID+// GetPrincipalByID gets an instance of Principal by ID.func (s *Store) GetPrincipalByID(ctx context.Context, id int) (*api.Principal, error) {principalFind := &api.PrincipalFind{ID: &id}principalRaw, err := s.getPrincipalRaw(ctx, principalFind)@@ -242,7 +242,7 @@ func (s *Store) patchPrincipalRaw(ctx context.Context, patch *api.PrincipalPatchreturn principal, nil}-// composePrincipal composes an instance of Principal by principalRaw+// composePrincipal composes an instance of Principal by principalRaw.func (s *Store) composePrincipal(ctx context.Context, raw *principalRaw) (*api.Principal, error) {principal := raw.toPrincipal()diff --git a/store/project.go b/store/project.goindex 92855ac8f2..b43ef470d4 100644--- a/store/project.go+++ b/store/project.go@@ -55,7 +55,7 @@ func (raw *projectRaw) toProject() *api.Project {}}-// GetProjectByID gets an instance of Project+// GetProjectByID gets an instance of Project.func (s *Store) GetProjectByID(ctx context.Context, id int) (*api.Project, error) {find := &api.ProjectFind{ID: &id}projectRaw, err := s.getProjectRaw(ctx, find)@@ -72,7 +72,7 @@ func (s *Store) GetProjectByID(ctx context.Context, id int) (*api.Project, errorreturn project, nil}-// FindProject finds a list of Project instances+// FindProject finds a list of Project instances.func (s *Store) FindProject(ctx context.Context, find *api.ProjectFind) ([]*api.Project, error) {projectRawList, err := s.findProjectRaw(ctx, find)if err != nil {@@ -89,7 +89,7 @@ func (s *Store) FindProject(ctx context.Context, find *api.ProjectFind) ([]*api.return projectList, nil}-// CreateProject creates an instance of Project+// CreateProject creates an instance of Project.func (s *Store) CreateProject(ctx context.Context, create *api.ProjectCreate) (*api.Project, error) {projectRaw, err := s.createProjectRaw(ctx, create)if err != nil {@@ -102,7 +102,7 @@ func (s *Store) CreateProject(ctx context.Context, create *api.ProjectCreate) (*return project, nil}-// PatchProject patches an instance of Project+// PatchProject patches an instance of Project.func (s *Store) PatchProject(ctx context.Context, patch *api.ProjectPatch) (*api.Project, error) {projectRaw, err := s.patchProjectRaw(ctx, patch)if err != nil {diff --git a/store/project_member.go b/store/project_member.goindex 9568f0ce41..73d4467daf 100644--- a/store/project_member.go+++ b/store/project_member.go@@ -54,7 +54,7 @@ func (raw *projectMemberRaw) toProjectMember() *api.ProjectMember {}}-// CreateProjectMember creates an instance of ProjectMember+// CreateProjectMember creates an instance of ProjectMember.func (s *Store) CreateProjectMember(ctx context.Context, create *api.ProjectMemberCreate) (*api.ProjectMember, error) {projectMemberRaw, err := s.createProjectMemberRaw(ctx, create)if err != nil {@@ -67,7 +67,7 @@ func (s *Store) CreateProjectMember(ctx context.Context, create *api.ProjectMembreturn projectMember, nil}-// FindProjectMember finds a list of ProjectMember instances+// FindProjectMember finds a list of ProjectMember instances.func (s *Store) FindProjectMember(ctx context.Context, find *api.ProjectMemberFind) ([]*api.ProjectMember, error) {projectMemberRawList, err := s.findProjectMemberRaw(ctx, find)if err != nil {@@ -84,7 +84,7 @@ func (s *Store) FindProjectMember(ctx context.Context, find *api.ProjectMemberFireturn projectMemberList, nil}-// GetProjectMemberByID gets an instance of ProjectMember+// GetProjectMemberByID gets an instance of ProjectMember.func (s *Store) GetProjectMemberByID(ctx context.Context, id int) (*api.ProjectMember, error) {find := &api.ProjectMemberFind{ID: &id}projectMemberRaw, err := s.getProjectMemberRaw(ctx, find)@@ -101,7 +101,7 @@ func (s *Store) GetProjectMemberByID(ctx context.Context, id int) (*api.ProjectMreturn projectMember, nil}-// PatchProjectMember patches an instance of ProjectMember+// PatchProjectMember patches an instance of ProjectMember.func (s *Store) PatchProjectMember(ctx context.Context, patch *api.ProjectMemberPatch) (*api.ProjectMember, error) {projectMemberRaw, err := s.patchProjectMemberRaw(ctx, patch)if err != nil {@@ -133,7 +133,7 @@ func (s *Store) DeleteProjectMember(ctx context.Context, delete *api.ProjectMembreturn nil}-// BatchUpdateProjectMember update the project member with provided project member list+// BatchUpdateProjectMember update the project member with provided project member list.func (s *Store) BatchUpdateProjectMember(ctx context.Context, batchUpdate *api.ProjectMemberBatchUpdate) ([]*api.ProjectMember, []*api.ProjectMember, error) {createdMemberRawList, deletedMemberRawList, err := s.batchUpdateProjectMemberRaw(ctx, batchUpdate)if err != nil {@@ -161,7 +161,7 @@ func (s *Store) BatchUpdateProjectMember(ctx context.Context, batchUpdate *api.P// private functions//-// composeProjectMember composes an instance of ProjectMember by projectMemberRaw+// composeProjectMember composes an instance of ProjectMember by projectMemberRaw.func (s *Store) composeProjectMember(ctx context.Context, raw *projectMemberRaw) (*api.ProjectMember, error) {projectMember := raw.toProjectMember()@@ -264,7 +264,7 @@ func (s *Store) patchProjectMemberRaw(ctx context.Context, patch *api.ProjectMemreturn projectMember, nil}-// getBatchUpdatePrincipalIDList return the principal ID for each operation (this function may be a litter overhead, but it is easy to be tested)+// getBatchUpdatePrincipalIDList return the principal ID for each operation (this function may be a litter overhead, but it is easy to be tested).func getBatchUpdatePrincipalIDList(oldPrincipalIDList []int, newPrincipalIDList []int) (createPrincipalIDList, patchPrincipalIDList, deletePrincipalIDList []int) {oldPrincipalIDSet := make(map[int]bool)for _, id := range oldPrincipalIDList {@@ -296,7 +296,7 @@ func getBatchUpdatePrincipalIDList(oldPrincipalIDList []int, newPrincipalIDListreturn createPrincipalIDList, patchPrincipalIDList, deletePrincipalIDList}-// batchUpdateProjectMemberRaw update the project member with provided project member list+// batchUpdateProjectMemberRaw update the project member with provided project member list.func (s *Store) batchUpdateProjectMemberRaw(ctx context.Context, batchUpdate *api.ProjectMemberBatchUpdate) ([]*projectMemberRaw, []*projectMemberRaw, error) {var createdMemberRawList []*projectMemberRawvar deletedMemberRawList []*projectMemberRawdiff --git a/store/project_webhook.go b/store/project_webhook.goindex 9222d8272c..b381c79a58 100644--- a/store/project_webhook.go+++ b/store/project_webhook.go@@ -57,7 +57,7 @@ func (raw *projectWebhookRaw) toProjectWebhook() *api.ProjectWebhook {return &projectWebhook}-// CreateProjectWebhook creates an instance of ProjectWebhook+// CreateProjectWebhook creates an instance of ProjectWebhook.func (s *Store) CreateProjectWebhook(ctx context.Context, create *api.ProjectWebhookCreate) (*api.ProjectWebhook, error) {projectWebhookRaw, err := s.createProjectWebhookRaw(ctx, create)if err != nil {@@ -70,7 +70,7 @@ func (s *Store) CreateProjectWebhook(ctx context.Context, create *api.ProjectWebreturn projectWebhook, nil}-// GetProjectWebhookByID gets an instance of ProjectWebhook+// GetProjectWebhookByID gets an instance of ProjectWebhook.func (s *Store) GetProjectWebhookByID(ctx context.Context, id int) (*api.ProjectWebhook, error) {find := &api.ProjectWebhookFind{ID: &id}projectWebhookRaw, err := s.getProjectWebhookRaw(ctx, find)@@ -87,7 +87,7 @@ func (s *Store) GetProjectWebhookByID(ctx context.Context, id int) (*api.Projectreturn projectWebhook, nil}-// FindProjectWebhook finds a list of ProjectWebhook instances+// FindProjectWebhook finds a list of ProjectWebhook instances.func (s *Store) FindProjectWebhook(ctx context.Context, find *api.ProjectWebhookFind) ([]*api.ProjectWebhook, error) {projectWebhookRawList, err := s.findProjectWebhookRaw(ctx, find)if err != nil {@@ -104,7 +104,7 @@ func (s *Store) FindProjectWebhook(ctx context.Context, find *api.ProjectWebhookreturn projectWebhookList, nil}-// PatchProjectWebhook patches an instance of ProjectWebhook+// PatchProjectWebhook patches an instance of ProjectWebhook.func (s *Store) PatchProjectWebhook(ctx context.Context, patch *api.ProjectWebhookPatch) (*api.ProjectWebhook, error) {projectWebhookRaw, err := s.patchProjectWebhookRaw(ctx, patch)if err != nil {diff --git a/store/repository.go b/store/repository.goindex 4bb6585cae..56bf0b2b56 100644--- a/store/repository.go+++ b/store/repository.go@@ -77,7 +77,7 @@ func (raw *repositoryRaw) toRepository() *api.Repository {}}-// CreateRepository creates an instance of Repository+// CreateRepository creates an instance of Repository.func (s *Store) CreateRepository(ctx context.Context, create *api.RepositoryCreate) (*api.Repository, error) {repositoryRaw, err := s.createRepositoryRaw(ctx, create)if err != nil {@@ -90,7 +90,7 @@ func (s *Store) CreateRepository(ctx context.Context, create *api.RepositoryCreareturn repository, nil}-// GetRepository gets an instance of Repository+// GetRepository gets an instance of Repository.func (s *Store) GetRepository(ctx context.Context, find *api.RepositoryFind) (*api.Repository, error) {repositoryRaw, err := s.getRepositoryRaw(ctx, find)if err != nil {@@ -106,7 +106,7 @@ func (s *Store) GetRepository(ctx context.Context, find *api.RepositoryFind) (*areturn repository, nil}-// FindRepository finds a list of Repository instances+// FindRepository finds a list of Repository instances.func (s *Store) FindRepository(ctx context.Context, find *api.RepositoryFind) ([]*api.Repository, error) {repositoryRawList, err := s.findRepositoryRaw(ctx, find)if err != nil {@@ -123,7 +123,7 @@ func (s *Store) FindRepository(ctx context.Context, find *api.RepositoryFind) ([return repositoryList, nil}-// PatchRepository patches an instance of Repository+// PatchRepository patches an instance of Repository.func (s *Store) PatchRepository(ctx context.Context, patch *api.RepositoryPatch) (*api.Repository, error) {repositoryRaw, err := s.patchRepositoryRaw(ctx, patch)if err != nil {diff --git a/store/setting.go b/store/setting.goindex 929ab058cd..55436e4b6f 100644--- a/store/setting.go+++ b/store/setting.go@@ -46,7 +46,7 @@ func (raw *settingRaw) toSetting() *api.Setting {}}-// CreateSettingIfNotExist creates an instance of Setting+// CreateSettingIfNotExist creates an instance of Setting.func (s *Store) CreateSettingIfNotExist(ctx context.Context, create *api.SettingCreate) (*api.Setting, error) {settingRaw, err := s.createSettingRawIfNotExist(ctx, create)if err != nil {@@ -59,7 +59,7 @@ func (s *Store) CreateSettingIfNotExist(ctx context.Context, create *api.Settingreturn setting, nil}-// FindSetting finds a list of Setting instances+// FindSetting finds a list of Setting instances.func (s *Store) FindSetting(ctx context.Context, find *api.SettingFind) ([]*api.Setting, error) {settingRawList, err := s.findSettingRaw(ctx, find)if err != nil {@@ -76,7 +76,7 @@ func (s *Store) FindSetting(ctx context.Context, find *api.SettingFind) ([]*api.return settingList, nil}-// PatchSetting patches an instance of Setting+// PatchSetting patches an instance of Setting.func (s *Store) PatchSetting(ctx context.Context, patch *api.SettingPatch) (*api.Setting, error) {settingRaw, err := s.patchSettingRaw(ctx, patch)if err != nil {diff --git a/store/sheet.go b/store/sheet.goindex fcded8a0a3..39de505799 100644--- a/store/sheet.go+++ b/store/sheet.go@@ -70,7 +70,7 @@ func (raw *sheetRaw) toSheet() *api.Sheet {}}-// CreateSheet creates an instance of Sheet+// CreateSheet creates an instance of Sheet.func (s *Store) CreateSheet(ctx context.Context, create *api.SheetCreate) (*api.Sheet, error) {sheetRaw, err := s.createSheetRaw(ctx, create)if err != nil {@@ -83,7 +83,7 @@ func (s *Store) CreateSheet(ctx context.Context, create *api.SheetCreate) (*api.return sheet, nil}-// GetSheet gets an instance of Sheet+// GetSheet gets an instance of Sheet.func (s *Store) GetSheet(ctx context.Context, find *api.SheetFind, currentPrincipalID int) (*api.Sheet, error) {sheetRaw, err := s.getSheetRaw(ctx, find)if err != nil {@@ -99,7 +99,7 @@ func (s *Store) GetSheet(ctx context.Context, find *api.SheetFind, currentPrincireturn sheet, nil}-// FindSheet finds a list of Sheet instances+// FindSheet finds a list of Sheet instances.func (s *Store) FindSheet(ctx context.Context, find *api.SheetFind, currentPrincipalID int) ([]*api.Sheet, error) {sheetRawList, err := s.findSheetRaw(ctx, find)if err != nil {@@ -116,7 +116,7 @@ func (s *Store) FindSheet(ctx context.Context, find *api.SheetFind, currentPrincreturn sheetList, nil}-// PatchSheet patches an instance of Sheet+// PatchSheet patches an instance of Sheet.func (s *Store) PatchSheet(ctx context.Context, patch *api.SheetPatch) (*api.Sheet, error) {sheetRaw, err := s.patchSheetRaw(ctx, patch)if err != nil {diff --git a/store/stage.go b/store/stage.goindex d6d0065bad..7db0c91bbb 100644--- a/store/stage.go+++ b/store/stage.go@@ -50,7 +50,7 @@ func (raw *stageRaw) toStage() *api.Stage {}}-// CreateStage creates an instance of Stage+// CreateStage creates an instance of Stage.func (s *Store) CreateStage(ctx context.Context, create *api.StageCreate) (*api.Stage, error) {stageRaw, err := s.createStageRaw(ctx, create)if err != nil {@@ -63,7 +63,7 @@ func (s *Store) CreateStage(ctx context.Context, create *api.StageCreate) (*api.return stage, nil}-// FindStage finds a list of Stage instances+// FindStage finds a list of Stage instances.func (s *Store) FindStage(ctx context.Context, find *api.StageFind) ([]*api.Stage, error) {stageRawList, err := s.findStageRaw(ctx, find)if err != nil {@@ -108,7 +108,7 @@ func (s *Store) composeStageValidateOnly(ctx context.Context, stage *api.Stage)return nil}-// Note: MUST keep in sync with composeStageValidateOnly+// Note: MUST keep in sync with composeStageValidateOnly.func (s *Store) composeStage(ctx context.Context, raw *stageRaw) (*api.Stage, error) {stage := raw.toStage()diff --git a/store/store.go b/store/store.goindex 7adac10ea3..e1e0868cf6 100644--- a/store/store.go+++ b/store/store.go@@ -4,13 +4,13 @@ import ("github.com/bytebase/bytebase/api")-// Store provides database access to all raw objects+// Store provides database access to all raw objects.type Store struct {db *DBcache api.CacheService}-// New creates a new instance of Store+// New creates a new instance of Store.func New(db *DB, cache api.CacheService) *Store {return &Store{db: db,diff --git a/store/table.go b/store/table.goindex 04fd00d647..a61659eede 100644--- a/store/table.go+++ b/store/table.go@@ -68,7 +68,7 @@ func (raw *tableRaw) toTable() *api.Table {}}-// GetTable gets an instance of Table+// GetTable gets an instance of Table.func (s *Store) GetTable(ctx context.Context, find *api.TableFind) (*api.Table, error) {tableRaw, err := s.getTableRaw(ctx, find)if err != nil {@@ -84,7 +84,7 @@ func (s *Store) GetTable(ctx context.Context, find *api.TableFind) (*api.Table,return table, nil}-// FindTable finds a list of Table instances+// FindTable finds a list of Table instances.func (s *Store) FindTable(ctx context.Context, find *api.TableFind) ([]*api.Table, error) {tableRawList, err := s.findTableRaw(ctx, find)if err != nil {diff --git a/store/task.go b/store/task.goindex 44ccce4666..a356a6524c 100644--- a/store/task.go+++ b/store/task.go@@ -80,7 +80,7 @@ func (raw *taskRaw) toTask() *api.Task {return task}-// CreateTask creates an instance of Task+// CreateTask creates an instance of Task.func (s *Store) CreateTask(ctx context.Context, create *api.TaskCreate) (*api.Task, error) {taskRaw, err := s.createTaskRaw(ctx, create)if err != nil {@@ -93,7 +93,7 @@ func (s *Store) CreateTask(ctx context.Context, create *api.TaskCreate) (*api.Tareturn task, nil}-// GetTaskByID gets an instance of Task+// GetTaskByID gets an instance of Task.func (s *Store) GetTaskByID(ctx context.Context, id int) (*api.Task, error) {find := &api.TaskFind{ID: &id}taskRaw, err := s.getTaskRaw(ctx, find)@@ -110,7 +110,7 @@ func (s *Store) GetTaskByID(ctx context.Context, id int) (*api.Task, error) {return task, nil}-// FindTask finds a list of Task instances+// FindTask finds a list of Task instances.func (s *Store) FindTask(ctx context.Context, find *api.TaskFind, returnOnErr bool) ([]*api.Task, error) {taskRawList, err := s.findTaskRaw(ctx, find)if err != nil {@@ -133,7 +133,7 @@ func (s *Store) FindTask(ctx context.Context, find *api.TaskFind, returnOnErr boreturn taskList, nil}-// PatchTask patches an instance of Task+// PatchTask patches an instance of Task.func (s *Store) PatchTask(ctx context.Context, patch *api.TaskPatch) (*api.Task, error) {taskRaw, err := s.patchTaskRaw(ctx, patch)if err != nil {@@ -146,7 +146,7 @@ func (s *Store) PatchTask(ctx context.Context, patch *api.TaskPatch) (*api.Task,return task, nil}-// PatchTaskStatus patches an instance of TaskStatus+// PatchTaskStatus patches an instance of TaskStatus.func (s *Store) PatchTaskStatus(ctx context.Context, patch *api.TaskStatusPatch) (*api.Task, error) {taskRaw, err := s.patchTaskRawStatus(ctx, patch)if err != nil {diff --git a/store/task_check_run.go b/store/task_check_run.goindex 3ea3ff0934..217cd03807 100644--- a/store/task_check_run.go+++ b/store/task_check_run.go@@ -60,7 +60,7 @@ func (raw *taskCheckRunRaw) toTaskCheckRun() *api.TaskCheckRun {}}-// CreateTaskCheckRunIfNeeded creates an instance of TaskCheckRun if needed+// CreateTaskCheckRunIfNeeded creates an instance of TaskCheckRun if needed.func (s *Store) CreateTaskCheckRunIfNeeded(ctx context.Context, create *api.TaskCheckRunCreate) (*api.TaskCheckRun, error) {taskCheckRunRaw, err := s.createTaskCheckRunRawIfNeeded(ctx, create)if err != nil {@@ -73,7 +73,7 @@ func (s *Store) CreateTaskCheckRunIfNeeded(ctx context.Context, create *api.Taskreturn taskCheckRun, nil}-// FindTaskCheckRun finds a list of TaskCheckRun instances+// FindTaskCheckRun finds a list of TaskCheckRun instances.func (s *Store) FindTaskCheckRun(ctx context.Context, find *api.TaskCheckRunFind) ([]*api.TaskCheckRun, error) {taskCheckRunRawList, err := s.findTaskCheckRunRaw(ctx, find)if err != nil {@@ -90,7 +90,7 @@ func (s *Store) FindTaskCheckRun(ctx context.Context, find *api.TaskCheckRunFindreturn taskCheckRunList, nil}-// PatchTaskCheckRunStatus patches an instance of TaskCheckRunStatus+// PatchTaskCheckRunStatus patches an instance of TaskCheckRunStatus.func (s *Store) PatchTaskCheckRunStatus(ctx context.Context, patch *api.TaskCheckRunStatusPatch) (*api.TaskCheckRun, error) {taskCheckRunRaw, err := s.patchTaskCheckRunRawStatus(ctx, patch)if err != nil {@@ -107,7 +107,7 @@ func (s *Store) PatchTaskCheckRunStatus(ctx context.Context, patch *api.TaskChec// private functions//-// composeTaskCheckRun composes an instance of TaskCheckRun by taskCheckRunRaw+// composeTaskCheckRun composes an instance of TaskCheckRun by taskCheckRunRaw.func (s *Store) composeTaskCheckRun(ctx context.Context, raw *taskCheckRunRaw) (*api.TaskCheckRun, error) {taskCheckRun := raw.toTaskCheckRun()@@ -126,7 +126,7 @@ func (s *Store) composeTaskCheckRun(ctx context.Context, raw *taskCheckRunRaw) (return taskCheckRun, nil}-// createTaskCheckRunRawIfNeeded creates a new taskCheckRun. See interface for the expected behavior+// createTaskCheckRunRawIfNeeded creates a new taskCheckRun. See interface for the expected behavior.func (s *Store) createTaskCheckRunRawIfNeeded(ctx context.Context, create *api.TaskCheckRunCreate) (*taskCheckRunRaw, error) {tx, err := s.db.BeginTx(ctx, nil)if err != nil {diff --git a/store/task_dag.go b/store/task_dag.goindex b7446b347a..1a547808b9 100644--- a/store/task_dag.go+++ b/store/task_dag.go@@ -56,7 +56,7 @@ func (s *Store) FindTaskDAGList(ctx context.Context, find *api.TaskDAGFind) ([]*return taskDAGList, nil}-// GetTaskDAGByToTaskID gets a single TaskDAG by ToTaskID+// GetTaskDAGByToTaskID gets a single TaskDAG by ToTaskID.func (s *Store) GetTaskDAGByToTaskID(ctx context.Context, id int) (*api.TaskDAG, error) {taskDAGList, err := s.FindTaskDAGList(ctx, &api.TaskDAGFind{ToTaskID: id})if err != nil {diff --git a/store/vcs.go b/store/vcs.goindex aeed9f4e69..cac7896159 100644--- a/store/vcs.go+++ b/store/vcs.go@@ -51,7 +51,7 @@ func (raw *vcsRaw) toVCS() *api.VCS {}}-// CreateVCS creates an instance of VCS+// CreateVCS creates an instance of VCS.func (s *Store) CreateVCS(ctx context.Context, create *api.VCSCreate) (*api.VCS, error) {vcsRaw, err := s.createVCSRaw(ctx, create)if err != nil {@@ -64,7 +64,7 @@ func (s *Store) CreateVCS(ctx context.Context, create *api.VCSCreate) (*api.VCS,return vcs, nil}-// FindVCS finds a list of VCS instances+// FindVCS finds a list of VCS instances.func (s *Store) FindVCS(ctx context.Context, find *api.VCSFind) ([]*api.VCS, error) {vcsRawList, err := s.findVCSRaw(ctx, find)if err != nil {@@ -81,7 +81,7 @@ func (s *Store) FindVCS(ctx context.Context, find *api.VCSFind) ([]*api.VCS, errreturn vcsList, nil}-// GetVCSByID gets a composesd instance of VCS by ID+// GetVCSByID gets a composesd instance of VCS by ID.func (s *Store) GetVCSByID(ctx context.Context, id int) (*api.VCS, error) {vcsRaw, err := s.getVCSRaw(ctx, id)if err != nil {@@ -98,7 +98,7 @@ func (s *Store) GetVCSByID(ctx context.Context, id int) (*api.VCS, error) {return vcs, nil}-// PatchVCS patches an instance of VCS+// PatchVCS patches an instance of VCS.func (s *Store) PatchVCS(ctx context.Context, patch *api.VCSPatch) (*api.VCS, error) {vcsRaw, err := s.patchVCSRaw(ctx, patch)if err != nil {@@ -111,7 +111,7 @@ func (s *Store) PatchVCS(ctx context.Context, patch *api.VCSPatch) (*api.VCS, erreturn vcs, nil}-// DeleteVCS deletes an instance of VCS+// DeleteVCS deletes an instance of VCS.func (s *Store) DeleteVCS(ctx context.Context, delete *api.VCSDelete) error {if err := s.deleteVCSRaw(ctx, delete); err != nil {return fmt.Errorf("failed to delete VCS with VCSDelete[%+v], error: %w", delete, err)diff --git a/store/view.go b/store/view.goindex 09397ea46c..d61877500b 100644--- a/store/view.go+++ b/store/view.go@@ -53,7 +53,7 @@ func (raw *viewRaw) toView() *api.View {}}-// FindView finds a list of View instances+// FindView finds a list of View instances.func (s *Store) FindView(ctx context.Context, find *api.ViewFind) ([]*api.View, error) {viewRawList, err := s.findViewRaw(ctx, find)if err != nil {@@ -105,7 +105,7 @@ func (s *Store) SetViewList(ctx context.Context, schema *db.Schema, databaseID i}//-// private functions+// private functions.//func generateViewActions(oldViewRawList []*viewRaw, viewList []db.View, databaseID int) ([]*api.ViewDelete, []*api.ViewCreate) {var viewCreateList []*api.ViewCreatediff --git a/tests/backup_restore_test.go b/tests/backup_restore_test.goindex afc3a51656..0241257afe 100644--- a/tests/backup_restore_test.go+++ b/tests/backup_restore_test.go@@ -32,7 +32,7 @@ import (// 2. create a full backup// 3. clear data// 4. restore data-// 5. validate+// 5. validate.func TestBackupRestoreBasic(t *testing.T) {t.Parallel()a := require.New(t)diff --git a/tests/external_pg_test.go b/tests/external_pg_test.goindex a443500708..bb20af6fa8 100644--- a/tests/external_pg_test.go+++ b/tests/external_pg_test.go@@ -18,7 +18,7 @@ type fakeExternalPg struct {pgUser string}-// newFakeExternalPg will install postgres in tmpDir and listen on Unix domain socket with port+// newFakeExternalPg will install postgres in tmpDir and listen on Unix domain socket with port.func newFakeExternalPg(tmpDir string, port int) (*fakeExternalPg, error) {resourceDir := path.Join(tmpDir, "resources")dataDir := path.Join(tmpDir, "pgdata")diff --git a/tests/fake/gitlab.go b/tests/fake/gitlab.goindex 1f8000cc08..172ebba0a3 100644--- a/tests/fake/gitlab.go+++ b/tests/fake/gitlab.go@@ -107,7 +107,7 @@ func (gl *GitLab) createProjectHook(c echo.Context) error {return nil}-// readProjectTree reads a project file nodes+// readProjectTree reads a project file nodes.func (gl *GitLab) readProjectTree(c echo.Context) error {gitlabProjectID := c.Param("id")path := c.QueryParam("path")@@ -135,7 +135,7 @@ func (gl *GitLab) readProjectTree(c echo.Context) error {return c.String(http.StatusOK, string(buf))}-// readProjectFile reads a project file+// readProjectFile reads a project file.func (gl *GitLab) readProjectFile(c echo.Context) error {gitlabProjectID := c.Param("id")filePathEscaped := c.Param("filePath")@@ -157,7 +157,7 @@ func (gl *GitLab) readProjectFile(c echo.Context) error {return c.String(http.StatusOK, content)}-// readProjectFileMetadata reads a project file metadata+// readProjectFileMetadata reads a project file metadata.func (gl *GitLab) readProjectFileMetadata(c echo.Context) error {gitlabProjectID := c.Param("id")filePathEscaped := c.Param("filePath")@@ -191,7 +191,7 @@ func (gl *GitLab) readProjectFileMetadata(c echo.Context) error {return c.String(http.StatusOK, string(buf))}-// getFakeCommit get a fake commit data+// getFakeCommit get a fake commit data.func (gl *GitLab) getFakeCommit(c echo.Context) error {gitlabProjectID := c.Param("id")_, ok := gl.projects[gitlabProjectID]diff --git a/tests/tests.go b/tests/tests.goindex 7fcb77cb97..d50b2bc3f5 100644--- a/tests/tests.go+++ b/tests/tests.go@@ -180,7 +180,7 @@ func (ctl *controller) StartServer(ctx context.Context, dataDir string, port intreturn ctl.start(ctx, port)}-// start only called by StartServer() and StartServerWithExternalPg+// start only called by StartServer() and StartServerWithExternalPg.func (ctl *controller) start(ctx context.Context, port int) error {ctl.rootURL = fmt.Sprintf("http://localhost:%d", port)ctl.apiURL = fmt.Sprintf("http://localhost:%d/api", port)@@ -315,7 +315,7 @@ func (ctl *controller) waitForHealthz() error {}-// Close closes long running resources+// Close closes long running resources.func (ctl *controller) Close(ctx context.Context) error {var e errorif ctl.server != nil {