Documentation ¶
Overview ¶
Package helper contains common library functions that are shared among business related functions.
Index ¶
- func AddBalance(currentBalance string, amount string) (string, error)
- func ArrayContains(s []string, searchString string) bool
- func CompareFloatBalance(currentBalance string, amount float64) int
- func CompareStringBalance(currentBalance string, amount string) int
- func EnrollmentKey(tokenId string) []string
- func GenerateID(docPrefix string, txID string) string
- func HealthCheckKey(id string) []string
- func NFTKey(nftId string) []string
- func RespError(err errorcode.ErrorCode) error
- func SubBalance(currentBalance string, amount string) (string, error)
- func TimestampISO(timeUnix int64) string
- func TokenKey(tokenId string) []string
- func TransactionKey(txId string) []string
- func WalletKey(walletId string) []string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddBalance ¶
AddBalance add amount into current balance
func ArrayContains ¶
ArrayContains return true if array contain search string, otherwise return fail
func CompareFloatBalance ¶
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 ¶
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 ¶
EnrollmentKey return list key of enrollment will be compose in couch db key
func GenerateID ¶
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 ¶
HealthCheckKey return list key of health check will be compose in couch db key
func SubBalance ¶
SubBalance sub current balance with amount
func TimestampISO ¶
TimestampISO convert time unix to time ISO 8601
func TransactionKey ¶
TransactionKey return list key of transaction will be compose in couch db key
Types ¶
This section is empty.