Skip to content

Instantly share code, notes, and snippets.

Avatar

Ronny López ronnylt

View GitHub Profile
@ronnylt
ronnylt / Event-stream based GraphQL subscriptions.md
Created Aug 31, 2020 — forked from OlegIlyenko/Event-stream based GraphQL subscriptions.md
Event-stream based GraphQL subscriptions for real-time updates
View Event-stream based GraphQL subscriptions.md

In this gist I would like to describe an idea for GraphQL subscriptions. It was inspired by conversations about subscriptions in the GraphQL slack channel and different GH issues, like #89 and #411.

Conceptual Model

At the moment GraphQL allows 2 types of queries:

  • query
  • mutation

Reference implementation also adds the third type: subscription. It does not have any semantics yet, so here I would like to propose one possible semantics interpretation and the reasoning behind it.

View aggregate.go
package domain
// An Aggregate is a tree of object relations that protect business invariants (business rules).
// Concretely, an aggregates handle commands and have a state model encapsulated within it that allows
// it to implement the required command validation, thus upholding the invariants (business rules) of the aggregate.
// Aggregates are usually composed of several entities and values objects.
// The lifetimes of the components of an aggregate are bounded by the lifetime of the entire aggregate.
// Aggregate is abstract concept, it's just represented as an empty interface with no specific contract.
type Aggregate interface{}
View gist:98eb14055f72d3263dc1ad13c099a385
### Keybase proof
I hereby claim:
* I am ronnylt on github.
* I am ronnylt (https://keybase.io/ronnylt) on keybase.
* I have a public key whose fingerprint is FE3B F389 D20C 1F39 487F 772A 65B5 6D4F 6D86 095E
To claim this, I am signing this object:
View gist:9191734
(feature/erlangmk●●)$ make
APP cowlib.app.src
APP ranch.app.src
APP cowboy.app.src
APP mimetypes.app.src
./rebar compile
==> json (compile)
ERROR: compile failed while processing /Users/ronnylt/workspace/sp/spchat-erlang/deps/json: {'EXIT',{badarg,[{re,split,
[[118,99,115,95,105,110,102,111,95,109,115,103,95,48,95,
61,40,37,70,123,99,121,97,110,125,102,101,97,116,117,
View gist:9076279
PROJECT = spine
DEPS = cowboy
dep_cowlib = pkg://cowlib 0.9.0
TEST_DEPS = ct_helper
dep_ct_helper = https://github.com/extend/ct_helper.git master
include erlang.mk
View gist:6711674
<?php
define('N', 1000);
class Redis
{
public function run($n)
{
$a = rand($n, 2 * $n);