datastore

package
v0.0.0-...-301f0f8 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	GetKeywordPool() ([]string, error)
	AddNewsItems(newsItems []NewsItem) error
	// contains filtered or unexported methods
}

Client is an interface to interact with the firebase firestore

func NewClient

func NewClient() Client

NewClient creates a new instance of the client

type FirestoreClient

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

FirestoreClient implements Client

func (*FirestoreClient) AddNewsItems

func (fc *FirestoreClient) AddNewsItems(newsItems []NewsItem) error

AddNewsItems add a list of news items to the database

func (*FirestoreClient) CacheNewsTitle

func (fc *FirestoreClient) CacheNewsTitle(titles []string) error

CacheNewsTitle to the database

func (*FirestoreClient) GetKeywordPool

func (fc *FirestoreClient) GetKeywordPool() ([]string, error)

GetKeywordPool gets the pool of keywords from the database

type NewsItem

type NewsItem struct {
	Item    newsapi.Article `json:"item"`
	Keyword string          `json:"keyword"`
}

NewsItem is a modle of the news item in the database

Jump to

Keyboard shortcuts

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