From 7f0158e450d399eb8b9055c566dadeb00d222fef Mon Sep 17 00:00:00 2001 From: MrMelon54 Date: Tue, 14 May 2024 11:02:11 +0100 Subject: [PATCH] Accept any struct with GetPasswordHash implementation --- auth.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/auth.go b/auth.go index 600fd82..f4da7a9 100644 --- a/auth.go +++ b/auth.go @@ -52,7 +52,11 @@ func NewAuth(dbStr string, logger *log.Logger) *Auth { } type Auth struct { - DB *database.Queries + DB DbQueries +} + +type DbQueries interface { + GetPasswordHash(ctx context.Context, username string) (string, error) } func (a *Auth) Middleware(next http.Handler) http.Handler {