Public
Edited
Oct 1, 2024
1 fork
5 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
render(Tsql.template`
select *
from Users
where ${Tsql.where({
'fooJson->bar': true
})}
`)
Insert cell
Insert cell
render(Tsql.template`
select *
from Users
where ${Tsql.where({
myValue: {
$distinct: Tsql.id('myDefaultsJson->$.myValueDefault')
}
})}
`)
Insert cell
Insert cell
render(Tsql.where({
$or: [
{
state: { $ne: 'DONE' },
createdAt: { $gt: new Date(Date.now() - (24 * 60 * 60 * 1000)) }
},
{ state: { $in: [ 'PENDING', 'PROCESSING' ] } }
]
}))
Insert cell
Insert cell
render(Tsql.where({ 'payloadJson->$.email': { $like: '%foo%' } }))
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
render(Tsql.insertIgnore('Users', [ 'email' ], [
{ email: 'foo@local', name: 'Foo' },
{ email: 'bar@local', name: 'Bar' },
{ email: 'baz@local', name: 'Baz' }
]))
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
render(Tsql.upsertObjects('Users', [ 'email' ], [
{ email: 'foo@local', name: 'Foo' },
{ email: 'bar@local', name: 'Bar' },
{ email: 'baz@local', name: 'Baz' }
]))
Insert cell
Insert cell
render(Tsql.update('Users', { id: { $notIn: [ 1, 2, 3 ] }, otherId: 42 }, { otherId: null }))
Insert cell
render(Tsql.update('Users', { id: 1, 'payloadJson->processed': true }, { status: 'OK' }))
Insert cell
Insert cell
render(Tsql.updateObjects('UserLimits', [ 'userId', 'symbol' ], [
{ userId: 1, symbol: 'ETH', long: 1, short: 2 },
{ userId: 2, symbol: 'BTC', long: 2, short: 3 }
]))
Insert cell
Insert cell
render(Tsql.merge1n('UserCryptos', [ 'userId', 'symbol' ], 'usr:123', [ 'ETH', 'BTC' ]))
Insert cell
Insert cell
render(Tsql.modifyJsons('Users', [
{ id: 1, payloadJson: { status: 'OK' } },
{ id: 2, payloadJson: { status: 'ERR' } }
]))
Insert cell
Insert cell
render(Tsql.delete('UserPermissions', {
userId: { $in: [ 'A', 'B', 'C' ] },
permissionId: { $in: [ 'CREATE', 'UPDATE', 'DELETE' ] }
}))
Insert cell
Insert cell
render(Tsql.orderBy([
[ 'foo bar', 'asc' ],
[ undefined, 'asc' ], // undefined identifier is ignored
undefined, // undefined is ignored
[ 'baz', 'desc' ]
]))
Insert cell
render(Tsql.in('a', null))
Insert cell
render(Tsql.in('a', []))
Insert cell
render(Tsql.in('a', [null]))
Insert cell
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more