common

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2024 License: MIT Imports: 13 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug added in v0.2.0

func Debug(prefix string, obj interface{}, stdout *Stdout)

func FormatBasicAuth added in v0.9.14

func FormatBasicAuth(user, pass string) string

func HttpGetRaw added in v0.2.0

func HttpGetRaw(client *http.Client, URL, contentType string, authorization string) ([]byte, error)

func HttpGetRawWithHeaders added in v0.2.0

func HttpGetRawWithHeaders(client *http.Client, URL string, headers map[string]string) ([]byte, error)

func HttpPostRaw added in v0.2.0

func HttpPostRaw(client *http.Client, URL, contentType string, authorization string, raw []byte) ([]byte, error)

func HttpPostRawOutCode added in v0.7.2

func HttpPostRawOutCode(client *http.Client, URL, contentType string, authorization string, raw []byte) (body []byte, code int, err error)

func HttpPostRawWithHeaders added in v0.2.0

func HttpPostRawWithHeaders(client *http.Client, URL string, headers map[string]string, raw []byte) ([]byte, error)

func HttpPostRawWithHeadersOutCode added in v0.7.2

func HttpPostRawWithHeadersOutCode(client *http.Client, URL string, headers map[string]string, raw []byte) (body []byte, code int, err error)

func HttpPutRaw added in v0.4.2

func HttpPutRaw(client *http.Client, URL, contentType string, authorization string, raw []byte) ([]byte, error)

func HttpPutRawWithHeaders added in v0.4.2

func HttpPutRawWithHeaders(client *http.Client, URL string, headers map[string]string, raw []byte) ([]byte, error)

func HttpRequestRawWithHeaders added in v0.4.2

func HttpRequestRawWithHeaders(client *http.Client, method, URL string, headers map[string]string, raw []byte) ([]byte, error)

func HttpRequestRawWithHeadersOutCode added in v0.7.2

func HttpRequestRawWithHeadersOutCode(client *http.Client, method, URL string, headers map[string]string, raw []byte) (body []byte, code int, err error)

func InterfaceToMap added in v0.6.6

func InterfaceToMap(prefix string, i interface{}) (map[string]interface{}, error)

func JsonMarshal added in v0.4.3

func JsonMarshal(t interface{}) ([]byte, error)

we need custom json marshal due to no html escaption

func Output added in v0.0.6

func Output(query, to string, prefix string, opts []interface{}, bytes []byte, stdout *Stdout)

func OutputJson added in v0.2.0

func OutputJson(outputOpts OutputOptions, prefix string, opts []interface{}, bytes []byte, stdout *Stdout)

func OutputRaw added in v0.2.0

func OutputRaw(output string, bytes []byte, stdout *Stdout)

func ReadAndMarshal added in v0.6.6

func ReadAndMarshal(path string) (map[string]interface{}, error)

func RemoveEmptyStrings added in v0.10.0

func RemoveEmptyStrings(items []string) []string

func TruncateString added in v0.2.4

func TruncateString(str string, length int) string

Types

type Jsonata added in v0.9.2

type Jsonata struct {
	// contains filtered or unexported fields
}

func NewJsonata added in v0.9.2

func NewJsonata(options JsonataOptions) *Jsonata

func (*Jsonata) Eval added in v0.9.2

func (j *Jsonata) Eval(data interface{}, query string) (interface{}, error)

func (*Jsonata) RegisterVars added in v0.9.2

func (j *Jsonata) RegisterVars(vars map[string]interface{}) error

type JsonataOptions added in v0.9.2

type JsonataOptions struct {
}

type Logger added in v0.5.0

type Logger interface {
	Info(obj interface{}, args ...interface{})
	Warn(obj interface{}, args ...interface{})
	Debug(obj interface{}, args ...interface{})
	Error(obj interface{}, args ...interface{})
}

type OutputOptions added in v0.2.0

type OutputOptions struct {
	Output string
	Query  string
}

type Stdout

type Stdout struct {
	// contains filtered or unexported fields
}

func NewStdout

func NewStdout(options StdoutOptions) *Stdout

func (*Stdout) Debug

func (so *Stdout) Debug(obj interface{}, args ...interface{})

func (*Stdout) Error

func (so *Stdout) Error(obj interface{}, args ...interface{})

func (*Stdout) Info

func (so *Stdout) Info(obj interface{}, args ...interface{})

func (*Stdout) Panic

func (so *Stdout) Panic(obj interface{}, args ...interface{})

func (*Stdout) SetCallerOffset

func (so *Stdout) SetCallerOffset(offset int)

func (*Stdout) Warn

func (so *Stdout) Warn(obj interface{}, args ...interface{})

type StdoutOptions

type StdoutOptions struct {
	Format          string
	Level           string
	Template        string
	TimestampFormat string
	TextColors      bool
}

Jump to

Keyboard shortcuts

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