calc

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddRequest

type AddRequest struct {
	// A is the first number to add.
	A int
	// B is the other number to add.
	B int
}

AddRequest wrangles the two integers you plan to add together.

type AddResponse

type AddResponse struct {
	// Value contains the resulting sum.
	Value int
}

AddResponse represents the result of an Add() operation.

type CalculatorService

type CalculatorService interface {
	// Add calculates and returns the sum of two numbers.
	//
	// HTTP 200
	// GET  /add/{A}/{B}
	Add(context.Context, *AddRequest) (*AddResponse, error)

	// Sub calculates and returns the difference between two numbers.
	//
	// HTTP 200
	// GET  /sub/{A}/{B}
	Sub(context.Context, *SubRequest) (*SubResponse, error)

	// Mul calculates and returns the product of two numbers.
	//
	// HTTP 200
	// GET  /multiply/{A}/{B}
	Mul(context.Context, *MulRequest) (*MulResponse, error)

	// Double multiplies the value by 2
	//
	// HTTP 200
	// POST /double/{Value}
	// ON   CalculatorService.Mul
	Double(context.Context, *DoubleRequest) (*DoubleResponse, error)
}

CalculatorService provides the ability to perform basic arithmetic on two numbers.

type CalculatorServiceHandler

type CalculatorServiceHandler struct{}

func (CalculatorServiceHandler) Add

func (CalculatorServiceHandler) Double

func (CalculatorServiceHandler) Mul

func (CalculatorServiceHandler) Sub

type DoubleRequest

type DoubleRequest struct {
	// Value is the number to multiply by 2.
	Value int
}

DoubleRequest contains the number we're multiplying by 2 in a Double() operation.

type DoubleResponse

type DoubleResponse struct {
	// Value contains the resulting product.
	Value int
}

DoubleResponse represents the result of a Mul() operation.

type MulRequest

type MulRequest struct {
	// A is the first factor to multiply.
	A int
	// B is the other factor to multiply.
	B int
}

MulRequest contains the two numbers whose product you're calculating in Mul().

type MulResponse

type MulResponse struct {
	// Value contains the resulting product.
	Value int
}

MulResponse represents the result of a Mul() operation.

type SubRequest

type SubRequest struct {
	// A is the "minuend" in the subtraction operation.
	A int
	// B is the "subtrahend" in the subtraction operation.
	B int
}

SubRequest contains the two numbers whose difference you're calculating in Sub().

type SubResponse

type SubResponse struct {
	// Value contains the resulting difference.
	Value int
}

SubResponse represents the result of an Add() operation.

Directories

Path Synopsis
Code generated by Frodo - DO NOT EDIT.
Code generated by Frodo - DO NOT EDIT.

Jump to

Keyboard shortcuts

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