Documentation ¶
Index ¶
- func DefaultFindFromRequest(r *http.Request, db *gorm.DB, data interface{}) error
- func DefaultQueryAll(r *http.Request, q *gorm.DB) *gorm.DB
- func GetSha(b []byte) string
- func Has(b, flag RightBits) bool
- func HasRights(r *http.Request, rights RightBits, ...) bool
- func HasRightsRequest(r *http.Request, rights RightBits) bool
- func Message(status bool, message string) map[string]interface{}
- func ReadFloatURL(r *http.Request, param string) (float64, error)
- func ReadInt(r *http.Request, param string, v int64) (int64, error)
- func ReadIntURL(r *http.Request, param string) (int, error)
- func ReadJSON(r *http.Request, v interface{}) error
- func ReadURL(r *http.Request, param string) string
- func Respond(w http.ResponseWriter, data map[string]interface{})
- func RespondCode(w http.ResponseWriter, data map[string]interface{}, statusCode int)
- type JSON
- func (j JSON) Equals(j1 JSON) bool
- func (j JSON) IsNull() bool
- func (j JSON) MarshalJSON() ([]byte, error)
- func (j *JSON) New(value interface{}) error
- func (j *JSON) Scan(value interface{}) error
- func (j JSON) To(ret interface{}) error
- func (j JSON) ToInterface() map[string]interface{}
- func (j *JSON) UnmarshalJSON(data []byte) error
- func (j JSON) Value() (driver.Value, error)
- type RightBits
- type Route
- type Routes
- type Token
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultFindFromRequest ¶
func HasRights ¶
func HasRights(r *http.Request, rights RightBits, f func(r *http.Request, rights RightBits) bool) bool
HasRights check for correct role
func HasRightsRequest ¶
HasRightsRequest check for correct role
func ReadFloatURL ¶
ReadIntURL read an URL parameter
func ReadIntURL ¶
ReadIntURL read an URL parameter
func Respond ¶
func Respond(w http.ResponseWriter, data map[string]interface{})
Respond Create a JSON response with headers
func RespondCode ¶
func RespondCode(w http.ResponseWriter, data map[string]interface{}, statusCode int)
RespondCode Create a JSON response with headers
Types ¶
type JSON ¶
type JSON []byte
JSON return a json type
func (JSON) ToInterface ¶
ToInterface to return an string interface
func (*JSON) UnmarshalJSON ¶
UnmarshalJSON return JSON
type Route ¶
type Route struct { Name string `json:"name"` Method string `json:"method"` Pattern string `json:"pattern"` HandlerFunc http.HandlerFunc `json:"-"` Authorization uint32 `json:"auth"` }
Route define a route with url and rights required to access it
Click to show internal directories.
Click to hide internal directories.