database

package
v0.0.0-...-e986e8f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 27, 2019 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB struct {
	// contains filtered or unexported fields
}

Struct DB implements Database interface.

func NewDB

func NewDB(connectionString string) (*DB, error)

func (*DB) GetAll

func (db *DB) GetAll() []*models.NewsArticle

func (*DB) GetBestNews

func (db *DB) GetBestNews() []*models.NewsArticle

func (*DB) UpdateNewsArticle

func (db *DB) UpdateNewsArticle(id int, rating int)

type Database

type Database interface {
	UpdateNewsArticle(id int, rating int)
	GetBestNews() []*models.NewsArticle
	GetAll() []*models.NewsArticle
}

type MockDB

type MockDB struct{}

func (*MockDB) GetAll

func (mockDB *MockDB) GetAll() []*models.NewsArticle

func (*MockDB) GetBestNews

func (mockDB *MockDB) GetBestNews() []*models.NewsArticle

func (*MockDB) UpdateNewsArticle

func (mockDB *MockDB) UpdateNewsArticle(id int, rating int)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL