electric-sql / electric

Sync little subsets of your Postgres data into local apps and services.
https://electric-sql.com
Apache License 2.0
6.47k stars 156 forks source link

Add example Phoenix application #1948

Closed magnetised closed 2 days ago

magnetised commented 2 weeks ago

Plus update the gatekeeper-auth example to use the new Electric.Phoenix apis

thruflo commented 2 weeks ago

Awesome! Can you add a note/section to the Phoenix docs linking to and flagging up this example?

magnetised commented 2 weeks ago

Awesome! Can you add a note/section to the Phoenix docs linking to and flagging up this example?

https://github.com/electric-sql/electric/pull/1948/commits/ada89413d82e5ab6e0d4cdf7c6fb8f9af9b4e648

@thruflo how's that?

netlify[bot] commented 2 weeks ago

Deploy Preview for electric-next ready!

Name Link
Latest commit 7b14551cbf8c47f0c66ca10b176abca33196d768
Latest deploy log https://app.netlify.com/sites/electric-next/deploys/673de5908afab90008564d63
Deploy Preview https://deploy-preview-1948--electric-next.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

thruflo commented 2 weeks ago

@magnetised nice, ta. Two niggly suggestions:

  1. rename the example folder to electric-phoenix, the -example prefix just adds noise and we're removing them
  2. move this down to the page, above the help wanted section

So make it a:

## Examples

### electric-phoenix

...

<HelpWanted ...

So we can add multiple examples over time. Ideally with some description of what the example shows (i.e.: the scope of the integration / functionality).

As per https://electric-sql.com/docs/integrations/next#examples (but actually up a heading level).

github-actions[bot] commented 3 days ago

Examples

magnetised commented 2 days ago

@thruflo I pulled some of your work out of the gateway auth example and made them part of Electric.Phoenix - specifically the Electric.Phoenix.shape_from_params/2 is based on your Api.Shape.from/1 function and I've added ShapeDefinition.matches?/2 so that our code supports most of the core functionality used in the token matching.

https://github.com/electric-sql/electric_phoenix/blob/74a20fd57a5d269af4ce916b61dd1bbaf588f254/lib/electric/phoenix.ex#L140

thruflo commented 2 days ago

@magnetised great 👍