當前位置: 首頁>>代碼示例>>Golang>>正文


Golang validate.Enum函數代碼示例

本文整理匯總了Golang中github.com/go-openapi/validate.Enum函數的典型用法代碼示例。如果您正苦於以下問題:Golang Enum函數的具體用法?Golang Enum怎麽用?Golang Enum使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了Enum函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: validateDurationPeriodEnum

// prop value enum
func (m *CreateAggregatingSubscriptionRequest) validateDurationPeriodEnum(path, location string, value string) error {
	if createAggregatingSubscriptionRequestTypeDurationPeriodPropEnum == nil {
		var res []string
		if err := json.Unmarshal([]byte(`["minutes","days","months","years"]`), &res); err != nil {
			return err
		}
		for _, v := range res {
			createAggregatingSubscriptionRequestTypeDurationPeriodPropEnum = append(createAggregatingSubscriptionRequestTypeDurationPeriodPropEnum, v)
		}
	}
	if err := validate.Enum(path, location, value, createAggregatingSubscriptionRequestTypeDurationPeriodPropEnum); err != nil {
		return err
	}
	return nil
}
開發者ID:authclub,項目名稱:billforward,代碼行數:16,代碼來源:create_aggregating_subscription_request.go

示例2: validateTaxStatusEnum

// prop value enum
func (m *ProductRatePlan) validateTaxStatusEnum(path, location string, value string) error {
	if productRatePlanTypeTaxStatusPropEnum == nil {
		var res []string
		if err := json.Unmarshal([]byte(`["inclusive","exclusive"]`), &res); err != nil {
			return err
		}
		for _, v := range res {
			productRatePlanTypeTaxStatusPropEnum = append(productRatePlanTypeTaxStatusPropEnum, v)
		}
	}
	if err := validate.Enum(path, location, value, productRatePlanTypeTaxStatusPropEnum); err != nil {
		return err
	}
	return nil
}
開發者ID:authclub,項目名稱:billforward,代碼行數:16,代碼來源:product_rate_plan.go

示例3: validatePricingTypeEnum

// prop value enum
func (m *PricingComponentTier) validatePricingTypeEnum(path, location string, value string) error {
	if pricingComponentTierTypePricingTypePropEnum == nil {
		var res []string
		if err := json.Unmarshal([]byte(`["unit","fixed"]`), &res); err != nil {
			return err
		}
		for _, v := range res {
			pricingComponentTierTypePricingTypePropEnum = append(pricingComponentTierTypePricingTypePropEnum, v)
		}
	}
	if err := validate.Enum(path, location, value, pricingComponentTierTypePricingTypePropEnum); err != nil {
		return err
	}
	return nil
}
開發者ID:authclub,項目名稱:billforward,代碼行數:16,代碼來源:pricing_component_tier.go

示例4: validateInvoiceIssueTypeEnum

// prop value enum
func (m *ProductRatePlan) validateInvoiceIssueTypeEnum(path, location string, value string) error {
	if productRatePlanTypeInvoiceIssueTypePropEnum == nil {
		var res []string
		if err := json.Unmarshal([]byte(`["Immediate","Delayed","Manual"]`), &res); err != nil {
			return err
		}
		for _, v := range res {
			productRatePlanTypeInvoiceIssueTypePropEnum = append(productRatePlanTypeInvoiceIssueTypePropEnum, v)
		}
	}
	if err := validate.Enum(path, location, value, productRatePlanTypeInvoiceIssueTypePropEnum); err != nil {
		return err
	}
	return nil
}
開發者ID:authclub,項目名稱:billforward,代碼行數:16,代碼來源:product_rate_plan.go

示例5: validateProRataModeEnum

// prop value enum
func (m *ProductRatePlan) validateProRataModeEnum(path, location string, value string) error {
	if productRatePlanTypeProRataModePropEnum == nil {
		var res []string
		if err := json.Unmarshal([]byte(`["None","WithCoupon","WithoutCoupon","Full"]`), &res); err != nil {
			return err
		}
		for _, v := range res {
			productRatePlanTypeProRataModePropEnum = append(productRatePlanTypeProRataModePropEnum, v)
		}
	}
	if err := validate.Enum(path, location, value, productRatePlanTypeProRataModePropEnum); err != nil {
		return err
	}
	return nil
}
開發者ID:authclub,項目名稱:billforward,代碼行數:16,代碼來源:product_rate_plan.go

示例6: validateExecutionStrategyEnum

// prop value enum
func (m *TimeRequest) validateExecutionStrategyEnum(path, location string, value string) error {
	if timeRequestTypeExecutionStrategyPropEnum == nil {
		var res []string
		if err := json.Unmarshal([]byte(`["SingleAttempt","FollowDunning","None"]`), &res); err != nil {
			return err
		}
		for _, v := range res {
			timeRequestTypeExecutionStrategyPropEnum = append(timeRequestTypeExecutionStrategyPropEnum, v)
		}
	}
	if err := validate.Enum(path, location, value, timeRequestTypeExecutionStrategyPropEnum); err != nil {
		return err
	}
	return nil
}
開發者ID:authclub,項目名稱:billforward,代碼行數:16,代碼來源:time_request.go

示例7: validateLocationTypeEnum

// prop value enum
func (m *LocationDto) validateLocationTypeEnum(path, location string, value string) error {
	if locationDtoTypeLocationTypePropEnum == nil {
		var res []string
		if err := json.Unmarshal([]byte(`["HUB","DEPOT","DPD_DEPOT","LOAD_POINT","SERVICE_POINT","UNDEF","CUSTOMER_LOCATION","SLINGA","DISTRIBUTION_PARTNER","IPS_LOCATION","POSTAL_SERVICE_TERMINAL","DELIVERY_POINT"]`), &res); err != nil {
			return err
		}
		for _, v := range res {
			locationDtoTypeLocationTypePropEnum = append(locationDtoTypeLocationTypePropEnum, v)
		}
	}
	if err := validate.Enum(path, location, value, locationDtoTypeLocationTypePropEnum); err != nil {
		return err
	}
	return nil
}
開發者ID:shipwallet,項目名稱:go-postnord,代碼行數:16,代碼來源:location_dto.go

示例8: validateGatewayEnum

// property enum
func (m *StripeAuthCaptureRequest) validateGatewayEnum(path, location string, value string) error {
	if stripeAuthCaptureRequestTypeGatewayPropEnum == nil {
		var res []string
		if err := json.Unmarshal([]byte(`["Balanced","Braintree","Cybersource","Paypal","Stripe","AuthorizeNet","Spreedly","SagePay","TrustCommerce","Payvision","Kash"]`), &res); err != nil {
			return err
		}
		for _, v := range res {
			stripeAuthCaptureRequestTypeGatewayPropEnum = append(stripeAuthCaptureRequestTypeGatewayPropEnum, v)
		}
	}
	if err := validate.Enum(path, location, value, stripeAuthCaptureRequestTypeGatewayPropEnum); err != nil {
		return err
	}
	return nil
}
開發者ID:authclub,項目名稱:billforward,代碼行數:16,代碼來源:stripe_auth_capture_request.go

示例9: validateManagedByEnum

// prop value enum
func (m *Subscription) validateManagedByEnum(path, location string, value string) error {
	if subscriptionTypeManagedByPropEnum == nil {
		var res []string
		if err := json.Unmarshal([]byte(`["BillForward","Stripe"]`), &res); err != nil {
			return err
		}
		for _, v := range res {
			subscriptionTypeManagedByPropEnum = append(subscriptionTypeManagedByPropEnum, v)
		}
	}
	if err := validate.Enum(path, location, value, subscriptionTypeManagedByPropEnum); err != nil {
		return err
	}
	return nil
}
開發者ID:authclub,項目名稱:billforward,代碼行數:16,代碼來源:subscription.go

示例10: validateTypeEnum

// prop value enum
func (m *InvoiceLine) validateTypeEnum(path, location string, value string) error {
	if invoiceLineTypeTypePropEnum == nil {
		var res []string
		if err := json.Unmarshal([]byte(`["PricingComponent","Coupon","Migration","AggregatedInvoice"]`), &res); err != nil {
			return err
		}
		for _, v := range res {
			invoiceLineTypeTypePropEnum = append(invoiceLineTypeTypePropEnum, v)
		}
	}
	if err := validate.Enum(path, location, value, invoiceLineTypeTypePropEnum); err != nil {
		return err
	}
	return nil
}
開發者ID:authclub,項目名稱:billforward,代碼行數:16,代碼來源:invoice_line.go

示例11: validateTypeEnum

// prop value enum
func (m *ItemFreeTextDto) validateTypeEnum(path, location string, value string) error {
	if itemFreeTextDtoTypeTypePropEnum == nil {
		var res []string
		if err := json.Unmarshal([]byte(`["ICN","SIC","UNDEF"]`), &res); err != nil {
			return err
		}
		for _, v := range res {
			itemFreeTextDtoTypeTypePropEnum = append(itemFreeTextDtoTypeTypePropEnum, v)
		}
	}
	if err := validate.Enum(path, location, value, itemFreeTextDtoTypeTypePropEnum); err != nil {
		return err
	}
	return nil
}
開發者ID:shipwallet,項目名稱:go-postnord,代碼行數:16,代碼來源:item_free_text_dto.go

示例12: validatePricingComponentTypeEnum

// prop value enum
func (m *InvoiceLine) validatePricingComponentTypeEnum(path, location string, value string) error {
	if invoiceLineTypePricingComponentTypePropEnum == nil {
		var res []string
		if err := json.Unmarshal([]byte(`["setup","subscription","arrears","usage"]`), &res); err != nil {
			return err
		}
		for _, v := range res {
			invoiceLineTypePricingComponentTypePropEnum = append(invoiceLineTypePricingComponentTypePropEnum, v)
		}
	}
	if err := validate.Enum(path, location, value, invoiceLineTypePricingComponentTypePropEnum); err != nil {
		return err
	}
	return nil
}
開發者ID:authclub,項目名稱:billforward,代碼行數:16,代碼來源:invoice_line.go

示例13: validateChargeTypeEnum

// prop value enum
func (m *InvoiceLine) validateChargeTypeEnum(path, location string, value string) error {
	if invoiceLineTypeChargeTypePropEnum == nil {
		var res []string
		if err := json.Unmarshal([]byte(`["Credit","Debit"]`), &res); err != nil {
			return err
		}
		for _, v := range res {
			invoiceLineTypeChargeTypePropEnum = append(invoiceLineTypeChargeTypePropEnum, v)
		}
	}
	if err := validate.Enum(path, location, value, invoiceLineTypeChargeTypePropEnum); err != nil {
		return err
	}
	return nil
}
開發者ID:authclub,項目名稱:billforward,代碼行數:16,代碼來源:invoice_line.go

示例14: validateProductTypeEnum

// prop value enum
func (m *CreateAggregatingSubscriptionRequest) validateProductTypeEnum(path, location string, value string) error {
	if createAggregatingSubscriptionRequestTypeProductTypePropEnum == nil {
		var res []string
		if err := json.Unmarshal([]byte(`["nonrecurring","recurring"]`), &res); err != nil {
			return err
		}
		for _, v := range res {
			createAggregatingSubscriptionRequestTypeProductTypePropEnum = append(createAggregatingSubscriptionRequestTypeProductTypePropEnum, v)
		}
	}
	if err := validate.Enum(path, location, value, createAggregatingSubscriptionRequestTypeProductTypePropEnum); err != nil {
		return err
	}
	return nil
}
開發者ID:authclub,項目名稱:billforward,代碼行數:16,代碼來源:create_aggregating_subscription_request.go

示例15: validateUnitEnum

// prop value enum
func (m *WeightDto) validateUnitEnum(path, location string, value string) error {
	if weightDtoTypeUnitPropEnum == nil {
		var res []string
		if err := json.Unmarshal([]byte(`["g","kg"]`), &res); err != nil {
			return err
		}
		for _, v := range res {
			weightDtoTypeUnitPropEnum = append(weightDtoTypeUnitPropEnum, v)
		}
	}
	if err := validate.Enum(path, location, value, weightDtoTypeUnitPropEnum); err != nil {
		return err
	}
	return nil
}
開發者ID:shipwallet,項目名稱:go-postnord,代碼行數:16,代碼來源:weight_dto.go


注:本文中的github.com/go-openapi/validate.Enum函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。