snow/aid/aid.go

26 lines
437 B
Go
Raw Normal View History

2023-11-01 00:05:17 +00:00
package aid
import (
"os"
"os/signal"
"syscall"
"github.com/goccy/go-json"
2023-11-01 00:05:17 +00:00
)
func WaitForExit() {
sc := make(chan os.Signal, 1)
signal.Notify(sc, syscall.SIGINT, syscall.SIGTERM, os.Interrupt)
<-sc
}
func JSONStringify(input interface{}) string {
json, _ := json.Marshal(input)
return string(json)
}
func JSONParse(input string) interface{} {
var output interface{}
json.Unmarshal([]byte(input), &output)
return output
2023-11-01 00:05:17 +00:00
}