common

package
v1.2.85 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2021 License: MIT Imports: 6 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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 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

type WhoPays

type WhoPays int

WhoPays for file downloading.

const (
	WhoPaysOwner    WhoPays = iota // 0, file owner pays
	WhoPays3rdParty                // 1, 3rd party user pays
)

possible variants

func (*WhoPays) Parse

func (wp *WhoPays) Parse(val string) (err error)

Parse given string and set the WhoPays by it. Or return parsing error. The given string should be as result of the String method (case insensitive).

func (WhoPays) String

func (wp WhoPays) String() string

String implements fmt.Stringer interface.

func (WhoPays) Validate

func (wp WhoPays) Validate() (err error)

Validate the WhoPays value.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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