mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
Datastore refactor and added postgres tests (#259)
* fix apps & routes creation/update * refactor datastore and added postgres tests * added test-datastore and fixed circleci test
This commit is contained in:
@@ -13,6 +13,7 @@ var (
|
||||
ErrAppsRemoving = errors.New("Could not remove app from datastore")
|
||||
ErrAppsGet = errors.New("Could not get app from datastore")
|
||||
ErrAppsList = errors.New("Could not list apps from datastore")
|
||||
ErrAppsAlreadyExists = errors.New("App already exists")
|
||||
ErrAppsNotFound = errors.New("App not found")
|
||||
ErrAppsNothingToUpdate = errors.New("Nothing to update")
|
||||
ErrAppsMissingNew = errors.New("Missing new application")
|
||||
|
||||
@@ -5,13 +5,15 @@ import "errors"
|
||||
type Datastore interface {
|
||||
GetApp(appName string) (*App, error)
|
||||
GetApps(*AppFilter) ([]*App, error)
|
||||
StoreApp(*App) (*App, error)
|
||||
InsertApp(app *App) (*App, error)
|
||||
UpdateApp(app *App) (*App, error)
|
||||
RemoveApp(appName string) error
|
||||
|
||||
GetRoute(appName, routePath string) (*Route, error)
|
||||
GetRoutes(*RouteFilter) (routes []*Route, err error)
|
||||
GetRoutesByApp(string, *RouteFilter) (routes []*Route, err error)
|
||||
StoreRoute(*Route) (*Route, error)
|
||||
InsertRoute(route *Route) (*Route, error)
|
||||
UpdateRoute(route *Route) (*Route, error)
|
||||
RemoveRoute(appName, routePath string) error
|
||||
|
||||
// The following provide a generic key value store for arbitrary data, can be used by extensions to store extra data
|
||||
|
||||
@@ -11,14 +11,15 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
ErrRoutesCreate = errors.New("Could not create route")
|
||||
ErrRoutesUpdate = errors.New("Could not update route")
|
||||
ErrRoutesRemoving = errors.New("Could not remove route from datastore")
|
||||
ErrRoutesGet = errors.New("Could not get route from datastore")
|
||||
ErrRoutesList = errors.New("Could not list routes from datastore")
|
||||
ErrRoutesNotFound = errors.New("Route not found")
|
||||
ErrRoutesMissingNew = errors.New("Missing new route")
|
||||
ErrInvalidPayload = errors.New("Invalid payload")
|
||||
ErrRoutesCreate = errors.New("Could not create route")
|
||||
ErrRoutesUpdate = errors.New("Could not update route")
|
||||
ErrRoutesRemoving = errors.New("Could not remove route from datastore")
|
||||
ErrRoutesGet = errors.New("Could not get route from datastore")
|
||||
ErrRoutesList = errors.New("Could not list routes from datastore")
|
||||
ErrRoutesAlreadyExists = errors.New("Route already exists")
|
||||
ErrRoutesNotFound = errors.New("Route not found")
|
||||
ErrRoutesMissingNew = errors.New("Missing new route")
|
||||
ErrInvalidPayload = errors.New("Invalid payload")
|
||||
)
|
||||
|
||||
type Routes []*Route
|
||||
|
||||
Reference in New Issue
Block a user