Documentation ¶
Index ¶
- Variables
- func Close()
- func ExtractToken(r *http.Request) string
- func GetSimpleValue(r *http.Request, paramName string) (value string, exists bool)
- func GetSimpleValueAsInt(r *http.Request, paramName string) (value int64, exists bool, err error)
- func Hash(password string) ([]byte, error)
- func InitDb(host, dbname, dbuser, dbpass string)
- func Install(loadTestData bool)
- func ReadToken(secretKey string, tokenString string) (*jwt.Token, error)
- func ResponseERROR(w http.ResponseWriter, statusCode int, err error)
- func ResponseJSON(w http.ResponseWriter, statusCode int, data interface{})
- func SetMiddlewareAuth(next http.HandlerFunc) http.HandlerFunc
- func SetMiddlewareJSON(next http.HandlerFunc) http.HandlerFunc
- func TokenValid(r *http.Request) error
- func ValidPassword(hashedPassword, password string) (bool, error)
- type Route
- type Routes
- type TokenPair
Constants ¶
This section is empty.
Variables ¶
View Source
var Db *sql.DB
View Source
var TempSecret = "123"
Functions ¶
func ExtractToken ¶
func GetSimpleValue ¶
func GetSimpleValueAsInt ¶
func ResponseERROR ¶
func ResponseERROR(w http.ResponseWriter, statusCode int, err error)
func ResponseJSON ¶
func ResponseJSON(w http.ResponseWriter, statusCode int, data interface{})
func SetMiddlewareAuth ¶
func SetMiddlewareAuth(next http.HandlerFunc) http.HandlerFunc
Проверяем токен
func SetMiddlewareJSON ¶
func SetMiddlewareJSON(next http.HandlerFunc) http.HandlerFunc
Добавляем Content-Type всем обработчикам
func ValidPassword ¶
Types ¶
Click to show internal directories.
Click to hide internal directories.