a mini social media app for small communities
1// **all** interactions with the database should be handled in this module.
2module database
3
4import db.pg
5import entity { User, Post }
6
7// DatabaseAccess handles all interactions with the database.
8pub struct DatabaseAccess {
9pub mut:
10 db pg.DB
11}
12
13// get_unknown_user returns a user representing an unknown user
14pub fn (app &DatabaseAccess) get_unknown_user() User {
15 return User{
16 username: 'unknown'
17 }
18}
19
20// get_unknown_post returns a post representing an unknown post
21pub fn (app &DatabaseAccess) get_unknown_post() Post {
22 return Post{
23 title: 'unknown'
24 }
25}