insert method

Sqler insert(
  1. QField table,
  2. List<Map<String, QVar>> values
)

Sets up the query for an INSERT operation with the specified values.

table The table to insert into. values List of field-value maps to insert. Returns this to enable method chaining.

Note: This sets the FROM table and adds the values for insertion.

Example:

query.insert(QField('users'), [
  {'name': QVar('John'), 'email': QVar('john@example.com')},
  {'name': QVar('Jane'), 'email': QVar('jane@example.com')}
]); // INSERT INTO users (name, email) VALUES ('John', 'john@example.com'), ('Jane', 'jane@example.com')

Implementation

Sqler insert(QField table, List<Map<String, QVar>> values) {
  _from = [table];
  _insert.addAll(values);
  return this;
}