1 Star 0 Fork 29

carefreezj/shipyard

forked from CODOG.CN/shipyard 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
registry.go 1.11 KB
一键复制 编辑 原始数据 按行查看 历史
Evan Hazlett 提交于 2015-04-11 02:12 . multiple registry support
package shipyard
import (
registry "github.com/shipyard/shipyard/registry/v1"
)
type Registry struct {
ID string `json:"id,omitempty" gorethink:"id,omitempty"`
Name string `json:"name,omitempty" gorethink:"name,omitempty"`
Addr string `json:"addr,omitempty", gorethink:"addr,omitempty"`
registryClient *registry.RegistryClient `json:"-" gorethink:"-"`
}
func NewRegistry(id, name, addr string) (*Registry, error) {
rClient, err := registry.NewRegistryClient(addr, nil)
if err != nil {
return nil, err
}
return &Registry{
ID: id,
Name: name,
Addr: addr,
registryClient: rClient,
}, nil
}
func (r *Registry) Repositories() ([]*registry.Repository, error) {
res, err := r.registryClient.Search("", 1, 100)
if err != nil {
return nil, err
}
return res.Results, nil
}
func (r *Registry) Repository(name string) (*registry.Repository, error) {
return r.registryClient.Repository(name)
}
func (r *Registry) DeleteRepository(name string) error {
return r.registryClient.DeleteRepository(name)
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/carefreezj/shipyard.git
git@gitee.com:carefreezj/shipyard.git
carefreezj
shipyard
shipyard
master

搜索帮助