add db to struct
This commit is contained in:
		
							
								
								
									
										6
									
								
								app.go
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								app.go
									
									
									
									
									
								
							| @@ -5,17 +5,19 @@ import ( | ||||
| 	"fmt" | ||||
|  | ||||
| 	"github.com/gen2brain/beeep" | ||||
| 	"gorm.io/gorm" | ||||
| ) | ||||
|  | ||||
| // App struct | ||||
| type App struct { | ||||
| 	ctx context.Context | ||||
| 	db  *gorm.DB | ||||
| } | ||||
|  | ||||
| // NewApp creates a new App application struct | ||||
| func NewApp() *App { | ||||
| func NewApp(db *gorm.DB) *App { | ||||
|  | ||||
| 	return &App{} | ||||
| 	return &App{db: db} | ||||
| } | ||||
|  | ||||
| // startup is called when the app starts. The context is saved | ||||
|   | ||||
		Reference in New Issue
	
	Block a user