33 lines
820 B
Go
33 lines
820 B
Go
package goap
|
|
|
|
import (
|
|
"time"
|
|
|
|
"gitlab.com/mstarongitlab/goutils/other"
|
|
"gitlab.com/mstarongitlab/goutils/sliceutils"
|
|
)
|
|
|
|
func appendWithKey(toAppend map[string]any, key string, val any) map[string]any {
|
|
toAppend[key] = val
|
|
return toAppend
|
|
}
|
|
|
|
// Returns an array of IdValues since that's what is expected for compression of the map later on
|
|
func strToId(str string) []IdValue {
|
|
return []IdValue{{Id: str}}
|
|
}
|
|
|
|
func strsToIds(strs []string) []IdValue {
|
|
return sliceutils.Map(strs, func(s string) IdValue {
|
|
return IdValue{Id: s}
|
|
})
|
|
}
|
|
|
|
// Returns an array of values since that's what expected for compression later on
|
|
func timeToXmlTime(t time.Time) []ValueValue[string] {
|
|
return []ValueValue[string]{
|
|
{
|
|
Type: other.IntoPointer(KEY_XMLSCHEMA_DATETIME),
|
|
Value: t.Format("2006-01-02T15:04:05.000Z"),
|
|
}}
|
|
}
|