Documentation ¶
Index ¶
- Variables
- func AlterUserConnectionLimit(d sqlx.DBExecutor, usename string, lmt int) error
- func CreateUserIfNotExists(d sqlx.DBExecutor, usename, passwd string) (error, bool)
- func CurrentUser(d sqlx.DBExecutor) (string, error)
- func DropUser(d sqlx.DBExecutor, usename string) error
- func GrantAllPrivileges(d sqlx.DBExecutor, on PrivilegeDomain, onName, usename string) error
- func InterpolateParams(query string, args []driver.NamedValue, loc *time.Location) (string, error)
- type ColumnSchema
- type Connector
- func (c *Connector) AddColumn(col *builder.Column) builder.SqlExpr
- func (c *Connector) AddIndex(key *builder.Key) builder.SqlExpr
- func (c *Connector) Connect(ctx context.Context) (driver.Conn, error)
- func (c *Connector) CreateDatabase(dbName string) builder.SqlExpr
- func (c *Connector) CreateSchema(schema string) builder.SqlExpr
- func (c *Connector) CreateTableIsNotExists(t *builder.Table) (exprs []builder.SqlExpr)
- func (c *Connector) DataType(columnType *builder.ColumnType) builder.SqlExpr
- func (Connector) Driver() driver.Driver
- func (Connector) DriverName() string
- func (c *Connector) DropColumn(col *builder.Column) builder.SqlExpr
- func (c *Connector) DropDatabase(dbName string) builder.SqlExpr
- func (c *Connector) DropIndex(key *builder.Key) builder.SqlExpr
- func (c *Connector) DropTable(t *builder.Table) builder.SqlExpr
- func (Connector) IsErrorConflict(err error) bool
- func (Connector) IsErrorUnknownDatabase(err error) bool
- func (c *Connector) Migrate(ctx context.Context, db sqlx.DBExecutor) error
- func (c *Connector) ModifyColumn(col *builder.Column, prev *builder.Column) builder.SqlExpr
- func (Connector) PrimaryKeyName() string
- func (c *Connector) RenameColumn(col *builder.Column, target *builder.Column) builder.SqlExpr
- func (c *Connector) TruncateTable(t *builder.Table) builder.SqlExpr
- func (c Connector) WithDBName(name string) driver.Connector
- type Driver
- type IndexSchema
- type LoggingConn
- func (c *LoggingConn) BeginTx(ctx context.Context, opts driver.TxOptions) (driver.Tx, error)
- func (c *LoggingConn) ExecContext(ctx context.Context, query string, args []driver.NamedValue) (res driver.Result, err error)
- func (c *LoggingConn) Prepare(string) (driver.Stmt, error)
- func (c *LoggingConn) QueryContext(ctx context.Context, query string, args []driver.NamedValue) (rows driver.Rows, err error)
- type LoggingTx
- type Opts
- type PrivilegeDomain
- type SqlPrinter
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrDropCurrentUser = errors.New("cannot drop current user")
)
View Source
var SchemaDB = sqlx.NewDatabase("INFORMATION_SCHEMA")
Functions ¶
func AlterUserConnectionLimit ¶ added in v1.2.2
func AlterUserConnectionLimit(d sqlx.DBExecutor, usename string, lmt int) error
func CreateUserIfNotExists ¶ added in v1.2.2
func CreateUserIfNotExists(d sqlx.DBExecutor, usename, passwd string) (error, bool)
func CurrentUser ¶ added in v1.2.2
func CurrentUser(d sqlx.DBExecutor) (string, error)
func GrantAllPrivileges ¶ added in v1.2.2
func GrantAllPrivileges(d sqlx.DBExecutor, on PrivilegeDomain, onName, usename string) error
func InterpolateParams ¶
Types ¶
type ColumnSchema ¶
type ColumnSchema struct { TABLE_SCHEMA string `db:"table_schema"` TABLE_NAME string `db:"table_name"` COLUMN_NAME string `db:"column_name"` DATA_TYPE string `db:"data_type"` IS_NULLABLE string `db:"is_nullable"` COLUMN_DEFAULT string `db:"column_default"` CHARACTER_MAXIMUM_LENGTH uint64 `db:"character_maximum_length"` NUMERIC_PRECISION uint64 `db:"numeric_precision"` NUMERIC_SCALE uint64 `db:"numeric_scale"` }
func (ColumnSchema) TableName ¶
func (ColumnSchema) TableName() string
type Connector ¶
type Connector struct { Host string DBName string MustSchema string Extra string Extensions []string }
func (*Connector) CreateDatabase ¶
func (*Connector) CreateTableIsNotExists ¶
func (*Connector) DataType ¶
func (c *Connector) DataType(columnType *builder.ColumnType) builder.SqlExpr
func (Connector) DriverName ¶
func (Connector) IsErrorConflict ¶
func (Connector) IsErrorUnknownDatabase ¶
func (*Connector) ModifyColumn ¶
func (Connector) PrimaryKeyName ¶
func (*Connector) RenameColumn ¶
func (*Connector) TruncateTable ¶
type IndexSchema ¶
type IndexSchema struct { TABLE_SCHEMA string `db:"schemaname"` TABLE_NAME string `db:"tablename"` INDEX_NAME string `db:"indexname"` INDEX_DEF string `db:"indexdef"` }
func (IndexSchema) TableName ¶
func (IndexSchema) TableName() string
type LoggingConn ¶
func (*LoggingConn) ExecContext ¶
func (c *LoggingConn) ExecContext(ctx context.Context, query string, args []driver.NamedValue) (res driver.Result, err error)
func (*LoggingConn) QueryContext ¶
func (c *LoggingConn) QueryContext(ctx context.Context, query string, args []driver.NamedValue) (rows driver.Rows, err error)
type Opts ¶
func ParseOption ¶
type PrivilegeDomain ¶ added in v1.2.2
type PrivilegeDomain string
const ( PrivilegeDomainDatabase PrivilegeDomain = "DATABASE" PrivilegeDomainTABLE PrivilegeDomain = "TABLE" )
type SqlPrinter ¶
type SqlPrinter struct {
// contains filtered or unexported fields
}
func (*SqlPrinter) String ¶
func (p *SqlPrinter) String() string
Click to show internal directories.
Click to hide internal directories.