assetservice

package
v0.0.0-...-c477d60 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2019 License: GPL-3.0 Imports: 15 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Service

type Service struct {
	*dbservice.DB
}

Service defines asset service type

func NewService

func NewService(db *dbservice.DB) *Service

NewService factory for Service

func (*Service) Create

func (db *Service) Create(
	sc datatype.ServiceContainer,
	userID datatype.ID,
	name string,
	symbol string,
	description string,
	isSensor bool,
	ethereumAddress string,
	ethereumTransactionAddress string,
) (*datatype.Asset, error)

Create insert asset

func (*Service) CreateAssetBlock

func (db *Service) CreateAssetBlock(
	userID datatype.ID,
	assetID datatype.ID,
	blockText string,
	images []string,
) (*datatype.Block, error)

CreateAssetBlock insert asset block

func (*Service) DepositBalance

func (db *Service) DepositBalance(
	userID datatype.ID,
	assetID datatype.ID,
	amount decimaldt.Decimal,
) error

DepositBalance cache user balance in the SQL db

func (*Service) DidUserLikeBlock

func (db *Service) DidUserLikeBlock(userID datatype.ID, blockID datatype.ID) bool

DidUserLikeBlock checks whether user liked a block or not

func (*Service) FindAll

func (db *Service) FindAll(user *datatype.User) ([]datatype.Asset, error)

FindAll finds all assets

func (*Service) FindByID

func (db *Service) FindByID(id datatype.ID) (*datatype.Asset, error)

FindByID finds Asset by ID

func (*Service) FindByName

func (db *Service) FindByName(name string) (*datatype.Asset, error)

FindByName find asset by name

func (*Service) FindBySymbol

func (db *Service) FindBySymbol(symbol string) (*datatype.Asset, error)

FindBySymbol find asset by symbol

func (*Service) FindUserBalance

func (db *Service) FindUserBalance(
	userID datatype.ID,
	assetID datatype.ID,
) (
	decimaldt.Decimal,
	decimaldt.Decimal,
	error,
)

FindUserBalance finds user's balance of given asset

func (*Service) FindUserFavoriteAssets

func (db *Service) FindUserFavoriteAssets(user *datatype.User) ([]datatype.Asset, error)

FindUserFavoriteAssets finds all user's favored assits

func (*Service) GetAssetBlockImages

func (db *Service) GetAssetBlockImages(
	blockID datatype.ID,
) ([]string, error)

GetAssetBlockImages finds block images

func (*Service) GetAssetBlocks

func (db *Service) GetAssetBlocks(
	assetID datatype.ID,
) ([]datatype.Block, error)

GetAssetBlocks finds all user's favored assits

func (*Service) GetAssetMiners

func (db *Service) GetAssetMiners(
	assetID datatype.ID,
) ([]datatype.Miner, error)

GetAssetMiners finds all user's favored assits

func (*Service) IsMiner

func (db *Service) IsMiner(userID datatype.ID, assetID datatype.ID) bool

IsMiner checks whether a user is a miner of a token or not

func (*Service) IsOracle

func (db *Service) IsOracle(userID datatype.ID, assetID datatype.ID) bool

IsOracle checks whether email is already registered or not

func (*Service) SensorVerifyBlock

func (db *Service) SensorVerifyBlock(
	sc *datatype.ServiceContainer,
	status int,
	accessToken string,
) error

SensorVerifyBlock sensor claim verification

func (*Service) ToggleFavorite

func (db *Service) ToggleFavorite(user *datatype.User, assetID datatype.ID) error

ToggleFavorite toggles asset as fav/not fav

func (*Service) ToggleFavoriteBlock

func (db *Service) ToggleFavoriteBlock(user *datatype.User, blockID datatype.ID) error

ToggleFavoriteBlock toggles asset block as fav/not fav

func (*Service) UpdateOraclePingTime

func (db *Service) UpdateOraclePingTime(accessToken string) error

UpdateOraclePingTime updates last ping from oracle

func (*Service) ValidateAsset

func (db *Service) ValidateAsset(
	name string,
	symbol string,
	description string,
) error

ValidateAsset checks whether a user is a miner of a token or not

func (*Service) VerifyAssetBlock

func (db *Service) VerifyAssetBlock(
	sc *datatype.ServiceContainer,
	user *datatype.User,
	blockID datatype.ID,
	status int,
) error

VerifyAssetBlock insert asset block

Jump to

Keyboard shortcuts

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