Documentation ¶
Index ¶
- 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 GetAllHandler(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 LogTransID(tx *gorm.DB, method, url, cardinality string)
- 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 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 ReadOneHandler(typeString string, mapper datamapper.IDataMapper) func(c *gin.Context)
- func RenderJSONForModel(c *gin.Context, modelObj models.IModel, hpdata *models.HookPointData)
- func RenderModel(c *gin.Context, modelObj models.IModel, hpdata *models.HookPointData, ...)
- func RenderModelSlice(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
Constants ¶
This section is empty.
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)
CreateHandler creates a resource
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 GetAllHandler ¶ added in v0.4.29
func GetAllHandler(typeString string, mapper datamapper.IDataMapper) func(c *gin.Context)
GetAllHandler returns a Gin handler which fetch multiple records of a resource
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 LogTransID ¶ added in v0.7.0
------------------------------------------------------
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 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 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 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