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 CustomRender(c *gin.Context, data *hook.Data, ep *hook.EndPoint, total *int, ...) bool
- 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) (*datatype.UUID, render.Renderer)
- func JSONPatchesFromJSONBody(r *http.Request) ([]mdlutil.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 mdlutil.UserIDFetchable) (mdl.IModel, render.Renderer)
- func ModelOrModelsFromJSONBody(r *http.Request, typeString string, who mdlutil.UserIDFetchable) ([]mdl.IModel, *bool, render.Renderer)
- func ModelsFromJSONBody(r *http.Request, typeString string, who mdlutil.UserIDFetchable, ...) ([]mdl.IModel, render.Renderer)
- func OptionFromContext(r *http.Request) map[urlparam.Param]interface{}
- func OptionToContext(c *gin.Context, options map[urlparam.Param]interface{})
- func OrderByFromQueryString(values *url.Values) *string
- 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 RenderCodeAndMsg(c *gin.Context, code int, total int, msg *string, err *string)
- func RenderJSONForModel(c *gin.Context, modelObj mdl.IModel, data *hook.Data, ep *hook.EndPoint)
- func RenderModel(c *gin.Context, data *hook.Data, ep *hook.EndPoint, total *int, ...)
- func RenderModelSlice(c *gin.Context, data *hook.Data, ep *hook.EndPoint, 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) mdlutil.UserIDFetchable
Register Who handler func WhoFromContext(r *http.Request) mdl.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 CustomRender ¶ added in v0.10.3
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 mdlutil.UserIDFetchable) (mdl.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 mdlutil.UserIDFetchable) ([]mdl.IModel, *bool, render.Renderer)
ModelOrModelsFromJSONBody parses JSON body into array of mdl 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 mdlutil.UserIDFetchable, toValidate bool) ([]mdl.IModel, render.Renderer)
ModelsFromJSONBody parses JSON body into array of mdl
func OptionFromContext ¶ added in v0.8.0
func OptionToContext ¶ added in v0.8.0
func OrderByFromQueryString ¶ added in v0.9.26
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 RenderCodeAndMsg ¶ added in v0.10.3
func RenderJSONForModel ¶ added in v0.5.5
func RenderModel ¶ added in v0.4.16
func RenderModelSlice ¶ added in v0.4.16
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 { }
------------------------------------------------------