cotton icon indicating copy to clipboard operation
cotton copied to clipboard

Allow Object type in queries when using Postgres

Open zcdunn opened this issue 4 years ago • 0 comments

Postgres has support for JSON data via the json and jsonb datatypes, but Cotton's DatabaseValues doesn't include Object so queries like below result in a Typescript error even though they are correct.

db
  .table("test")
  .insert({
    "user_id": userId,
    data: {
      // @ts-ignore Have to add a ts-ignore here to get this to run
      "json_key": "some value",
      "another_key": 1,
      "is_key": true
    }
  })
.execute();

zcdunn avatar Mar 08 '21 18:03 zcdunn