本文整理匯總了Golang中github.com/dtan4/paus-frontend/store.Etcd.List方法的典型用法代碼示例。如果您正苦於以下問題:Golang Etcd.List方法的具體用法?Golang Etcd.List怎麽用?Golang Etcd.List使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/dtan4/paus-frontend/store.Etcd
的用法示例。
在下文中一共展示了Etcd.List方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: List
func List(etcd *store.Etcd, username string) ([]string, error) {
apps, err := etcd.List("/paus/users/"+username+"/apps/", true)
if err != nil {
return nil, err
}
result := make([]string, 0)
for _, app := range apps {
appName := strings.Replace(app, "/paus/users/"+username+"/apps/", "", 1)
result = append(result, appName)
}
return result, nil
}
示例2: URLs
func URLs(etcd *store.Etcd, uriScheme, baseDomain, username, appName string) ([]string, error) {
deployments, err := etcd.List("/paus/users/"+username+"/apps/"+appName+"/deployments/", true)
if err != nil {
return nil, err
}
result := make([]string, 0)
for _, deployment := range deployments {
revision, err := etcd.Get(deployment)
if err != nil {
return nil, err
}
identifier := username + "-" + appName + "-" + revision[0:8]
result = append(result, URL(uriScheme, identifier, baseDomain))
}
return result, nil
}