mathservice

package
v0.0.0-...-14493fd Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2019 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDivideByZero = errors.New("can't divide by zero")
	ErrNoMax        = errors.New("no maximum value, a and b are the same")
	ErrNoMin        = errors.New("no minimum value, a and b are the same")
)

Functions

func NewBasicService

func NewBasicService() basicService

NewBasicService returns a naïve, stateless implementation of Service.

Types

type Service

type Service interface {
	// Divide two integers, a/b
	Divide(ctx context.Context, a, b float64) (float64, error)
	// Max two integers, returns the greater value of a and b
	Max(ctx context.Context, a, b float64) (float64, error)
	// Min two integers, returns the lesser value of a and b
	Min(ctx context.Context, a, b float64) (float64, error)
	// Multiply two integers, a*b
	Multiply(ctx context.Context, a, b float64) (float64, error)
	// Pow two integers, a^b
	Pow(ctx context.Context, a, b float64) (float64, error)
	// Subtract two integers, a-b
	Subtract(ctx context.Context, a, b float64) (float64, error)
	// Sums two integers. a+b
	Sum(ctx context.Context, a, b float64) (float64, error)
}

Service describes a service that adds things together.

Jump to

Keyboard shortcuts

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