Skip to content

Instantly share code, notes, and snippets.

Avatar

Christian Lück clue

View GitHub Profile
View gist:fa6b953e841cf77b18fa95fa1f48f599
function main(): PromiseInterface {
return $this->query(1);
}
function query(page): PromiseInterface {
return $this
->makeAQuery(page)
->then($result) {
@clue
clue / gist:86c3cbdc10ecf49d444f61768034856a
Created Feb 17, 2020 — forked from davor010/gist:41ddf289c4155bce8daa8960d4cf885b
using transformer in between (mysql, clickhouse)
View gist:86c3cbdc10ecf49d444f61768034856a
$promise = new React\Promise\FulfilledPromise(1);
$transformer = new ThroughStream(function ($data) {
return array('id' => $data['id'], 'stocknummer' => $data['id'], 'dealer_id' => $data['id'], '_vnr' => 1, '_checksum' => sha1(json_encode($data)), '_timestamp' => date('Y-m-d h:i:s'));
});
//try to change in Client class add _vnr, _checksum and _timestamp
$source->pipe($transformer)->pipe($stream);
//$source->pipe($stream);
View MagicBytesSplitter.php
<?php
namespace Clue\React\Foo;
use Evenement\EventEmitter;
use React\Stream\ReadableStreamInterface;
use React\Stream\WritableStreamInterface;
use React\Stream\Util;
class MagicBytesSplitter extends EventEmitter implements ReadableStreamInterface
You can’t perform that action at this time.