Fix Performer Studio filtering (#1483)

* Fix performer studio filtering

* Fix studio filter hook
This commit is contained in:
WithoutPants
2021-06-06 15:05:05 +10:00
committed by GitHub
parent 732cc57149
commit c53799c25b
6 changed files with 115 additions and 52 deletions

View File

@@ -1,7 +1,9 @@
package utils
import (
"fmt"
"math/rand"
"strings"
"time"
)
@@ -15,3 +17,18 @@ func RandomSequence(n int) string {
}
return string(b)
}
type StrFormatMap map[string]interface{}
func StrFormat(format string, m StrFormatMap) string {
args := make([]string, len(m)*2)
i := 0
for k, v := range m {
args[i] = fmt.Sprintf("{%s}", k)
args[i+1] = fmt.Sprint(v)
i += 2
}
return strings.NewReplacer(args...).Replace(format)
}