Versions in this module Expand all Collapse all v1 v1.0.0 Apr 18, 2024 Changes in this version + var ErrDuplicateEmail = errors.New("models: duplicate email") + var ErrInvalidCredentials = errors.New("models: invalid credentials") + var ErrNoRecord = errors.New("models: not matching record found") + type Snippet struct + Content string + Created time.Time + Expires time.Time + ID int + Title string + type SnippetModel struct + DB *sql.DB + func (m *SnippetModel) Get(id int) (*Snippet, error) + func (m *SnippetModel) Insert(title string, content string, expires int) (int, error) + func (m *SnippetModel) Latest() ([]*Snippet, error) + type SnippetModelInterface interface + Get func(id int) (*Snippet, error) + Insert func(title, content string, expires int) (int, error) + Latest func() ([]*Snippet, 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) Get(id int) (*User, error) + func (m *UserModel) Insert(name, email, password string) error + func (m *UserModel) PasswordUpdate(id int, currentPassword, newPassword string) error + type UserModelInterface interface + Authenticate func(email, password string) (int, error) + Exists func(id int) (bool, error) + Get func(id int) (*User, error) + Insert func(name, email, password string) error + PasswordUpdate func(id int, currentPassword, newPassword string) error