Nabo v0.0.1 Nabo.Repo behaviour

Precompiles and provides interface to interact with your posts.

Example

defmodule MyRepo do
  use Nabo.Repo, root: "priv/posts"
end

{:ok, posts} = MyRepo.all
{:ok, post} = MyRepo.get("foo")
post = MyRepo.get!("foo")

Link to this section Summary

Callbacks

Fetches all available posts in the repo

Fetches all availables post names in the repo

Finds a post by the given slug

Similar to get/1 but raises error when no post was found

Link to this section Callbacks

Fetches all available posts in the repo.

Example

{:ok, posts} = MyRepo.all()
Link to this callback availables()
availables() :: List.t

Fetches all availables post names in the repo.

Example

availables = MyRepo.availables()
Link to this callback get(name)
get(name :: String.t) :: {:ok, Nabo.Post.t} | {:error, any}

Finds a post by the given slug.

Example

{:ok, post} = MyRepo.get("my-slug")
Link to this callback get!(name)
get!(name :: String.t) :: Nabo.Post.t

Similar to get/1 but raises error when no post was found.

Example

post = MyRepo.get!("my-slug")