common

package
v1.0.48 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2020 License: MIT Imports: 4 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InvalidRequest added in v0.0.1

func InvalidRequest(msg string) error

InvalidRequest - create error messages that are needed when validating request input

Types

type Balance

type Balance int64

Balance represents an amount of tokens.

func ToBalance

func ToBalance(tok float64) Balance

ToBalance converts ZCN tokens to Balance.

func (Balance) String

func (b Balance) String() string

String implements fmt.Stringer interface.

func (Balance) ToToken

func (b Balance) ToToken() float64

ToToken converts the Balance to ZCN tokens.

type Error added in v0.0.1

type Error struct {
	Code string `json:"code,omitempty"`
	Msg  string `json:"msg"`
}

Error type for a new application error

func NewError added in v0.0.1

func NewError(code string, msg string) *Error

NewError - create a new error

func (*Error) Error added in v0.0.1

func (err *Error) Error() string

type Key

type Key string

A Key represents an identifier. It can be a pool ID, client ID, smart contract address, etc.

type Size

type Size int64

A Size represents a size in bytes.

func (Size) String

func (s Size) String() string

String implements fmt.Stringer interface

type Timestamp

type Timestamp int64

Timestamp represents Unix time (e.g. in seconds)

func Now

func Now() Timestamp

Now - current datetime

func (Timestamp) ToTime

func (t Timestamp) ToTime() time.Time

ToTime converts the Timestamp to standard time.Time

func (Timestamp) Within

func (t Timestamp) Within(seconds Timestamp) bool

Within ensures a given timestamp is within certain number of seconds

Directories

Path Synopsis
errors module

Jump to

Keyboard shortcuts

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