Documentation ¶
Index ¶
- type AdaptorOption
- type AnalysisAdaptor
- func (a *AnalysisAdaptor) AddExplainFunc(f ExplainFunc)
- func (a *AnalysisAdaptor) AddGetTableMetaBySQLFunc(f GetTableMetaBySQLFunc)
- func (a *AnalysisAdaptor) AddGetTableMetaByTableNameFunc(f GetTableMetaByTableNameFunc)
- func (a *AnalysisAdaptor) AddListTablesInSchemaFunc(f ListTablesInSchemaFunc)
- func (a *AnalysisAdaptor) GeneratePlugin() goPlugin.Plugin
- type AuditAdaptor
- func (a *AuditAdaptor) AddAdditionalParams(p *params.Param)
- func (a *AuditAdaptor) AddRule(r *driver.Rule, h rawSQLRuleHandler)
- func (a *AuditAdaptor) AddRuleWithSQLParser(r *driver.Rule, h astSQLRuleHandler)
- func (a *AuditAdaptor) GeneratePlugin(opts ...AdaptorOption) goPlugin.Plugin
- func (a *AuditAdaptor) Serve(opts ...AdaptorOption)
- type DbConf
- type Dialector
- type ExplainFunc
- type GetTableMetaBySQLFunc
- type GetTableMetaByTableNameFunc
- type ListTablesInSchemaFunc
- type MssqlDialector
- type OracleDialector
- type PostgresDialector
- type QueryAdaptor
- type SQLQueryFunc
- type SQLQueryPrepareFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AdaptorOption ¶
type AdaptorOption interface {
// contains filtered or unexported methods
}
AdaptorOption store some custom options for the driver adaptor.
func WithSQLParser ¶
func WithSQLParser(parser func(sql string) (ast interface{}, err error)) AdaptorOption
WithSQLParser define custom SQL parser. If set, the adaptor will use it to parse the SQL. User can assert the SQL to correspond ast structure in ruleHandler.
type AnalysisAdaptor ¶ added in v1.2207.0
type AnalysisAdaptor struct {
// contains filtered or unexported fields
}
func NewAnalysisAdaptor ¶ added in v1.2207.0
func NewAnalysisAdaptor(dt Dialector) *AnalysisAdaptor
func (*AnalysisAdaptor) AddExplainFunc ¶ added in v1.2207.0
func (a *AnalysisAdaptor) AddExplainFunc(f ExplainFunc)
func (*AnalysisAdaptor) AddGetTableMetaBySQLFunc ¶ added in v1.2207.0
func (a *AnalysisAdaptor) AddGetTableMetaBySQLFunc(f GetTableMetaBySQLFunc)
func (*AnalysisAdaptor) AddGetTableMetaByTableNameFunc ¶ added in v1.2207.0
func (a *AnalysisAdaptor) AddGetTableMetaByTableNameFunc(f GetTableMetaByTableNameFunc)
func (*AnalysisAdaptor) AddListTablesInSchemaFunc ¶ added in v1.2207.0
func (a *AnalysisAdaptor) AddListTablesInSchemaFunc(f ListTablesInSchemaFunc)
func (*AnalysisAdaptor) GeneratePlugin ¶ added in v1.2207.0
func (a *AnalysisAdaptor) GeneratePlugin() goPlugin.Plugin
type AuditAdaptor ¶ added in v1.2206.0
type AuditAdaptor struct {
// contains filtered or unexported fields
}
AuditAdaptor is a wrapper for the sqle driver layer. It provides a more simpler interface for the database plugin.
func NewAdaptor ¶
func NewAdaptor(dt Dialector) *AuditAdaptor
NewAdaptor create a database plugin AuditAdaptor with dialector. NewAdaptor is actually NewAuditAdaptor, but the method name cannot be changed for historical reasons
func (*AuditAdaptor) AddAdditionalParams ¶ added in v1.2206.0
func (a *AuditAdaptor) AddAdditionalParams(p *params.Param)
func (*AuditAdaptor) AddRule ¶ added in v1.2206.0
func (a *AuditAdaptor) AddRule(r *driver.Rule, h rawSQLRuleHandler)
func (*AuditAdaptor) AddRuleWithSQLParser ¶ added in v1.2206.0
func (a *AuditAdaptor) AddRuleWithSQLParser(r *driver.Rule, h astSQLRuleHandler)
func (*AuditAdaptor) GeneratePlugin ¶ added in v1.2206.0
func (a *AuditAdaptor) GeneratePlugin(opts ...AdaptorOption) goPlugin.Plugin
func (*AuditAdaptor) Serve ¶ added in v1.2206.0
func (a *AuditAdaptor) Serve(opts ...AdaptorOption)
type Dialector ¶
type Dialector interface { // Dialect return the driver name and dsn detail. The return value is used for sql.Open(). Dialect(dsn *driver.DSN) (driverName string, dsnDetail string) // ShowDatabaseSQL return the sql to show all databases. ShowDatabaseSQL() string // String return the dialect name with more formal name. It is different from driver name. // For example, "PostgreSQL" is more formal name than "pgx". String() string }
Dialector is a interface for database dialect. It used for sql.Open()
type ExplainFunc ¶ added in v1.2207.0
type ExplainFunc func(ctx context.Context, conf *driver.ExplainConf, dbConf DbConf) (*driver.ExplainResult, error)
type GetTableMetaBySQLFunc ¶ added in v1.2207.0
type GetTableMetaBySQLFunc func(ctx context.Context, conf *driver.GetTableMetaBySQLConf, dbConf DbConf) (*driver.GetTableMetaBySQLResult, error)
type GetTableMetaByTableNameFunc ¶ added in v1.2207.0
type GetTableMetaByTableNameFunc func(ctx context.Context, conf *driver.GetTableMetaByTableNameConf, dbConf DbConf) (*driver.GetTableMetaByTableNameResult, error)
type ListTablesInSchemaFunc ¶ added in v1.2207.0
type ListTablesInSchemaFunc func(ctx context.Context, conf *driver.ListTablesInSchemaConf, dbConf DbConf) (*driver.ListTablesInSchemaResult, error)
type MssqlDialector ¶
type MssqlDialector struct { }
func (*MssqlDialector) ShowDatabaseSQL ¶
func (d *MssqlDialector) ShowDatabaseSQL() string
func (*MssqlDialector) String ¶
func (d *MssqlDialector) String() string
type OracleDialector ¶
type OracleDialector struct { }
func (*OracleDialector) Dialect ¶
func (d *OracleDialector) Dialect(dsn *driver.DSN) (string, string)
func (*OracleDialector) ShowDatabaseSQL ¶
func (d *OracleDialector) ShowDatabaseSQL() string
func (*OracleDialector) String ¶
func (d *OracleDialector) String() string
type PostgresDialector ¶
type PostgresDialector struct { }
func (*PostgresDialector) Dialect ¶
func (d *PostgresDialector) Dialect(dsn *driver.DSN) (string, string)
func (*PostgresDialector) ShowDatabaseSQL ¶
func (d *PostgresDialector) ShowDatabaseSQL() string
func (*PostgresDialector) String ¶
func (d *PostgresDialector) String() string
type QueryAdaptor ¶ added in v1.2206.0
type QueryAdaptor struct {
// contains filtered or unexported fields
}
func NewQueryAdaptor ¶ added in v1.2206.0
func NewQueryAdaptor(dt Dialector) *QueryAdaptor
func (*QueryAdaptor) AddSQLQueryFunc ¶ added in v1.2206.0
func (q *QueryAdaptor) AddSQLQueryFunc(f SQLQueryFunc)
func (*QueryAdaptor) AddSQLQueryPrepareFunc ¶ added in v1.2206.0
func (q *QueryAdaptor) AddSQLQueryPrepareFunc(f SQLQueryPrepareFunc)
func (*QueryAdaptor) GeneratePlugin ¶ added in v1.2206.0
func (q *QueryAdaptor) GeneratePlugin() goPlugin.Plugin
type SQLQueryFunc ¶ added in v1.2206.0
type SQLQueryPrepareFunc ¶ added in v1.2206.0
type SQLQueryPrepareFunc func(ctx context.Context, sql string, conf *driver.QueryPrepareConf, dbConf DbConf) (*driver.QueryPrepareResult, error)
Click to show internal directories.
Click to hide internal directories.