Connection.update

Updates records filtered by the filter string, setting the values as specified in the update string. Both should be SQL-syntax

Useful when updating just a single or a bunch of values in the table, or when setting the values relatively to their current value.

  1. int update(string filter, string update, U vals)
    struct Connection
    int
    update
    (
    T
    U...
    )
    (
    string filter
    ,
    string update
    ,
    )
  2. int update(U id, Value[string] updates, bool async = false)
  3. int update(U id, T updates, bool async = false)

Parameters

filter
Type: string

the SQL filter string

update
Type: string

the SQL update string

vals
Type: U

values to be used in the query

Examples

Connection c; // an established connection
struct User { int id; int posts ...}
c.update!User("id = $1", "posts = posts + $2", 123, 1);

Meta