thesis v0.0.14 Thesis.Store behaviour

Thesis.Store is an Elixir “behaviour” that defines the public function interface necessary for Thesis to use a particular store module.

There are currently five required functions, as described below.

Summary

Callbacks

Returns a Thesis.Page struct with the given slug (aka request_path)

Returns a map consisting of string keys and Thesis.PageContent structs for the given Thesis.Page struct. This is generally used to populate the page content using the Thesis.View.content/4 function

Returns all pages currently in the database, as a list of Thesis.Page structs. Will return an empty list if none are found

Updates the given page (identified by its slug) with the given map of string keys and Thesis.PageContent structs. Returns :ok

Callbacks

page(arg0)

Specs

Returns a Thesis.Page struct with the given slug (aka request_path).

page_contents(arg0)

Specs

page_contents(Thesis.Page.t) :: %{String.t => Thesis.PageContent.t}

Returns a map consisting of string keys and Thesis.PageContent structs for the given Thesis.Page struct. This is generally used to populate the page content using the Thesis.View.content/4 function.

pages()

Specs

pages :: %{String.t => Thesis.Page.t}

Returns all pages currently in the database, as a list of Thesis.Page structs. Will return an empty list if none are found.

update(%{}, map)

Specs

update(%{String.t => String.t}, map) :: atom

Updates the given page (identified by its slug) with the given map of string keys and Thesis.PageContent structs. Returns :ok.

update(%{"slug" => "/"}, %{"Heading" => "My Heading Content"})