package
0.0.0-20230910125232-9c070a028f62
Repository: https://github.com/tqrj/cd.git
Documentation: pkg.go.dev
# Functions
Contains returns true if an element is present in a collection.
CreateHandler handles
POST /T
creates a new model T, responds with the created model T if successful.
CreateNestedHandler handles
POST /P/:parentIDRouteParam/T
where: - P is the parent model, T is the child model - parentIDRouteParam is the route param name of the parent model P - field is the field name of the child model T in the parent model P
responds with the updated parent model P
Request body: - {...} // fields of the child model T
Response: - 200 OK: { P: {...} } - 400 Bad Request: { error: "request band failed" } - 422 Unprocessable Entity: { error: "create process failed" }.
DeleteHandler handles
DELETE /T/:idParam
Deletes the model T with the given id.
DeleteNestedHandler handles
DELETE /P/:parentIdParam/T/:childIdParam
where: - P is the parent model, T is the child model - parentIdParam is the route param name of the parent model P - childIdParam is the route param name of the child model T in the parent model P - field is the field name of the child model T in the parent model P
Request body: none
Response: - 200 OK: { deleted: true } - 400 Bad Request: { error: "missing id" } - 422 Unprocessable Entity: { error: "delete process failed" }.
ErrorResponseBody builds the error response body:
{ error: "error message" }.
GetByIDHandler handles
GET /T/:idParam
QueryOptions (See GetRequestOptions for more details): preload
Response: - 200 OK: { T: {...} } - 400 Bad Request: { error: "request band failed" } - 422 Unprocessable Entity: { error: "get process failed" }.
GetFieldHandler handles
GET /T/:idParam/field
QueryOptions (See GetRequestOptions for more details):
limit, offset, order_by, desc, filter_by, filter_value, preload, total.
GetListHandler handles
GET /T
It returns a list of models.
ResponseError writes an error response to client in JSON.
ResponseSuccess writes a success response to client in JSON.
SuccessResponseBody builds the success response body:
{ `model`: { ..
UpdateHandler handles
PUT /T/:idParam
Updates the model T with the given id.
# Constants
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Variables
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author