Skip to content

Instantly share code, notes, and snippets.

@kelunik
Created May 13, 2020 19:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kelunik/e7288bb28faa979d32504a61df80bec0 to your computer and use it in GitHub Desktop.
Save kelunik/e7288bb28faa979d32504a61df80bec0 to your computer and use it in GitHub Desktop.
<?php
$confirmedEmails = yield $db->select()
->stream()
->filter(fn (User $user) => $user->isEmailConfirmed())
->map(fn (User $user) => $user->getEmail())
->toArray();
$pagedConfirmedUsers = yield $db->select()
->stream()
->filter(fn (User $user) => $user->isEmailConfirmed())
->skip(10 * ($page - 1))
->limit(10)
->toArray();
@kelunik
Copy link
Author

kelunik commented May 13, 2020

  • map(callable): Stream
  • filter(callable): Stream
  • each(callable): Promise
  • drop(int): Stream / skip(int): Stream
  • dropWhile(callable): Stream / skipWhile(callable): Stream
  • dropUntil(callable): Stream / skipUntil(callable): Stream
  • limit(int): Stream / take(int): Stream
  • count(): Promise
  • sum(): Promise
  • toArray(): Promise

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment