Added databse handler to New() so that it functionally identical to old approach

This commit is contained in:
Ben Davies 2014-10-04 12:48:45 +01:00
parent cb314c235b
commit b6de09f2a3
1 changed files with 5 additions and 2 deletions

View File

@ -117,12 +117,15 @@ type Feed struct {
}
// New is a helper function to stay semi-compatible with
// the old code
// the old code. Includes the databse handler to ensure
// that this approach is functionally identical to the
// old databse/handlers version
func New(cachetimeout int, enforcecachelimit bool, ch ChannelHandlerFunc, ih ItemHandlerFunc) *Feed {
return NewWithHandler(cachetimeout, enforcecachelimit, NewHandlerBonder(ch, ih))
return NewWithHandler(cachetimeout, enforcecachelimit, NewDatabaseHandler(NewHandlerBonder(ch, ih)))
}
// NewWithHandler creates a new feed with a handler
// People should use this appraoch from now on
func NewWithHandler(cachetimeout int, enforcecachelimit bool, h Handler) *Feed {
v := new(Feed)
v.CacheTimeout = cachetimeout