mirror of https://github.com/pressly/goose.git
Use VerboseMode as boolean + Display block comments
parent
7b7eaf1c29
commit
b935f725d3
18
goose.go
18
goose.go
|
@ -8,14 +8,14 @@ import (
|
|||
"sync"
|
||||
)
|
||||
|
||||
// VerboseLevel verbose level of the goose library
|
||||
type VerboseLevel int
|
||||
// VerboseMode is the goose verbosity
|
||||
type VerboseMode bool
|
||||
|
||||
const (
|
||||
// VerboseOff disable the log of the executed SQL statements
|
||||
VerboseOff VerboseLevel = iota + 1
|
||||
// VerboseOn log the executed SQL statements
|
||||
VerboseOn
|
||||
// VerboseOn is the goose verbose mode
|
||||
VerboseOn VerboseMode = true
|
||||
// VerboseOff is the goose silent mode
|
||||
VerboseOff VerboseMode = false
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -24,11 +24,11 @@ var (
|
|||
maxVersion = int64((1 << 63) - 1)
|
||||
timestampFormat = "20060102150405"
|
||||
verbose = VerboseOff
|
||||
reMatchSQLComments = regexp.MustCompile(`(--.*)|(((\/\*)+?[\w\W]+?(\*\/)+))`)
|
||||
reMatchSQLComments = regexp.MustCompile(`(--.*)`)
|
||||
)
|
||||
|
||||
// SetVerbosity defines the goose verbose level
|
||||
func SetVerbosity(vl VerboseLevel) {
|
||||
// SetVerbosity defines the goose verbosity
|
||||
func SetVerbosity(vl VerboseMode) {
|
||||
verbose = vl
|
||||
}
|
||||
|
||||
|
|
|
@ -202,7 +202,7 @@ func runSQLMigration(db *sql.DB, scriptFile string, v int64, direction bool) err
|
|||
}
|
||||
|
||||
func printInfo(s string, args ...interface{}) {
|
||||
if verbose == VerboseOn {
|
||||
if verbose {
|
||||
log.Printf(s, args...)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue