Skip to Main Content
Mastering Elixir
book

Mastering Elixir

by André Albuquerque, Daniel Caixinha
July 2018
Intermediate to advanced content levelIntermediate to advanced
574 pages
14h 7m
English
Packt Publishing
Content preview from Mastering Elixir

Media folder queries

Our Phoenix umbrella application will send us a user_id and a folder_path values and we will need to fetch all the Media entries on the given path. Paths in ElixirDrip always start with $, so $, $/folder, and $/a/b/c/d/e/f/g are all valid paths (notice that paths can't have a trailing slash).

Under the hood, we store the full path of each media file, but we store all the media in a single folder on Google Cloud Storage (given by each media storage_key). As such, typical file operations, such as move and rename, are just a matter of changing the media full_path and the file_name accordingly:

iex> Storage.list_all_media         |> Enum.map(fn m -> %{user_id: m.user_id,                               file_name: m.file_name,                               path: m.full_path, storage_key: m.storage_key} ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Testing Elixir

Testing Elixir

Andrea Leopardi, Jeffrey Matthias

Publisher Resources

ISBN: 9781788472678Supplemental Content