Repository: launchbadge/sqlx
File: sqlx-core/src/postgres/options/mod.rs (Rust)

Code before:
    /// Sets the capacity of the connection's statement cache in a number of stored
    /// distinct statements. Caching is handled using LRU, meaning when the
    /// amount of queries hits the defined limit, the oldest statement will get
    /// dropped.
    ///
    /// The default cache capacity is 100 statements.
    pub fn statement_cache_capacity(mut self, capacity: usize) -> Self {
        self.statement_cache_capacity = capacity;
        self
    }

    /// Sets the application name. Defaults to None
    ///
    /// # Example
    ///
    /// ```rust
    /// # use sqlx_core::postgres::PgConnectOptions;
    /// let options = PgConnectOptions::new()
    ///     .application_name("my-app");
    /// ```
    pub fn application_name(mut self, application_name: &str) -> Self {
        self.application_name = Some(application_name.to_owned());
        self
    }

    /// Sets the extra options. Defaults to None
    ///
    /// # Example
    ///
    /// ```rust
    /// # use sqlx_core::postgres::PgConnectOptions;
    /// let options = PgConnectOptions::new()
    ///     .options([("geqo", "off"), ("statement_timeout", "5min")]);
    /// ```
    pub fn options<K, V, I>(mut self, options: I) -> Self
    where
        K: ToString,
        V: ToString,
        I: IntoIterator<Item = (K, V)>,
    {
        let mut options_str = String::new();
        for (k, v) in options {
            options_str += &format!("-c {}={}", k.to_string(), v.to_string());
        }
        if let Some(ref mut v) = self.options {
            v.push(' ');
            v.push_str(&options_str);
        } else {
            self.options = Some(options_str);
        }
        self

Review comment (suggestion):
```suggestion
    /// Set additional startup options for the connection as a list of key-value pairs. 
    /// 
    /// Possible options are documented in the [PostgreSQL Manual, Chapter 20: Server Configuration](https://www.postgresql.org/docs/current/runtime-config.html).
    ///
    /// You can also set the options string manually via the `PGOPTIONS` environment variable
    /// similar to what's shown with `psql` here: [PostgreSQL Manual, Section 20.1: Setting Parameters](https://www.postgresql.org/docs/current/config-setting.html#id-1.6.7.4.5
```

Code after:

    /// Sets the capacity of the connection's statement cache in a number of stored
    /// distinct statements. Caching is handled using LRU, meaning when the
    /// amount of queries hits the defined limit, the oldest statement will get
    /// dropped.
    ///
    /// The default cache capacity is 100 statements.
    pub fn statement_cache_capacity(mut self, capacity: usize) -> Self {
        self.statement_cache_capacity = capacity;
        self
    }

    /// Sets the application name. Defaults to None
    ///
    /// # Example
    ///
    /// ```rust
    /// # use sqlx_core::postgres::PgConnectOptions;
    /// let options = PgConnectOptions::new()
    ///     .application_name("my-app");
    /// ```
    pub fn application_name(mut self, application_name: &str) -> Self {
        self.application_name = Some(application_name.to_owned());
        self
    }

    /// Set additional startup options for the connection as a list of key-value pairs.
    ///
    /// # Example
    ///
    /// ```rust
    /// # use sqlx_core::postgres::PgConnectOptions;
    /// let options = PgConnectOptions::new()
    ///     .options([("geqo", "off"), ("statement_timeout", "5min")]);
    /// ```
    pub fn options<K, V, I>(mut self, options: I) -> Self
    where
        K: Display,
        V: Display,
        I: IntoIterator<Item = (K, V)>,
    {
        let mut options_str = String::new();
        for (k, v) in options {
            options_str += &format!("-c {}={}", k, v);
        }
        if let Some(ref mut v) = self.options {
            v.push(' ');
            v.push_str(&options_str);
        } else {
            self.options = Some(options_str);
        }