Update update resource in the db
(ctx context.Context, resource *schema.Resource)
| 682 | |
| 683 | //Update update resource in the db |
| 684 | func (tx *Transaction) UpdateContext(ctx context.Context, resource *schema.Resource) error { |
| 685 | defer tx.measureTime(time.Now(), resource.Schema().ID, "update") |
| 686 | |
| 687 | q, err := tx.updateQuery(resource) |
| 688 | if err != nil { |
| 689 | return err |
| 690 | } |
| 691 | sql, args, err := q.ToSql() |
| 692 | if err != nil { |
| 693 | return err |
| 694 | } |
| 695 | if resource.Schema().StateVersioning() { |
| 696 | sql += ", `" + configVersionColumnName + "` = `" + configVersionColumnName + "` + 1" |
| 697 | } |
| 698 | sql += " WHERE id = ?" |
| 699 | args = append(args, resource.ID()) |
| 700 | return tx.exec(ctx, sql, args...) |
| 701 | } |
| 702 | |
| 703 | func (tx *Transaction) StateUpdate(resource *schema.Resource, state *transaction.ResourceState) error { |
| 704 | return tx.StateUpdateContext(context.Background(), resource, state) |
no test coverage detected