コード例 #1
0
ファイル: address_test.go プロジェクト: joao-parana/csfw
func (siCustomerAddressAttribute) ByCode(code string) (eav.AttributeIndex, error) {
	switch code {
	case "city":
		return CustomerAddressAttributeCity, nil
	case "company":
		return CustomerAddressAttributeCompany, nil
	case "country_id":
		return CustomerAddressAttributeCountryID, nil
	case "fax":
		return CustomerAddressAttributeFax, nil
	case "firstname":
		return CustomerAddressAttributeFirstname, nil
	case "lastname":
		return CustomerAddressAttributeLastname, nil
	case "middlename":
		return CustomerAddressAttributeMiddlename, nil
	case "postcode":
		return CustomerAddressAttributePostcode, nil
	case "prefix":
		return CustomerAddressAttributePrefix, nil
	case "region":
		return CustomerAddressAttributeRegion, nil
	case "region_id":
		return CustomerAddressAttributeRegionID, nil
	case "street":
		return CustomerAddressAttributeStreet, nil
	case "suffix":
		return CustomerAddressAttributeSuffix, nil
	case "telephone":
		return CustomerAddressAttributeTelephone, nil
	case "vat_id":
		return CustomerAddressAttributeVatID, nil
	case "vat_is_valid":
		return CustomerAddressAttributeVatIsValid, nil
	case "vat_request_date":
		return CustomerAddressAttributeVatRequestDate, nil
	case "vat_request_id":
		return CustomerAddressAttributeVatRequestID, nil
	case "vat_request_success":
		return CustomerAddressAttributeVatRequestSuccess, nil

	default:
		return eav.AttributeIndex(0), eav.ErrAttributeNotFound
	}
}
コード例 #2
0
ファイル: address_test.go プロジェクト: joao-parana/csfw
func (siCustomerAddressAttribute) ByID(id int64) (eav.AttributeIndex, error) {
	switch id {
	case 26:
		return CustomerAddressAttributeCity, nil
	case 24:
		return CustomerAddressAttributeCompany, nil
	case 27:
		return CustomerAddressAttributeCountryID, nil
	case 32:
		return CustomerAddressAttributeFax, nil
	case 20:
		return CustomerAddressAttributeFirstname, nil
	case 22:
		return CustomerAddressAttributeLastname, nil
	case 21:
		return CustomerAddressAttributeMiddlename, nil
	case 30:
		return CustomerAddressAttributePostcode, nil
	case 19:
		return CustomerAddressAttributePrefix, nil
	case 28:
		return CustomerAddressAttributeRegion, nil
	case 29:
		return CustomerAddressAttributeRegionID, nil
	case 25:
		return CustomerAddressAttributeStreet, nil
	case 23:
		return CustomerAddressAttributeSuffix, nil
	case 31:
		return CustomerAddressAttributeTelephone, nil
	case 36:
		return CustomerAddressAttributeVatID, nil
	case 37:
		return CustomerAddressAttributeVatIsValid, nil
	case 39:
		return CustomerAddressAttributeVatRequestDate, nil
	case 38:
		return CustomerAddressAttributeVatRequestID, nil
	case 40:
		return CustomerAddressAttributeVatRequestSuccess, nil

	default:
		return eav.AttributeIndex(0), eav.ErrAttributeNotFound
	}
}