Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrPasswordUnmatch = errors.New("password unmatch")
ErrPasswordUnmatch is error for password unmatch when logging in.
Functions ¶
func ArticlesDeleteAll ¶
ArticlesDeleteAll deltes all articles. Useful for testing.
Types ¶
type Article ¶
type Article struct { ID int64 `json:"article_id"` Title string `json:"title"` Body string `json:"body"` UserID int64 `json:"user_id"` Created time.Time `json:"created"` Updated time.Time `json:"updated"` }
Article returns model object for article.
func ArticleOne ¶
ArticleOne returns the article for given id.
func ArticlesAll ¶
ArticlesAll returns all articles.
type ArticleUser ¶
type ArticleUser struct { ID int64 `json:"article_id"` Title string `json:"title"` Body string `json:"body"` UserID int64 `json:"user_id"` Created time.Time `json:"created"` Updated time.Time `json:"updated"` UserName string `json:"user_name"` }
ArticleUser includes writer information who wrote it.
func ArticleUserOne ¶
func ArticleUserOne(db *sql.DB, id int64) (ArticleUser, error)
func ScanArticleUser ¶
func ScanArticleUser(r *sql.Row) (ArticleUser, error)
func ScanArticleUsers ¶
func ScanArticleUsers(rs *sql.Rows) ([]ArticleUser, error)
type User ¶
type User struct { ID int64 `json:"user_id"` Name string `json:"name"` Email string `json:"email"` Salt string `json:"salt"` Salted string `json:"salted"` Created time.Time `json:"created"` Updated time.Time `json:"updated"` }
User returns model object for user.
func UserByEmail ¶
UserByEmail fetch user by email. Email is unique key.
Click to show internal directories.
Click to hide internal directories.