Versions in this module Expand all Collapse all v0 v0.2.0 Jan 31, 2023 Changes in this version type BlogPost + Author string + ImgURL string + Version int + type MailData struct + Content string + From string + Name string + Subject string + To string + type MailServer struct + Host string + Password string + Port int + Username string v0.1.0 Sep 1, 2022 Changes in this version + var ErrDuplicateEmail = errors.New("models: duplicate email") + var ErrInvalidCredentials = errors.New("models: invalid credentials") + var ErrNoRecord = errors.New("models: no matching record found") + type BlogPost struct + Content string + Created time.Time + Expires time.Time + ID int + Title string + type BlogPostModel struct + DB *sql.DB + func (m *BlogPostModel) All() ([]*BlogPost, error) + func (m *BlogPostModel) Get(id int) (*BlogPost, error) + func (m *BlogPostModel) Insert(title string, content string, expires int) (int, error) + func (m *BlogPostModel) Latest() ([]*BlogPost, error) + type BlogPostModelInterface interface + All func() ([]*BlogPost, error) + Get func(id int) (*BlogPost, error) + Insert func(title string, content string, expires int) (int, error) + Latest func() ([]*BlogPost, error) + type User struct + Created time.Time + Email string + HashedPassword []byte + ID int + Name string + type UserModel struct + DB *sql.DB + func (m *UserModel) Authenticate(email, password string) (int, error) + func (m *UserModel) Exists(id int) (bool, error) + func (m *UserModel) Insert(name, email, password string) error + type UserModelInterface interface + Authenticate func(email, password string) (int, error) + Exists func(id int) (bool, error) + Insert func(name, email, password string) error