Class
SQLInsertBuilder
Builds
SQLInsert queries.final class SQLInsertBuilder
Overview
Note
Although in the strictest sense, this builder could conform to SQLUnqualifiedColumnListBuilder, doing so would be semantically inappropriate. The protocol documents its columns() methods as being additive, but SQLInsertBuilder’s otherwise-identical public APIs overwrite the effects of any previous invocation. It would ideally be preferable to change SQLInsertBuilder‘s semantics in this regard, but this would be a significant breaking change in the API’s behavior, and must therefore wait for a major version bump.
Topics
Initializers
init(_:on:)Creates a newSQLInsertBuilder.
Instance Properties
databaseConnection to execute query on.insertTheSQLInsertquery this builder builds.queryQuery being built.returningThe specification of what the query should return, if any.tableExpressionGroupAn optional group of common table expressions to include in the query under construction.
Instance Methods
columns(_:)Specify mutiple columns to be included in the list of columns for the query.ignoringConflicts(with:)Specify that constraint violations for the key over the given column should cause the conflicting row(s) to be ignored.model(_:prefix:keyEncodingStrategy:nilEncodingStrategy:userInfo:)Use anEncodablevalue to generate a row to insert and add that row to the query.model(_:with:)Use anEncodablevalue to generate a row to insert and add that row to the query.models(_:prefix:keyEncodingStrategy:nilEncodingStrategy:userInfo:)Use an array ofEncodablevalues to generate rows to insert and add those rows to the query.models(_:with:)Use an array ofEncodablevalues to generate rows to insert and add those rows to the query.onConflict(with:do:)Specify that constraint violations for the key over the given column should cause the conflicting row(s) to be updated as specified instead. SeeSQLConflictUpdateBuilder.rows(_:)Add multiple sequences of values each inserted as a separate row.select(_:)Specify aSELECTquery to generate rows to insert.values(_:)Add a set of values to be inserted as a single row.
Relationships
Conforms To
See Also
Query Builders
SQLAlterEnumBuilderBuildsSQLAlterEnumqueries.SQLAlterTableBuilderBuildsSQLAlterTablequeries.SQLConflictUpdateBuilderA builder for specifying column updates and an optional predicate to be applied to rows that caused unique key conflicts during anINSERT.SQLCreateEnumBuilderBuildsSQLCreateEnumqueries.SQLCreateIndexBuilderBuildsSQLCreateIndexqueries.SQLCreateTableBuilderBuildsSQLCreateTablequeries.SQLCreateTriggerBuilderBuildsSQLCreateTriggerqueries.SQLDeleteBuilderBuildsSQLDeletequeries.SQLDropEnumBuilderBuildsSQLDropEnumqueries.SQLDropIndexBuilderBuildsSQLDropIndexqueries.SQLDropTableBuilderBuildsSQLDropTablequeries.SQLDropTriggerBuilderBuildsSQLDropTriggerqueries.SQLPredicateGroupBuilderNestedSQLPredicateBuilderfor building expression groups.SQLRawBuilderBuilds raw SQL queries.SQLReturningResultBuilderA builder returned from the methods ofSQLReturningBuilder; this builder wraps the original builder with one which providesSQLQueryFetcherconformance. As such, thereturning(_:)methods must always be the last ones in any call chain.