class

Lustra::SQL::InsertQuery

Inherits Lustra::SQL::Query::OnConflict < Lustra::SQL::Query::Connection < Lustra::SQL::Query::Change < Lustra::SQL::Query::CTE < Reference < Object

An insert query

cf. postgres documentation

[ WITH [ RECURSIVE ] with_query [, ...] ]
INSERT INTO table_name [ AS alias ] [ ( column_name [, ...] ) ]
   { DEFAULT VALUES | VALUES ( { expression | DEFAULT } [, ...] ) [, ...] | query }
   [ ON CONFLICT [ conflict_target ] conflict_action ]
   [ RETURNING * | output_expression [ [ AS ] output_name ] [, ...] ]

Constructors

new(table : Symbol | String, values)
Source
new(table : Symbol | String)
Source

Instance methods

clear_values
Source
columns(*args : Array(String | Symbol))

Used with values

Source
execute(connection_name : String = "default") : Hash(String, Lustra::SQL::Any)
Source
fetch(connection_name : String = "default", & : Hash(String, Lustra::SQL::Any) -> Nil)
Source
into(table : Symbol | String)
Source
keys
Source
returning(str : String)
Source
returning
Source
size

Number of rows of this insertion request

Source
table
Source
table?
Source
to_sql
Source
values(row : Hash(Symbolic, Inserable))
Source
values(rows : Array(Hash(Symbolic, Inserable)))
Source
values(row : NamedTuple)

Fast insert system

insert({field: "value"}).into(:table)

Source
values(rows : Array(NamedTuple))
Source
values(select_query : SelectBuilder)

Insert into ... (...) SELECT

Source
values
Source
values(*args)
Source

Nested types