Documentation ¶
Index ¶
- Constants
- Variables
- func AddRESTRoutes(r *gin.Engine)
- func CreateHandler(typeString string, mapper datamapper.IDataMapper) func(c *gin.Context)
- func CreatedTimeRangeFromQueryString(values *url.Values) (*int, *int, error)
- func DeleteManyHandler(typeString string, mapper datamapper.IDataMapper) func(c *gin.Context)
- func DeleteOneHandler(typeString string, mapper datamapper.IDataMapper) func(c *gin.Context)
- func GetOptionByParsingURL(r *http.Request) (map[urlparam.Param]interface{}, error)
- func GuardMiddleWare(typeString string) func(c *gin.Context)
- func IDFromURLQueryString(c *gin.Context) (*datatypes.UUID, render.Renderer)
- func JSONPatchesFromJSONBody(r *http.Request) ([]models.JSONIDPatch, render.Renderer)
- func LatestnFromQueryString(values *url.Values) *string
- func LatestnOnFromQueryString(values *url.Values) []string
- func LimitAndOffsetFromQueryString(values *url.Values) (*int, *int, error)
- func ModelFromJSONBody(r *http.Request, typeString string, who models.UserIDFetchable) (models.IModel, render.Renderer)
- func ModelOrModelsFromJSONBody(r *http.Request, typeString string, who models.UserIDFetchable) ([]models.IModel, *bool, render.Renderer)
- func ModelsFromJSONBody(r *http.Request, typeString string, who models.UserIDFetchable) ([]models.IModel, render.Renderer)
- func OptionFromContext(r *http.Request) map[urlparam.Param]interface{}
- func OptionToContext(c *gin.Context, options map[urlparam.Param]interface{})
- func OrderFromQueryString(values *url.Values) *string
- func PatchManyHandler(typeString string, mapper datamapper.IDataMapper) func(c *gin.Context)
- func PatchOneHandler(typeString string, mapper datamapper.IDataMapper) func(c *gin.Context)
- func ReadManyHandler(typeString string, mapper datamapper.IDataMapper) func(c *gin.Context)
- func ReadOneHandler(typeString string, mapper datamapper.IDataMapper) func(c *gin.Context)
- func RenderJSONForModel(c *gin.Context, modelObj models.IModel, data *controller.Data)
- func RenderJSONForModelOri(c *gin.Context, modelObj models.IModel, hpdata *models.HookPointData)
- func RenderModel(c *gin.Context, total *int, data *controller.Data, ...)
- func RenderModelOri(c *gin.Context, modelObj models.IModel, hpdata *models.HookPointData, ...)
- func RenderModelSlice(c *gin.Context, total *int, data *controller.Data, ...)
- func RenderModelSliceOri(c *gin.Context, modelObjs []models.IModel, total *int, ...)
- func UpdateManyHandler(typeString string, mapper datamapper.IDataMapper) func(c *gin.Context)
- func UpdateOneHandler(typeString string, mapper datamapper.IDataMapper) func(c *gin.Context)
- type JSONBodyWithContent
- type TransIDLogger
Constants ¶
const (
ContextKeyOption contextKey = "option"
)
Variables ¶
var WhoFromContext func(r *http.Request) models.UserIDFetchable
Register Who handler func WhoFromContext(r *http.Request) models.Who
Functions ¶
func CreateHandler ¶ added in v0.1.25
func CreateHandler(typeString string, mapper datamapper.IDataMapper) func(c *gin.Context)
func CreatedTimeRangeFromQueryString ¶ added in v0.4.16
func DeleteManyHandler ¶
func DeleteManyHandler(typeString string, mapper datamapper.IDataMapper) func(c *gin.Context)
DeleteManyHandler returns a Gin handler which delete many records
func DeleteOneHandler ¶
func DeleteOneHandler(typeString string, mapper datamapper.IDataMapper) func(c *gin.Context)
DeleteOneHandler returns a Gin handler which delete one record
func GetOptionByParsingURL ¶ added in v0.4.16
func GuardMiddleWare ¶ added in v0.7.0
func IDFromURLQueryString ¶
IDFromURLQueryString parses resource ID from the URL query string
func JSONPatchesFromJSONBody ¶ added in v0.3.1
JSONPatchesFromJSONBody pares an array of JSON patch from the HTTP body
func LatestnFromQueryString ¶ added in v0.4.16
func LatestnOnFromQueryString ¶ added in v0.4.30
func LimitAndOffsetFromQueryString ¶ added in v0.4.16
---------------------------------------------
func ModelFromJSONBody ¶
func ModelFromJSONBody(r *http.Request, typeString string, who models.UserIDFetchable) (models.IModel, render.Renderer)
ModelFromJSONBody parses JSON body into a model FIXME: Validation should not be done here because empty field does not pass validation, but sometimes we need empty fields such as patch
func ModelOrModelsFromJSONBody ¶ added in v0.1.24
func ModelOrModelsFromJSONBody(r *http.Request, typeString string, who models.UserIDFetchable) ([]models.IModel, *bool, render.Renderer)
ModelOrModelsFromJSONBody parses JSON body into array of models It take care where the case when it is not even an array and there is a "content" in there
func ModelsFromJSONBody ¶
func ModelsFromJSONBody(r *http.Request, typeString string, who models.UserIDFetchable) ([]models.IModel, render.Renderer)
ModelsFromJSONBody parses JSON body into array of models
func OptionFromContext ¶ added in v0.8.0
func OptionToContext ¶ added in v0.8.0
func OrderFromQueryString ¶ added in v0.4.16
func PatchManyHandler ¶ added in v0.3.1
func PatchManyHandler(typeString string, mapper datamapper.IDataMapper) func(c *gin.Context)
PatchManyHandler returns a Gin handler which patch (partial update) many records
func PatchOneHandler ¶
func PatchOneHandler(typeString string, mapper datamapper.IDataMapper) func(c *gin.Context)
PatchOneHandler returns a Gin handler which patch (partial update) one record
func ReadManyHandler ¶ added in v0.8.0
func ReadManyHandler(typeString string, mapper datamapper.IDataMapper) func(c *gin.Context)
ReadManyHandler returns a Gin handler which fetch multiple records of a resource
func ReadOneHandler ¶
func ReadOneHandler(typeString string, mapper datamapper.IDataMapper) func(c *gin.Context)
ReadOneHandler returns a http.Handler which read one resource
func RenderJSONForModel ¶ added in v0.5.5
func RenderJSONForModelOri ¶ added in v0.8.0
func RenderModel ¶ added in v0.4.16
func RenderModel(c *gin.Context, total *int, data *controller.Data, info *controller.EndPointInfo)
func RenderModelOri ¶ added in v0.8.0
func RenderModelSlice ¶ added in v0.4.16
func RenderModelSlice(c *gin.Context, total *int, data *controller.Data, info *controller.EndPointInfo)
func RenderModelSliceOri ¶ added in v0.8.0
func UpdateManyHandler ¶
func UpdateManyHandler(typeString string, mapper datamapper.IDataMapper) func(c *gin.Context)
UpdateManyHandler returns a Gin handler which updates many records
func UpdateOneHandler ¶
func UpdateOneHandler(typeString string, mapper datamapper.IDataMapper) func(c *gin.Context)
UpdateOneHandler returns a http.Handler which updates a resource
Types ¶
type JSONBodyWithContent ¶ added in v0.1.24
type JSONBodyWithContent struct {
Content []json.RawMessage
}
JSONBodyWithContent for partial unmarshalling
type TransIDLogger ¶ added in v0.8.0
type TransIDLogger struct { }
------------------------------------------------------