helper

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 19, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package helper contains common library functions that are shared among business related functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddBalance

func AddBalance(currentBalance string, amount string) (string, error)

AddBalance add amount into current balance

func ArrayContains

func ArrayContains(s []string, searchString string) bool

ArrayContains return true if array contain search string, otherwise return fail

func CompareFloatBalance

func CompareFloatBalance(currentBalance string, amount float64) int

CompareFloatBalance to compare between current balance and amount. Amount is float64 type. Return 1 if current balance greater than amount. Otherwise return -1

func CompareStringBalance

func CompareStringBalance(currentBalance string, amount string) int

CompareStringBalance to compare between current balance and amount. Amount is string type. Return 1 if current balance greater than amount. Otherwise return -1

func EnrollmentKey

func EnrollmentKey(tokenId string) []string

EnrollmentKey return list key of enrollment will be compose in couch db key

func GenerateID

func GenerateID(docPrefix string, txID string) string

GenerateID return id of docs base on document prefix name and Fabric transaction ID This way, each document in the state database will have this type of ID format:

func HealthCheckKey

func HealthCheckKey(id string) []string

HealthCheckKey return list key of health check will be compose in couch db key

func NFTKey

func NFTKey(nftId string) []string

NFTKey return list key of NFT will be compose in couch db key

func RespError

func RespError(err errorcode.ErrorCode) error

Format the error message that is returned to the client

func SubBalance

func SubBalance(currentBalance string, amount string) (string, error)

SubBalance sub current balance with amount

func TimestampISO

func TimestampISO(timeUnix int64) string

TimestampISO convert time unix to time ISO 8601

func TokenKey

func TokenKey(tokenId string) []string

TokenKey return list key of token will be compose in couch db key

func TransactionKey

func TransactionKey(txId string) []string

TransactionKey return list key of transaction will be compose in couch db key

func WalletKey

func WalletKey(walletId string) []string

WalletKey return list key of wallet will be compose in couch db key

Types

This section is empty.

Directories

Path Synopsis
Package Gringotts Logger (glogger) contains a singleton logging instance to use throughout the project.
Package Gringotts Logger (glogger) contains a singleton logging instance to use throughout the project.

Jump to

Keyboard shortcuts

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