🐛 Only trim bang on out

This commit is contained in:
Dan Jones 2024-10-31 15:09:42 -05:00
commit 0b2e178066
4 changed files with 20 additions and 5 deletions

View file

@ -5,6 +5,7 @@ import (
"encoding/json"
"fmt"
"strconv"
"strings"
"time"
)
@ -27,6 +28,9 @@ func WriteValue(buff *bytes.Buffer, val any) (n int, err error) {
return buff.Write(o)
}
case string:
if strings.HasPrefix(v, "!") {
return buff.WriteString(strings.TrimPrefix(v, "!"))
}
return buff.WriteString(v)
case int:
return buff.WriteString(strconv.Itoa(v))
@ -39,6 +43,9 @@ func WriteValue(buff *bytes.Buffer, val any) (n int, err error) {
case json.RawMessage:
return buff.Write(v)
case []byte:
if v[0] == '!' {
return buff.Write(v[1:])
}
return buff.Write(v)
case byte:
err = buff.WriteByte(v)