Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Adaptor ¶
type Adaptor struct {
// contains filtered or unexported fields
}
Adaptor is a wrapper for the sqle driver layer. It provides a more simpler interface for the database plugin.
func NewAdaptor ¶
NewAdaptor create a database plugin Adaptor with dialector.
func (*Adaptor) AddAdditionalParams ¶ added in v1.2203.0
func (*Adaptor) AddRuleWithSQLParser ¶
func (*Adaptor) Serve ¶
func (a *Adaptor) Serve(opts ...AdaptorOption)
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 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 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
Click to show internal directories.
Click to hide internal directories.