scriptorium/models/database
The database contains all the parsed data from the input files, but not processed content.
Types
Posts organised by month. This is used inside YearPosts
.
pub type MonthPosts =
dict.Dict(date.Month, ordered_tree.OrderedTree(PostWithID))
Internal post ID, generated automatically.
pub type PostID =
bigi.BigInt
pub type PostWithID {
PostWithID(id: bigi.BigInt, post: post.Post)
}
Constructors
-
PostWithID(id: bigi.BigInt, post: post.Post)
All tags and their posts.
pub type TagPosts =
dict.Dict(String, ordered_tree.OrderedTree(PostWithID))
Posts organised by year, containing posts organised by month.
pub type YearPosts =
dict.Dict(
Int,
dict.Dict(date.Month, ordered_tree.OrderedTree(PostWithID)),
)
Values
pub fn get_posts_with_ids(
db: Database,
order: ordered_tree.WalkOrder,
) -> List(PostWithID)
Get all posts in the given order.
pub fn set_menu(
db: Database,
menu: List(menu.MenuItem),
) -> Database
Set the menu items of the database, replacing any old ones.
pub fn tags(
db: Database,
) -> dict.Dict(String, ordered_tree.OrderedTree(PostWithID))
Get posts organised by tags.
pub fn years(
db: Database,
) -> dict.Dict(
Int,
dict.Dict(date.Month, ordered_tree.OrderedTree(PostWithID)),
)
Get posts organised by years and months.