Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Database ¶
type Database struct {
// contains filtered or unexported fields
}
Database is postgres wrapper
func NewPostgresDatabase ¶
func NewPostgresDatabase(user string, password string, addr string, dbName string) (*Database, error)
NewPostgresDatabase creates and connects to a postgres database
func NewPostgresDatabaseFromURL ¶ added in v0.0.1
NewPostgresDatabaseFromURL creates and connects to a postgres database from a URL
func (*Database) GetSymbols ¶ added in v0.0.2
GetSymbols get symbols
type Event ¶
type Event struct { ID int Type string `pg:"type:'varchar'"` Source string `pg:"type:'varchar'"` Title string `pg:"type:'varchar'"` Content string `pg:"type:'text'"` URL string `pg:"type:'varchar'"` ConfirmedSymbols []string `pg:"type:'varchar',array"` Name string `pg:"type:'varchar'"` Author string `pg:"type:'varchar'"` PrevValue string `pg:"type:'varchar'"` ExpectedValue string `pg:"type:'varchar'"` ActualValue string `pg:"type:'varchar'"` Impact string `pg:"type:'varchar'"` TimeFor string `pg:"type:'varchar'"` TimeReported string `pg:"type:'varchar'"` Extras map[string]interface{} `pg:"type:'json'"` CacheHash string `pg:"type:'varchar',unique"` TimeLogged string `pg:"type:'timestamptz'"` HostName string `pg:"type:'varchar'"` }
Event represents an events that occured in the world
type EventStream ¶
type EventStream struct {
// contains filtered or unexported fields
}
EventStream is a stream of events
func NewEventStream ¶
func NewEventStream(db *Database, warmUp time.Duration) *EventStream
NewEventStream creates an event stream
func (*EventStream) GetSymbols ¶ added in v0.0.2
func (es *EventStream) GetSymbols() ([]Symbol, error)
GetSymbols gets db of symbols
func (*EventStream) OnEvent ¶
func (es *EventStream) OnEvent(evt *Event)
OnEvent handles the occurance of an event
func (*EventStream) OnEventArticleResolveBody ¶
func (es *EventStream) OnEventArticleResolveBody(source string, title string, url string, contentResolver func(string) string)
OnEventArticleResolveBody handles an article event, if appropriate it calls contentResolver for the content of the article
Click to show internal directories.
Click to hide internal directories.