deprecate all useless tag methods, implement Find() and friends.

This commit is contained in:
fiatjaf
2025-03-10 02:33:29 -03:00
parent 99b11ea3be
commit a52165fb7d
6 changed files with 90 additions and 75 deletions

View File

@ -69,8 +69,22 @@ func (evt *Event) Serialize() []byte {
dst = append(dst, ',')
// tags
dst = evt.Tags.marshalTo(dst)
dst = append(dst, ',')
dst = append(dst, '[')
for i, tag := range evt.Tags {
if i > 0 {
dst = append(dst, ',')
}
// tag item
dst = append(dst, '[')
for i, s := range tag {
if i > 0 {
dst = append(dst, ',')
}
dst = escapeString(dst, s)
}
dst = append(dst, ']')
}
dst = append(dst, "],"...)
// content needs to be escaped in general as it is user generated.
dst = escapeString(dst, evt.Content)