Skip to content

Instantly share code, notes, and snippets.

@weixiyen
Created January 2, 2018 21:39
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 weixiyen/62e498fb6e2942daa6325be8449290f8 to your computer and use it in GitHub Desktop.
Save weixiyen/62e498fb6e2942daa6325be8449290f8 to your computer and use it in GitHub Desktop.
defmodule Schema.UserByEmail do
require Schema.User # if you want to auto-create at compile time
use Triton.MaterializedView
materialized_view :users_by_email, from: Schema.User do
fields [
:user_id,
:email,
:display_name,
:password
]
partition_key [:email]
cluster_columns [:user_id]
with_options [
gc_grace_seconds: 172_800,
clustering_order_by: [
email: :asc,
user_id: :desc
]
]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment