2024-08-07 06:51:51 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2024-11-17 03:10:24 +00:00
|
|
|
"strconv"
|
2024-09-04 06:07:11 +00:00
|
|
|
"encoding/json"
|
|
|
|
"log"
|
2024-08-15 07:50:50 +00:00
|
|
|
"strings"
|
2024-08-07 06:51:51 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func maybeSuffix(counter int) string {
|
|
|
|
if counter == 0 {
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
|
2024-11-17 03:10:24 +00:00
|
|
|
return strconv.Itoa(counter+1)
|
2024-08-07 06:51:51 +00:00
|
|
|
}
|
2024-08-15 07:50:50 +00:00
|
|
|
|
|
|
|
func titleCase(s string) string {
|
|
|
|
return strings.ToUpper(s[0:1]) + s[1:]
|
|
|
|
}
|
2024-09-04 06:07:11 +00:00
|
|
|
|
|
|
|
func prettyPrint(obj interface{}) {
|
|
|
|
jb, err := json.MarshalIndent(obj, "", " ")
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
log.Println(string(jb))
|
|
|
|
}
|
2024-09-11 05:40:52 +00:00
|
|
|
|
|
|
|
func ifv[T any](condition bool, trueval T, falseval T) T {
|
|
|
|
if condition {
|
|
|
|
return trueval
|
|
|
|
}
|
|
|
|
return falseval
|
2024-10-25 21:41:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func addr[T any](s T) *T {
|
|
|
|
return &s
|
|
|
|
}
|