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


Golang gophercloud.BuildQueryString函數代碼示例

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


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

示例1: 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
}
開發者ID:stephamon,項目名稱:rack,代碼行數:9,代碼來源:requests.go

示例2: 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
}
開發者ID:stephamon,項目名稱:rack,代碼行數:8,代碼來源:requests.go

示例3: ToServerListQuery

// ToServerListQuery formats a ListOpts into a query string.
func (opts ListOpts) ToServerListQuery() (string, error) {
	q, err := gophercloud.BuildQueryString(opts)
	if err != nil {
		return "", err
	}
	return q.String(), nil
}
開發者ID:stephamon,項目名稱:rack,代碼行數:8,代碼來源:requests.go

示例4: List

// List returns a Pager which allows you to iterate over a collection of
// security group rules. It accepts a ListOpts struct, which allows you to filter
// and sort the returned collection for greater efficiency.
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 SecGroupRulePage{pagination.LinkedPageBase{PageResult: r}}
	})
}
開發者ID:hdansou,項目名稱:rack,代碼行數:13,代碼來源:requests.go

示例5: 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
}
開發者ID:stephamon,項目名稱:rack,代碼行數:13,代碼來源:requests.go

示例6: ToObjectCreateParams

// ToObjectCreateParams formats a CreateOpts into a query string and map of
// headers.
func (opts CreateOpts) ToObjectCreateParams() (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
	}

	for k, v := range opts.Metadata {
		h["X-Object-Meta-"+k] = v
	}

	return h, q.String(), nil
}
開發者ID:stephamon,項目名稱:rack,代碼行數:18,代碼來源:requests.go


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