storage

package
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 17, 2018 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InfluxStorage

type InfluxStorage struct {
	// contains filtered or unexported fields
}

InfluxStorage represent a client to store trade data to influx DB

func NewInfluxStorage

func NewInfluxStorage(sugar *zap.SugaredLogger, dbName string, influxClient client.Client) (*InfluxStorage, error)

NewInfluxStorage init an instance of InfluxStorage

func (*InfluxStorage) IsExceedDailyLimit

func (inf *InfluxStorage) IsExceedDailyLimit(address string, dailyLimit float64) (bool, error)

IsExceedDailyLimit return if add address trade over daily limit or not

type Interface

type Interface interface {
	CreateOrUpdate(common.UserData) error
	IsKYCed(string) (bool, error)
}

Interface is the common interface of users persistent storage.

type UserDB

type UserDB struct {
	// contains filtered or unexported fields
}

UserDB is storage of user data

func NewDB

func NewDB(sugar *zap.SugaredLogger, db *sqlx.DB) (*UserDB, error)

NewDB open a new database connection

func (*UserDB) Close

func (udb *UserDB) Close() error

Close close db connection and return error if any

func (*UserDB) CreateOrUpdate

func (udb *UserDB) CreateOrUpdate(userData common.UserData) error

CreateOrUpdate store user info to persist in database

func (*UserDB) DeleteAllTables

func (udb *UserDB) DeleteAllTables() error

DeleteAllTables delete all table from schema using for test only

func (*UserDB) IsKYCed

func (udb *UserDB) IsKYCed(address string) (bool, error)

IsKYCed returns true when given address is found in database, means that user is already KYCed.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL