All code formatted with gofmt
This commit is contained in:
@@ -4,35 +4,35 @@
|
||||
package appcontext
|
||||
|
||||
import (
|
||||
// 3rd-party
|
||||
"github.com/jmoiron/sqlx"
|
||||
// 3rd-party
|
||||
"github.com/go-telegram-bot-api/telegram-bot-api"
|
||||
// local
|
||||
"../config"
|
||||
"../connections"
|
||||
"github.com/jmoiron/sqlx"
|
||||
// local
|
||||
"../config"
|
||||
"../connections"
|
||||
// interfaces
|
||||
"../getters/gettersinterface"
|
||||
"../migrations/migrationsinterface"
|
||||
"../parsers/parsersinterface"
|
||||
"../router/routerinterface"
|
||||
"../talkers/talkersinterface"
|
||||
"../getters/gettersinterface"
|
||||
"../migrations/migrationsinterface"
|
||||
"../parsers/parsersinterface"
|
||||
"../router/routerinterface"
|
||||
"../talkers/talkersinterface"
|
||||
)
|
||||
|
||||
type Context struct {
|
||||
Cfg *config.Config
|
||||
Bot *tgbotapi.BotAPI
|
||||
Migrations migrationsinterface.MigrationsInterface
|
||||
Router routerinterface.RouterInterface
|
||||
Parsers parsersinterface.ParsersInterface
|
||||
Db *sqlx.DB
|
||||
Talkers talkersinterface.TalkersInterface
|
||||
Getters gettersinterface.GettersInterface
|
||||
Cfg *config.Config
|
||||
Bot *tgbotapi.BotAPI
|
||||
Migrations migrationsinterface.MigrationsInterface
|
||||
Router routerinterface.RouterInterface
|
||||
Parsers parsersinterface.ParsersInterface
|
||||
Db *sqlx.DB
|
||||
Talkers talkersinterface.TalkersInterface
|
||||
Getters gettersinterface.GettersInterface
|
||||
}
|
||||
|
||||
func (c *Context) Init() {
|
||||
c.Cfg = config.New()
|
||||
c.Cfg.Init()
|
||||
c.Bot = connections.BotInit(c.Cfg)
|
||||
c.Cfg = config.New()
|
||||
c.Cfg.Init()
|
||||
c.Bot = connections.BotInit(c.Cfg)
|
||||
c.Db = connections.DBInit(c.Cfg)
|
||||
}
|
||||
|
||||
@@ -42,23 +42,23 @@ func (c *Context) RegisterRouterInterface(ri routerinterface.RouterInterface) {
|
||||
}
|
||||
|
||||
func (c *Context) RegisterMigrationsInterface(mi migrationsinterface.MigrationsInterface) {
|
||||
c.Migrations = mi
|
||||
c.Migrations.Init()
|
||||
c.Migrations = mi
|
||||
c.Migrations.Init()
|
||||
}
|
||||
|
||||
func (c *Context) RegisterParsersInterface(pi parsersinterface.ParsersInterface) {
|
||||
c.Parsers = pi
|
||||
c.Parsers = pi
|
||||
}
|
||||
|
||||
func (c *Context) RegisterTalkersInterface(ti talkersinterface.TalkersInterface) {
|
||||
c.Talkers = ti
|
||||
c.Talkers = ti
|
||||
}
|
||||
|
||||
func (c *Context) RegisterGettersInterface(gi gettersinterface.GettersInterface) {
|
||||
c.Getters = gi
|
||||
c.Getters = gi
|
||||
}
|
||||
|
||||
func (c *Context) RunDatabaseMigrations() {
|
||||
c.Migrations.SetDialect("mysql")
|
||||
c.Migrations.Migrate()
|
||||
c.Migrations.SetDialect("mysql")
|
||||
c.Migrations.Migrate()
|
||||
}
|
||||
|
@@ -4,10 +4,10 @@
|
||||
package appcontext
|
||||
|
||||
var (
|
||||
a *Context
|
||||
a *Context
|
||||
)
|
||||
|
||||
func New() *Context {
|
||||
c := &Context{}
|
||||
return c
|
||||
c := &Context{}
|
||||
return c
|
||||
}
|
||||
|
Reference in New Issue
Block a user