example: add jsonencode using extension (#3142)

This commit is contained in:
Ariel Mashraki
2022-12-04 10:38:23 +02:00
committed by GitHub
parent f40fff0f5c
commit 3f1d7c960e
39 changed files with 7024 additions and 4 deletions

View File

@@ -143,6 +143,15 @@ func (f GenerateFunc) Generate(g *Graph) error {
return f(g)
}
// Set sets an annotation a new annotation in the map.
// A new map is created if the receiver is nil.
func (a *Annotations) Set(k string, v any) {
if *a == nil {
*a = make(Annotations)
}
(*a)[k] = v
}
// NewGraph creates a new Graph for the code generation from the given schema definitions.
// It fails if one of the schemas is invalid.
func NewGraph(c *Config, schemas ...*load.Schema) (g *Graph, err error) {