Documentation ¶
Overview ¶
database driver
Index ¶
- type Database
- type PostgresDB
- func (db *PostgresDB) BoardPage(newsgroup string, pageno, perpage int) (page *model.BoardPage, err error)
- func (db *PostgresDB) Init() (err error)
- func (db *PostgresDB) MessageIDByHash(hash string) (msgid string, err error)
- func (db *PostgresDB) StorePost(post model.Post) (err error)
- func (db *PostgresDB) ThreadByHash(hash string) (thread *model.Thread, err error)
- func (db *PostgresDB) ThreadByMessageID(msgid string) (thread *model.Thread, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Database ¶
type Database interface { ThreadByMessageID(msgid string) (*model.Thread, error) ThreadByHash(hash string) (*model.Thread, error) MessageIDByHash(hash string) (string, error) BoardPage(newsgroup string, pageno, perpage int) (*model.BoardPage, error) StorePost(post model.Post) error Init() error }
func NewDBFromConfig ¶
func NewDBFromConfig(c *config.DatabaseConfig) (db Database, err error)
get new database connector from configuration
type PostgresDB ¶
type PostgresDB struct {
// contains filtered or unexported fields
}
func (*PostgresDB) Init ¶
func (db *PostgresDB) Init() (err error)
func (*PostgresDB) MessageIDByHash ¶
func (db *PostgresDB) MessageIDByHash(hash string) (msgid string, err error)
func (*PostgresDB) ThreadByHash ¶
func (db *PostgresDB) ThreadByHash(hash string) (thread *model.Thread, err error)
func (*PostgresDB) ThreadByMessageID ¶
func (db *PostgresDB) ThreadByMessageID(msgid string) (thread *model.Thread, err error)
Click to show internal directories.
Click to hide internal directories.