diff --git a/server/server.go b/server/server.go index 5bc101b..2f11b49 100644 --- a/server/server.go +++ b/server/server.go @@ -103,6 +103,11 @@ func NewServer(ctx context.Context, profile *profile.Profile, store *store.Store } s.Secret = secret + // Register healthz endpoint. + e.GET("/healthz", func(c echo.Context) error { + return c.String(http.StatusOK, "Service ready.") + }) + rootGroup := e.Group("") // Register API v1 routes. apiV1Service := apiv1.NewAPIV1Service(profile, store, licenseService) diff --git a/store/db/postgres/common.go b/store/db/postgres/common.go new file mode 100644 index 0000000..2c05e4b --- /dev/null +++ b/store/db/postgres/common.go @@ -0,0 +1,18 @@ +package postgres + +import ( + "fmt" + "strings" +) + +func placeholder(n int) string { + return "$" + fmt.Sprint(n) +} + +func placeholders(n int) string { + list := []string{} + for i := 0; i < n; i++ { + list = append(list, placeholder(i+1)) + } + return strings.Join(list, ", ") +} diff --git a/store/db/postgres/memo.go b/store/db/postgres/memo.go index 7bce42a..3548b19 100644 --- a/store/db/postgres/memo.go +++ b/store/db/postgres/memo.go @@ -171,11 +171,3 @@ func (d *DB) DeleteMemo(ctx context.Context, delete *store.DeleteMemo) error { } return nil } - -func placeholders(n int) string { - list := []string{} - for i := 0; i < n; i++ { - list = append(list, fmt.Sprintf("$%d", i+1)) - } - return strings.Join(list, ", ") -} diff --git a/store/db/postgres/user.go b/store/db/postgres/user.go index b595fbe..3ab9b72 100644 --- a/store/db/postgres/user.go +++ b/store/db/postgres/user.go @@ -3,7 +3,6 @@ package postgres import ( "context" "errors" - "fmt" "strings" "github.com/yourselfhosted/slash/store" @@ -153,7 +152,3 @@ func (d *DB) DeleteUser(ctx context.Context, delete *store.DeleteUser) error { } return nil } - -func placeholder(n int) string { - return "$" + fmt.Sprint(n) -}