event: add GetRaw() to initialize Raw if necessary (#313)
Some checks failed
Go / Lint (latest) (push) Has been cancelled
Go / Build (old, libolm) (push) Has been cancelled
Go / Build (latest, libolm) (push) Has been cancelled
Go / Build (old, goolm) (push) Has been cancelled
Go / Build (latest, goolm) (push) Has been cancelled

This commit is contained in:
Scott Weber 2024-11-06 11:23:37 -05:00 committed by GitHub
commit 22a4c50e0d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -188,6 +188,13 @@ func IsUnsupportedContentType(err error) bool {
var ErrContentAlreadyParsed = errors.New("content is already parsed")
var ErrUnsupportedContentType = errors.New("unsupported event type")
func (content *Content) GetRaw() map[string]interface{} {
if content.Raw == nil {
content.Raw = make(map[string]interface{})
}
return content.Raw
}
func (content *Content) ParseRaw(evtType Type) error {
if content.Parsed != nil {
return ErrContentAlreadyParsed