Documentation ¶
Index ¶
- Constants
- Variables
- func Dump() error
- func MySQL5Backtick(col string) string
- func MySQL5BacktickUser(user string) string
- func MySQL5Escape(val string) string
- func MySQL5JoinColumns(cols []string) string
- func MySQL5JoinValues(vals []string) string
- func MySQL5Quote(val string) string
- func ParseFlags() (*ConnectionArgs, *DumpArgs, error)
- type Column
- type ColumnMap
- type ConnectionArgs
- type Constraint
- type Database
- type DumpArgs
- type Dumper
- type Field
- type MySQL5Database
- func (db *MySQL5Database) CharSet() string
- func (db *MySQL5Database) Collation() string
- func (db *MySQL5Database) CreateSQL() (string, error)
- func (db *MySQL5Database) Name() string
- func (db *MySQL5Database) Routines() (routines RoutineGraph, err error)
- func (db *MySQL5Database) Server() *Server
- func (db *MySQL5Database) SetCreateSQL(sql string)
- func (db *MySQL5Database) SetName(name string)
- func (db *MySQL5Database) Tables() (tables TableGraph, err error)
- func (db *MySQL5Database) Views() (views ViewGraph, err error)
- type MySQL5Dumper
- type MySQL5DumperTemplateValues
- type MySQL5PreparedStatements
- type Routine
- type RoutineGraph
- type Row
- type Rows
- type Server
- type Table
- type TableGraph
- type Trigger
- type TriggerGraph
- type View
- type ViewGraph
Constants ¶
const ( Name = "DBSample" Version = "0.1" )
const (
DriverMySQL = "mysql"
)
const MySQL5DumperTemplatesPath = "./templates/mysql"
Variables ¶
var Filters = filters.NewFilterController()
var IsDebugBuild = false
var IsDebugging = false
Functions ¶
func MySQL5Escape ¶
MySQL5Escape... @see https://dev.mysql.com/doc/refman/5.7/en/string-literals.html
func ParseFlags ¶
func ParseFlags() (*ConnectionArgs, *DumpArgs, error)
ParseFlags parses the command line flags.
Types ¶
type Column ¶
type Column struct { Name string OrdinalPosition int Type string CharacterMaximumLength int64 DataType string }
Column...
type ConnectionArgs ¶
type ConnectionArgs struct { Driver string Name string Host string Port string User string Pass string Protocol string }
ConnectionArgs...
type Constraint ¶
Constraint...
type Database ¶
type Database interface { Name() string SetName(string) CharSet() string Collation() string CreateSQL() (string, error) SetCreateSQL(string) Tables() (TableGraph, error) Views() (ViewGraph, error) Routines() (RoutineGraph, error) Server() *Server }
Database queries a database.
type DumpArgs ¶
type DumpArgs struct { Limit int Routines bool Triggers bool RenameDatabase string NoCreateDatabase bool SkipLockTables bool SkipAddDropTable bool ExtendedInsert bool Filters []string Constraints map[string][]*Constraint }
DumpArgs...
type MySQL5Database ¶
type MySQL5Database struct {
// contains filtered or unexported fields
}
MySQL5Database implements Database for MySQL5.
func NewMySQL5Database ¶
func NewMySQL5Database(server *Server, name, charSet, collation string) *MySQL5Database
NewMySQL5Database returns a new *MySQL5Database instance.
func (*MySQL5Database) CreateSQL ¶
func (db *MySQL5Database) CreateSQL() (string, error)
CreateSQL...
func (*MySQL5Database) Routines ¶
func (db *MySQL5Database) Routines() (routines RoutineGraph, err error)
Routines...
func (*MySQL5Database) SetCreateSQL ¶
func (db *MySQL5Database) SetCreateSQL(sql string)
SetCreateSQL...
func (*MySQL5Database) Tables ¶
func (db *MySQL5Database) Tables() (tables TableGraph, err error)
Tables...
func (*MySQL5Database) Views ¶
func (db *MySQL5Database) Views() (views ViewGraph, err error)
Views...
type MySQL5Dumper ¶
type MySQL5Dumper struct {
// contains filtered or unexported fields
}
MySQL5Dumper...
func NewMySQL5Dumper ¶
func NewMySQL5Dumper(args *DumpArgs) *MySQL5Dumper
NewMySQL5Dumper returns a new *MySQL5Dumper instance.
type MySQL5DumperTemplateValues ¶
type MySQL5DumperTemplateValues struct { ShouldDumpDatabase bool ShouldDumpTables bool ShouldDumpViews bool ShouldDumpRoutines bool ShouldDumpTriggers bool Debug bool AppName string AppVersion string DumpDate string DumpDuration string CharSet string Collation string OriginalDatabaseName string Database Database Args *DumpArgs Connection *ConnectionArgs Server *Server Tables TableGraph Views ViewGraph Routines RoutineGraph }
MySQL5DumperTemplateValues...
type MySQL5PreparedStatements ¶
type MySQL5PreparedStatements struct {
// contains filtered or unexported fields
}
MySQL5PreparedStatements...
func NewMySQL5PreparedStatements ¶
func NewMySQL5PreparedStatements(db *gosql.DB) *MySQL5PreparedStatements
NewMySQL5PreparedStatements returns a new *MySQL5PreparedStatements instance.
func (*MySQL5PreparedStatements) Err ¶
func (p *MySQL5PreparedStatements) Err() error
Err returns the last error.
func (*MySQL5PreparedStatements) Prepare ¶
func (p *MySQL5PreparedStatements) Prepare(name, sql string) error
Prepare...
type Routine ¶
type Routine struct { Name string Type string CreateSQL string SecurityType string Definer string ParamList string Returns string IsDeterministic string SQLMode string CharSet string Collation string }
Routine...
type RoutineGraph ¶
type RoutineGraph []*Routine
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server...
func NewServer ¶
func NewServer(conn *ConnectionArgs, args *DumpArgs) *Server
NewServer returns a new *Server instance.
type Table ¶
type Table struct { Name string CreateSQL string CharSet string Collation string DebugMsgs []string Columns ColumnMap Constraints []*Constraint Triggers TriggerGraph Rows Rows }
Table stores the details of a single database table.
func (*Table) AppendDebugMsg ¶
AppendDebugMsg appends a message to the debug messages.
type TableGraph ¶
type TableGraph []*Table
type Trigger ¶
type Trigger struct { Name string CreateSQL string ActionTiming string EventManipulation string EventObjectTable string ActionOrientation string Definer string SQLMode string CharSet string Collation string }
Trigger...
type TriggerGraph ¶
type TriggerGraph []*Trigger