database

package
v0.0.0-...-485d38d Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2017 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

database.go

Index

Constants

This section is empty.

Variables

View Source
var Db *sql.DB

Functions

func CreateSecondaryAddress

func CreateSecondaryAddress(c context.Context, accessKey string, newAddress string) error

func CreateUserKey

func CreateUserKey(userId int64, assetId string, blockchainId string, sourceAddress string, parentAccessKey string) (string, string, error)

func GetActivationByActivationId

func GetActivationByActivationId(c context.Context, accessKey string, activationId string) map[string]interface{}

func GetAssetByAccessKey

func GetAssetByAccessKey(accessKey string) string

func GetAssetByAssetId

func GetAssetByAssetId(c context.Context, accessKey string, assetId string) (enulib.Asset, error)

func GetBlockchainIdByUserKey

func GetBlockchainIdByUserKey(accessKey string) string

func GetDividendByDividendId

func GetDividendByDividendId(c context.Context, accessKey string, dividendId string) (enulib.Dividend, error)

func GetNonceByAccessKey

func GetNonceByAccessKey(accessKey string) int64

create table userKeys (userId BIGINT, accessKey varchar(64), secret varchar(64), nonce bigint, assetId varchar(100), blockchainId varchar(100), sourceAddress varchar(100)) Used to verify if the current request has a nonce > the value stored in the DB

func GetPaymentByPaymentId

func GetPaymentByPaymentId(c context.Context, accessKey string, paymentId string) enulib.SimplePayment

func GetPaymentByPaymentTag

func GetPaymentByPaymentTag(c context.Context, accessKey string, paymentTag string) enulib.SimplePayment

func GetPaymentsByAddress

func GetPaymentsByAddress(c context.Context, accessKey string, address string) []enulib.SimplePayment

func GetSecretByAccessKey

func GetSecretByAccessKey(accessKey string) string

Used to retrieve the secret to verify the HMAC signature

func GetSourceAddressByAccessKey

func GetSourceAddressByAccessKey(accessKey string) string

Returns newest address associated with the access key

func GetStatusByUserKey

func GetStatusByUserKey(accessKey string) string

func Init

func Init()

Initialises global variables and database connection for all handlers

func InitWithConfigPath

func InitWithConfigPath(configFilePath string)

func InsertActivation

func InsertActivation(c context.Context, accessKey string, activationId string, blockchainId string, addressToActivate string, amount uint64)

Inserts an activation request into the database

func InsertAsset

func InsertAsset(accessKey string, blockchainId string, assetId string, sourceAddressValue string, distributionAddressValue string, assetValue string, descriptionValue string, quantityValue uint64, divisibleValue bool, status string) error

Inserts an asset into the assets database

func InsertDividend

func InsertDividend(accessKey string, dividendId string, sourceAddressValue string, assetValue string, dividendAssetValue string, quantityPerUnitValue uint64, status string)

Inserts a dividend into the dividends database

func InsertPayment

func InsertPayment(c context.Context, accessKey string, blockIdValue int64, blockchainIdValue string, sourceTxidValue string, sourceAddressValue string, destinationAddressValue string, outAssetValue string, issuerValue string, outAmountValue uint64, statusValue string, lastUpdatedBlockIdValue int64, txFeeValue uint64, paymentTag string)

Inserts a payment into the payment database

func InsertTrustAsset

func InsertTrustAsset(c context.Context, accessKey string, activationId string, blockchainId string, asset string, issuer string, amount uint64)

Inserts an activation request into the database

func UpdateAssetCompleteByAssetId

func UpdateAssetCompleteByAssetId(c context.Context, accessKey string, assetId string, txId string) error

func UpdateAssetNameByAssetId

func UpdateAssetNameByAssetId(c context.Context, accessKey string, assetId string, assetName string) error

func UpdateAssetStatusByAssetId

func UpdateAssetStatusByAssetId(c context.Context, accessKey string, assetId string, status string) error

func UpdateAssetWithErrorByAssetId

func UpdateAssetWithErrorByAssetId(c context.Context, accessKey string, assetId string, errorCode int64, errorDescription string) error

func UpdateDividendCompleteByDividendId

func UpdateDividendCompleteByDividendId(c context.Context, accessKey string, dividendId string, txId string) error

func UpdateDividendWithErrorByDividendId

func UpdateDividendWithErrorByDividendId(c context.Context, accessKey string, dividendId string, errorCode int64, errorDescription string) error

func UpdateNonce

func UpdateNonce(accessKey string, nonce int64) error

Used to update the value of the nonce after a successful API call

func UpdatePaymentCompleteByPaymentId

func UpdatePaymentCompleteByPaymentId(c context.Context, accessKey string, paymentId string, txId string) error

func UpdatePaymentSignedRawTxByPaymentId

func UpdatePaymentSignedRawTxByPaymentId(c context.Context, accessKey string, paymentId string, signedRawTx string) error

func UpdatePaymentStatusByPaymentId

func UpdatePaymentStatusByPaymentId(c context.Context, accessKey string, paymentId string, status string) error

func UpdatePaymentWithErrorByPaymentId

func UpdatePaymentWithErrorByPaymentId(c context.Context, accessKey string, paymentId string, txId string, errorCode int64, errorDescription string) error

func UpdateUserKeyStatus

func UpdateUserKeyStatus(accessKey string, status string) error

Updates a given accessKey, ignores what the existing status is

func UserKeyExists

func UserKeyExists(accessKey string) bool

Only return true where an accessKey exists and also has a valid status

Types

This section is empty.

Jump to

Keyboard shortcuts

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