Module dsl

Module dsl 

Source
Expand description

Includes various helper types and bare functions which are named too generically to be included in prelude, but are often used when using Diesel.

Re-exports§

pub use crate::pg::expression::dsl::*;postgres_backend
pub use crate::sqlite::expression::dsl::*;sqlite

Modules§

frame
Different frame clause specifications for window functions

Structs§

CountStar
DuplicatedKeysmysql_backend
A marker type signaling that the given ON CONFLICT clause uses mysql’s ON DUPLICATE KEY syntax that triggers on all unique constraints
now
Represents the SQL CURRENT_TIMESTAMP constant. This is equivalent to the NOW() function on backends that support it.
today
Represents the SQL CURRENT_DATE constant.

Traits§

FrameBoundDsl
Construct a frame clause for window functions from an integer
FrameClauseDsl
Construct a frame clause for window functions
OnlyDslpostgres_backend
The only method
TablesampleDslpostgres_backend
The tablesample method

Functions§

avg
Represents a SQL AVG function. This function can only take types which are Foldable.
case_when
Creates a SQL CASE WHEN ... END expression
copy_frompostgres_backend
Creates a COPY FROM statement
copy_topostgres_backend
Creates a COPY TO statement
count
Creates a SQL COUNT expression
count_distinctDeprecatedwith-deprecated and non-without-deprecated
count_star
Creates a SQL COUNT(*) expression
cume_dist
Cumulative distribution value
date
Represents the SQL DATE function. The argument should be a Timestamp expression, and the return value will be an expression of type Date.
delete
Creates a DELETE statement.
dense_rank
Rank of current row within its partition, without gaps
exists
Creates a SQL EXISTS expression.
first_value
Value of argument from first row of window frame
insert_into
Creates an INSERT statement for the target table.
insert_or_ignore_into
Creates an INSERT [OR] IGNORE statement.
lag
Value of argument from row lagging current row within partition
lag_with_offset
Value of argument from row lagging current row within partition
lag_with_offset_and_default
Value of argument from row lagging current row within partition
last_value
Value of argument from last row of window frame
lead
Value of argument from row leading current row within partition
lead_with_offset
Value of argument from row leading current row within partition
lead_with_offset_and_default
Value of argument from row leading current row within partition
max
Represents a SQL MAX function. This function can only take types which are ordered.
min
Represents a SQL MIN function. This function can only take types which are ordered.
not
Creates a SQL NOT expression
nth_value
Value of argument from N-th row of window frame
ntile
Bucket number of current row within its partition
percent_rank
Percentage rank value
rank
Rank of current row within its partition, with gaps
replace_into
Creates a REPLACE statement.
row_number
Number of th current row within its partition
select
Creates a bare select statement, with no from clause. Primarily used for testing diesel itself, but likely useful for third party crates as well. The given expressions must be selectable from anywhere.
sql
Use literal SQL in the query builder.
sql_query
Construct a full SQL query using raw SQL.
sum
Represents a SQL SUM function. This function can only take types which are Foldable.
update
Creates an UPDATE statement.

Type Aliases§

Add
The return type of l + r
AggregateAll
Return type of AggregateExpressionMethods::aggregate_all
AggregateDistinct
Return type of AggregateExpressionMethods::aggregate_distinct
AggregateFilter
Return type of AggregateExpressionMethods::aggregate_filter
AggregateOrder
Return type of AggregateExpressionMethods::aggregate_order
AliasedFields
Maps F to Alias<S>
And
The return type of lhs.and(rhs)
AndNetpostgres_backend and sqlite
The return type of lsh.and(rhs) for network types
ArrayContainsDeprecatedpostgres_backend and sqlite
ArrayIndexDeprecatedpostgres_backend and sqlite
AsExpr
The type of Item when converted to an expression with the same type as TargetExpr
AsExprOf
The type of Item when converted to an expression of Type
AsSelect
Represents the return type of .as_select()
Asc
The return type of expr.asc()
AssumeNotNull
The return type of expr.assume_not_null()
AtTimeZonepostgres_backend and sqlite
The return type of expr.at_time_zone(tz)
BareSelectDeprecated
Between
The return type of lhs.between(lower, upper)
Cast
The return type of expr.cast<ST>()
Concat
The return type of lhs.concat(rhs)
ConcatArrayDeprecatedpostgres_backend and sqlite
ConcatBinaryDeprecatedpostgres_backend and sqlite
ConcatJsonbDeprecatedpostgres_backend and sqlite
Containspostgres_backend and sqlite
The return type of lhs.contains(rhs) for array expressions
ContainsJsonbDeprecatedpostgres_backend and sqlite
ContainsNetpostgres_backend and sqlite
The return type of lhs.contains(rhs) for network types
ContainsNetLoosepostgres_backend and sqlite
The return type of lhs.contains_or_eq(rhs)
ContainsOrEqpostgres_backend and sqlite
ContainsRangepostgres_backend and sqlite
The return type of lhs.contains_range(rhs) for range expressions
Count
CountDistinctwith-deprecated and non-without-deprecated
Desc
The return type of expr.desc()
Diffpostgres_backend and sqlite
Differencepostgres_backend and sqlite
The return type of lhs.difference_range(rhs)
DifferenceNetpostgres_backend and sqlite
The return type of lsh.diff(rhs)
DifferenceRangepostgres_backend and sqlite
Distinct
Represents the return type of .distinct()
DistinctOnpostgres_backend
Represents the return type of .distinct_on(expr)
Div
The return type of l / r
Eq
The return type of lhs.eq(rhs)
EqAny
The return type of lhs.eq_any(rhs)
Escape
The return type of lhs.escape('x')
Except
Represents the return type of .except(rhs)
ExceptAll
Represents the return type of .except_all(rhs)
Field
The return type of alias.field(field)
Fields
The return type of alias.fields(fields)
Filter
Represents the return type of .filter(predicate)
Find
Represents the return type of .find(pk)
FindBy
Represents the return type of .filter(lhs.eq(rhs))
Following
Return type of FrameBoundDsl::following
ForKeyShare
Represents the return type of .for_key_share()
ForNoKeyUpdate
Represents the return type of .for_no_key_update()
ForShare
Represents the return type of .for_share()
ForUpdate
Represents the return type of .for_update()
FrameBetween
Return type of FrameClauseDsl::frame_between
FrameBetweenWithExclusion
Return type of FrameClauseDsl::frame_between_with_exclusion
FrameBy
Return type of WindowExpressionMethods::frame_by
FrameStartWith
Return type of FrameClauseDsl::frame_start_with
FrameStartWithExclusion
Return type of FrameClauseDsl::frame_start_with_exclusion
Ge
GreaterThanpostgres_backend and sqlite
GreaterThanRangepostgres_backend and sqlite
The return type of lhs.range_is_contained_by(rhs)
GroupBy
Represents the return type of .group_by(expr)
Gt
The return type of lhs.gt(rhs)
GtEq
The return type of lhs.ge(rhs)
HasAllKeyspostgres_backend and sqlite
HasAllKeysJsonbpostgres_backend and sqlite
The return type of lsh.has_all_keys(rhs)
HasAnyKeypostgres_backend and sqlite
HasAnyKeyJsonbpostgres_backend and sqlite
The return type of lsh.has_any_key(rhs)
HasKeypostgres_backend and sqlite
HasKeyJsonbpostgres_backend and sqlite
The return type of lsh.has_key(rhs)
Having
Represents the return type of .having(predicate)
ILikepostgres_backend and sqlite
The return type of lhs.ilike(rhs)
Ilikepostgres_backend and sqlite
Indexpostgres_backend and sqlite
The return type of lhs.index(rhs)
InnerJoin
Represents the return type of .inner_join(rhs)
InnerJoinOn
Represents the return type of .inner_join(rhs.on(on))
InnerJoinQuerySource
A query source representing the inner join between two tables.
Intersect
Represents the return type of .intersect(rhs)
IntersectAll
Represents the return type of .intersect_all(rhs)
Intersectionpostgres_backend and sqlite
The return type of lhs.intersection_range(rhs)
IntersectionRangepostgres_backend and sqlite
IntoBoxed
Represents the return type of .into_boxed::<'a, DB>()
IntoSql
Represents the return type of .into_sql()
Issqlite and postgres_backend
The return type of lhs.is(rhs).
IsContainedBypostgres_backend and sqlite
The return type of lhs.range_is_contained_by(rhs) and lhs.is_contained_by(rhs)
IsContainedByJsonbDeprecatedpostgres_backend and sqlite
IsContainedByNetpostgres_backend and sqlite
The return type of lhs.is_contained_by(rhs) for network types
IsContainedByNetLoosepostgres_backend and sqlite
The return type of lhs.is_contained_by_or_eq(rhs)
IsContainedByOrEqpostgres_backend and sqlite
IsContainedByRangepostgres_backend and sqlite
The return type of lhs.is_contained_by_range(rhs)
IsDistinctFrompostgres_backend and sqlite
The return type of lhs.is_distinct_from(rhs)
IsJsonpostgres_backend and sqlite
The return type of expr.is_json()
IsJsonArraypostgres_backend and sqlite
The return type of expr.is_json_array()
IsJsonObjectpostgres_backend and sqlite
The return type of expr.is_json_object()
IsJsonScalarpostgres_backend and sqlite
The return type of expr.is_json_scalar()
IsNotsqlite and postgres_backend
The return type of lhs.is_not(rhs).
IsNotDistinctFrompostgres_backend and sqlite
The return type of lhs.is_not_distinct_from(rhs)
IsNotJsonpostgres_backend and sqlite
The return type of expr.is_not_json()
IsNotJsonArraypostgres_backend and sqlite
The return type of expr.is_not_json_array()
IsNotJsonObjectpostgres_backend and sqlite
The return type of expr.is_not_json_object()
IsNotJsonScalarpostgres_backend and sqlite
The return type of expr.is_not_json_scalar()
IsNotNull
The return type of expr.is_not_null()
IsNull
The return type of expr.is_null()
Le
LeftJoin
Represents the return type of .left_join(rhs)
LeftJoinOn
Represents the return type of .left_join(rhs.on(on))
LeftJoinQuerySource
A query source representing the left outer join between two tables.
LesserThanpostgres_backend and sqlite
LesserThanRangepostgres_backend and sqlite
The return type of lhs.range_is_contained_by(rhs)
Like
The return type of lhs.like(rhs)
LikeBinaryDeprecatedpostgres_backend and sqlite
Limit
Represents the return type of .limit()
LoadIterDeprecatedwith-deprecated and non-without-deprecated
Lt
The return type of lhs.lt(rhs)
LtEq
The return type of lhs.le(rhs)
Mul
The return type of l * r
Ne
NeAll
NeAny
The return type of lhs.ne_all(rhs)
NoWait
Represents the return type of .no_wait()
NotBetween
The return type of lhs.not_between(lower, upper)
NotEq
The return type of lhs.ne(rhs)
NotILikepostgres_backend and sqlite
The return type of lhs.not_ilike(rhs)
NotIlikepostgres_backend and sqlite
NotLike
The return type of lhs.not_like(rhs)
NotLikeBinaryDeprecatedpostgres_backend and sqlite
NotSimilarTopostgres_backend and sqlite
The return type of lhs.not_similar_to(rhs)
Nullable
The return type of expr.nullable()
NullableSelect
Represents the return type of .nullable()
NullsFirstpostgres_backend and sqlite
The return type of expr.nulls_first()
NullsLastpostgres_backend and sqlite
The return type of expr.nulls_last()
Offset
Represents the return type of .offset()
On
Represents the return type of rhs.on(on)
Or
The return type of lhs.or(rhs)
OrFilter
Represents the return type of .or_filter(predicate)
OrNetpostgres_backend and sqlite
The return type of lsh.or(rhs) for network types
Order
Represents the return type of .order(ordering)
OrderBy
Represents the return type of .order_by(ordering)
Otherwise
The return type of case_when(...).otherwise(...)
Over
Return type of WindowExpressionMethods::over
OverlapsWithpostgres_backend and sqlite
The return type of lhs.overlaps_with(rhs) and lhs.overlaps_with(rhs)
OverlapsWithNetpostgres_backend and sqlite
The return type of lhs.overlaps_with(rhs) for network types
PartitionBy
Return type of WindowExpressionMethods::partition_by
Preceding
Return type of FrameBoundDsl::preceding
RangeAdjacentpostgres_backend and sqlite
The return type of lhs.range_adjacent(rhs)
RangeContainspostgres_backend and sqlite
The return type of lhs.contains(rhs) for range expressions
RangeExtendsLeftTopostgres_backend and sqlite
The return type of lhs.range_extends_left_to(rhs) for range expressions
RangeExtendsRightTopostgres_backend and sqlite
The return type of lhs.range_extends_right_to(rhs) for range expressions
Removepostgres_backend and sqlite
RemoveByPathpostgres_backend and sqlite
RemoveByPathFromJsonbpostgres_backend and sqlite
The return type of lhs.remove_by_path(rhs)
RemoveFromJsonbpostgres_backend and sqlite
The return type of lhs.remove(rhs)
RetrieveAsObjectpostgres_backend and sqlite
The return type of lhs.retrieve_as_object(rhs)
RetrieveAsObjectJsonpostgres_backend and sqlite
RetrieveAsObjectSqlitesqlite and postgres_backend
The return type of lhs.retrieve_as_object(rhs)
RetrieveAsTextpostgres_backend or sqlite
The return type of lhs.retrieve_as_text(rhs)
RetrieveAsTextJsonpostgres_backend and sqlite
RetrieveByPathAsObjectpostgres_backend and sqlite
RetrieveByPathAsObjectJsonpostgres_backend and sqlite
The return type of lhs.retrieve_by_path_as_object(rhs)
RetrieveByPathAsTextpostgres_backend and sqlite
RetrieveByPathAsTextJsonpostgres_backend and sqlite
The return type of lhs.retrieve_by_path_as_text(rhs)
Returning
Represents the return type of InsertStatement::returning, UpdateStatement::returning and DeleteStatement::returning
Select
Represents the return type of .select(selection)
Set
Represents the return type of UpdateStatement::set()
SimilarTopostgres_backend and sqlite
The return type of lhs.similar_to(rhs)
SingleValue
Represents the return type of .single_value()
SkipLocked
Represents the return type of .skip_locked()
SqlTypeOf
The SQL type of an expression
Sub
The return type of l - r
ThenOrderBy
Represents the return type of .then_order_by(ordering)
Union
Represents the return type of .union(rhs)
UnionAll
Represents the return type of .union_all(rhs)
UnionRangepostgres_backend and sqlite
The return type of lhs.union_range(rhs)
Update
Represents the return type of update(lhs).set(rhs)
Values
Represents the return type of IncompleteInsertStatement::values()
When
The return type of case_when(...).when(...)
WindowFilter
Return type of WindowExpressionMethods::window_filter
WindowOrder
Return type of WindowExpressionMethods::window_order
abbrev
Return type of the abbrev() SQL function.
array_append
Return type of the array_append() SQL function.
array_cat
Return type of the array_cat() SQL function.
array_dims
Return type of the array_dims() SQL function.
array_fill
Return type of the array_fill() SQL function.
array_fill_with_lower_bound
Return type of the array_fill_with_lower_bound() SQL function.
array_length
Return type of the array_length() SQL function.
array_lower
Return type of the array_lower() SQL function.
array_ndims
Return type of the array_ndims() SQL function.
array_position
Return type of the array_position() SQL function.
array_position_with_subscript
Return type of the array_position_with_subscript() SQL function.
array_positions
Return type of the array_positions() SQL function.
array_prepend
Return type of the array_prepend() SQL function.
array_remove
Return type of the array_remove() SQL function.
array_replace
Return type of the array_replace() SQL function.
array_sample
Return type of the array_sample() SQL function.
array_shuffle
Return type of the array_shuffle() SQL function.
array_to_json
Return type of the array_to_json() SQL function.
array_to_string
Return type of the array_to_string() SQL function.
array_to_string_with_null_string
Return type of the array_to_string_with_null_string() SQL function.
array_upper
Return type of the array_upper() SQL function.
avg
The return type of avg(expr)
broadcast
Return type of the broadcast() SQL function.
cardinality
Return type of the cardinality() SQL function.
case_when
The return type of case_when()
count
The return type of count(expr)
count_distinctDeprecatedwith-deprecated and non-without-deprecated
count_star
The return type of count_star()
cume_dist
The return type of cume_dist()
date
The return type of date(expr)
daterange
Return type of the daterange() SQL function.
delete
Represents the return type of diesel::delete
dense_rank
The return type of dense_rank()
exists
The return type of exists(expr)
family
Return type of the family() SQL function.
first_value
The return type of first_value(expr)
host
Return type of the host() SQL function.
hostmask
Return type of the hostmask() SQL function.
inet_merge
Return type of the inet_merge() SQL function.
inet_same_family
Return type of the inet_same_family() SQL function.
insert_into
Represents the return type of diesel::insert_into
insert_or_ignore_into
Represents the return type of diesel::insert_or_ignore_into
int4range
Return type of the int4range() SQL function.
int8range
Return type of the int8range() SQL function.
isempty
Return type of the isempty() SQL function.
json
Return type of the json() SQL function.
json_array_0
Return type of the json_array_0() SQL function.
json_array_1
Return type of the json_array_1() SQL function.
json_array_2
Return type of the json_array_2() SQL function.
json_array_length
Return type of the json_array_length() SQL function.
json_array_length_with_path
Return type of the json_array_length_with_path() SQL function.
json_build_array_0
Return type of the json_build_array_0() SQL function.
json_build_array_1
Return type of the json_build_array_1() SQL function.
json_build_array_2
Return type of the json_build_array_2() SQL function.
json_error_position
Return type of the json_error_position() SQL function.
json_extract_path_1
Return type of the json_extract_path_1() SQL function.
json_extract_path_2
Return type of the json_extract_path_2() SQL function.
json_group_array
Return type of the json_group_array() SQL function.
json_group_object
Return type of the json_group_object() SQL function.
json_object
Return type of the json_object() SQL function.
json_object_0
Return type of the json_object_0() SQL function.
json_object_1
Return type of the json_object_1() SQL function.
json_object_2
Return type of the json_object_2() SQL function.
json_object_with_keys_and_values
Return type of the json_object_with_keys_and_values() SQL function.
json_patch
Return type of the json_patch() SQL function.
json_populate_record
Return type of the json_populate_record() SQL function.
json_pretty
Return type of the json_pretty() SQL function.
json_pretty_with_indentation
Return type of the json_pretty_with_indentation() SQL function.
json_quote
Return type of the json_quote() SQL function.
json_remove_0
Return type of the json_remove_0() SQL function.
json_remove_1
Return type of the json_remove_1() SQL function.
json_remove_2
Return type of the json_remove_2() SQL function.
json_strip_nulls
Return type of the json_strip_nulls() SQL function.
json_type
Return type of the json_type() SQL function.
json_type_with_path
Return type of the json_type_with_path() SQL function.
json_typeof
Return type of the json_typeof() SQL function.
json_valid
Return type of the json_valid() SQL function.
json_valid_with_flags
Return type of the json_valid_with_flags() SQL function.
jsonb
Return type of the jsonb() SQL function.
jsonb_array_0
Return type of the jsonb_array_0() SQL function.
jsonb_array_1
Return type of the jsonb_array_1() SQL function.
jsonb_array_2
Return type of the jsonb_array_2() SQL function.
jsonb_array_length
Return type of the jsonb_array_length() SQL function.
jsonb_build_array_0
Return type of the jsonb_build_array_0() SQL function.
jsonb_build_array_1
Return type of the jsonb_build_array_1() SQL function.
jsonb_build_array_2
Return type of the jsonb_build_array_2() SQL function.
jsonb_extract_path_1
Return type of the jsonb_extract_path_1() SQL function.
jsonb_extract_path_2
Return type of the jsonb_extract_path_2() SQL function.
jsonb_group_array
Return type of the jsonb_group_array() SQL function.
jsonb_group_object
Return type of the jsonb_group_object() SQL function.
jsonb_insert
Return type of the jsonb_insert() SQL function.
jsonb_insert_with_insert_after
Return type of the jsonb_insert_with_insert_after() SQL function.
jsonb_object
Return type of the jsonb_object() SQL function.
jsonb_object_0
Return type of the jsonb_object_0() SQL function.
jsonb_object_1
Return type of the jsonb_object_1() SQL function.
jsonb_object_2
Return type of the jsonb_object_2() SQL function.
jsonb_object_with_keys_and_values
Return type of the jsonb_object_with_keys_and_values() SQL function.
jsonb_patch
Return type of the jsonb_patch() SQL function.
jsonb_populate_record
Return type of the jsonb_populate_record() SQL function.
jsonb_pretty
Return type of the jsonb_pretty() SQL function.
jsonb_remove_0
Return type of the jsonb_remove_0() SQL function.
jsonb_remove_1
Return type of the jsonb_remove_1() SQL function.
jsonb_remove_2
Return type of the jsonb_remove_2() SQL function.
jsonb_set
Return type of the jsonb_set() SQL function.
jsonb_set_create_if_missing
Return type of the jsonb_set_create_if_missing() SQL function.
jsonb_set_lax
Return type of the jsonb_set_lax() SQL function.
jsonb_strip_nulls
Return type of the jsonb_strip_nulls() SQL function.
jsonb_typeof
Return type of the jsonb_typeof() SQL function.
lag
The return type of lag(expr)
lag_with_offset
The return type of lag_with_offset(expr, offset)
lag_with_offset_and_default
The return type of lag_with_offset_and_default(expr, offset)
last_value
The return type of last_value(expr)
lead
The return type of lead(expr)
lead_with_offset
The return type of lead_with_offset(expr, offset)
lead_with_offset_and_default
The return type of lead_with_offset_and_default(expr, offset)
lower
Return type of the lower() SQL function.
lower_inc
Return type of the lower_inc() SQL function.
lower_inf
Return type of the lower_inf() SQL function.
masklen
Return type of the masklen() SQL function.
max
The return type of max(expr)
min
The return type of min(expr)
multirange_merge
Return type of the multirange_merge() SQL function.
netmask
Return type of the netmask() SQL function.
network
Return type of the network() SQL function.
not
The return type of not(expr)
nth_value
The return type of nth_value(expr, n)
ntile
The return type of ntile()
numrange
Return type of the numrange() SQL function.
percent_rank
The return type of percent_rank()
range_merge
Return type of the range_merge() SQL function.
rank
The return type of rank()
replace_into
Represents the return type of diesel::replace_into
row_number
The return type of row_number()
row_to_json
Return type of the row_to_json() SQL function.
select
Represents the return type of diesel::select(selection)
set_masklen
Return type of the set_masklen() SQL function.
sum
The return type of sum(expr)
to_json
Return type of the to_json() SQL function.
to_jsonb
Return type of the to_jsonb() SQL function.
trim_array
Return type of the trim_array() SQL function.
tsrange
Return type of the tsrange() SQL function.
tstzrange
Return type of the tstzrange() SQL function.
update
Represents the return type of diesel::update
upper
Return type of the upper() SQL function.
upper_inc
Return type of the upper_inc() SQL function.
upper_inf
Return type of the upper_inf() SQL function.

Attribute Macros§

auto_type
Automatically annotates return type of a query fragment function