tacitus: some refactoring
This commit is contained in:
parent
f227f7f79b
commit
7f7ce5013d
8
database_client.go
Normal file
8
database_client.go
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
package tacitus
|
||||||
|
|
||||||
|
type DatabaseClientService interface {
|
||||||
|
Open() error
|
||||||
|
Close() error
|
||||||
|
TradeService() TradeService
|
||||||
|
SetLogger(logger Logger)
|
||||||
|
}
|
@ -2,9 +2,11 @@ package tacitus
|
|||||||
|
|
||||||
type ListenerService interface {
|
type ListenerService interface {
|
||||||
Open() error
|
Open() error
|
||||||
Close()
|
Close() error
|
||||||
Subscribe(product string)
|
Subscribe(products ...string)
|
||||||
Stream() <-chan Trade
|
Stream() <-chan Trade
|
||||||
Error() <-chan error
|
Error() <-chan error
|
||||||
|
SendErrors() bool
|
||||||
|
SetSendErrors(send bool)
|
||||||
SetLogger(logger Logger)
|
SetLogger(logger Logger)
|
||||||
}
|
}
|
||||||
|
11
trade.go
11
trade.go
@ -21,15 +21,22 @@ type Trade struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type TradeService interface {
|
type TradeService interface {
|
||||||
Trade(id int) (Trade, error)
|
|
||||||
TradeByTradeId(id int, prod string) (Trade, error)
|
|
||||||
CreateTrade(t Trade) (Trade, error)
|
CreateTrade(t Trade) (Trade, error)
|
||||||
DeleteTrade(id int)
|
DeleteTrade(id int)
|
||||||
|
|
||||||
|
Trade(id int) (Trade, error)
|
||||||
|
TradeByTradeId(id int, prod string) (Trade, error)
|
||||||
TradesInDateRange(product string, start, end time.Time) ([]Trade, error)
|
TradesInDateRange(product string, start, end time.Time) ([]Trade, error)
|
||||||
FirstTrades(product string, limit int) ([]Trade, error)
|
FirstTrades(product string, limit int) ([]Trade, error)
|
||||||
LastTrades(product string, limit int) ([]Trade, error)
|
LastTrades(product string, limit int) ([]Trade, error)
|
||||||
TradesAfter(product string, id, limit int) ([]Trade, error)
|
TradesAfter(product string, id, limit int) ([]Trade, error)
|
||||||
TradesBefore(product string, id, limit int) ([]Trade, error)
|
TradesBefore(product string, id, limit int) ([]Trade, error)
|
||||||
|
|
||||||
|
TradesAfterAll(product string, id int) error
|
||||||
|
|
||||||
|
Next() (Trade, error)
|
||||||
|
Done() bool
|
||||||
|
CloseRows() error
|
||||||
}
|
}
|
||||||
|
|
||||||
func ValidProduct(prod string) bool {
|
func ValidProduct(prod string) bool {
|
||||||
|
Reference in New Issue
Block a user