cotton
cotton copied to clipboard
Allow Object type in queries when using Postgres
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();