mirror of
https://mau.dev/mautrix/go.git
synced 2026-03-14 14:25:53 +01:00
event: add GetRaw() to initialize Raw if necessary (#313)
Some checks failed
Some checks failed
This commit is contained in:
parent
449de115ff
commit
22a4c50e0d
1 changed files with 7 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue