Esempio n. 1
0
func genEnums() {
	defer waitGroup.Done()
	writer := new(bytes.Buffer)

	if err := internal.EnumTemplate.Execute(writer, internal.GlobalFieldTypes); err != nil {
		errors <- err
		return
	}

	if err := internal.WriteFile("enum/enums.generated.go", writer.String()); err != nil {
		errors <- err
	}
}
Esempio n. 2
0
func gen(t *template.Template, fileOut string, data interface{}) {
	defer waitGroup.Done()
	writer := new(bytes.Buffer)

	if err := t.Execute(writer, data); err != nil {
		errors <- err
		return
	}

	if err := internal.WriteFile(fileOut, writer.String()); err != nil {
		errors <- err
	}
}
Esempio n. 3
0
func genTrailer(pkg string, spec *datadictionary.DataDictionary) {
	defer waitGroup.Done()
	writer := new(bytes.Buffer)
	c := component{
		Package:    pkg,
		Name:       "Trailer",
		MessageDef: spec.Trailer,
	}
	if err := internal.TrailerTemplate.Execute(writer, c); err != nil {
		errors <- err
		return
	}

	if err := internal.WriteFile(path.Join(pkg, "trailer.generated.go"), writer.String()); err != nil {
		errors <- err
	}
}
Esempio n. 4
0
func genMessage(fixPkg string, spec *datadictionary.DataDictionary, msg *datadictionary.MessageDef) {
	defer waitGroup.Done()
	pkgName := strings.ToLower(msg.Name)
	transportPkg := getTransportPackageName(spec)

	writer := new(bytes.Buffer)
	c := component{
		Package:          pkgName,
		FIXPackage:       fixPkg,
		TransportPackage: transportPkg,
		FIXSpec:          spec,
		Name:             msg.Name,
		MessageDef:       msg,
	}

	if err := internal.MessageTemplate.Execute(writer, c); err != nil {
		errors <- err
		return
	}

	if err := internal.WriteFile(path.Join(fixPkg, pkgName, msg.Name+".generated.go"), writer.String()); err != nil {
		errors <- err
	}
}