package extractor import ( b64 "encoding/base64" "fmt" "os" ) func GenGjsonQuery(i int, query string) string { return fmt.Sprintf("%d%s", i, query) } func ProxyUrl(url string) string { encodedUrl := b64.URLEncoding.EncodeToString([]byte(url)) backendUrl := os.Getenv("URL") return backendUrl + "/proxy/img/" + encodedUrl } func ProxyClip(url string) string { encodedUrl := b64.URLEncoding.EncodeToString([]byte(url)) backendUrl := os.Getenv("URL") return backendUrl + "/proxy/clip/" + encodedUrl } type ServerFormat struct { Status string `json:"status"` Message interface{} `json:"data"` } func FormatMessage(data interface{}, ok bool) ServerFormat { var status string if ok { status = "ok" } else { status = "error" } serverFormat := ServerFormat{ Status: status, Message: data, } return serverFormat }