Documentation ¶
Index ¶
- type Dao
- func (dao *Dao) Close()
- func (dao *Dao) GetQueryCache(c context.Context, m *model.BtcQuery) ([]*model.BtcResponse, bool)
- func (dao *Dao) InsertCoin(c context.Context, m *model.BtcData) error
- func (dao *Dao) Ping(ctx context.Context) (err error)
- func (dao *Dao) QueryCoin(c context.Context, m *model.BtcQuery) ([][]interface{}, error)
- func (dao *Dao) SetQueryCache(c context.Context, m *model.BtcQuery, v []*model.BtcResponse) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Dao ¶
Dao object
func (*Dao) GetQueryCache ¶
GetQueryCache will try to get result of query in redis if redis is disabled or no result found or an error occurred, the second return value will be false
func (*Dao) InsertCoin ¶
InsertCoin save a new record in db amount and timestamp will be saved in int64, timestamp is additional variable to help query the target data.
func (*Dao) SetQueryCache ¶
SetQueryCache will store the result of query in redis if redis is available Since the result is not real-time sensitive, we can set the expiration time to 5 minutes to reduce the pressure of database.
Click to show internal directories.
Click to hide internal directories.