5 }}} == a b c: 5 • References • Sum types/enums a | b | c • Default values number | *1 • Arithmetic 4 + 5 • String interpolation "Hello \(person)" • List and field comprehensions [ x for x in y ] !17
A int `cue:"C-B" json:",omitempty"` B int `cue:"C-A" json:",omitempty"` C int `cue:"A+B" json:",omitempty"` } Go struct with cue field tags a := Sum{A: 1, B: 5, C: 10} err := cuego.Complete(&a) fmt.Printf(err==nil) // false a = Sum{A: 1, B: 5} err = cuego.Complete(&a) fmt.Printf("%#v\n", a) // Sum{A:1, B:5, C:6} Example: cuego.Complete
} func init() { cuego.MustAddConstraints(&Setup{}, `{ Filename: =~".json$" // must be a .json file Min: >100 & <=Max Max: <=10_000 }`) } Associate Go type with CUE fmt.Println( cuego.Validate(&Config{"foo.jso", 120, 500})) // "foo.jso" does not match =~".json$" Usage cuego.Validate