Documentation ¶
Index ¶
- func CalculateMAC(message, key []byte) []byte
- func CamelToSnake(s string) string
- func DeepCopyMapParam(param map[string]interface{}) map[string]interface{}
- func DeepCopyParam(param interface{}) interface{}
- func FileExists(filename string) bool
- func GetBoolParam(param map[string]interface{}, name string) (bool, error)
- func GetFloatParam(param map[string]interface{}, name string) (float64, error)
- func GetIntParam(param map[string]interface{}, name string) (int, error)
- func GetMapParam(param map[string]interface{}, name string) (map[string]interface{}, error)
- func GetNestedMapValue(param map[string]interface{}, nestedKey string) (interface{}, error)
- func GetStringParam(param map[string]interface{}, name string) (string, error)
- func GetStringSliceParam(param map[string]interface{}, name string) ([]string, error)
- func InterfaceMapToStringMap(param interface{}) interface{}
- func JSONToMap(text []byte) (map[string]interface{}, error)
- func MergeMapParam(mapOrigin, mapNew map[string]interface{})
- func RunCmd(args []string, cwd string, env []string, background bool, ...) (int, error)
- func SHA256Sum(r io.Reader) ([]byte, error)
- func SHA256SumFile(fn string) ([]byte, error)
- func ValidateMAC(message, messageMAC, key []byte) bool
- type BaseLogger
- type ExeGit
- type HTTPServer
- type PrefixLogger
- type SimpleFormatter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeepCopyMapParam ¶
DeepCopyMapParam returns a deep copied map param object
func DeepCopyParam ¶
func DeepCopyParam(param interface{}) interface{}
DeepCopyParam returns a deep copied json param object
func FileExists ¶ added in v1.8.0
FileExists checks if a file exists
func GetBoolParam ¶
GetBoolParam get the bool param from the map
func GetFloatParam ¶ added in v1.8.4
GetFloatParam get the float param from the map
func GetIntParam ¶
GetIntParam get the int param from the map
func GetMapParam ¶
GetMapParam get the map param from the map
func GetNestedMapValue ¶
GetNestedMapValue get the value of a nested key from the map map["a/b/c"] = map["a"]["b"]["c"]
func GetStringParam ¶
GetStringParam get the string param from the map
func GetStringSliceParam ¶
GetStringSliceParam get the string slice param from the map (string or slice of strings)
func InterfaceMapToStringMap ¶
func InterfaceMapToStringMap(param interface{}) interface{}
InterfaceMapToStringMap will only keep map with string keys
func MergeMapParam ¶
func MergeMapParam(mapOrigin, mapNew map[string]interface{})
MergeMapParam merges the two maps
func RunCmd ¶
func RunCmd(args []string, cwd string, env []string, background bool, stdout, stderr *string) (int, error)
RunCmd will open the sub process
func SHA256SumFile ¶
SHA256SumFile calculate the sha256 checksum from the file
func ValidateMAC ¶
ValidateMAC checks the validation of message based on the key
Types ¶
type BaseLogger ¶
type BaseLogger struct {
// contains filtered or unexported fields
}
BaseLogger is a basic struct implement LoggerSetter
func (*BaseLogger) Debugf ¶
func (l *BaseLogger) Debugf(f string, v ...interface{})
Debugf log debug output
func (*BaseLogger) Errorf ¶
func (l *BaseLogger) Errorf(f string, v ...interface{})
Errorf log error output
func (*BaseLogger) Infof ¶
func (l *BaseLogger) Infof(f string, v ...interface{})
Infof log info output
func (*BaseLogger) SetLogger ¶
func (l *BaseLogger) SetLogger(logger interface{})
SetLogger will set logger
func (*BaseLogger) Warnf ¶
func (l *BaseLogger) Warnf(f string, v ...interface{})
Warnf log warn output
type ExeGit ¶
type ExeGit struct { BaseLogger WorkDir string }
ExeGit executes script from git repository
func (*ExeGit) WorkRepoDir ¶ added in v1.8.3
WorkRepoDir return the run directory
func (*ExeGit) WorkRunDir ¶
WorkRunDir return the run directory
type HTTPServer ¶
type HTTPServer struct { BaseLogger UnixSocket string Host string Port int ServerHeader string ValidateFunc func(*http.Request, []byte) error ProcessFunc func(http.ResponseWriter, *http.Request, []byte) // contains filtered or unexported fields }
HTTPServer is a trigger which will listen to http request
type PrefixLogger ¶
PrefixLogger automatically add prefix for logger
func (*PrefixLogger) Debugf ¶
func (l *PrefixLogger) Debugf(f string, v ...interface{})
Debugf log debug output
func (*PrefixLogger) Errorf ¶
func (l *PrefixLogger) Errorf(f string, v ...interface{})
Errorf log error output
func (*PrefixLogger) Infof ¶
func (l *PrefixLogger) Infof(f string, v ...interface{})
Infof log info output
func (*PrefixLogger) Warnf ¶
func (l *PrefixLogger) Warnf(f string, v ...interface{})
Warnf log warn output