improv api, datastore, postgres, runner

This commit is contained in:
Pedro Nasser
2016-07-21 21:18:02 -03:00
parent 154fd82b68
commit 5a13e2c0cc
10 changed files with 215 additions and 127 deletions

View File

@@ -2,20 +2,32 @@ package models
import "errors"
type Apps []App
type Apps []*App
var (
ErrAppsCreate = errors.New("Could not create app")
ErrAppsUpdate = errors.New("Could not update app")
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")
ErrAppsNotFound = errors.New("App not found")
ErrAppsCreate = errors.New("Could not create app")
ErrAppsUpdate = errors.New("Could not update app")
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")
ErrAppsNotFound = errors.New("App not found")
ErrAppNothingToUpdate = errors.New("Nothing to update")
)
type App struct {
Name string `json:"name"`
Routes Routes `json:"routes"`
Routes Routes `json:"routes,omitempty"`
}
var (
ErrAppsValidationName = errors.New("Missing app name")
)
func (a *App) Validate() error {
if a.Name == "" {
return ErrAppsValidationName
}
return nil
}
type AppFilter struct {