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

Code before:
    ///     .values(&vec![
    ///         tags.eq(vec!["cool", "awesome"]),
    ///         tags.eq(vec!["splendid", "marvellous"]),
    ///    ])
    ///     .execute(conn)?;
    ///
    /// let data = posts.select(tags.index(id))
    ///     .load::<String>(conn)?;
    /// assert_eq!(vec!["cool", "marvellous"], data);
    ///
    /// let data = posts.select(id)
    ///     .filter(tags.index(1).eq("splendid"))
    ///     .load::<i32>(conn)?;
    /// assert_eq!(vec![2], data);
    /// #     Ok(())
    /// # }
    /// ```
    fn index<T>(self, other: T) -> dsl::ArrayIndex<Self, T>
    where
        Self::SqlType: SqlType,
        T: AsExpression<Integer>,
    {
        ArrayIndex::new(self, other.as_expression())
    }

    /// Concatenates two PostgreSQL Arrays using the `||` operator.
    ///
    /// # Example
    ///
    /// ```rust
    /// # include!("../../doctest_setup.rs");
    /// #
    /// # table! {
    /// #     posts {
    /// #         id -> Integer,
    /// #         tags -> Array<VarChar>,
    /// #     }
    /// # }
    /// #
    /// # fn main() {
    /// #     run_test().unwrap();
    /// # }
    /// #
    /// # fn run_test() -> QueryResult<()> {
    /// #     use self::posts::dsl::*;
    /// #     let conn = &mut establish_connection();
    /// #     diesel::sql_query("DROP TABLE IF EXISTS posts").execute(conn).unwrap();
    /// #     diesel::sql_query("CREATE TABLE posts (id SERIAL PRIMARY KEY, tags TEXT[] NOT NULL)")
    /// #         .execute(conn)
    /// #         .unwrap();
    /// #

Review comment (suggestion):
Please follow the same pattern of documentation from other methods for this description. `contains` is a good example.

Code after:
    ///     .values(&vec![
    ///         tags.eq(vec!["cool", "awesome"]),
    ///         tags.eq(vec!["splendid", "marvellous"]),
    ///    ])
    ///     .execute(conn)?;
    ///
    /// let data = posts.select(tags.index(id))
    ///     .load::<String>(conn)?;
    /// assert_eq!(vec!["cool", "marvellous"], data);
    ///
    /// let data = posts.select(id)
    ///     .filter(tags.index(1).eq("splendid"))
    ///     .load::<i32>(conn)?;
    /// assert_eq!(vec![2], data);
    /// #     Ok(())
    /// # }
    /// ```
    fn index<T>(self, other: T) -> dsl::ArrayIndex<Self, T>
    where
        Self::SqlType: SqlType,
        T: AsExpression<Integer>,
    {
        ArrayIndex::new(self, other.as_expression())
    }

    /// Creates a PostgreSQL `||` expression.
    ///
    /// This operator concatenates two Array values and returns Array value
    ///
    /// # Example
    ///
    /// ```rust
    /// # include!("../../doctest_setup.rs");
    /// #
    /// # table! {
    /// #     posts {
    /// #         id -> Integer,
    /// #         tags -> Array<VarChar>,
    /// #     }
    /// # }
    /// #
    /// # fn main() {
    /// #     run_test().unwrap();
    /// # }
    /// #
    /// # fn run_test() -> QueryResult<()> {
    /// #     use self::posts::dsl::*;
    /// #     let conn = &mut establish_connection();
    /// #     diesel::sql_query("DROP TABLE IF EXISTS posts").execute(conn).unwrap();
    /// #     diesel::sql_query("CREATE TABLE posts (id SERIAL PRIMARY KEY, tags TEXT[] NOT NULL)")
    /// #         .execute(conn)