本文整理汇总了Golang中github.com/rackspace/gophercloud.BuildQueryString函数的典型用法代码示例。如果您正苦于以下问题:Golang BuildQueryString函数的具体用法?Golang BuildQueryString怎么用?Golang BuildQueryString使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了BuildQueryString函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: ToObjectGetQuery
// ToObjectGetQuery formats a GetOpts into a query string.
func (opts GetOpts) ToObjectGetQuery() (string, error) {
q, err := gophercloud.BuildQueryString(opts)
if err != nil {
return "", err
}
return q.String(), nil
}
示例2: ToResourceEventListQuery
// ToResourceEventListQuery formats a ListResourceEventsOpts into a query string.
func (opts ListResourceEventsOpts) ToResourceEventListQuery() (string, error) {
q, err := gophercloud.BuildQueryString(opts)
if err != nil {
return "", err
}
return q.String(), nil
}
示例3: ToMeterStatisticsQuery
// ToMeterStatisticsQuery formats a StatisticsOpts into a query string.
func (opts MeterStatisticsOpts) ToMeterStatisticsQuery() (string, error) {
q, err := gophercloud.BuildQueryString(opts)
if err != nil {
return "", err
}
return q.String(), nil
}
示例4: ToPortListQuery
// ToPortListQuery formats a ListOpts into a query string.
func (opts ListOpts) ToPortListQuery() (string, error) {
q, err := gophercloud.BuildQueryString(opts)
if err != nil {
return "", err
}
return q.String(), nil
}
示例5: ToContainerListParams
// ToContainerListParams formats a ListOpts into a query string and boolean
// representing whether to list complete information for each container.
func (opts ListOpts) ToContainerListParams() (bool, string, error) {
q, err := gophercloud.BuildQueryString(opts)
if err != nil {
return false, "", err
}
return false, q.String(), nil
}
示例6: ToRolesListAssignmentsQuery
// ToRolesListAssignmentsQuery formats a ListAssignmentsOpts into a query string.
func (opts ListAssignmentsOpts) ToRolesListAssignmentsQuery() (string, error) {
q, err := gophercloud.BuildQueryString(opts)
if err != nil {
return "", err
}
return q.String(), nil
}
示例7: ToShowQuery
// ToMeterShowQuery formats a ShowOpts into a query string.
func (opts ShowOpts) ToShowQuery() (string, error) {
q, err := gophercloud.BuildQueryString(opts)
if err != nil {
return "", err
}
return q.String(), nil
}
示例8: ToObjectListParams
// ToObjectListParams formats a ListOpts into a query string and boolean
// representing whether to list complete information for each object.
func (opts ListOpts) ToObjectListParams() (bool, string, error) {
q, err := gophercloud.BuildQueryString(opts)
if err != nil {
return false, "", err
}
return opts.Full, q.String(), nil
}
示例9: ToCDNAssetDeleteParams
// ToCDNAssetDeleteParams formats a DeleteOpts into a query string.
func (opts DeleteOpts) ToCDNAssetDeleteParams() (string, error) {
q, err := gophercloud.BuildQueryString(opts)
if err != nil {
return "", err
}
return q.String(), nil
}
示例10: GetDataByResolution
// GetDataByPoints retrieve metric data by resolution, for the specified tenant associated with RackspaceMetrics.
func GetDataByResolution(c *gophercloud.ServiceClient, metric string, opts QueryParams) GetResult {
var res GetResult
url := getURLForResolution(c, metric)
query, _ := gophercloud.BuildQueryString(opts)
url += query.String()
_, res.Err = c.Get(url, &res.Body, nil)
return res
}
示例11: List
// List returns a Pager which allows you to iterate over a collection of
// routers. It accepts a ListOpts struct, which allows you to filter and sort
// the returned collection for greater efficiency.
//
// Default policy settings return only those routers that are owned by the
// tenant who submits the request, unless an admin user submits the request.
func List(c *gophercloud.ServiceClient, opts ListOpts) pagination.Pager {
q, err := gophercloud.BuildQueryString(&opts)
if err != nil {
return pagination.Pager{Err: err}
}
u := rootURL(c) + q.String()
return pagination.NewPager(c, u, func(r pagination.PageResult) pagination.Page {
return RouterPage{pagination.LinkedPageBase{PageResult: r}}
})
}
示例12: ToObjectDownloadParams
// ToObjectDownloadParams formats a DownloadOpts into a query string and map of
// headers.
func (opts DownloadOpts) ToObjectDownloadParams() (map[string]string, string, error) {
q, err := gophercloud.BuildQueryString(opts)
if err != nil {
return nil, "", err
}
h, err := gophercloud.BuildHeaders(opts)
if err != nil {
return nil, q.String(), err
}
return h, q.String(), nil
}
示例13: List
// List enumerates the services available to a specific user.
func List(client *gophercloud.ServiceClient, opts ListOpts) pagination.Pager {
u := listURL(client)
q, err := gophercloud.BuildQueryString(opts)
if err != nil {
return pagination.Pager{Err: err}
}
u += q.String()
createPage := func(r pagination.PageResult) pagination.Page {
return ServicePage{pagination.LinkedPageBase{PageResult: r}}
}
return pagination.NewPager(client, u, createPage)
}
示例14: SearchMetric
// SearchMetric retrieves a list of available metrics for the specified tenant associated with RackspaceMetrics.
func SearchMetric(c *gophercloud.ServiceClient, opts QueryParams) ([]Metric, error) {
var res GetResult
url := getSearchURL(c)
query, _ := gophercloud.BuildQueryString(opts)
url += query.String()
_, res.Err = c.Get(url, &res.Body, nil)
b := res.Body.(interface{})
var metrics []Metric
err := mapstructure.Decode(b, &metrics)
return metrics, err
}
示例15: GetEvents
//GetEvents retrieves a list of events for the specified tenant associated with RackspaceMetrics.
func GetEvents(c *gophercloud.ServiceClient, opts QueryParams) ([]Event, error) {
var res GetResult
url := getEventURL(c)
query, _ := gophercloud.BuildQueryString(opts)
url += query.String()
_, res.Err = c.Get(url, &res.Body, nil)
b := res.Body.(interface{})
var events []Event
err := mapstructure.Decode(b, &events)
return events, err
}