Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrDuplicateEmail = errors.New("models: duplicate email")
Custom error for when a user attempts to sign up with an email address that is already being used.
View Source
var ErrInvalidCredentials = errors.New("models: invalid credentials")
Custom error for when a user attempts to login with an invalid email or invalid password.
View Source
var ErrNoRecord = errors.New("models: no matching record found")
Custom error for when an sql row query returns no matching records.
Functions ¶
This section is empty.
Types ¶
type SnippetModel ¶
Define a SnippetModel type which wraps an sql.DB connection pool.
func (*SnippetModel) Get ¶
func (m *SnippetModel) Get(id int) (*Snippet, error)
Define a function that will read and return a specified snippet based on its unique ID.
func (*SnippetModel) Insert ¶
Define a function that will insert a new snippet into the MYSQL database.
func (*SnippetModel) Latest ¶
func (m *SnippetModel) Latest() ([]*Snippet, error)
Define a function that will return the 10 most recently created snippets.
type SnippetModelInterface ¶
Click to show internal directories.
Click to hide internal directories.