Documentation ¶
Index ¶
- Constants
- func ConvertSort(input string) (string, error)
- func ExtractClaims(tokenstring string, secret []byte) (jwt.MapClaims, error)
- func GenerateToken(account models.Account, secret []byte) (string, error)
- func IsZeroOfUnderlyingType(x interface{}) bool
- func RandNumberBytes(n int) string
- func RandStringBytes(n int) string
- func Replace(a, b interface{}) error
- func ResponseAuthJSON(c *gin.Context, code int, message string)
- func ResponseBadRequestJSON(c *gin.Context, code int, message interface{})
- func ResponseCreatedJSON(c *gin.Context, code int, message string, data interface{})
- func ResponseEntityListJSON(c *gin.Context, code int, message string, entityList interface{}, ...)
- func ResponseErrorJSON(c *gin.Context, error ErrorDetail)
- func ResponseErrorsJSON(c *gin.Context, errors Errors)
- func ResponseForbiddenJSON(c *gin.Context, code int, message interface{})
- func ResponseJSON(c *gin.Context, status int, code int, message string, data interface{})
- func ResponseNoContentJSON(c *gin.Context)
- func ResponseNotFoundJSON(c *gin.Context, code int, message string)
- func ResponseServerErrorJSON(c *gin.Context)
- func ResponseSuccessJSON(c *gin.Context, code int, message string, data interface{})
- func ValidateToken(tokenstring string, secret []byte) (bool, error)
- func VerifyFacebookID(id string, accessToken string) bool
- type ErrorDetail
- type Errors
- type ParamsGetAll
- type Sender
Constants ¶
const ( //Common error ErrorMissingParameter = 10 //Error about User ErrorExistEmail = 101 ErrorExistUsername = 102 ErrorExistEmailAndUsername = 103 ErrorExistStudentCode = 113 )
const
const (
GraphFacebookAPI = "https://graph.facebook.com"
)
const
const (
//SMTPSever const stror link email smtp
SMTPSever = "smtp.gmail.com"
)
Variables ¶
This section is empty.
Functions ¶
func ConvertSort ¶
ConvertSort func return a string for Query work ORDER BY, eg: input '+created_at' output 'created_at DESC'
func ExtractClaims ¶
ExtractClaims func to get map claims
func GenerateToken ¶
GenerateToken func to set token for a new login
func IsZeroOfUnderlyingType ¶
func IsZeroOfUnderlyingType(x interface{}) bool
IsZeroOfUnderlyingType return wether x is the is the zero-value of its underlying type.
func RandNumberBytes ¶
RandNumberBytes fun return a random number's string with n characters
func RandStringBytes ¶
RandStringBytes fun return a random string with n characters
func Replace ¶
func Replace(a, b interface{}) error
Replace replaces all fields of struct b that have a zero-value with the corresponding field value from a. b must be a pointer to a struct.
func ResponseAuthJSON ¶
ResponseAuthJSON func
func ResponseBadRequestJSON ¶
ResponseBadRequestJSON func
func ResponseCreatedJSON ¶
ResponseCreatedJSON func
func ResponseEntityListJSON ¶
func ResponseEntityListJSON(c *gin.Context, code int, message string, entityList interface{}, metadata interface{}, total int)
ResponseEntityListJSON func
func ResponseErrorJSON ¶
func ResponseErrorJSON(c *gin.Context, error ErrorDetail)
ResponseErrorJSON func
func ResponseErrorsJSON ¶
ResponseErrorsJSON func
func ResponseForbiddenJSON ¶
ResponseForbiddenJSON func
func ResponseJSON ¶
ResponseJSON func
func ResponseNotFoundJSON ¶
ResponseNotFoundJSON func
func ResponseServerErrorJSON ¶
ResponseServerErrorJSON func
func ResponseSuccessJSON ¶
ResponseSuccessJSON func
func ValidateToken ¶
ValidateToken func to authen token
func VerifyFacebookID ¶
VerifyFacebookID func to check logged in via Facebook
Types ¶
type ErrorDetail ¶
ErrorDetail struct for a Error
func NewErrorDetail ¶
func NewErrorDetail(c int, m string) ErrorDetail
NewErrorDetail func to create and return a new ErrorDetail
type Errors ¶
type Errors struct { Code int `json:"code"` Message string `json:"message"` ErrorDetails []ErrorDetail `json:"error_details"` }
Errors struct include a or a few errors
type ParamsGetAll ¶
type ParamsGetAll struct { Filter string `json:"filter,omitempty"` Sort string `json:"sort,omitempty"` Skip int `json:"skip,omitempty"` Limit int `json:"limit,omitempty"` Type string `json:"type,omitempty"` Properties map[string]interface{} `json:"properties,omitempty"` }
ParamsGetAll struct