package
0.0.0-20201207183138-34c5bf1cd2ff
Repository: https://github.com/jakewright/home-automation.git
Documentation: pkg.go.dev

# README

JRPC

JRPC generates code from def files to assist with JSON-based RPCs.

Types

A message field can have one of the following types. The table shows the corresponding generated types. Fields can be marked as repeated by prepending the type with [].

JRPC typeGolang type
boolbool
stringstring
int8int8
int32int32
int64int64
uint8byte
uint32uint32
uint64uint64
float32float32
float64float64
bytes[]byte
timetime.Time
anyinterface{}
map[x]ymap[x]y
rgbutil.RGB

Field options

Message fields can take various options which are used to generate validation functions. The router code (template_router.go) automatically calls the validation functions in the generated handlers.

required If set, the value in the incoming JSON must be set. This holds for repeated fields as well, i.e. the field must be set (but could be an empty array).

min Can be used on numeric fields to enforce a minimum allowed value.

max Can be used on numeric fields to enforce a maximum allowed value.