本文整理匯總了Golang中github.com/ncw/swift.ObjectsOpts.Prefix方法的典型用法代碼示例。如果您正苦於以下問題:Golang ObjectsOpts.Prefix方法的具體用法?Golang ObjectsOpts.Prefix怎麽用?Golang ObjectsOpts.Prefix使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/ncw/swift.ObjectsOpts
的用法示例。
在下文中一共展示了ObjectsOpts.Prefix方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: get_objects
func get_objects(c swift.Connection, container string, prefix string) []string {
opts := new(swift.ObjectsOpts)
opts.Prefix = prefix
names, err := c.ObjectNames(container, opts)
if err != nil {
panic(err)
}
return names
}
示例2: GetHistory
func GetHistory(ren render.Render, r *http.Request, cf *swift.Connection) {
opts := swift.ObjectsOpts{}
opts.Prefix = "cfpaste-"
opts.Limit = 10
objects, err := cf.ObjectNames("go-cfpaste", &opts)
pastes := make([]string, 10)
for i := range objects {
object, headers, err := cf.Object("go-cfpaste", objects[i])
PanicIf(err)
log.Println(object.Name)
pastes = append(pastes, headers["X-Object-Meta-Pasteid"])
}
PanicIf(err)
ren.HTML(200, "history", pastes)
return
}