Available on crate feature
postgres_backend
only.Expand description
PostgreSQL specific expression DSL methods.
This module will be glob imported by
diesel::dsl
when compiled with the feature = "postgres"
flag.
Traits§
- Interval
Dsl - A DSL added to integers and
f64
to construct PostgreSQL intervals. - Into
Array Expression - Trait for types which can be converted into an expression of type
Array
- OnlyDsl
- The
only
method - Tablesample
Dsl - The
tablesample
method
Functions§
- abbrev
- Creates an abbreviated display format as text.
- all
Deprecated with-deprecated
and non-without-deprecated
- Creates a PostgreSQL
ALL
expression. - any
Deprecated with-deprecated
and non-without-deprecated
- Creates a PostgreSQL
ANY
expression. - array
- Creates an
ARRAY[e1, e2, ...]
orARRAY(subselect)
expression. - array_
append - Append an element to the end of an array
- array_
cat - Concatenates two arrays
- array_
dims - Returns a text representation of the array’s dimensions
- array_
fill - Returns an array initialized with supplied value and dimensions, optionally with lower bounds other than 1. This function omits the optional lower bound argument. See array_fill_with_lower_bound for that.
- array_
fill_ with_ lower_ bound - Returns an array initialized with supplied value and dimensions, with lower bounds other than 1
- array_
length - Returns the length of the requested array
- array_
lower - Returns the lower bound of the requested array
- array_
ndims - Returns the number of dimensions of the array
- array_
position - Returns the subscript of the first occurrence of the second argument in the array, or NULL if it’s not present. If the third argument is given, the search begins at that subscript. This function omits the third argument. See array_position_with_subscript.
- array_
position_ with_ subscript - Returns the subscript of the first occurrence of the second argument in the array, or NULL if it’s not present, beginning at the subscript given as the third argument.
- array_
positions - Returns an array of the subscripts of all occurrences of the second argument in the array given as first argument.
- array_
prepend - Prepends an element to the beginning of an array
- array_
remove - Removes all elements equal to the given value from the array
- array_
replace - Replace all occurrences of an element in an array with a given element
- array_
sample - Returns an array of n items randomly selected from array. n may not exceed the length of the array.
- array_
shuffle - Randomly shuffles the first dimension of the array.
- array_
to_ json - Converts any Array to json.
- array_
to_ string - Converts each array element to its text representation and concatenates those elements
separated by the delimiter string.
NULL
entries are omitted in this variant. See array_to_string_with_null_string for a variant with that argument. - array_
to_ string_ with_ null_ string - Converts each array element to its text representation and concatenates those elements
separated by the delimiter string. If
null_string
is provided and is notNULL
, thenNULL
array entries are represented by that string; otherwise, they are omitted. - array_
upper - Returns the upper bound of the requested array
- broadcast
- Computes the broadcast address for the address’s network.
- cardinality
- Returns the total number of elements in the array, or 0 if the array is empty.
- daterange
- Returns range of dates
- family
- Returns the address’s family: 4 for IPv4, 6 for IPv6.
- host
- Returns the IP address as text, ignoring the netmask.
- hostmask
- Computes the host mask for the address’s network.
- inet_
merge - Computes the smallest network that includes both of the given networks.
- inet_
same_ family - Tests whether the addresses belong to the same IP family.
- int4range
- Returns range of integer
- int8range
- Returns range of big ints
- isempty
- Returns true if the range is empty
- json_
array_ length - Returns the number of elements in the top-level JSON array
- json_
object - Builds a JSON object out of a text array. The array must have an even number of members, in which case they are taken as alternating key/value pairs
- json_
object_ with_ keys_ and_ values - This form of json_object takes keys and values pairwise from two separate arrays. In all other respects it is identical to the one-argument form.
- json_
populate_ record - This function
json_populate_record
takes a Record base and Json as an input and converts it to top-level JSON object to a row having the composite type of the base argument. - json_
strip_ nulls - Deletes all object fields that have null values from the given JSON value, recursively.
- json_
typeof - Returns the type of the top-level json value as a text-string
- jsonb_
array_ length - Returns the number of elements in the top-level JSON array
- jsonb_
insert - Returns target with
new_value
inserted intobase
. - jsonb_
insert_ with_ insert_ after - Returns target with
new_value
inserted intobase
. - jsonb_
object - Builds a JSON object out of a text array. The array must have an even number of members, in which case they are taken as alternating key/value pairs. This function also has a form that that takes keys and values as separate text array arguments. See jsonb_object_with_keys_and_values
- jsonb_
object_ with_ keys_ and_ values - This form of jsonb_object takes keys and values pairwise from two separate arrays. In all other respects it is identical to the one-argument form.
- jsonb_
populate_ record - This function
jsonb_populate_record
takes a Record base and Jsonb as an input and converts it to top-level JSON object to a row having the composite type of the base argument. - jsonb_
pretty - Converts the given json value to pretty-printed, indented text
- jsonb_
set - Returns target with the item designated by path replaced by new_value, or with new_value added and the item designated by path does not exist.
- jsonb_
set_ create_ if_ missing - Returns target with the item designated by path replaced by new_value, or with new_value added if create_if_missing is true (which is the default) and the item designated by path does not exist.
- jsonb_
set_ lax - Returns target with the item designated by path replaced by new_value, or with new_value added and the item designated by path does not exist.
- jsonb_
strip_ nulls - Deletes all object fields that have null values from the given JSON value, recursively.
- jsonb_
typeof - Returns the type of the top-level jsonb value as a text-string
- lower
- Returns the lower bound of the range
- lower_
inc - Returns true if the range’s lower bound is inclusive
- lower_
inf - Returns true if the range’s lower bound is unbounded
- masklen
- Returns the netmask length in bits.
- multirange_
merge - Returns the smallest range which includes all ranges in the multirange
- netmask
- Computes the network mask for the address’s network.
- network
- Returns the network part of the address, zeroing out whatever is to the right of the netmask. (This is equivalent to casting the value to cidr.)
- numrange
- Returns range of numeric values
- range_
merge - Returns the smallest range which includes both of the given ranges
- row_
to_ json - This function
row_to_json
takes a Record type as an input and converts it to JSON. - set_
masklen - Sets the netmask length for an inet or cidr value. For inet, the address part does not changes. For cidr, address bits to the right of the new netmask are set to zero.
- to_json
- Converts any SQL value to json
- to_
jsonb - Converts any SQL value to jsonb
- trim_
array - Trims an array by removing the last n elements. If the array is multidimensional, only the first dimension is trimmed.
- tsrange
- Returns range of timestamps without timezone
- tstzrange
- Returns range of timestamps with timezone
- upper
- Returns the upper bound of the range
- upper_
inc - Returns true if the range’s upper bound is inclusive
- upper_
inf - Returns true if the range’s upper bound is unbounded
Type Aliases§
- abbrev
- The return type of
abbrev()
- array
- Return type of
array(tuple_or_subselect)
- array_
append - The return type of
array_append()
- array_
cat - The return type of
array_cat()
- array_
dims - The return type of
array_dims()
- array_
fill - The return type of
array_fill()
- array_
fill_ with_ lower_ bound - The return type of
array_fill_with_lower_bound()
- array_
length - The return type of
array_length()
- array_
lower - The return type of
array_lower()
- array_
ndims - The return type of
array_ndims()
- array_
position - The return type of
array_position()
- array_
position_ with_ subscript - The return type of
array_position_with_subscript()
- array_
positions - The return type of
array_positions()
- array_
prepend - The return type of
array_prepend()
- array_
remove - The return type of
array_remove()
- array_
replace - The return type of
array_replace()
- array_
sample - The return type of
array_sample()
- array_
shuffle - The return type of
array_shuffle()
- array_
to_ json - The return type of
array_to_json()
- array_
to_ string - The return type of
array_to_string()
- array_
to_ string_ with_ null_ string - The return type of
array_to_string_with_null_string()
- array_
upper - The return type of
array_upper()
- broadcast
- The return type of
broadcast()
- cardinality
- The return type of
cardinality()
- daterange
- The return type of
daterange()
- family
- The return type of
family()
- host
- The return type of
host()
- hostmask
- The return type of
hostmask()
- inet_
merge - The return type of
inet_merge()
- inet_
same_ family - The return type of
inet_same_family()
- int4range
- The return type of
int4range()
- int8range
- The return type of
int8range()
- isempty
- The return type of
isempty()
- json_
array_ length - The return type of
json_array_length()
- json_
object - The return type of
json_object()
- json_
object_ with_ keys_ and_ values - The return type of
json_object_with_keys_and_values()
- json_
populate_ record - The return type of
json_populate_record()
- json_
strip_ nulls - The return type of
json_strip_nulls()
- json_
typeof - The return type of
json_typeof()
- jsonb_
array_ length - The return type of
jsonb_array_length()
- jsonb_
insert - The return type of
jsonb_insert()
- jsonb_
insert_ with_ insert_ after - The return type of
jsonb_insert_with_insert_after()
- jsonb_
object - The return type of
jsonb_object()
- jsonb_
object_ with_ keys_ and_ values - The return type of
jsonb_object_with_keys_and_values()
- jsonb_
populate_ record - The return type of
jsonb_populate_record()
- jsonb_
pretty - The return type of
jsonb_pretty()
- jsonb_
set - The return type of
jsonb_set()
- jsonb_
set_ create_ if_ missing - The return type of
jsonb_set_create_if_missing()
- jsonb_
set_ lax - The return type of
jsonb_set_lax()
- jsonb_
strip_ nulls - The return type of
jsonb_strip_nulls()
- jsonb_
typeof - The return type of
jsonb_typeof()
- lower
- The return type of
lower()
- lower_
inc - The return type of
lower_inc()
- lower_
inf - The return type of
lower_inf()
- masklen
- The return type of
masklen()
- multirange_
merge - The return type of
multirange_merge()
- netmask
- The return type of
netmask()
- network
- The return type of
network()
- numrange
- The return type of
numrange()
- range_
merge - The return type of
range_merge()
- row_
to_ json - The return type of
row_to_json()
- set_
masklen - The return type of
set_masklen()
- to_json
- The return type of
to_json()
- to_
jsonb - The return type of
to_jsonb()
- trim_
array - The return type of
trim_array()
- tsrange
- The return type of
tsrange()
- tstzrange
- The return type of
tstzrange()
- upper
- The return type of
upper()
- upper_
inc - The return type of
upper_inc()
- upper_
inf - The return type of
upper_inf()