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: organize the Driver interface better (#2013)
tianzhou86c2c3524545
diff --git a/plugin/db/driver.go b/plugin/db/driver.goindex a59920182c..3734b4236f 100644--- a/plugin/db/driver.go+++ b/plugin/db/driver.go@@ -381,6 +381,7 @@ type ConnectionContext struct {// Driver is the interface for database driver.type Driver interface {+ // General execution// A driver might support multiple engines (e.g. MySQL driver can support both MySQL and TiDB),// So we pass the dbType to tell the exact engine.Open(ctx context.Context, dbType Type, config ConnectionConfig, connCtx ConnectionContext) (Driver, error)@@ -388,9 +389,6 @@ type Driver interface {Close(ctx context.Context) errorPing(ctx context.Context) errorGetDBConnection(ctx context.Context, database string) (*sql.DB, error)- // SyncDBSchema syncs a single database schema.- SyncDBSchema(ctx context.Context, database string) (*Schema, error)- SyncInstance(ctx context.Context) (*InstanceMeta, error)// Execute will execute the statement. For CREATE DATABASE statement, some types of databases such as Postgres// will not use transactions to execute the statement but will still use transactions to execute the rest of statements.Execute(ctx context.Context, statement string) error@@ -398,6 +396,12 @@ type Driver interface {// limit is the maximum row count returned. No limit enforced if limit <= 0Query(ctx context.Context, statement string, limit int) ([]interface{}, error)+ // Sync schema+ // SyncInstance syncs the instance metadata.+ SyncInstance(ctx context.Context) (*InstanceMeta, error)+ // SyncDBSchema syncs a single database schema.+ SyncDBSchema(ctx context.Context, database string) (*Schema, error)+// Migration related// Check whether we need to setup migration (e.g. creating/upgrading the migration related tables)NeedsSetupMigration(ctx context.Context) (bool, error)