Skip to content

Commit

Permalink
add: 添加子元素与扩展属性动态设置方法
Browse files Browse the repository at this point in the history
  • Loading branch information
WindowsSov8forUs committed Jun 19, 2024
1 parent 0d1f361 commit 5de5949
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions pkg/message/message_element.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ func (e *ChildrenMessageElement) GetChildren() []MessageElement {
return e.children
}

func (e *ChildrenMessageElement) SetChildren(children []MessageElement) *ChildrenMessageElement {
e.children = children
return e
}

type ExtendAttributes struct {
attributes map[string]string
}
Expand All @@ -72,6 +77,14 @@ func (e *ExtendAttributes) AddAttribute(key, value string) *ExtendAttributes {
return result
}

func (e *ExtendAttributes) DelAttribute(key string) *ExtendAttributes {
if e == nil {
return nil
}
delete(e.attributes, key)
return e
}

func (e *ExtendAttributes) Get(key string) (string, bool) {
if e == nil {
return "", false
Expand Down

0 comments on commit 5de5949

Please sign in to comment.