feat(db): add memory storage driver

removes the sqlite dependency for tests, also brings back the option for
users to run zero persistence instances of tinyauth.

adds new mapErr fn for sqlc wrapper gen to prevent sql errors from
leaking out of the store implementation.
This commit is contained in:
Scott McKendry
2026-05-04 05:02:27 +12:00
parent 0244f39387
commit 04b8e9884b
14 changed files with 435 additions and 69 deletions
+3 -4
View File
@@ -12,9 +12,9 @@ import (
"github.com/gin-gonic/gin"
"github.com/google/go-querystring/query"
"github.com/tinyauthapp/tinyauth/internal/bootstrap"
"github.com/tinyauthapp/tinyauth/internal/config"
"github.com/tinyauthapp/tinyauth/internal/controller"
"github.com/tinyauthapp/tinyauth/internal/repository/memory"
"github.com/tinyauthapp/tinyauth/internal/service"
"github.com/tinyauthapp/tinyauth/internal/utils/tlog"
"github.com/stretchr/testify/assert"
@@ -847,11 +847,10 @@ func TestOIDCController(t *testing.T) {
},
}
store, err := bootstrap.NewSQLiteStore(path.Join(tempDir, "tinyauth.db"))
require.NoError(t, err)
store := memory.New()
oidcService := service.NewOIDCService(oidcServiceCfg, store)
err = oidcService.Init()
err := oidcService.Init()
require.NoError(t, err)
for _, test := range tests {