Documentation
¶
Index ¶
- func DeleteSessionCookie(w http.ResponseWriter)
- func GenerateSessionKey() (string, error)
- func GetCookie(r *http.Request) *http.Cookie
- func GetInt32FromPath(r *http.Request, key string) (int32, error)
- func GetInt32FromQuery(r *http.Request, key string, defaultValue int32) int32
- func GetInt64FromPath(r *http.Request, key string) (int64, error)
- func GetPagination(limit, page int32) (newLimit, offset int64)
- func GetSessionFromContext(ctx context.Context) *entity.Session
- func GetUserIDFromContext(ctx context.Context) int64
- func HashBcrypt(password string) (string, error)
- func HashBcryptCompare(password, hash string) bool
- func HashSha256(data string) string
- func NewSqlInt64(val *int64) sql.NullInt64
- func NewSqlString(val *string) sql.NullString
- func ParseJsonFromHTTPRequest(r io.ReadCloser, data interface{}) error
- func PrepareStringToLike(s string) string
- func Response(w http.ResponseWriter, respBody interface{}) error
- func ResponseWithMeta(w http.ResponseWriter, respBody interface{}, meta *Meta) error
- func SetSessionCookie(session string, w http.ResponseWriter)
- func SqlStringToString(val sql.NullString) *string
- func UUIDGenerate() (string, error)
- func WriteJSONHTTPResponse(w http.ResponseWriter, httpCode int, data interface{}) error
- type JSONResponse
- type Meta
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeleteSessionCookie ¶
func DeleteSessionCookie(w http.ResponseWriter)
func GenerateSessionKey ¶
func GetInt32FromQuery ¶
func GetPagination ¶
func GetUserIDFromContext ¶
func HashBcrypt ¶
func HashBcryptCompare ¶
func HashSha256 ¶
func NewSqlInt64 ¶
func NewSqlString ¶
func NewSqlString(val *string) sql.NullString
func ParseJsonFromHTTPRequest ¶
func ParseJsonFromHTTPRequest(r io.ReadCloser, data interface{}) error
func PrepareStringToLike ¶
func Response ¶
func Response(w http.ResponseWriter, respBody interface{}) error
func ResponseWithMeta ¶
func ResponseWithMeta(w http.ResponseWriter, respBody interface{}, meta *Meta) error
func SetSessionCookie ¶
func SetSessionCookie(session string, w http.ResponseWriter)
func SqlStringToString ¶
func SqlStringToString(val sql.NullString) *string
func UUIDGenerate ¶
func WriteJSONHTTPResponse ¶
func WriteJSONHTTPResponse(w http.ResponseWriter, httpCode int, data interface{}) error
Types ¶
type JSONResponse ¶
type JSONResponse struct {
// Body
Data interface{} `json:"data,omitempty"`
// Meta
Meta *Meta `json:"meta,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.