Documentation ¶
Index ¶
- Constants
- type DB
- func (s *DB) Close() error
- func (s *DB) CreateArticle(title, body string, author uint) (*model.Article, error)
- func (s *DB) CreateUser(username, firstname, lastname string) (*model.User, error)
- func (s *DB) DeleteArticle(id uint) error
- func (s *DB) DeleteUser(id uint) error
- func (s *DB) DownVote(user uint, article uint) (*model.Vote, error)
- func (s *DB) GetAllArticles() ([]model.Article, error)
- func (s *DB) GetAllUsers() ([]model.User, error)
- func (s *DB) GetArticleByID(id uint) (*model.Article, error)
- func (s *DB) GetArticlesByAuthor(id uint) ([]model.Article, error)
- func (s *DB) GetUserByID(id uint) (*model.User, error)
- func (s *DB) Open() error
- func (s *DB) UpVote(user uint, article uint) (*model.Vote, error)
- func (s *DB) UpdateArticle(id uint, title *string, body *string) (*model.Article, error)
- func (s *DB) UpdateUser(id uint, username, firstname, lastname *string) (*model.User, error)
- type Err
Constants ¶
View Source
const ( // ErrNotInitialized raised when using a non initialized database ErrNotInitialized = Err("db not initialized") // ErrInitFailed raised when db cannot be initialized ErrInitFailed = Err("db init failed") // ErrCreate raised on creation errors ErrCreate = Err("creation error") // ErrUpdate raised on update errors ErrUpdate = Err("update error") // ErrDelete raised on delete errors ErrDelete = Err("delete error") // ErrTransaction raised on transaction errors ErrTransaction = Err("transaction error") // ErrNotFound raised when a resource is not found ErrNotFound = Err("resource not found") // ErrUnexpected raised on unexpected errors ErrUnexpected = Err("unexpected error") )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB using sqlite3 driver
func (*DB) CreateArticle ¶
CreateArticle ...
func (*DB) CreateUser ¶
CreateUser ...
func (*DB) GetAllArticles ¶
GetAllArticles ...
func (*DB) GetArticleByID ¶
GetArticleByID ...
func (*DB) GetArticlesByAuthor ¶
GetArticlesByAuthor ...
func (*DB) UpdateArticle ¶
UpdateArticle ...
Click to show internal directories.
Click to hide internal directories.