本文整理匯總了Golang中github.com/weaveworks/flux/common/store.Store.GetAllServices方法的典型用法代碼示例。如果您正苦於以下問題:Golang Store.GetAllServices方法的具體用法?Golang Store.GetAllServices怎麽用?Golang Store.GetAllServices使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/weaveworks/flux/common/store.Store
的用法示例。
在下文中一共展示了Store.GetAllServices方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: testServices
func testServices(s store.Store, t *testing.T) {
require.Nil(t, s.AddService("svc", testService))
svc2, err := s.GetService("svc", store.QueryServiceOptions{})
require.Nil(t, err)
require.Equal(t, "svc", svc2.Name)
require.Equal(t, testService, svc2.Service)
require.Nil(t, s.CheckRegisteredService("svc"))
services := func() map[string]data.Service {
svcs := make(map[string]data.Service)
ss, err := s.GetAllServices(store.QueryServiceOptions{})
require.Nil(t, err)
for _, svc := range ss {
svcs[svc.Name] = svc.Service
}
return svcs
}
require.Equal(t, map[string]data.Service{"svc": testService}, services())
require.Nil(t, s.RemoveService("svc"))
require.Equal(t, map[string]data.Service{}, services())
require.Nil(t, s.AddService("svc", testService))
require.Nil(t, s.RemoveAllServices())
require.Equal(t, map[string]data.Service{}, services())
}
示例2: allServices
func allServices(t *testing.T, st store.Store) []*store.ServiceInfo {
services, err := st.GetAllServices(store.QueryServiceOptions{})
require.NoError(t, err)
return services
}