(ctx context.Context, n *ent.Node)
| 102 | } |
| 103 | |
| 104 | func (c *nodeClient) Upsert(ctx context.Context, n *ent.Node) (*ent.Node, error) { |
| 105 | if n.ID == 0 { |
| 106 | return c.client.Node.Create(). |
| 107 | SetName(n.Name). |
| 108 | SetServer(n.Server). |
| 109 | SetSlaveKey(n.SlaveKey). |
| 110 | SetStatus(n.Status). |
| 111 | SetType(node.TypeSlave). |
| 112 | SetSettings(n.Settings). |
| 113 | SetCapabilities(n.Capabilities). |
| 114 | SetWeight(n.Weight). |
| 115 | Save(ctx) |
| 116 | } |
| 117 | |
| 118 | res, err := c.client.Node.UpdateOne(n). |
| 119 | SetName(n.Name). |
| 120 | SetServer(n.Server). |
| 121 | SetSlaveKey(n.SlaveKey). |
| 122 | SetStatus(n.Status). |
| 123 | SetSettings(n.Settings). |
| 124 | SetCapabilities(n.Capabilities). |
| 125 | SetWeight(n.Weight). |
| 126 | Save(ctx) |
| 127 | if err != nil { |
| 128 | return nil, err |
| 129 | } |
| 130 | |
| 131 | return res, nil |
| 132 | } |
| 133 | |
| 134 | func getNodeOrderOption(args *ListNodeParameters) []node.OrderOption { |
| 135 | orderTerm := getOrderTerm(args.Order) |
nothing calls this directly
no test coverage detected