Documentation ¶
Overview ¶
Package service provides implementation for a community-sentiment-analysis server. It provides an in-memory database implementation, http handlers, http routes, and a mechanism to start the server on a given port. It also implements a two-stage data processing pipeline, which allows for parallel processing, exploiting the cores that the hardware has to offer.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Routes ¶
Routes specifies and returns the available http routes that are exposed as REST APIs. The allowed content type is JSON for all APIs. Authentication has been ignored for this demo service. A JWT based authentication can be implemented using the following packages:
- github.com/dgrijalva/jwt-go
- github.com/go-chi/jwtauth
Types ¶
type App ¶
App contains the server configuration and http routes.
func GetApp ¶
func GetApp() *App
GetApp instantiates an app with its configuration, handlers, and routes.
func (*App) StartServer ¶
func (a *App) StartServer()
StartServer starts the http server for the supplied App instance.
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler exposes the base handler for the app.
func GetHandler ¶
func GetHandler(db database.DataStore, c config.Config, vtc []chan pipeline.TweetText, ptc []chan pipeline.TweetText, vtr *pipeline.MemRR, ptr *pipeline.MemRR) *Handler
GetHandler returns an instance of handler.
func (*Handler) GetSentiments ¶
func (h *Handler) GetSentiments(w http.ResponseWriter, r *http.Request)
GetSentiments is an http handler that returns all the sentiments, category-wise, from the db.
type SaveTextReq ¶
type SaveTextReq struct {
TextString string
}
SaveTextReq represents a textString key of type string, incoming via http request body.
type SaveTextResp ¶
type SaveTextResp struct {
Saved bool
}
SaveTextResp is used for creating a response object for SaveText handler.