Skip to content

Instantly share code, notes, and snippets.

@kelunik
Created May 13, 2020
Embed
What would you like to do?
<?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