postgresql & migrations
This commit is contained in:
parent
ae096d4820
commit
7f6cd8e557
15 changed files with 254 additions and 27 deletions
|
|
@ -2,27 +2,26 @@ package main
|
|||
|
||||
import (
|
||||
"context"
|
||||
"crypto_alert_bot/internal/config"
|
||||
"crypto_alert_bot/internal/entities"
|
||||
"crypto_alert_bot/internal/logger"
|
||||
"crypto_alert_bot/internal/provider/bybit"
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"gitea.computernetthings.ru/yash/crypto_alert_bot/internal/config"
|
||||
"gitea.computernetthings.ru/yash/crypto_alert_bot/internal/logger"
|
||||
"gitea.computernetthings.ru/yash/crypto_alert_bot/internal/repository/postgresql"
|
||||
)
|
||||
|
||||
func main() {
|
||||
ctx := context.Background()
|
||||
// read config
|
||||
cfg := config.MustLoad()
|
||||
// init logger
|
||||
log := logger.NewAppLogger(&cfg.Logger)
|
||||
log.Info("app started")
|
||||
// init telegram bot
|
||||
b := bybit.New(log, &cfg.Providers.Bybit)
|
||||
price, err := b.Price(context.Background(), entities.Pair{
|
||||
BaseCurrency: "BTC",
|
||||
QuoteCurrency: "USDT",
|
||||
})
|
||||
// init storage
|
||||
storage, err := postgresql.New(ctx, log, &cfg.Postgresql)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
log.Error("failed to connect to postgresql", "err", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
fmt.Printf("%+v\n", price)
|
||||
_ = storage
|
||||
// init telegram bot
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue