Added databse handler to New() so that it functionally identical to old approach
This commit is contained in:
		
							parent
							
								
									cb314c235b
								
							
						
					
					
						commit
						b6de09f2a3
					
				
					 1 changed files with 5 additions and 2 deletions
				
			
		
							
								
								
									
										7
									
								
								feed.go
									
										
									
									
									
								
							
							
						
						
									
										7
									
								
								feed.go
									
										
									
									
									
								
							|  | @ -117,12 +117,15 @@ type Feed struct { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // New is a helper function to stay semi-compatible with | // 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 { | 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 | // 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 { | func NewWithHandler(cachetimeout int, enforcecachelimit bool, h Handler) *Feed { | ||||||
| 	v := new(Feed) | 	v := new(Feed) | ||||||
| 	v.CacheTimeout = cachetimeout | 	v.CacheTimeout = cachetimeout | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue