Properly close store

This commit is contained in:
Gabriel Simmer 2022-07-06 11:39:41 +01:00
parent 709353b46e
commit c15f3f70ab
2 changed files with 6 additions and 0 deletions

View file

@ -14,6 +14,7 @@ func main() {
if err != nil { if err != nil {
panic(err) panic(err)
} }
defer db.Close()
handlers := transport.New(db) handlers := transport.New(db)
// Auth endpoints // Auth endpoints
mux.Group(func(mux *flow.Mux) { mux.Group(func(mux *flow.Mux) {

View file

@ -34,6 +34,7 @@ type Storer interface {
SessionUser(token string) (User, error) SessionUser(token string) (User, error)
SaveOauthState(state OauthState) error SaveOauthState(state OauthState) error
OauthState(id string) (OauthState, error) OauthState(id string) (OauthState, error)
Close() error
} }
type OauthState struct { type OauthState struct {
@ -349,3 +350,7 @@ func (s *Store) OauthState(id string) (OauthState, error) {
} }
return state, nil return state, nil
} }
func (s *Store) Close() error {
return s.database.Close()
}