коммит произвёл
GitHub
родитель
678c7d3b8c
Коммит
9640962428
2
go.mod
2
go.mod
@@ -27,7 +27,7 @@ require (
|
|||||||
github.com/fsnotify/fsnotify v1.5.1
|
github.com/fsnotify/fsnotify v1.5.1
|
||||||
github.com/getsentry/sentry-go v0.12.0
|
github.com/getsentry/sentry-go v0.12.0
|
||||||
github.com/go-asn1-ber/asn1-ber v1.5.3 // indirect
|
github.com/go-asn1-ber/asn1-ber v1.5.3 // indirect
|
||||||
github.com/go-morph/morph v0.2.3-0.20220126093237-74bffc135498
|
github.com/go-morph/morph v0.2.3-0.20220215130848-76392b135ee5
|
||||||
github.com/go-redis/redis/v8 v8.11.4 // indirect
|
github.com/go-redis/redis/v8 v8.11.4 // indirect
|
||||||
github.com/go-resty/resty/v2 v2.7.0 // indirect
|
github.com/go-resty/resty/v2 v2.7.0 // indirect
|
||||||
github.com/go-sql-driver/mysql v1.6.0
|
github.com/go-sql-driver/mysql v1.6.0
|
||||||
|
|||||||
4
go.sum
4
go.sum
@@ -540,8 +540,8 @@ github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG
|
|||||||
github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas=
|
github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas=
|
||||||
github.com/go-logr/logr v0.2.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU=
|
github.com/go-logr/logr v0.2.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU=
|
||||||
github.com/go-martini/martini v0.0.0-20170121215854-22fa46961aab/go.mod h1:/P9AEU963A2AYjv4d1V5eVL1CQbEJq6aCNHDDjibzu8=
|
github.com/go-martini/martini v0.0.0-20170121215854-22fa46961aab/go.mod h1:/P9AEU963A2AYjv4d1V5eVL1CQbEJq6aCNHDDjibzu8=
|
||||||
github.com/go-morph/morph v0.2.3-0.20220126093237-74bffc135498 h1:DTTRQXU9VOPKjn8iN67Gt6htfiIGyUYoF+0ndDzDbAo=
|
github.com/go-morph/morph v0.2.3-0.20220215130848-76392b135ee5 h1:yEZQApe5XfUURfPJW4AB1WgHbmK67d3B1ag44gmycYg=
|
||||||
github.com/go-morph/morph v0.2.3-0.20220126093237-74bffc135498/go.mod h1:XQh5WcM351wOV3z3zEWRM8RaJ65E2p4P7WWbmFAi8x4=
|
github.com/go-morph/morph v0.2.3-0.20220215130848-76392b135ee5/go.mod h1:XQh5WcM351wOV3z3zEWRM8RaJ65E2p4P7WWbmFAi8x4=
|
||||||
github.com/go-openapi/jsonpointer v0.19.2/go.mod h1:3akKfEdA7DF1sugOqz1dVQHBcuDBPKZGEoHC/NkiQRg=
|
github.com/go-openapi/jsonpointer v0.19.2/go.mod h1:3akKfEdA7DF1sugOqz1dVQHBcuDBPKZGEoHC/NkiQRg=
|
||||||
github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg=
|
github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg=
|
||||||
github.com/go-openapi/jsonreference v0.19.2/go.mod h1:jMjeRr2HHw6nAVajTXJ4eiUwohSTlpa0o73RUL1owJc=
|
github.com/go-openapi/jsonreference v0.19.2/go.mod h1:jMjeRr2HHw6nAVajTXJ4eiUwohSTlpa0o73RUL1owJc=
|
||||||
|
|||||||
18
vendor/github.com/go-morph/morph/color_logger.go
сгенерированный
поставляемый
18
vendor/github.com/go-morph/morph/color_logger.go
сгенерированный
поставляемый
@@ -1,6 +1,8 @@
|
|||||||
package morph
|
package morph
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"log"
|
||||||
|
|
||||||
"github.com/fatih/color"
|
"github.com/fatih/color"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -16,3 +18,19 @@ type Logger interface {
|
|||||||
Printf(format string, v ...interface{})
|
Printf(format string, v ...interface{})
|
||||||
Println(v ...interface{})
|
Println(v ...interface{})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type colorLogger struct {
|
||||||
|
log *log.Logger
|
||||||
|
}
|
||||||
|
|
||||||
|
func newColorLogger(log *log.Logger) *colorLogger {
|
||||||
|
return &colorLogger{log: log}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l *colorLogger) Printf(format string, v ...interface{}) {
|
||||||
|
l.log.Println(InfoLoggerLight.Sprintf(format, v...))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l *colorLogger) Println(v ...interface{}) {
|
||||||
|
l.log.Println(InfoLoggerLight.Sprint(v...))
|
||||||
|
}
|
||||||
|
|||||||
12
vendor/github.com/go-morph/morph/morph.go
сгенерированный
поставляемый
12
vendor/github.com/go-morph/morph/morph.go
сгенерированный
поставляемый
@@ -42,7 +42,7 @@ type Config struct {
|
|||||||
|
|
||||||
type EngineOption func(*Morph)
|
type EngineOption func(*Morph)
|
||||||
|
|
||||||
func WithLogger(logger *log.Logger) EngineOption {
|
func WithLogger(logger Logger) EngineOption {
|
||||||
return func(m *Morph) {
|
return func(m *Morph) {
|
||||||
m.config.Logger = logger
|
m.config.Logger = logger
|
||||||
}
|
}
|
||||||
@@ -80,7 +80,7 @@ func WithLock(key string) EngineOption {
|
|||||||
func New(ctx context.Context, driver drivers.Driver, source sources.Source, options ...EngineOption) (*Morph, error) {
|
func New(ctx context.Context, driver drivers.Driver, source sources.Source, options ...EngineOption) (*Morph, error) {
|
||||||
engine := &Morph{
|
engine := &Morph{
|
||||||
config: &Config{
|
config: &Config{
|
||||||
Logger: log.New(os.Stderr, "", log.LstdFlags), // add default logger
|
Logger: newColorLogger(log.New(os.Stderr, "", log.LstdFlags)), // add default logger
|
||||||
},
|
},
|
||||||
source: source,
|
source: source,
|
||||||
driver: driver,
|
driver: driver,
|
||||||
@@ -164,14 +164,14 @@ func (m *Morph) Apply(limit int) (int, error) {
|
|||||||
for i := 0; i < steps; i++ {
|
for i := 0; i < steps; i++ {
|
||||||
start := time.Now()
|
start := time.Now()
|
||||||
migrationName := migrations[i].Name
|
migrationName := migrations[i].Name
|
||||||
m.config.Logger.Println(InfoLoggerLight.Sprint(formatProgress(fmt.Sprintf(migrationProgressStart, migrationName))))
|
m.config.Logger.Println(formatProgress(fmt.Sprintf(migrationProgressStart, migrationName)))
|
||||||
if err := m.driver.Apply(migrations[i], true); err != nil {
|
if err := m.driver.Apply(migrations[i], true); err != nil {
|
||||||
return applied, err
|
return applied, err
|
||||||
}
|
}
|
||||||
|
|
||||||
applied++
|
applied++
|
||||||
elapsed := time.Since(start)
|
elapsed := time.Since(start)
|
||||||
m.config.Logger.Println(InfoLoggerLight.Sprint(formatProgress(fmt.Sprintf(migrationProgressFinished, migrationName, fmt.Sprintf("%.4fs", elapsed.Seconds())))))
|
m.config.Logger.Println(formatProgress(fmt.Sprintf(migrationProgressFinished, migrationName, fmt.Sprintf("%.4fs", elapsed.Seconds()))))
|
||||||
}
|
}
|
||||||
|
|
||||||
return applied, nil
|
return applied, nil
|
||||||
@@ -204,7 +204,7 @@ func (m *Morph) ApplyDown(limit int) (int, error) {
|
|||||||
for i := 0; i < steps; i++ {
|
for i := 0; i < steps; i++ {
|
||||||
start := time.Now()
|
start := time.Now()
|
||||||
migrationName := sortedMigrations[i].Name
|
migrationName := sortedMigrations[i].Name
|
||||||
m.config.Logger.Println(InfoLoggerLight.Sprint(formatProgress(fmt.Sprintf(migrationProgressStart, migrationName))))
|
m.config.Logger.Println(formatProgress(fmt.Sprintf(migrationProgressStart, migrationName)))
|
||||||
|
|
||||||
down := downMigrations[migrationName]
|
down := downMigrations[migrationName]
|
||||||
if err := m.driver.Apply(down, true); err != nil {
|
if err := m.driver.Apply(down, true); err != nil {
|
||||||
@@ -213,7 +213,7 @@ func (m *Morph) ApplyDown(limit int) (int, error) {
|
|||||||
|
|
||||||
applied++
|
applied++
|
||||||
elapsed := time.Since(start)
|
elapsed := time.Since(start)
|
||||||
m.config.Logger.Println(InfoLoggerLight.Sprint(formatProgress(fmt.Sprintf(migrationProgressFinished, migrationName, fmt.Sprintf("%.4fs", elapsed.Seconds())))))
|
m.config.Logger.Println(formatProgress(fmt.Sprintf(migrationProgressFinished, migrationName, fmt.Sprintf("%.4fs", elapsed.Seconds()))))
|
||||||
}
|
}
|
||||||
|
|
||||||
return applied, nil
|
return applied, nil
|
||||||
|
|||||||
2
vendor/modules.txt
поставляемый
2
vendor/modules.txt
поставляемый
@@ -215,7 +215,7 @@ github.com/gigawattio/window
|
|||||||
# github.com/go-asn1-ber/asn1-ber v1.5.3
|
# github.com/go-asn1-ber/asn1-ber v1.5.3
|
||||||
## explicit
|
## explicit
|
||||||
github.com/go-asn1-ber/asn1-ber
|
github.com/go-asn1-ber/asn1-ber
|
||||||
# github.com/go-morph/morph v0.2.3-0.20220126093237-74bffc135498
|
# github.com/go-morph/morph v0.2.3-0.20220215130848-76392b135ee5
|
||||||
## explicit
|
## explicit
|
||||||
github.com/go-morph/morph
|
github.com/go-morph/morph
|
||||||
github.com/go-morph/morph/drivers
|
github.com/go-morph/morph/drivers
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user