title: How to represent array of strings column in Rust sqlx
body: <p>I have a table called <code>product</code>; one of the columns called <code>tags</code> is JSONB type and essentially contains an array of strings. Each product in the table has various amounts of tags. Some can be 0 some can be 40. I've created a <code>struct</code> in Rust to best represent the table structure and I have some conflicts with the sqlx JSON types for that column. The structs are:</p>
  <pre><code>#[derive(Deserialize)]
  pub struct Product {
      pub id: i32,
      pub product_id: i64,
      pub title: String,
      pub handle: Option&lt;String&gt;,
      pub tags: Vec&lt;String&gt;,
      pub product_type: Option&lt;String&gt;,
      pub image_url: String,
      pub created_at: String,
      pub updatedAt: String,
  }
  
  #[derive(Deserialize)]
  pub struct ProductPatch {
      pub product_id: i64,
      pub title: String,
      pub handle: Option&lt;String&gt;,
      pub tags: Vec&lt;String&gt;,
      pub product_type: Option&lt;String&gt;,
      pub image_url: String,
  }
  </code></pre>
  <p>And my <code>add_product</code> function using that struct:</p>
  <pre><code>async fn add_product(
      pool: &amp;Db,
      product: ProductPatch,
  ) -&gt; Result&lt;ProductPatch, sqlx::postgres::PgDatabaseError&gt; {
      let rec = sqlx::query_as!(
          ProductPatch,
          r#&quot;--sql
          INSERT INTO products (product_id, title, handle, tags, product_type, image_url)
          VALUES ($1, $2, $3, $4, $5, $6)
          RETURNING product_id, title, handle, tags, product_type, image_url
          &quot;#,
          &amp;product.product_id,
          &amp;product.title,
          &amp;product.handle.unwrap(),
          &amp;product.tags,
          &amp;product.product_type.unwrap(),
          &amp;product.image_url
      )
      .fetch_one(&amp;pool.clone())
      .await;
  
      Ok(rec.unwrap())
  }
  </code></pre>
  <p>The error I'm dealing with is</p>
  <blockquote>
  <p>expected struct <code>Vec&lt;std::string::String&gt;</code>
  found enum <code>std::option::Option&lt;JsonValue&gt;</code>rustcE0308</p>
  </blockquote>
  <p>Should I be creating an enum for that specific column and referencing that in my struct? That doesn't feel right since it's just an array of strings.</p>