utils

package
v0.0.0-...-18e68d0 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2019 License: BSD-2-Clause Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Logger *log.Logger

Logger global log object

Functions

func DoHttpRequest

func DoHttpRequest(client *http.Client, req *http.Request) (*http.Response, error)

func EmptyStrExists

func EmptyStrExists(vars ...string) bool

func GetHttpResponseJson

func GetHttpResponseJson(resp *http.Response, result interface{}) error

func GetLogLevel

func GetLogLevel(logStr string) log.Level

GetLogLevel Get the log level based on input string Valid string: panic fatal error warning info debug trace

func GetLoginOptions

func GetLoginOptions() (string, string, string, error)

GetLoginOptions Get login information

func InitHttpClient

func InitHttpClient() http.Client

func InitHttpRequest

func InitHttpRequest(method string, url string, payload interface{}) (*http.Request, error)

func InitLogger

func InitLogger(filename string, levelStr string)

InitLogger Init global log object

func Log

func Log(levelStr string, message string)

Log log message based on log level

func PrettyPrint

func PrettyPrint(data interface{}, pre string, post string)

PrettyPrint Print json to console elegantly, which is helpful for degbugging

func URL

func URL(proto string, fqdn string, port string, uri ...string) string

URL Compose a URL based on protocol, server address, URI, etc.

func UpdateHttpRequestHeaders

func UpdateHttpRequestHeaders(req *http.Request, headers map[string]string)

func UpdateHttpRequestParams

func UpdateHttpRequestParams(req *http.Request, pairs map[string]string)

Types

This section is empty.

Jump to

Keyboard shortcuts

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