Documentation ¶
Overview ¶
database.go
Index ¶
- Variables
- func CreateSecondaryAddress(c context.Context, accessKey string, newAddress string) error
- func CreateUserKey(userId int64, assetId string, blockchainId string, sourceAddress string, ...) (string, string, error)
- func GetActivationByActivationId(c context.Context, accessKey string, activationId string) map[string]interface{}
- func GetAssetByAccessKey(accessKey string) string
- func GetAssetByAssetId(c context.Context, accessKey string, assetId string) (enulib.Asset, error)
- func GetBlockchainIdByUserKey(accessKey string) string
- func GetDividendByDividendId(c context.Context, accessKey string, dividendId string) (enulib.Dividend, error)
- func GetNonceByAccessKey(accessKey string) int64
- func GetPaymentByPaymentId(c context.Context, accessKey string, paymentId string) enulib.SimplePayment
- func GetPaymentByPaymentTag(c context.Context, accessKey string, paymentTag string) enulib.SimplePayment
- func GetPaymentsByAddress(c context.Context, accessKey string, address string) []enulib.SimplePayment
- func GetSecretByAccessKey(accessKey string) string
- func GetSourceAddressByAccessKey(accessKey string) string
- func GetStatusByUserKey(accessKey string) string
- func Init()
- func InitWithConfigPath(configFilePath string)
- func InsertActivation(c context.Context, accessKey string, activationId string, blockchainId string, ...)
- func InsertAsset(accessKey string, blockchainId string, assetId string, ...) error
- func InsertDividend(accessKey string, dividendId string, sourceAddressValue string, ...)
- func InsertPayment(c context.Context, accessKey string, blockIdValue int64, ...)
- func InsertTrustAsset(c context.Context, accessKey string, activationId string, blockchainId string, ...)
- func UpdateAssetCompleteByAssetId(c context.Context, accessKey string, assetId string, txId string) error
- func UpdateAssetNameByAssetId(c context.Context, accessKey string, assetId string, assetName string) error
- func UpdateAssetStatusByAssetId(c context.Context, accessKey string, assetId string, status string) error
- func UpdateAssetWithErrorByAssetId(c context.Context, accessKey string, assetId string, errorCode int64, ...) error
- func UpdateDividendCompleteByDividendId(c context.Context, accessKey string, dividendId string, txId string) error
- func UpdateDividendWithErrorByDividendId(c context.Context, accessKey string, dividendId string, errorCode int64, ...) error
- func UpdateNonce(accessKey string, nonce int64) error
- func UpdatePaymentCompleteByPaymentId(c context.Context, accessKey string, paymentId string, txId string) error
- func UpdatePaymentSignedRawTxByPaymentId(c context.Context, accessKey string, paymentId string, signedRawTx string) error
- func UpdatePaymentStatusByPaymentId(c context.Context, accessKey string, paymentId string, status string) error
- func UpdatePaymentWithErrorByPaymentId(c context.Context, accessKey string, paymentId string, txId string, ...) error
- func UpdateUserKeyStatus(accessKey string, status string) error
- func UserKeyExists(accessKey string) bool
Constants ¶
This section is empty.
Variables ¶
var Db *sql.DB
Functions ¶
func CreateSecondaryAddress ¶
func CreateUserKey ¶
func GetAssetByAccessKey ¶
func GetAssetByAssetId ¶
func GetDividendByDividendId ¶
func GetNonceByAccessKey ¶
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 GetPaymentByPaymentTag ¶
func GetPaymentsByAddress ¶
func GetSecretByAccessKey ¶
Used to retrieve the secret to verify the HMAC signature
func GetSourceAddressByAccessKey ¶
Returns newest address associated with the access key
func GetStatusByUserKey ¶
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 UpdateNonce ¶
Used to update the value of the nonce after a successful API call
func UpdateUserKeyStatus ¶
Updates a given accessKey, ignores what the existing status is
func UserKeyExists ¶
Only return true where an accessKey exists and also has a valid status
Types ¶
This section is empty.