server

package
v0.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 1, 2017 License: GPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddResourcesToApi2Go

func AddResourcesToApi2Go(api *api2go.API, tables []resource.TableInfo, db *sqlx.DB, ms *resource.MiddlewareSet, configStore *resource.ConfigStore) map[string]*resource.DbResource

func BuildMiddlewareSet

func BuildMiddlewareSet(cmsConfig *resource.CmsConfig) resource.MiddlewareSet

func CleanUpConfigFiles

func CleanUpConfigFiles()

func CorsMiddlewareFunc

func CorsMiddlewareFunc(c *gin.Context)

func CreateConfigHandler

func CreateConfigHandler(configStore *resource.ConfigStore) func(context *gin.Context)

func CreateEventHandler

func CreateEventHandler(initConfig *resource.CmsConfig, fsmManager resource.FsmManager, cruds map[string]*resource.DbResource, db *sqlx.DB) func(context *gin.Context)

func CreateEventStartHandler

func CreateEventStartHandler(fsmManager resource.FsmManager, cruds map[string]*resource.DbResource, db *sqlx.DB) func(context *gin.Context)

func CreateJsModelHandler

func CreateJsModelHandler(initConfig *resource.CmsConfig) func(*gin.Context)

func GetActionPerformers

func GetActionPerformers(initConfig *resource.CmsConfig, configStore *resource.ConfigStore) []resource.ActionPerformerInterface

func GetTablesFromWorld

func GetTablesFromWorld(db *sqlx.DB) ([]resource.TableInfo, error)

func Main

func Main()

func NewStateMachineEvent

func NewStateMachineEvent(machineId string, eventName string) resource.StateMachineEvent

Types

type CorsInfo

type CorsInfo struct {
	IsCors      bool
	IsPreflight bool
	Origin      string
	OriginUrl   *url.URL

	// The header value is converted to uppercase to avoid common mistakes.
	AccessControlRequestMethod string

	// The header values are normalized with http.CanonicalHeaderKey.
	AccessControlRequestHeaders []string
}

func GetCorsInfo

func GetCorsInfo(r *http.Request) *CorsInfo

type CorsMiddleware

type CorsMiddleware struct {

	// Reject non CORS requests if true. See CorsInfo.IsCors.
	RejectNonCorsRequests bool

	// Function excecuted for every CORS requests to validate the Origin. (Required)
	// Must return true if valid, false if invalid.
	// For instance: simple equality, regexp, DB lookup, ...
	OriginValidator func(origin string, request *http.Request) bool

	// List of allowed HTTP methods. Note that the comparison will be made in
	// uppercase to avoid common mistakes. And that the
	// Access-Control-Allow-Methods response header also uses uppercase.
	// (see CorsInfo.AccessControlRequestMethod)
	AllowedMethods []string

	// List of allowed HTTP Headers. Note that the comparison will be made with
	// noarmalized names (http.CanonicalHeaderKey). And that the response header
	// also uses normalized names.
	// (see CorsInfo.AccessControlRequestHeaders)
	AllowedHeaders []string

	// List of headers used to set the Access-Control-Expose-Headers header.
	AccessControlExposeHeaders []string

	// User to se the Access-Control-Allow-Credentials response header.
	AccessControlAllowCredentials bool

	// Used to set the Access-Control-Max-Age response header, in seconds.
	AccessControlMaxAge int
	// contains filtered or unexported fields
}

CorsMiddleware provides a configurable CORS implementation.

func (*CorsMiddleware) MiddlewareFunc

func (mw *CorsMiddleware) MiddlewareFunc(handler http.HandlerFunc) http.HandlerFunc

MiddlewareFunc makes CorsMiddleware implement the Middleware interface.

type JsModel

type JsModel struct {
	ColumnModel   map[string]interface{}
	Actions       []resource.Action
	StateMachines []map[string]interface{}
}

type JsonApiRelation

type JsonApiRelation struct {
	JsonApi    string `json:"jsonApi,omitempty"`
	ColumnType string `json:"columnType"`
	Type       string `json:"type,omitempty"`
	ColumnName string `json:"ColumnName"`
}

func NewJsonApiRelation

func NewJsonApiRelation(name string, relationName string, relationType string, columnType string) JsonApiRelation

type ManualResponse

type ManualResponse struct {
	Data interface{}
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL