Documentation
¶
Index ¶
- Variables
- func BytesToString(b []byte) string
- func StringToBytes(s string) []byte
- type CreateInfo
- type DeleteInfo
- type Difference
- type Element
- func (el *Element) AppendChild(child *Element)
- func (el *Element) Clone(deep bool) *Element
- func (el *Element) Destory()
- func (el *Element) GetAttribute(key string) (string, error)
- func (el *Element) GetNewID() uint64
- func (el *Element) HasChildNodes() bool
- func (el *Element) Hash()
- func (el *Element) IndexChild(child *Element) (int, bool)
- func (el *Element) Init()
- func (el *Element) InitHash()
- func (el *Element) Remove()
- func (el *Element) RemoveAttribute(key string)
- func (el *Element) RemoveChild(child *Element)
- func (el *Element) ReplaceChild(oldChild, newChild *Element)
- func (el *Element) SetAttribute(key, value string)
- func (el *Element) SetInnerText(text string)
- func (el *Element) String() string
- type Operation
- type OperationType
- type RemoveAttributeInfo
- type SetAttributeInfo
- type SetValueInfo
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrAttributeNotFound = fmt.Errorf("attribute not found")
Functions ¶
func BytesToString ¶
func StringToBytes ¶
Types ¶
type CreateInfo ¶
type DeleteInfo ¶
type DeleteInfo struct {
ID uint64
}
type Difference ¶
type Difference struct {
Diff []*Operation
}
func Diff ¶
func Diff(a, b *Element) *Difference
type Element ¶
type Element struct {
TagName string
Attrs map[string]string
Children []*Element
Value string
ID uint64
XXHash uint64
// contains filtered or unexported fields
}
func CreateElement ¶
func CreateTextNode ¶
func (*Element) AppendChild ¶
func (*Element) HasChildNodes ¶
func (*Element) RemoveAttribute ¶
func (*Element) RemoveChild ¶
func (*Element) ReplaceChild ¶
func (*Element) SetAttribute ¶
func (*Element) SetInnerText ¶
type Operation ¶
type Operation struct {
Type OperationType
Target uint64
CreateInfo *CreateInfo `json:"CreateInfo,omitempty"`
SetAttributeInfo *SetAttributeInfo `json:"SetAttributeInfo,omitempty"`
DeleteInfo *DeleteInfo `json:"DeleteInfo,omitempty"`
RemoveAttributeInfo *RemoveAttributeInfo `json:"RemoveAttributeInfo,omitempty"`
SetValueInfo *SetValueInfo `json:"SetValueInfo,omitempty"`
}
type OperationType ¶
type OperationType byte
const ( OP_CREATE_ELEMENT OperationType = iota OP_CREATE_TEXT OP_SET_VALUE OP_SET_ATTRIBUTE OP_REMOVE_ATTRIBUTE OP_APPEND_CHILD OP_REMOVE_CHILD OP_REPLACE_CHILD )
type RemoveAttributeInfo ¶
type RemoveAttributeInfo struct {
Key string
}
type SetAttributeInfo ¶
type SetValueInfo ¶
type SetValueInfo struct {
Val string
}
Click to show internal directories.
Click to hide internal directories.