pub fn split_part<'a, V, E, D, N>(
expr: E,
delimiter: D,
n: N,
) -> SQLExpr<'a, V, <V::DialectMarker as DialectTypes>::Text, <<E::Nullable as Nullability>::Or<D::Nullable> as Nullability>::Or<N::Nullable>, <<E::Aggregate as AggregateKind>::Or<D::Aggregate> as AggregateKind>::Or<N::Aggregate>, (E::Sources, (D::Sources, N::Sources))>where
V: SQLParam + 'a,
V::DialectMarker: DialectSupports<PostgresString>,
E: Expr<'a, V>,
E::SQLType: Textual,
D: Expr<'a, V>,
D::SQLType: Textual,
D::Nullable: Nullability,
D::Aggregate: AggregateKind,
N: Expr<'a, V>,
N::SQLType: Integral,
N::Nullable: Nullability,
N::Aggregate: AggregateKind,Expand description
The n-th field of a text value split on delimiter (SPLIT_PART), on PostgreSQL.
Fields are numbered from 1. expr and delimiter must be text and n an
integer. The result is text, nullable if any argument is.
ยงExamples
// The domain part of an email address.
let domain = split_part(users.email, "@", 2);
assert_eq!(domain.sql(), r#"SPLIT_PART ("users"."email", $1, $2)"#);