class CQL::Insert
Reference
< Object
The CQL::Insert
class is responsible for building SQL INSERT
statements. It provides methods to construct and execute these statements, allowing for both single and multiple record inserts.
Example: Inserting a Single Record
Example: Inserting Multiple Records
Methods
def into(table : Symbol)
Specifies the table to insert the records into.
@param table [Symbol] The name of the table.
@return [Insert] The insert statement.
def values(data : Hash(Symbol, DB::Any))
Specifies the data to insert into the table.
@param data [Hash(Symbol, DB::Any)] A hash of column names and values.
@return [Insert] The insert statement.
def last_insert_id
Retrieves the last inserted record's ID.
@return [Int64] The ID of the last inserted record.
Example: