types

package
v0.2.0-alpha Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DateRangesOverlap

func DateRangesOverlap(startTimeA, endTimeA, startTimeB, endTimeB time.Time) bool

DateRangesOverlap returns true if two date ranges overlap each other. End time is exclusive and start time is inclusive.

func DecApproxEqual

func DecApproxEqual(a, b sdk.Dec) bool

DecApproxEqual returns true if a and b are approximately equal, which means the diff ratio is equal or less than 0.1%.

func GetShareValue

func GetShareValue(amount sdk.Int, ratio sdk.Dec) sdk.Int

GetShareValue multiplies with truncation by receiving int amount and decimal ratio and returns int result.

func MustParseRFC3339

func MustParseRFC3339(s string) time.Time

MustParseRFC3339 parses string time to time in RFC3339 format.

func PP

func PP(data interface{})

func ParseCoin

func ParseCoin(s string) sdk.Coin

ParseCoin parses and returns sdk.Coin.

func ParseCoins

func ParseCoins(s string) sdk.Coins

ParseCoins parses and returns sdk.Coins.

func ParseDec

func ParseDec(s string) sdk.Dec

ParseDec is a shortcut for sdk.MustNewDecFromStr.

func ParseTime

func ParseTime(s string) time.Time

ParseTime parses and returns time.Time in time.RFC3339 format.

func RandomDec

func RandomDec(r *rand.Rand, min, max sdk.Dec) sdk.Dec

RandomDec returns a random decimal in the half-open interval [min, max).

func RandomInt

func RandomInt(r *rand.Rand, min, max sdk.Int) sdk.Int

RandomInt returns a random integer in the half-open interval [min, max).

Types

type StrIntMap

type StrIntMap map[string]sdk.Int

func (StrIntMap) AddOrSet

func (m StrIntMap) AddOrSet(key string, value sdk.Int)

AddOrSet Set when the key not existed on the map or add existed value of the key.

Jump to

Keyboard shortcuts

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