mapry.go.generate

Generate the Go code to parse and serialize a mapry object graph.

mapry.go.generate.types

Generate the code that defines the types of the object graph.

mapry.go.generate.types.generate(graph, go)

Generate the source file that defines the types of the object graph.

Parameters
  • graph (Graph) – definition of the object graph

  • go (Go) – Go settings

Return type

str

Returns

content of the source file

Ensures
  • result.endswith('\n')

mapry.go.generate.parse

Generate the code that defines general structures required for parsing.

mapry.go.generate.parse.generate(go)

Generate the souce file to define general structures required for parsing.

Return type

str

Returns

content of the source file

Ensures
  • result.endswith('\n')

mapry.go.generate.fromjsonable

Generate the code that parses the object graph from a JSONable structure.

mapry.go.generate.fromjsonable.generate(graph, go)

Generate the source file to parse an object graph from a JSONable object.

Parameters
  • graph (Graph) – mapry definition of the object graph

  • go (Go) – Go settings

Return type

str

Returns

content of the source file

Ensures
  • result.endswith('\n')

mapry.go.generate.fromjsonable_test

Generate the code to test parsing of object graphs from JSONables.

mapry.go.generate.fromjsonable_test.generate(graph, go)

Generate the source file to test parsing from a JSONable object.

Parameters
  • graph (Graph) – mapry definition of the object graph

  • go (Go) – Go settings

Return type

str

Returns

content of the source file

Ensures
  • result.endswith('\n')

mapry.go.generate.tojsonable

Generate the code that serializes the object graph to a JSONable.

mapry.go.generate.tojsonable.generate(graph, go)

Generate the source file to serialize an object graph to a JSONable object.

Parameters
  • graph (Graph) – mapry definition of the object graph

  • go (Go) – Go settings

Return type

str

Returns

content of the source file

Ensures
  • result.endswith('\n')

mapry.go.generate.tojsonable_test

Generate the code to test serializing object graphs to JSONables.

mapry.go.generate.tojsonable_test.generate(graph, go)

Generate the source file to test serializing to a JSONable.

Parameters
  • graph (Graph) – mapry definition of the object graph

  • go (Go) – Go settings

Return type

str

Returns

content of the source file

Ensures
  • result.endswith('\n')