From 89f8c57f62546da3bcd3b33fb18d36c7cdd168d4 Mon Sep 17 00:00:00 2001 From: Peter Sanchez Date: Mon, 13 Feb 2023 17:38:17 -0600 Subject: [PATCH] Adding DB as DBI interface for Context --- server/server.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server/server.go b/server/server.go index daa5822..ea6518e 100644 --- a/server/server.go +++ b/server/server.go @@ -20,6 +20,7 @@ import ( "github.com/labstack/echo/v4/middleware" "hg.code.netlandish.com/~netlandish/gobwebs" "hg.code.netlandish.com/~netlandish/gobwebs/config" + "hg.code.netlandish.com/~netlandish/gobwebs/database" "hg.code.netlandish.com/~netlandish/gobwebs/email" "hg.code.netlandish.com/~netlandish/gobwebs/internal/localizer" "hg.code.netlandish.com/~netlandish/gobwebs/storage" @@ -66,6 +67,7 @@ type Server struct { type Context struct { echo.Context Server *Server + DB database.DBI User gobwebs.User } @@ -289,7 +291,7 @@ func (s *Server) WithDefaultMiddleware() *Server { // Set custom context s.e.Use(func(next echo.HandlerFunc) echo.HandlerFunc { return func(c echo.Context) error { - ctx := &Context{Context: c, Server: s} + ctx := &Context{Context: c, Server: s, DB: database.NewDB(s.DB)} return next(ctx) } }) -- 2.45.2