Documentation ¶
Index ¶
- Constants
- Variables
- func AppendBindings(item interface{}) error
- func BindAndValidate(c *gin.Context, i interface{}) error
- func CRUDL(r gin.IRoutes, path string, i interface{}, methods string)
- func CheckPassword(password string, p layer.PasswordEncoderAware) bool
- func EncodePassword(p layer.PasswordEncoderAware) error
- func HandleDelete(c *gin.Context, i interface{}, id string)
- func HandleGet(c *gin.Context, i interface{}, id string)
- func HandleList(c *gin.Context, i interface{})
- func HandlePatch(c *gin.Context, i interface{}, id string)
- func HandlePost(c *gin.Context, i interface{})
- func HttpError(c *gin.Context, code int, message string, data interface{}) error
- func NewItem(i interface{}, sc *layer.SerializeGroups) interface{}
- func NewValidationError(tag string, field string, resource interface{}) layer.ValidationError
- func ParseToken(tokenString string) (interface{}, error)
- func RemoveUUIDBindings(item interface{})
- func Serialize(i interface{}, sc *layer.SerializeGroups) interface{}
- type CollectonItem
- type Token
Constants ¶
View Source
const ( SERIALIZER_CONTEXT_KEY_ONE = "one" SERIALIZER_CONTEXT_KEY_LIST = "list" )
View Source
const (
CONTEXT_KEY_TOKEN = "ctx.auth.token"
)
Variables ¶
View Source
var ( BinderConfig = &binderConfig{ KeepBody: false, } )
Functions ¶
func AppendBindings ¶
func AppendBindings(item interface{}) error
Append bindings based on GetUUIDBindings resource method
func BindAndValidate ¶
Bind and validate recursively a request body to a resource
func CheckPassword ¶
func CheckPassword(password string, p layer.PasswordEncoderAware) bool
Check the strong password
func EncodePassword ¶
func EncodePassword(p layer.PasswordEncoderAware) error
Strongly encode a password based on the resource ID
func HandleDelete ¶
Gin handler for a DELETE request
func HandlePatch ¶
Gin handler for a PATCH request
func NewItem ¶
func NewItem(i interface{}, sc *layer.SerializeGroups) interface{}
Create a new item single response
func NewValidationError ¶
func NewValidationError(tag string, field string, resource interface{}) layer.ValidationError
Create a new validation error from a tag and a field
func ParseToken ¶
Parse a string into a valid JWT token and returns the token information or return an error
func Serialize ¶
func Serialize(i interface{}, sc *layer.SerializeGroups) interface{}
Serialize a resource (aware of Interface or not)
Types ¶
type CollectonItem ¶
type CollectonItem struct { Items []interface{} `json:"items"` Count int `json:"count,omitempty"` Total int `json:"total,omitempty"` Links *layer.Links `json:"_links,omitempty"` }
func NewCollectionItem ¶
func NewCollectionItem(items []interface{}, sc *layer.SerializeGroups) *CollectonItem
Create a new item collection response
Source Files ¶
Click to show internal directories.
Click to hide internal directories.