Documentation ¶
Index ¶
- Variables
- func Encrypt(plaintext string) (cryptext string)
- func SessionDeleteAll() (err error)
- func UserDeleteAll() (err error)
- type Post
- type Session
- type Thread
- type User
- func (user *User) Create() (err error)
- func (user *User) CreatePost(conv Thread, body string) (post Post, err error)
- func (user *User) CreateSession() (session Session, err error)
- func (user *User) CreateThread(topic string) (conv Thread, err error)
- func (user *User) Delete() (err error)
- func (user *User) Session() (session Session, err error)
- func (user *User) Update() (err error)
Constants ¶
This section is empty.
Variables ¶
View Source
var Db *sql.DB
Db is a handler of database connection
Functions ¶
func SessionDeleteAll ¶
func SessionDeleteAll() (err error)
SessionDeleteAll delete all sessions from database
Types ¶
type Post ¶
Post struct
func (*Post) CreatedAtDate ¶
CreatedAtDate formats the CreatedAt date to display nicely on the screen
type Session ¶
Session struct
func (*Session) DeleteByUUID ¶
DeleteByUUID deletes session from database
type Thread ¶
Thread struct
func ThreadByUUID ¶
ThreadByUUID return a thread by the UUID
func (*Thread) CreatedAtDate ¶
CreatedAtDate formats the CreatedAt date to display nicely on the screen
func (*Thread) NumReplies ¶
NumReplies gets the number of posts in a thread
type User ¶
type User struct { ID int UUID string Name string Email string Password string CreatedAt time.Time }
User struct
func UserByEmail ¶
UserByEmail gets a single user given the email
func UserByUUID ¶
UserByUUID gets a single user given the UUID
func (*User) CreatePost ¶
CreatePost creates a new post to a thread
func (*User) CreateSession ¶
CreateSession create a new session for an existing user
func (*User) CreateThread ¶
CreateThread create a new thread
Click to show internal directories.
Click to hide internal directories.