migrate to integer ID
This commit is contained in:
parent
ffb356182e
commit
7ff2a92118
4 changed files with 27 additions and 22 deletions
10
node.go
10
node.go
|
|
@ -205,7 +205,7 @@ func (c *NodeClient) ListServers(ctx context.Context, n *Node) (sl ServerRefList
|
|||
return
|
||||
}
|
||||
|
||||
func (c *NodeClient) FindServer(ctx context.Context, name, id string) (s *ServerRef, err error) {
|
||||
func (c *NodeClient) FindServer(ctx context.Context, name string, id int) (s *ServerRef, err error) {
|
||||
nl, err := c.List(ctx)
|
||||
if err != nil {
|
||||
return
|
||||
|
|
@ -223,7 +223,7 @@ func (c *NodeClient) FindServer(ctx context.Context, name, id string) (s *Server
|
|||
continue
|
||||
}
|
||||
for _, s := range sl {
|
||||
if id != "" && s.ID == id {
|
||||
if id != -1 && s.ID == id {
|
||||
return s, nil
|
||||
}
|
||||
if name != "" && s.Name == name {
|
||||
|
|
@ -241,11 +241,11 @@ func (c *NodeClient) FindServer(ctx context.Context, name, id string) (s *Server
|
|||
}
|
||||
|
||||
func (c *NodeClient) FindServerByName(ctx context.Context, name string) (s *ServerRef, err error) {
|
||||
return c.FindServer(ctx, name, "")
|
||||
return c.FindServer(ctx, name, -1)
|
||||
}
|
||||
|
||||
func (c *NodeClient) FindServerByID(ctx context.Context, id string) (s *ServerRef, err error) {
|
||||
if id == "" {
|
||||
func (c *NodeClient) FindServerByID(ctx context.Context, id int) (s *ServerRef, err error) {
|
||||
if id == -1 {
|
||||
err = ErrEmptyID
|
||||
return
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue