Documentation ¶
Index ¶
- Constants
- Variables
- func AbsInt(a int64) int64
- func Compress(bz []byte) ([]byte, error)
- func ConcurrentExecuteAsync(concurrency int, producer func(), consumer func(), postConsume func())
- func ConcurrentExecuteSync(concurrency int, producer func(), consumer func())
- func Int642Bytes(n int64) []byte
- func IsAlphaNum(s string) bool
- func MaxInt(a, b int64) int64
- func MinInt(a, b int64) int64
- func Mul64(a, b int64) (int64, bool)
- func Now() time.Time
- func ParsePrice(priceStr string) (int64, error)
- func SameDayInUTC(first, second time.Time) bool
- func SamePeriodInUTC(first, second time.Time, period int64) bool
- type Fixed8
- type FixedSizeRing
Constants ¶
View Source
const SecondsPerDay int64 = 86400
Variables ¶
View Source
var Fixed8Decimals = int(math.Pow10(precision))
Fixed8Decimals represents 10^precision (100000000), a value of 1 in Fixed8 format
View Source
var Fixed8One = NewFixed8(1)
Functions ¶
func ConcurrentExecuteAsync ¶
func ConcurrentExecuteAsync(concurrency int, producer func(), consumer func(), postConsume func())
func ConcurrentExecuteSync ¶
func ConcurrentExecuteSync(concurrency int, producer func(), consumer func())
func Int642Bytes ¶
func IsAlphaNum ¶
func ParsePrice ¶
Types ¶
type Fixed8 ¶
type Fixed8 int64
Fixed8 represents a fixed-point number with precision 10^-8
func Fixed8DecodeString ¶
Fixed8DecodeString parses s which must be a fixed point number with precision up to 10^-8
func (*Fixed8) MarshalJSON ¶
MarshalJSON implements the json marshaller interface
func (*Fixed8) UnmarshalJSON ¶
UnmarshalJSON implements the json unmarshaller interface
type FixedSizeRing ¶
type FixedSizeRing struct {
// contains filtered or unexported fields
}
FixedSizeRing is well-designed for the scenario that we always push elements back and never pop elements If the ring is full, the newly pushed elements will override the oldest elements. not goroutine-safe
func NewFixedSizedRing ¶
func NewFixedSizedRing(cap int64) *FixedSizeRing
func (*FixedSizeRing) Count ¶
func (q *FixedSizeRing) Count() int64
func (*FixedSizeRing) Elements ¶
func (q *FixedSizeRing) Elements() []interface{}
func (*FixedSizeRing) IsEmpty ¶
func (q *FixedSizeRing) IsEmpty() bool
func (*FixedSizeRing) Push ¶
func (q *FixedSizeRing) Push(v interface{}) *FixedSizeRing
func (*FixedSizeRing) String ¶
func (q *FixedSizeRing) String() string
Click to show internal directories.
Click to hide internal directories.