From f1cce3e1231751871789bb7671460d92a8342093 Mon Sep 17 00:00:00 2001 From: c9s Date: Wed, 8 Jun 2022 17:33:52 +0800 Subject: [PATCH] clean up --- pkg/service/deposit.go | 7 ------- pkg/service/deposit_test.go | 38 ------------------------------------- 2 files changed, 45 deletions(-) diff --git a/pkg/service/deposit.go b/pkg/service/deposit.go index ae7dff464..07ad21838 100644 --- a/pkg/service/deposit.go +++ b/pkg/service/deposit.go @@ -94,13 +94,6 @@ func (s *DepositService) scanRows(rows *sqlx.Rows) (deposits []types.Deposit, er return deposits, rows.Err() } -func (s *DepositService) Insert(deposit types.Deposit) error { - sql := `INSERT INTO deposits (exchange, asset, address, amount, txn_id, time) - VALUES (:exchange, :asset, :address, :amount, :txn_id, :time)` - _, err := s.DB.NamedExec(sql, deposit) - return err -} - func SelectLastDeposits(ex types.ExchangeName, limit uint64) sq.SelectBuilder { return sq.Select("*"). From("deposits"). diff --git a/pkg/service/deposit_test.go b/pkg/service/deposit_test.go index d3d60114f..6d43c3366 100644 --- a/pkg/service/deposit_test.go +++ b/pkg/service/deposit_test.go @@ -1,39 +1 @@ package service - -import ( - "testing" - "time" - - "github.com/jmoiron/sqlx" - "github.com/stretchr/testify/assert" - - "github.com/c9s/bbgo/pkg/types" - "github.com/c9s/bbgo/pkg/fixedpoint" -) - -func TestDepositService(t *testing.T) { - db, err := prepareDB(t) - if err != nil { - t.Fatal(err) - } - - defer db.Close() - - xdb := sqlx.NewDb(db.DB, "sqlite3") - service := &DepositService{DB: xdb} - - err = service.Insert(types.Deposit{ - Exchange: types.ExchangeMax, - Time: types.Time(time.Now()), - Amount: fixedpoint.NewFromFloat(0.001), - Asset: "BTC", - Address: "test", - TransactionID: "02", - Status: types.DepositSuccess, - }) - assert.NoError(t, err) - - deposits, err := service.Query(types.ExchangeMax) - assert.NoError(t, err) - assert.NotEmpty(t, deposits) -}