helpers

package
v0.0.0-...-20c7f3d Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FlattenSettings

func FlattenSettings(settings []models.Setting) gin.H

func GenerateAccessToken

func GenerateAccessToken(secret string, subject string) (*string, error)

func GenerateApiToken

func GenerateApiToken(secret string, subject, creator string) (*string, error)

func GetParsedToken

func GetParsedToken(token, secret string) (*jwt.Token, error)

func GetRequestParams

func GetRequestParams(body io.ReadCloser) (map[string]interface{}, error)

func GetTokenAudience

func GetTokenAudience(token, secret string) (string, error)

func StringContains

func StringContains(a []string, x string) bool

func ValidateJwtToken

func ValidateJwtToken(token string, secret string, audience string) (jwt.MapClaims, error)

Types

type Error

type Error struct {
	Code     string `json:"code"`
	Message  string `json:"message"`
	Trace    error  `json:"trace"`
	HttpCode int    `json:"-"`
}

func ErrorWithCode

func ErrorWithCode(code string, message string, trace error) Error

func NewError

func NewError(httpCode int, code string, message string, trace error) Error

func NewErrorWithTrace

func NewErrorWithTrace(httpCode int, code string, message string, trace error) Error

func (Error) Error

func (e Error) Error() string

func (Error) ErrorTrace

func (e Error) ErrorTrace() error

type ReaderCounter

type ReaderCounter struct {
	io.Reader
	// contains filtered or unexported fields
}

ReaderCounter is counter for io.Reader

func NewReaderCounter

func NewReaderCounter(r io.Reader) *ReaderCounter

NewReaderCounter function for create new ReaderCounter

func (*ReaderCounter) Count

func (counter *ReaderCounter) Count() uint64

Count function return counted bytes

func (*ReaderCounter) Read

func (counter *ReaderCounter) Read(buf []byte) (int, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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