calc

package
v0.0.0-...-cda3813 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CalculatorService

type CalculatorService interface {
	//concerto:method grpc:"Calculate"
	//concerto:method thrift:"Calculate,exceptions=1:concerto.rpc.status.Error"
	//concerto:method http:"POST /calculate,additional_routes=POST calculate/{op}/{num1}/{num2}"
	Calculate(
		ctx context.Context,

		op Op,

		num1 int64,

		num2 int64,
	) (

		result int64,
		err error,
	)
}

func NewCalculatorService

func NewCalculatorService(
	logger *slog.Logger,
) CalculatorService

NewCalculatorService constructs and returns an implementation of CalculatorService.

type Op

type Op int32

Op represents the type of arithmetic operation.

const (
	//concerto:value text:"Add"
	OpAdd      Op = iota // Add represents addition operation.
	OpSubtract           // Subtract represents subtraction operation.
	OpMultiply           // Multiply represents multiplication operation.
	OpDivide             // Divide represents division operation.
)

func OpFromString

func OpFromString(s string) (Op, error)

func (Op) MarshalJSON

func (x Op) MarshalJSON() ([]byte, error)

func (Op) MarshalText

func (x Op) MarshalText() ([]byte, error)

func (Op) String

func (x Op) String() string

func (*Op) UnmarshalJSON

func (x *Op) UnmarshalJSON(text []byte) error

func (*Op) UnmarshalText

func (x *Op) UnmarshalText(text []byte) error

Jump to

Keyboard shortcuts

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