utils

package
v0.0.0-...-12b39c2 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2022 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ContentType     = "Content-Type"
	ApplicationJSON = "application/json; charset=UTF-8"
)

Costanti

Variables

This section is empty.

Functions

func CalculateHash

func CalculateHash(v interface{}) (string, error)

CalculateHash calcola l'hash

func CalculateHashFromByteArray

func CalculateHashFromByteArray(b []byte) string

func ExtractParam

func ExtractParam(param url.Values, name string) string

ExtractParam ...

func ParsePost

func ParsePost(request *http.Request, body interface{}) error

ParsePost : funzione per il parsing di una richiesta POST

func RespondWithError

func RespondWithError(w http.ResponseWriter, code int, msg string)

RespondWithError : funzione per la restituzione di un errore JSON

func RespondWithJSON

func RespondWithJSON(w http.ResponseWriter, code int, payload interface{})

RespondWithJSON : funzione per la restituzione di una risposta JSON

func Serialize

func Serialize(v interface{}) string

Serialize ...

func VersioneSoftware

func VersioneSoftware() interface{}

VersioneSoftware recupera la versione implementata dei servizi REST

Types

type RestClient

type RestClient struct {
	BaseURL *url.URL
	// contains filtered or unexported fields
}

RestClient : struttura per le chiamate http client con zipkin

func GetRestClient

func GetRestClient(uri string) *RestClient

GetRestClient : metodo per il recupero della struttura RestClient

func RestClientFactory

func RestClientFactory(url *url.URL, httpClient *zipkinhttp.Client, config *config.Config) *RestClient

RestClientFactory factory rest client

func (*RestClient) Do

func (rs *RestClient) Do(ctx context.Context, req *http.Request, v interface{}) (*http.Response, error)

Do esegue una chiamata rest

func (*RestClient) NewRequest

func (rs *RestClient) NewRequest(method, path string, body interface{}) (*http.Request, error)

NewRequest : crea una nuova richiesta http

Jump to

Keyboard shortcuts

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