util

package
v0.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 20, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultBrotliConfig = BrotliConfig{
		Skipper: middleware.DefaultSkipper,
		Level:   brotli.DefaultCompression,
	}
)

DefaultBrotliConfig is the default Brotli middleware config

Functions

func Brotli

func Brotli() echo.MiddlewareFunc

Brotli returns a middleware which compresses HTTP response using brotli compression

func BrotliWithConfig

func BrotliWithConfig(config BrotliConfig) echo.MiddlewareFunc

BrotliWithConfig return Brotli middleware with config

func GenerateRandomBytes

func GenerateRandomBytes(x int) ([]byte, error)

GenerateRandomBytes using a Cryptographically Secure Pseudorandom Number Generator (CSPRNG)

func MySQL

func MySQL(x string, y int) *sqlx.DB

MySQL connects (or panics) to the MySQL database

Types

type BrotliConfig

type BrotliConfig struct {
	// Skipper defines a function to skip middleware
	Skipper middleware.Skipper
	// Brotli compression level, optional default = -1
	Level int `yaml:"level"`
}

BrotliConfig defines the config for Brotli middleware

type JWTclaims

type JWTclaims struct {
	PublicKey  string `json:"PublicKey"`
	ScreenName string `json:"ScreenName"`
	jwt.StandardClaims
}

JWTclaims to hold Monographia specific data

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL