Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Templates = map[string]string{
"typescript": `// Auto-generated TypeScript interface
export interface {{.Name}} {
{{range .Fields}} {{.Name}}: {{.Type}};
{{end}}}
`,
"csharp": `// Auto-generated C# class
public class {{.Name}} {
{{range .Fields}} public {{.Type}} {{.Name}} { get; set; }
{{end}}}
`,
"cpp": `#include <string>
// Auto-generated C++ struct
struct {{.Name}} {
{{range .Fields}} {{.Type}} {{.Name}};
{{end}}};
`,
"python": `# Auto-generated Python class
class {{.Name}}:
def __init__(self):
{{range .Fields}} self.{{.Name}}: {{.Type}} = None
{{end}}`,
"java": `// Auto-generated Java class
public class {{.Name}} {
{{range .Fields}} private {{.Type}} {{.Name}};
public {{.Type}} get{{.Name | title}}() {
return {{.Name}};
}
public void set{{.Name | title}}({{.Type}} {{.Name}}) {
this.{{.Name}} = {{.Name}};
}
{{end}}}
`,
}
Templates contains pre-defined templates for various languages
View Source
var TypeMappings = map[string]map[string]string{
"typescript": {
"string": "string",
"int": "number",
"float": "number",
"bool": "boolean",
},
"csharp": {
"string": "string",
"int": "int",
"float": "float",
"bool": "bool",
},
"cpp": {
"string": "std::string",
"int": "int",
"float": "float",
"bool": "bool",
},
"python": {
"string": "str",
"int": "int",
"float": "float",
"bool": "bool",
},
"java": {
"string": "String",
"int": "int",
"float": "float",
"bool": "boolean",
},
}
TypeMappings maps generic IR types to language-specific types
Functions ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.