satellite/satellitedb: fix selecting a nullable string
Change-Id: I59e645966e09da586512c69101691b47055c1e5a
This commit is contained in:
parent
0c8c11b251
commit
9200efc61f
@ -202,10 +202,14 @@ func (cache *overlaycache) queryNodes(ctx context.Context, excludedNodes []storj
|
||||
var node overlay.SelectedNode
|
||||
node.Address = &pb.NodeAddress{Transport: pb.NodeTransport_TCP_TLS_GRPC}
|
||||
|
||||
err = rows.Scan(&node.LastNet, &node.ID, &node.Address.Address, &node.LastIPPort)
|
||||
var lastIPPort sql.NullString
|
||||
err = rows.Scan(&node.LastNet, &node.ID, &node.Address.Address, &lastIPPort)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if lastIPPort.Valid {
|
||||
node.LastIPPort = lastIPPort.String
|
||||
}
|
||||
|
||||
nodes = append(nodes, &node)
|
||||
}
|
||||
@ -259,10 +263,14 @@ func (cache *overlaycache) queryNodesDistinct(ctx context.Context, excludedIDs [
|
||||
var node overlay.SelectedNode
|
||||
node.Address = &pb.NodeAddress{Transport: pb.NodeTransport_TCP_TLS_GRPC}
|
||||
|
||||
err = rows.Scan(&node.LastNet, &node.ID, &node.Address.Address, &node.LastIPPort)
|
||||
var lastIPPort sql.NullString
|
||||
err = rows.Scan(&node.LastNet, &node.ID, &node.Address.Address, &lastIPPort)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if lastIPPort.Valid {
|
||||
node.LastIPPort = lastIPPort.String
|
||||
}
|
||||
|
||||
nodes = append(nodes, &node)
|
||||
}
|
||||
@ -311,10 +319,15 @@ func (cache *overlaycache) GetOnlineNodesForGetDelete(ctx context.Context, nodeI
|
||||
var node overlay.SelectedNode
|
||||
node.Address = &pb.NodeAddress{Transport: pb.NodeTransport_TCP_TLS_GRPC}
|
||||
|
||||
err = rows.Scan(&node.LastNet, &node.ID, &node.Address.Address, &node.LastIPPort)
|
||||
var lastIPPort sql.NullString
|
||||
err = rows.Scan(&node.LastNet, &node.ID, &node.Address.Address, &lastIPPort)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if lastIPPort.Valid {
|
||||
node.LastIPPort = lastIPPort.String
|
||||
}
|
||||
|
||||
nodes[node.ID] = &node
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user