Documentation
¶
Overview ¶
Package database exposes a DataStore interface.
Index ¶
- type Category
- type Data
- type DataStore
- type ID
- type MemoryDB
- func (mdb *MemoryDB) FetchCategorySentiments(catg string) (map[Category]Sentiment, error)
- func (mdb *MemoryDB) FetchSentiments() (map[Category]Sentiment, error)
- func (mdb *MemoryDB) InsertText(t string) (Text, error)
- func (mdb *MemoryDB) UpdateSentiment(catg string, tcount int) (map[Category]Sentiment, error)
- type Sentiment
- type Text
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DataStore ¶
type DataStore interface {
InsertText(t string) (Text, error)
UpdateSentiment(catg string, tcount int) (map[Category]Sentiment, error)
FetchSentiments() (map[Category]Sentiment, error)
FetchCategorySentiments(catg string) (map[Category]Sentiment, error)
}
DataStore is a database interface that can be implemented by different kinds of databases.
type ID ¶
type ID string
ID represents ID of a Text, it is the string form of a UUID in the current implementation.
type MemoryDB ¶
type MemoryDB struct {
// contains filtered or unexported fields
}
MemoryDB indicates an in-memory database.
func (*MemoryDB) FetchCategorySentiments ¶
FetchCategorySentiments returns the Sentiment details of the supplied category.
func (*MemoryDB) FetchSentiments ¶
FetchSentiments returns the sentiment details of all the available categories.
func (*MemoryDB) InsertText ¶
InsertText is exposed by DataStore interface. MemoryDB implements this method.
Click to show internal directories.
Click to hide internal directories.