RawBuilder
An instance ofRawBuilder can be used to create raw SQL snippets or queries. You shouldn’t need to create RawBuilder instances directly. Instead you should use the sql template tag.
Type Parameters
The output type of the raw SQL expression
Properties
isRawBuilder
Identifier property that’s alwaystrue for RawBuilder instances.
Methods
as
Returns an aliased version of the SQL expression.The alias name for the expression
as "the_alias" to the end of the SQL, this method also provides strict typing.
Example:
$castTo
Change the output type of the raw expression.The new output type
RawBuilder with a new output type.
$notNull
Omit null from the expression’s type.this with a new output type.
withPlugin
Adds a plugin for this SQL snippet.The plugin to add
compile
Compiles the builder to aCompiledQuery.
The query executor provider (typically the Kysely instance)
execute
Executes the raw query.The query executor provider (typically the Kysely instance)
toOperationNode
Converts the builder to an operation node for internal use.Related Types
AliasedRawBuilder
RawBuilder with an alias. The result of calling RawBuilder.as.
The output type of the expression
The alias name
Properties
rawBuilder Returns the underlyingRawBuilder instance.
Usage with the sql template tag
Thesql template tag is the primary way to create RawBuilder instances: