diff options
| author | 2021-03-02 22:52:31 +0100 | |
|---|---|---|
| committer | 2021-03-02 22:52:31 +0100 | |
| commit | be1b631681ae1bc588c9002f1bedfcc01a7bb153 (patch) | |
| tree | 5d66376080520cba36b7e53b5090ae12216cedc4 /internal/db/service.go | |
| parent | start implementing db interface (diff) | |
| download | gotosocial-be1b631681ae1bc588c9002f1bedfcc01a7bb153.tar.xz | |
More messing around
Diffstat (limited to 'internal/db/service.go')
| -rw-r--r-- | internal/db/service.go | 10 | 
1 files changed, 5 insertions, 5 deletions
| diff --git a/internal/db/service.go b/internal/db/service.go index 6163b3c69..9a1d3ce2c 100644 --- a/internal/db/service.go +++ b/internal/db/service.go @@ -19,10 +19,12 @@  package db  import ( +	"context"  	"fmt"  	"strings"  	"github.com/go-fed/activity/pub" +	"github.com/sirupsen/logrus"  )  const dbTypePostgres string = "POSTGRES" @@ -39,9 +41,7 @@ type Service interface {  	/*  		ANY ADDITIONAL DESIRED FUNCTIONS  	*/ - -	// Ready indicates whether the database is ready to handle queries and whatnot. -	Ready() bool +	Stop(context.Context) error  }  // Config provides configuration options for the database connection @@ -57,10 +57,10 @@ type Config struct {  // NewService returns a new database service that satisfies the Service interface and, by extension,  // the go-fed database interface described here: https://github.com/go-fed/activity/blob/master/pub/database.go -func NewService(config *Config) (Service, error) { +func NewService(context context.Context, config *Config, log *logrus.Logger) (Service, error) {  	switch strings.ToUpper(config.Type) {  	case dbTypePostgres: -		return newPostgresService(config) +		return newPostgresService(context, config, log.WithField("service", "db"))  	default:  		return nil, fmt.Errorf("database type %s not supported", config.Type)  	} | 
