Skip to content

Instantly share code, notes, and snippets.

View gist:b0c0b9d3918ef7cd71a5dc199975e756
### Keybase proof
I hereby claim:
* I am zyclotrop-j on github.
* I am zyclotrop (https://keybase.io/zyclotrop) on keybase.
* I have a public key ASAkllhs7vILmYio6WAfl6tXemFysGVS5I7AsIPFJrKy3Qo
To claim this, I am signing this object:
@Zyclotrop-j
Zyclotrop-j / Relay Cursor Spec Pagination in SQL
Created Oct 8, 2021
Relay Cursor Spec Pagination in SQL
View Relay Cursor Spec Pagination in SQL
-- --------------------- CREATE TABLE -------------------
-- Table: public.pagination
CREATE TABLE IF NOT EXISTS public.pagination
(
uuid uuid NOT NULL DEFAULT gen_random_uuid(),
ts timestamp without time zone NOT NULL DEFAULT now(),
-- any columns
data jsonb NOT NULL,
@Zyclotrop-j
Zyclotrop-j / After + First
Created Oct 8, 2021
Relay Cursor Spec Pagination in MongoDB
View After + First
// see https://mongoplayground.net/p/hrVd5xrWBbh
db.collection.aggregate([
{
$match: {
...preconditions...
}
},
{
$sort: {
_id: 1
View EventTarget
class EventTarget {
constructor(options) {
if(options) {
Object.assign(this, options);
}
this.listeners = {};
}
addEventListener (type, callback, useCaptureOptions) {
if (!(type in this.listeners)) {