Skip to content

Commit

Permalink
Merge pull request #5 from dewep-online/develop
Browse files Browse the repository at this point in the history
update vendors
  • Loading branch information
markus621 committed Jul 22, 2022
2 parents 8192b4f + 2107467 commit 91f9107
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 19 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/deweppro/go-errors v0.0.4
github.com/deweppro/go-http v1.4.3
github.com/deweppro/go-logger v1.3.0
github.com/deweppro/go-orm v1.0.6
github.com/deweppro/go-orm v1.1.0
github.com/mailru/easyjson v0.7.7
github.com/oschwald/geoip2-golang v1.7.0
gopkg.in/yaml.v3 v3.0.1
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ github.com/deweppro/go-logger v1.3.0 h1:KN6RQmb6IoNBxQ7zx7Y1AtptHeL//FRgvQyEF5Pr
github.com/deweppro/go-logger v1.3.0/go.mod h1:jxBBLyHmIvJ4erGUj5qeE6ir36ztyAL1pI+9GymOHVI=
github.com/deweppro/go-orm v1.0.6 h1:HoM9SniQTI6oJ95EBEW4MX0vWhZPuVj5Qxp6l9B4oVU=
github.com/deweppro/go-orm v1.0.6/go.mod h1:JEbxJLmXMjSOtlwhuJmrJKZRLhcJcexRvGZ6hgautaw=
github.com/deweppro/go-orm v1.1.0 h1:CmW1OU+W6mn0Nk1MdoMf6PWxP12nIK/sXImboIwindw=
github.com/deweppro/go-orm v1.1.0/go.mod h1:JEbxJLmXMjSOtlwhuJmrJKZRLhcJcexRvGZ6hgautaw=
github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE=
github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
Expand Down
16 changes: 8 additions & 8 deletions plugins/database/mysql.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ type ConfigMysql struct {

//List getting all configs
func (v *ConfigMysql) List() (list []schema.ItemInterface) {
for _, item := range v.Pool {
list = append(list, item)
for _, vv := range v.Pool {
list = append(list, vv)
}
return
}
Expand Down Expand Up @@ -71,24 +71,24 @@ type (

//MySQL connection MySQL interface
MySQL interface {
Pool(name string) orm.StmtInterface
Pool(name string) *orm.Stmt
}
)

func (v *mysqlProvider) Up() error {
if err := v.conn.Reconnect(); err != nil {
return err
}
for _, item := range v.conf.Pool {
p, err := v.conn.Pool(item.Name)
for _, vv := range v.conf.Pool {
p, err := v.conn.Pool(vv.Name)
if err != nil {
return fmt.Errorf("pool `%s`: %w", item.Name, err)
return fmt.Errorf("pool `%s`: %w", vv.Name, err)
}
if err = p.Ping(); err != nil {
return fmt.Errorf("pool `%s`: %w", item.Name, err)
return fmt.Errorf("pool `%s`: %w", vv.Name, err)
}
v.log.WithFields(
logger.Fields{item.Name: fmt.Sprintf("%s:%d", item.Host, item.Port)},
logger.Fields{vv.Name: fmt.Sprintf("%s:%d", vv.Host, vv.Port)},
).Infof("MySQL connect")
}
return nil
Expand Down
20 changes: 10 additions & 10 deletions plugins/database/sqlite.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ func (v *ConfigSqlite) Default() {

//List getting all configs
func (v *ConfigSqlite) List() (list []schema.ItemInterface) {
for _, item := range v.Pool {
list = append(list, item)
for _, vv := range v.Pool {
list = append(list, vv)
}
return
}
Expand Down Expand Up @@ -76,26 +76,26 @@ type (

//SQLite connection SQLite interface
SQLite interface {
Pool(name string) orm.StmtInterface
Pool(name string) *orm.Stmt
}
)

func (v *sqliteProvider) Up() error {
if err := v.conn.Reconnect(); err != nil {
return err
}
for _, item := range v.conf.Pool {
p, err := v.conn.Pool(item.Name)
for _, vv := range v.conf.Pool {
p, err := v.conn.Pool(vv.Name)
if err != nil {
return fmt.Errorf("pool `%s`: %w", item.Name, err)
return fmt.Errorf("pool `%s`: %w", vv.Name, err)
}
if err = p.Ping(); err != nil {
return fmt.Errorf("pool `%s`: %w", item.Name, err)
return fmt.Errorf("pool `%s`: %w", vv.Name, err)
}
if err = v.migration(p, item.InitMigration); err != nil {
return fmt.Errorf("pool `%s`: %w", item.Name, err)
if err = v.migration(p, vv.InitMigration); err != nil {
return fmt.Errorf("pool `%s`: %w", vv.Name, err)
}
v.log.WithFields(logger.Fields{item.Name: item.File}).Infof("SQLite connect")
v.log.WithFields(logger.Fields{vv.Name: vv.File}).Infof("SQLite connect")
}
return nil
}
Expand Down
10 changes: 10 additions & 0 deletions plugins/http/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ type (
SetBody(code int) BodyWriter
Context() context.Context
Log() logger.LogWriter
Request() *nethttp.Request
Response() nethttp.ResponseWriter
}
)

Expand All @@ -52,6 +54,14 @@ func newCtx(w nethttp.ResponseWriter, r *nethttp.Request, l logger.Logger) *ctx
}
}

func (v *ctx) Request() *nethttp.Request {
return v.r
}

func (v *ctx) Response() nethttp.ResponseWriter {
return v.w
}

type (
//Paramer interface for typing a parameter from a URL
Paramer interface {
Expand Down

0 comments on commit 91f9107

Please sign in to comment.