Documentation
¶
Overview ¶
This package handles the retrieval of data from the CouchDB search database Synchronization is handled by triggers in the database using the http postgresql extension, without the need for postgres->application->couchdb->app->postgres- round trip (we need to store the returned document id to ensure deduplication)
Index ¶
- Constants
- Variables
- type Artist
- type Genre
- type GenreDescription
- type Media
- type Member
- type Rating
- type Storage
- func (s *Storage) ReadAll(ctx context.Context, target TargetDB) (data []interface{}, err error)
- func (s *Storage) ReadArtists(ctx context.Context) (data []Artist, err error)
- func (s *Storage) ReadGenres(ctx context.Context) (data []Genre, err error)
- func (s *Storage) ReadMedia(ctx context.Context) (data []Media, err error)
- func (s *Storage) ReadMembers(ctx context.Context) (data []Member, err error)
- func (s *Storage) ReadNew(ctx context.Context, outgoingDataFeed chan interface{}, continuousMode bool) (err error)
- func (s *Storage) ReadRatings(ctx context.Context) (data []Rating, err error)
- func (s *Storage) ReadStudios(ctx context.Context) (data []Studio, err error)
- type Studio
- type TargetDB
Constants ¶
const ( Members targetDBName = "members" Artists targetDBName = "artists" Ratings targetDBName = "ratings" Genres targetDBName = "genres" GenreDescriptions targetDBName = "genre_descriptions" // aka keywords Studios targetDBName = "studio" MediaDB targetDBName = "media" )
Variables ¶
var AllTargets = []TargetDB{ Members, Artists, Ratings, Genres, GenreDescriptions, Studios, MediaDB, }
nolint:gochecknoglobals
Functions ¶
This section is empty.
Types ¶
type Genre ¶
type Genre struct { ID string `json:"_id"` Rev string `json:"_rev"` Name string `json:"name"` Kinds []string `json:"kinds"` Descriptions [][]GenreDescription `json:"descriptions"` }
Those types are simplified representations of what is stored in postgres that are written on insert/update to couchdb
type GenreDescription ¶
type Rating ¶
type Rating struct { ID string `json:"_id"` Rev string `json:"_rev"` Topic string `json:"topic"` Body string `json:"body"` User string `json:"user"` MediaTitle string `json:"media_title"` // not sure whether this shouldn't actually be a string as well Added time.Time `json:"added"` Modified time.Time `json:"modified"` }
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
func (*Storage) ReadAll ¶
we only care about scanning the data into it's raw JSON representation so that we can then use it for indexing
func (*Storage) ReadArtists ¶
func (*Storage) ReadGenres ¶
func (*Storage) ReadMembers ¶
func (*Storage) ReadNew ¶
func (s *Storage) ReadNew( ctx context.Context, outgoingDataFeed chan interface{}, continuousMode bool, ) (err error)
ReadNew handles the cyclical or continuous retrieval of new documents for indexing. This function does not accept a target parameter, since it doesn't make much sense to only look for partial data. The channel parameter here is used to communicate data to the search indexer