Repository: diesel-rs/diesel
File: diesel/src/pg/expression/operators.rs (Rust)

Code before:
infix_operator!(IsContainedBy, " <@ ", backend: Pg);
infix_operator!(ILike, " ILIKE ", backend: Pg);
infix_operator!(NotILike, " NOT ILIKE ", backend: Pg);
infix_operator!(SimilarTo, " SIMILAR TO ", backend: Pg);
infix_operator!(NotSimilarTo, " NOT SIMILAR TO ", backend: Pg);
postfix_operator!(NullsFirst, " NULLS FIRST", NotSelectable, backend: Pg);
postfix_operator!(NullsLast, " NULLS LAST", NotSelectable, backend: Pg);
infix_operator!(ContainsNet, " >> ", backend: Pg);
infix_operator!(ContainsNetLoose, " >>= ", backend: Pg);
infix_operator!(IsContainedByNet, " << ", backend: Pg);
infix_operator!(IsContainedByNetLoose, " <<= ", backend: Pg);
infix_operator!(AndNet, " & ", Inet, backend: Pg);
infix_operator!(OrNet, " | ", Inet, backend: Pg);
infix_operator!(DifferenceNet, " - ", Bigint, backend: Pg);
infix_operator!(ConcatJsonb, " || ", Jsonb, backend: Pg);
infix_operator!(HasKeyJsonb, " ? ", backend: Pg);
infix_operator!(HasAnyKeyJsonb, " ?| ", backend: Pg);
infix_operator!(HasAllKeysJsonb, " ?& ", backend: Pg);
infix_operator!(ContainsJsonb, " @> ", backend: Pg);
infix_operator!(IsContainedByJsonb, " <@ ", backend: Pg);

#[derive(Debug, Clone, Copy, QueryId, DieselNumericOps, ValidGrouping)]
#[doc(hidden)]
pub struct ArrayIndex<L, R> {
    pub(crate) left: L,
    pub(crate) right: R,
}

impl<L, R> ArrayIndex<L, R> {
    pub fn new(left: L, right: R) -> Self {
        Self { left, right }
    }
}

impl<L, R, ST> crate::expression::Expression for ArrayIndex<L, R>
where
    L: crate::expression::Expression<SqlType = Array<ST>>,
    R: crate::expression::Expression<SqlType = Integer>,
    ST: SqlType + TypedExpressionType,
{
    type SqlType = ST;
}

impl_selectable_expression!(ArrayIndex<L, R>);

impl<L, R> QueryFragment<Pg> for ArrayIndex<L, R>
where
    L: QueryFragment<Pg>,
    R: QueryFragment<Pg>,
{
    fn walk_ast<'b>(

Review comment (suggestion):
I would prefer other names than `left` and `right` here.

```suggestion
    pub(crate) array_expr: L,
    pub(crate) index_expr: R,
```

Code after:
infix_operator!(IsContainedBy, " <@ ", backend: Pg);
infix_operator!(ILike, " ILIKE ", backend: Pg);
infix_operator!(NotILike, " NOT ILIKE ", backend: Pg);
infix_operator!(SimilarTo, " SIMILAR TO ", backend: Pg);
infix_operator!(NotSimilarTo, " NOT SIMILAR TO ", backend: Pg);
postfix_operator!(NullsFirst, " NULLS FIRST", NotSelectable, backend: Pg);
postfix_operator!(NullsLast, " NULLS LAST", NotSelectable, backend: Pg);
infix_operator!(ContainsNet, " >> ", backend: Pg);
infix_operator!(ContainsNetLoose, " >>= ", backend: Pg);
infix_operator!(IsContainedByNet, " << ", backend: Pg);
infix_operator!(IsContainedByNetLoose, " <<= ", backend: Pg);
infix_operator!(AndNet, " & ", Inet, backend: Pg);
infix_operator!(OrNet, " | ", Inet, backend: Pg);
infix_operator!(DifferenceNet, " - ", Bigint, backend: Pg);
infix_operator!(ConcatJsonb, " || ", Jsonb, backend: Pg);
infix_operator!(HasKeyJsonb, " ? ", backend: Pg);
infix_operator!(HasAnyKeyJsonb, " ?| ", backend: Pg);
infix_operator!(HasAllKeysJsonb, " ?& ", backend: Pg);
infix_operator!(ContainsJsonb, " @> ", backend: Pg);
infix_operator!(IsContainedByJsonb, " <@ ", backend: Pg);

#[derive(Debug, Clone, Copy, QueryId, DieselNumericOps, ValidGrouping)]
#[doc(hidden)]
pub struct ArrayIndex<L, R> {
    pub(crate) array_expr: L,
    pub(crate) index_expr: R,
}

impl<L, R> ArrayIndex<L, R> {
    pub fn new(array_expr: L, index_expr: R) -> Self {
        Self {
            array_expr,
            index_expr,
        }
    }
}

impl<L, R, ST> crate::expression::Expression for ArrayIndex<L, R>
where
    L: crate::expression::Expression<SqlType = Array<ST>>,
    R: crate::expression::Expression<SqlType = Integer>,
    ST: SqlType + TypedExpressionType,
{
    type SqlType = ST;
}

impl_selectable_expression!(ArrayIndex<L, R>);

impl<L, R> QueryFragment<Pg> for ArrayIndex<L, R>
where
    L: QueryFragment<Pg>,