本文整理匯總了Golang中github.com/go-openapi/swag.JoinByFormat函數的典型用法代碼示例。如果您正苦於以下問題:Golang JoinByFormat函數的具體用法?Golang JoinByFormat怎麽用?Golang JoinByFormat使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了JoinByFormat函數的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: WriteToRequest
// WriteToRequest writes these params to a swagger request
func (o *ListTasksParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
var res []error
if o.PageSize != nil {
// query param pageSize
var qrPageSize int32
if o.PageSize != nil {
qrPageSize = *o.PageSize
}
qPageSize := swag.FormatInt32(qrPageSize)
if qPageSize != "" {
if err := r.SetQueryParam("pageSize", qPageSize); err != nil {
return err
}
}
}
if o.SinceID != nil {
// query param sinceId
var qrSinceID int64
if o.SinceID != nil {
qrSinceID = *o.SinceID
}
qSinceID := swag.FormatInt64(qrSinceID)
if qSinceID != "" {
if err := r.SetQueryParam("sinceId", qSinceID); err != nil {
return err
}
}
}
valuesStatus := o.Status
joinedStatus := swag.JoinByFormat(valuesStatus, "pipes")
// query array param status
if err := r.SetQueryParam("status", joinedStatus...); err != nil {
return err
}
valuesTags := o.Tags
joinedTags := swag.JoinByFormat(valuesTags, "")
// query array param tags
if err := r.SetQueryParam("tags", joinedTags...); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
示例2: WriteToRequest
// WriteToRequest writes these params to a swagger request
func (o *SetMetadataForProductParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
var res []error
if err := r.SetBodyParam(o.Metadata); err != nil {
return err
}
valuesOrganizations := o.Organizations
joinedOrganizations := swag.JoinByFormat(valuesOrganizations, "multi")
// query array param organizations
if err := r.SetQueryParam("organizations", joinedOrganizations...); err != nil {
return err
}
// path param product-ID
if err := r.SetPathParam("product-ID", o.ProductID); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
示例3: WriteToRequest
// WriteToRequest writes these params to a swagger request
func (o *FindParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
var res []error
// header param X-Rate-Limit
if err := r.SetHeaderParam("X-Rate-Limit", swag.FormatInt32(o.XRateLimit)); err != nil {
return err
}
// form param limit
frLimit := o.Limit
fLimit := swag.FormatInt32(frLimit)
if err := r.SetFormParam("limit", fLimit); err != nil {
return err
}
var valuesTags []string
for _, v := range o.Tags {
valuesTags = append(valuesTags, swag.FormatInt32(v))
}
joinedTags := swag.JoinByFormat(valuesTags, "multi")
// form array param tags
if err := r.SetFormParam("tags", joinedTags...); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
示例4: WriteToRequest
// WriteToRequest writes these params to a swagger request
func (o *GetPaymentMethodByIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
var res []error
valuesOrganizations := o.Organizations
joinedOrganizations := swag.JoinByFormat(valuesOrganizations, "multi")
// query array param organizations
if err := r.SetQueryParam("organizations", joinedOrganizations...); err != nil {
return err
}
// path param payment-method-ID
if err := r.SetPathParam("payment-method-ID", o.PaymentMethodID); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
示例5: WriteToRequest
// WriteToRequest writes these params to a swagger request
func (o *GetSubscriptionByIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
var res []error
if o.IncludeRetired != nil {
// query param include_retired
var qrIncludeRetired bool
if o.IncludeRetired != nil {
qrIncludeRetired = *o.IncludeRetired
}
qIncludeRetired := swag.FormatBool(qrIncludeRetired)
if qIncludeRetired != "" {
if err := r.SetQueryParam("include_retired", qIncludeRetired); err != nil {
return err
}
}
}
valuesOrganizations := o.Organizations
joinedOrganizations := swag.JoinByFormat(valuesOrganizations, "multi")
// query array param organizations
if err := r.SetQueryParam("organizations", joinedOrganizations...); err != nil {
return err
}
// path param subscription-ID
if err := r.SetPathParam("subscription-ID", o.SubscriptionID); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
示例6: WriteToRequest
// WriteToRequest writes these params to a swagger request
func (o *GetRatePlanByProductAndRatePlanParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
var res []error
if o.IncludeRetired != nil {
// query param include_retired
var qrIncludeRetired bool
if o.IncludeRetired != nil {
qrIncludeRetired = *o.IncludeRetired
}
qIncludeRetired := swag.FormatBool(qrIncludeRetired)
if qIncludeRetired != "" {
if err := r.SetQueryParam("include_retired", qIncludeRetired); err != nil {
return err
}
}
}
if o.Offset != nil {
// query param offset
var qrOffset int32
if o.Offset != nil {
qrOffset = *o.Offset
}
qOffset := swag.FormatInt32(qrOffset)
if qOffset != "" {
if err := r.SetQueryParam("offset", qOffset); err != nil {
return err
}
}
}
if o.Order != nil {
// query param order
var qrOrder string
if o.Order != nil {
qrOrder = *o.Order
}
qOrder := qrOrder
if qOrder != "" {
if err := r.SetQueryParam("order", qOrder); err != nil {
return err
}
}
}
if o.OrderBy != nil {
// query param order_by
var qrOrderBy string
if o.OrderBy != nil {
qrOrderBy = *o.OrderBy
}
qOrderBy := qrOrderBy
if qOrderBy != "" {
if err := r.SetQueryParam("order_by", qOrderBy); err != nil {
return err
}
}
}
valuesOrganizations := o.Organizations
joinedOrganizations := swag.JoinByFormat(valuesOrganizations, "multi")
// query array param organizations
if err := r.SetQueryParam("organizations", joinedOrganizations...); err != nil {
return err
}
// path param product-ID
if err := r.SetPathParam("product-ID", o.ProductID); err != nil {
return err
}
// path param rate-plan-ID
if err := r.SetPathParam("rate-plan-ID", o.RatePlanID); err != nil {
return err
}
if o.Records != nil {
// query param records
var qrRecords int32
if o.Records != nil {
qrRecords = *o.Records
}
qRecords := swag.FormatInt32(qrRecords)
if qRecords != "" {
if err := r.SetQueryParam("records", qRecords); err != nil {
return err
}
}
//.........這裏部分代碼省略.........
示例7: WriteToRequest
// WriteToRequest writes these params to a swagger request
func (o *AvailablePaymentMethodsForSubscriptionParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
var res []error
if o.Offset != nil {
// query param offset
var qrOffset int32
if o.Offset != nil {
qrOffset = *o.Offset
}
qOffset := swag.FormatInt32(qrOffset)
if qOffset != "" {
if err := r.SetQueryParam("offset", qOffset); err != nil {
return err
}
}
}
if o.Order != nil {
// query param order
var qrOrder string
if o.Order != nil {
qrOrder = *o.Order
}
qOrder := qrOrder
if qOrder != "" {
if err := r.SetQueryParam("order", qOrder); err != nil {
return err
}
}
}
if o.OrderBy != nil {
// query param order_by
var qrOrderBy string
if o.OrderBy != nil {
qrOrderBy = *o.OrderBy
}
qOrderBy := qrOrderBy
if qOrderBy != "" {
if err := r.SetQueryParam("order_by", qOrderBy); err != nil {
return err
}
}
}
valuesOrganizations := o.Organizations
joinedOrganizations := swag.JoinByFormat(valuesOrganizations, "multi")
// query array param organizations
if err := r.SetQueryParam("organizations", joinedOrganizations...); err != nil {
return err
}
if o.Records != nil {
// query param records
var qrRecords int32
if o.Records != nil {
qrRecords = *o.Records
}
qRecords := swag.FormatInt32(qrRecords)
if qRecords != "" {
if err := r.SetQueryParam("records", qRecords); err != nil {
return err
}
}
}
// path param subscription-ID
if err := r.SetPathParam("subscription-ID", o.SubscriptionID); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
開發者ID:authclub,項目名稱:billforward,代碼行數:87,代碼來源:available_payment_methods_for_subscription_parameters.go
示例8: WriteToRequest
// WriteToRequest writes these params to a swagger request
func (o *GetAllSubscriptionsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
var res []error
valuesAccountID := o.AccountID
joinedAccountID := swag.JoinByFormat(valuesAccountID, "multi")
// query array param accountID
if err := r.SetQueryParam("accountID", joinedAccountID...); err != nil {
return err
}
if o.ExcludeChildren != nil {
// query param exclude_children
var qrExcludeChildren bool
if o.ExcludeChildren != nil {
qrExcludeChildren = *o.ExcludeChildren
}
qExcludeChildren := swag.FormatBool(qrExcludeChildren)
if qExcludeChildren != "" {
if err := r.SetQueryParam("exclude_children", qExcludeChildren); err != nil {
return err
}
}
}
if o.ExcludeServiceEnded != nil {
// query param exclude_service_ended
var qrExcludeServiceEnded bool
if o.ExcludeServiceEnded != nil {
qrExcludeServiceEnded = *o.ExcludeServiceEnded
}
qExcludeServiceEnded := swag.FormatBool(qrExcludeServiceEnded)
if qExcludeServiceEnded != "" {
if err := r.SetQueryParam("exclude_service_ended", qExcludeServiceEnded); err != nil {
return err
}
}
}
if o.IncludeRetired != nil {
// query param include_retired
var qrIncludeRetired bool
if o.IncludeRetired != nil {
qrIncludeRetired = *o.IncludeRetired
}
qIncludeRetired := swag.FormatBool(qrIncludeRetired)
if qIncludeRetired != "" {
if err := r.SetQueryParam("include_retired", qIncludeRetired); err != nil {
return err
}
}
}
if o.Metadata != nil {
// query param metadata
var qrMetadata string
if o.Metadata != nil {
qrMetadata = *o.Metadata
}
qMetadata := qrMetadata
if qMetadata != "" {
if err := r.SetQueryParam("metadata", qMetadata); err != nil {
return err
}
}
}
if o.Offset != nil {
// query param offset
var qrOffset int32
if o.Offset != nil {
qrOffset = *o.Offset
}
qOffset := swag.FormatInt32(qrOffset)
if qOffset != "" {
if err := r.SetQueryParam("offset", qOffset); err != nil {
return err
}
}
}
if o.Order != nil {
// query param order
var qrOrder string
if o.Order != nil {
qrOrder = *o.Order
}
//.........這裏部分代碼省略.........
示例9: WriteToRequest
//.........這裏部分代碼省略.........
// query param order
var qrOrder string
if o.Order != nil {
qrOrder = *o.Order
}
qOrder := qrOrder
if qOrder != "" {
if err := r.SetQueryParam("order", qOrder); err != nil {
return err
}
}
}
if o.OrderBy != nil {
// query param order_by
var qrOrderBy string
if o.OrderBy != nil {
qrOrderBy = *o.OrderBy
}
qOrderBy := qrOrderBy
if qOrderBy != "" {
if err := r.SetQueryParam("order_by", qOrderBy); err != nil {
return err
}
}
}
valuesOrganizations := o.Organizations
joinedOrganizations := swag.JoinByFormat(valuesOrganizations, "multi")
// query array param organizations
if err := r.SetQueryParam("organizations", joinedOrganizations...); err != nil {
return err
}
if o.Records != nil {
// query param records
var qrRecords int32
if o.Records != nil {
qrRecords = *o.Records
}
qRecords := swag.FormatInt32(qrRecords)
if qRecords != "" {
if err := r.SetQueryParam("records", qRecords); err != nil {
return err
}
}
}
if o.ShowPlanOnlyWhenAmbiguous != nil {
// query param show_plan_only_when_ambiguous
var qrShowPlanOnlyWhenAmbiguous bool
if o.ShowPlanOnlyWhenAmbiguous != nil {
qrShowPlanOnlyWhenAmbiguous = *o.ShowPlanOnlyWhenAmbiguous
}
qShowPlanOnlyWhenAmbiguous := swag.FormatBool(qrShowPlanOnlyWhenAmbiguous)
if qShowPlanOnlyWhenAmbiguous != "" {
if err := r.SetQueryParam("show_plan_only_when_ambiguous", qShowPlanOnlyWhenAmbiguous); err != nil {
return err
示例10: WriteToRequest
// WriteToRequest writes these params to a swagger request
func (o *GetAllAccountsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
var res []error
valuesID := o.ID
joinedID := swag.JoinByFormat(valuesID, "multi")
// query array param id
if err := r.SetQueryParam("id", joinedID...); err != nil {
return err
}
if o.IncludeRetired != nil {
// query param include_retired
var qrIncludeRetired bool
if o.IncludeRetired != nil {
qrIncludeRetired = *o.IncludeRetired
}
qIncludeRetired := swag.FormatBool(qrIncludeRetired)
if qIncludeRetired != "" {
if err := r.SetQueryParam("include_retired", qIncludeRetired); err != nil {
return err
}
}
}
if o.Metadata != nil {
// query param metadata
var qrMetadata string
if o.Metadata != nil {
qrMetadata = *o.Metadata
}
qMetadata := qrMetadata
if qMetadata != "" {
if err := r.SetQueryParam("metadata", qMetadata); err != nil {
return err
}
}
}
if o.Offset != nil {
// query param offset
var qrOffset int32
if o.Offset != nil {
qrOffset = *o.Offset
}
qOffset := swag.FormatInt32(qrOffset)
if qOffset != "" {
if err := r.SetQueryParam("offset", qOffset); err != nil {
return err
}
}
}
if o.Order != nil {
// query param order
var qrOrder string
if o.Order != nil {
qrOrder = *o.Order
}
qOrder := qrOrder
if qOrder != "" {
if err := r.SetQueryParam("order", qOrder); err != nil {
return err
}
}
}
if o.OrderBy != nil {
// query param order_by
var qrOrderBy string
if o.OrderBy != nil {
qrOrderBy = *o.OrderBy
}
qOrderBy := qrOrderBy
if qOrderBy != "" {
if err := r.SetQueryParam("order_by", qOrderBy); err != nil {
return err
}
}
}
valuesOrganizations := o.Organizations
joinedOrganizations := swag.JoinByFormat(valuesOrganizations, "multi")
// query array param organizations
if err := r.SetQueryParam("organizations", joinedOrganizations...); err != nil {
return err
}
//.........這裏部分代碼省略.........