Documentation
¶
Index ¶
- Constants
- func AddCORSHeaders(w http.ResponseWriter, methods string)
- func CollectionCountHandler(model Model, maestro *maestro) http.HandlerFunc
- func CollectionHandler(modelZero Model, maestro *maestro) http.HandlerFunc
- func CreateMaestro(router *mux.Router, dBPoolCallback DbPoolCallback) *maestro
- func DeleteHandler(modelZero Model, maestro *maestro) http.HandlerFunc
- func GetHandler(modelZero Model, maestro *maestro) http.HandlerFunc
- func GetNumericRouteField(r *http.Request, field string) (uint, error)
- func HealthCheckHandler(maestro *maestro) http.HandlerFunc
- func InternalError(w http.ResponseWriter, err error)
- func MakeArrayDataStruct(dataType reflect.Type, data []interface{}, modelS modelStructure) interface{}
- func MakeSingularDataStruct(dataType reflect.Type, data interface{}, modelS modelStructure) interface{}
- func OptionsHandler(headers []string) http.HandlerFunc
- func PatchHandler(modelZero Model, maestro *maestro) http.HandlerFunc
- func PostHandler(modelZero Model, maestro *maestro) http.HandlerFunc
- func PutHandler(modelZero Model, maestro *maestro) http.HandlerFunc
- func RelationAddHandler(model1, model2 Model, fieldName string, maestro *maestro) http.HandlerFunc
- func RelationRemoveHandler(model1, model2 Model, fieldName string, maestro *maestro) http.HandlerFunc
- func SendData(w http.ResponseWriter, status int, data interface{})
- func SendEmptyResponse(w http.ResponseWriter, status int)
- func SendError(w http.ResponseWriter, status int, errs []JSendErrorDescription)
- func SendFail(w http.ResponseWriter, status int, message string)
- func SendSingleError(w http.ResponseWriter, status int, message string, code string)
- type CRUDOptions
- type DbPoolCallback
- type FullModel
- type HardDeleteModel
- type JSendError
- type JSendErrorDescription
- type JSendFail
- type JSendSuccess
- type MiddlewareAfter
- type MiddlewareAfterData
- type MiddlewareAfterFunction
- type MiddlewareAfterReturn
- type MiddlewareBefore
- type MiddlewareBeforeData
- type MiddlewareBeforeFunction
- type MiddlewareBeforeReturn
- type MiddlewareInitial
- type MiddlewareInitialData
- type MiddlewareInitialFunction
- type MiddlewareInitialReturn
- type MiddlewareMetaData
- type Model
- type RouteConfig
- type SimpleModel
Constants ¶
View Source
const ( MIDDLEWARE_TYPE_GLOBAL = 1 MIDDLEWARE_TYPE_COLLECTION = 2 MIDDLEWARE_TYPE_GET = 3 MIDDLEWARE_TYPE_POST = 4 MIDDLEWARE_TYPE_PUT = 5 MIDDLEWARE_TYPE_PATCH = 6 MIDDLEWARE_TYPE_DELETE = 7 MIDDLEWARE_TYPE_RELATION = 8 )
* Type
View Source
const ( MIDDLEWARE_LEVEL_ANY = 1 MIDDLEWARE_LEVEL_ROOT = 2 )
* Level
View Source
const ( MODEL_TYPE_FULL = 1 MODEL_TYPE_HARDDELETE = 2 MODEL_TYPE_SIMPLE = 3 )
View Source
const ( FIELD_TYPE_INTERNAL = 1 FIELD_TYPE_COMMON = 2 FIELD_TYPE_COMMON_TIME = 3 FIELD_TYPE_COMMON_JSON = 4 FIELD_TYPE_RELATION_ID = 5 FIELD_TYPE_RELATION_MODEL = 6 FIELD_TYPE_RELATION_COL_IDS = 7 FIELD_TYPE_RELATION_COL_IDS_UPDATE = 8 FIELD_TYPE_RELATION_COL_IDS_REPLACE = 9 FIELD_TYPE_RELATION_COL_MODELS = 10 FIELD_TYPE_RELATION_COL_MODELS_UPDATE = 11 FIELD_TYPE_RELATION_COL_MODELS_REPLACE = 12 )
Variables ¶
This section is empty.
Functions ¶
func AddCORSHeaders ¶
func AddCORSHeaders(w http.ResponseWriter, methods string)
func CollectionCountHandler ¶
func CollectionCountHandler(model Model, maestro *maestro) http.HandlerFunc
func CollectionHandler ¶
func CollectionHandler(modelZero Model, maestro *maestro) http.HandlerFunc
func CreateMaestro ¶
func CreateMaestro(router *mux.Router, dBPoolCallback DbPoolCallback) *maestro
func DeleteHandler ¶
func DeleteHandler(modelZero Model, maestro *maestro) http.HandlerFunc
func GetHandler ¶
func GetHandler(modelZero Model, maestro *maestro) http.HandlerFunc
func HealthCheckHandler ¶
func HealthCheckHandler(maestro *maestro) http.HandlerFunc
func InternalError ¶
func InternalError(w http.ResponseWriter, err error)
func MakeArrayDataStruct ¶
func MakeSingularDataStruct ¶
func OptionsHandler ¶
func OptionsHandler(headers []string) http.HandlerFunc
func PatchHandler ¶
func PatchHandler(modelZero Model, maestro *maestro) http.HandlerFunc
func PostHandler ¶
func PostHandler(modelZero Model, maestro *maestro) http.HandlerFunc
func PutHandler ¶
func PutHandler(modelZero Model, maestro *maestro) http.HandlerFunc
func RelationAddHandler ¶
func RelationAddHandler(model1, model2 Model, fieldName string, maestro *maestro) http.HandlerFunc
func RelationRemoveHandler ¶
func RelationRemoveHandler(model1, model2 Model, fieldName string, maestro *maestro) http.HandlerFunc
func SendData ¶
func SendData(w http.ResponseWriter, status int, data interface{})
func SendEmptyResponse ¶
func SendEmptyResponse(w http.ResponseWriter, status int)
func SendError ¶
func SendError(w http.ResponseWriter, status int, errs []JSendErrorDescription)
func SendSingleError ¶
func SendSingleError(w http.ResponseWriter, status int, message string, code string)
Types ¶
type DbPoolCallback ¶
type DbPoolCallback func(r *http.Request, metaData MiddlewareMetaData) *gorm.DB
type HardDeleteModel ¶
type JSendError ¶
type JSendError struct { Status string `json:"status"` Data []JSendErrorDescription `json:"data"` }
type JSendErrorDescription ¶
type JSendSuccess ¶
type JSendSuccess struct { Status string `json:"status"` Data interface{} `json:"data"` }
type MiddlewareAfter ¶
type MiddlewareAfter struct { Function MiddlewareAfterFunction Type int Level int }
func MiddlewareAfterCreate ¶
func MiddlewareAfterCreate(function MiddlewareAfterFunction, Type int, Level int) MiddlewareAfter
type MiddlewareAfterData ¶
type MiddlewareAfterData struct { R *http.Request W http.ResponseWriter DbConn *gorm.DB Meta MiddlewareMetaData Response map[string]interface{} }
type MiddlewareAfterFunction ¶
type MiddlewareAfterFunction func(data MiddlewareAfterData) MiddlewareAfterReturn
type MiddlewareAfterReturn ¶
type MiddlewareAfterReturn struct { R *http.Request W http.ResponseWriter Meta MiddlewareMetaData Response map[string]interface{} Error *[]JSendErrorDescription }
type MiddlewareBefore ¶
type MiddlewareBefore struct { Function MiddlewareBeforeFunction Type int Level int }
func MiddlewareBeforeCreate ¶
func MiddlewareBeforeCreate(function MiddlewareBeforeFunction, Type int, Level int) MiddlewareBefore
type MiddlewareBeforeData ¶
type MiddlewareBeforeData struct { R *http.Request W http.ResponseWriter DbConn *gorm.DB Meta MiddlewareMetaData Model reflect.Value }
type MiddlewareBeforeFunction ¶
type MiddlewareBeforeFunction func(data MiddlewareBeforeData) MiddlewareBeforeReturn
type MiddlewareBeforeReturn ¶
type MiddlewareBeforeReturn struct { R *http.Request W http.ResponseWriter Meta MiddlewareMetaData Model reflect.Value Error *[]JSendErrorDescription }
type MiddlewareInitial ¶
type MiddlewareInitial struct { Function MiddlewareInitialFunction Type int }
func MiddlewareInitialCreate ¶
func MiddlewareInitialCreate(function MiddlewareInitialFunction, Type int, Level int) MiddlewareInitial
type MiddlewareInitialData ¶
type MiddlewareInitialData struct { R *http.Request W http.ResponseWriter Meta MiddlewareMetaData }
type MiddlewareInitialFunction ¶
type MiddlewareInitialFunction func(data MiddlewareInitialData) MiddlewareInitialReturn
type MiddlewareInitialReturn ¶
type MiddlewareInitialReturn struct { R *http.Request W http.ResponseWriter Meta MiddlewareMetaData Error *[]JSendErrorDescription }
type MiddlewareMetaData ¶
type MiddlewareMetaData map[string]interface{}
type Model ¶
type Model interface { CRUDOptions() CRUDOptions MiddlewareBefore() []MiddlewareBefore MiddlewareAfter() []MiddlewareAfter }
type RouteConfig ¶
type SimpleModel ¶
type SimpleModel struct {
ID uint `json:"id" gorm:"primary_key"`
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.