money

package
v0.0.0-...-2ce81c6 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2017 License: MIT Imports: 5 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DurationToUsdCents

func DurationToUsdCents(duration time.Duration) int

DurationToUsdCents converts the given duration to the cost it represents.

func UsdCentsToDuration

func UsdCentsToDuration(amount int) time.Duration

UsdCentsToDuration returns the duration convertible with the given amount of usd cents.

Types

type Broker

type Broker interface {
	ChangeBalance(ctx context.Context, deltaCents int) error
	GetBalance(ctx context.Context) (int, error)
}

Broker handles the account balance.

func NewDatastoreBroker

func NewDatastoreBroker(ctx context.Context, projectID string) (Broker, error)

NewDatastoreBroker creates a new broker connected to datastore.

Jump to

Keyboard shortcuts

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