Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
visitField(field, parameters) {
let array = '';
if(field.isArray()) {
array = '[]';
}
// we export all fields by capitalizing them
parameters.fileWriter.writeLine(1, ModelUtil.capitalizeFirstLetter(field.getName()) + ' ' + array + this.toGoType(field.getType()) + ' `json:"' + field.getName() + '"`' );
return null;
}
visitRelationship(relationship, parameters) {
let array = '';
if(relationship.isArray()) {
array = '[]';
}
// we export all relationships by capitalizing them
parameters.fileWriter.writeLine(1, ModelUtil.capitalizeFirstLetter(relationship.getName()) + ' ' + array + 'Relationship `json:"' + relationship.getName() + '"`' );
return null;
}
visitEnumValueDeclaration(enumValueDeclaration, parameters) {
// is this the first enum value?
// if yes, we need to use 'iota' to set the value to zero
const isFirstValue = enumValueDeclaration.getParent().getOwnProperties()[0].getName() === enumValueDeclaration.getName();
let iota = '';
if(isFirstValue) {
iota = ' ' + enumValueDeclaration.getParent().getName() + ' = 1 + iota';
}
// we export all fields by capitalizing them
parameters.fileWriter.writeLine(1, ModelUtil.capitalizeFirstLetter(enumValueDeclaration.getName()) + iota );
return null;
}