func getVendorAddress(cegadat util.NamedDbf) (schema.Cim, error) { address := schema.Cim{} postcode, err := cegadat.FieldByName(IRSZAM) if err != nil { return address, err } address.Iranyitoszam = strings.Trim(postcode.(string), util.Whitespace) town, err := cegadat.FieldByName(TELEPULES) if err != nil { return address, err } address.Telepules = strings.Trim(town.(string), util.Whitespace) thoroughfareName, err := cegadat.FieldByName(KOZTERULET) if err != nil { return address, err } address.Kozterulet_neve = strings.Trim(thoroughfareName.(string), util.Whitespace) thoroughfareType, err := cegadat.FieldByName(JELLEG) if err != nil { return address, err } address.Kozterulet_jellege = strings.Trim(thoroughfareType.(string), util.Whitespace) houseNumber, err := cegadat.FieldByName(HAZSZAM) if err != nil { return address, err } address.Hazszam = strings.Trim(houseNumber.(string), util.Whitespace) building, err := cegadat.FieldByName(EPULET) if err != nil { return address, err } address.Epulet = strings.Trim(building.(string), util.Whitespace) staircase, err := cegadat.FieldByName(LEPCSO) if err != nil { return address, err } address.Lepcsohaz = strings.Trim(staircase.(string), util.Whitespace) floor, err := cegadat.FieldByName(EMELET) if err != nil { return address, err } address.Szint = strings.Trim(floor.(string), util.Whitespace) doorNumber, err := cegadat.FieldByName(AJTO) if err != nil { return address, err } address.Ajto = strings.Trim(doorNumber.(string), util.Whitespace) return address, nil }
func getCustomerAddress(an311 util.NamedDbf) (schema.Cim, error) { address := schema.Cim{} postcode, err := an311.FieldByName(IRSZAM) if err != nil { return address, err } address.Iranyitoszam = strings.Trim(postcode.(string), util.Whitespace) town, err := an311.FieldByName(TELEPULES) if err != nil { return address, err } address.Telepules = strings.Trim(town.(string), util.Whitespace) thoroughfareName, err := an311.FieldByName(KOZTERULET) if err != nil { return address, err } if s, ok := thoroughfareName.(string); ok { address.Kozterulet_neve = strings.Trim(s, util.Whitespace) } thoroughfareType, err := an311.FieldByName(JELLEG) if err != nil { return address, err } if s, ok := thoroughfareType.(string); ok { address.Kozterulet_jellege = strings.Trim(s, util.Whitespace) } houseNumber, err := an311.FieldByName(HAZSZAM) if err != nil { return address, err } if s, ok := houseNumber.(string); ok { address.Hazszam = strings.Trim(s, util.Whitespace) } building, err := an311.FieldByName(EPULET) if err != nil { return address, err } if s, ok := building.(string); ok { address.Epulet = strings.Trim(s, util.Whitespace) } staircase, err := an311.FieldByName(LEPCSO) if err != nil { return address, err } if s, ok := staircase.(string); ok { address.Lepcsohaz = strings.Trim(s, util.Whitespace) } floor, err := an311.FieldByName(EMELET) if err != nil { return address, err } if s, ok := floor.(string); ok { address.Szint = strings.Trim(s, util.Whitespace) } doorNumber, err := an311.FieldByName(AJTO) if err != nil { return address, err } if s, ok := doorNumber.(string); ok { address.Ajto = strings.Trim(s, util.Whitespace) } return address, nil }