本文整理汇总了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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}