utils

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2020 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetRawFile

func GetRawFile(urlString string) (string, error)

GetRawFile returns a valid raw file for major code hosting platforms

func GetRawURL

func GetRawURL(url *url.URL) string

GetRawURL returns a valid raw root repository based on major code hosting platforms

func GetURLFromYMLBuffer

func GetURLFromYMLBuffer(in []byte) (*url.URL, error)

GetURLFromYMLBuffer returns a valid URL string based on input object takes valid URL as input

func SetupResponse

func SetupResponse(w *http.ResponseWriter, req *http.Request)

SetupResponse set CORS header

func Yaml2json

func Yaml2json(y []byte) []byte

Yaml2json yaml to json conversion

Types

type App

type App struct {
	Router         *mux.Router
	Port           string
	Debug          bool
	DisableNetwork bool
}

App application main settings and export for tests

type ErrorInvalidKey

type ErrorInvalidKey struct {
	Key string `json:"Key"`
}

ErrorInvalidKey represents an error caused by an invalid key.

func (ErrorInvalidKey) Error

func (e ErrorInvalidKey) Error() string

type ErrorInvalidValue

type ErrorInvalidValue struct {
	Key    string `json:"Key"`
	Reason string `json:"Reason"`
}

ErrorInvalidValue represents an error caused by an invalid value.

func ErrorsToValidationErrors added in v1.0.2

func ErrorsToValidationErrors(err error) (out []ErrorInvalidValue)

ErrorsToValidationErrors converts validation errors

func (ErrorInvalidValue) Error

func (e ErrorInvalidValue) Error() string

type ErrorParseMulti

type ErrorParseMulti []error

ErrorParseMulti represents an error caused by a multivalue key.

func (ErrorParseMulti) Error

func (es ErrorParseMulti) Error() string

type Message

type Message struct {
	Status          int                    `json:"status"`
	Message         string                 `json:"message"`
	Publiccode      *publiccode.PublicCode `json:"pc,omitempty"`
	Error           string                 `json:"error,omitempty"`
	ValidationError []ErrorInvalidValue    `json:"validationErrors,omitempty"`
}

Message json type mapping, for test purpose

Jump to

Keyboard shortcuts

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