new operator 'groupby'
This commit is contained in:
+21
-4
@@ -143,13 +143,12 @@ func (dict *DictType) HasKey(target any) (ok bool) {
|
||||
return
|
||||
}
|
||||
|
||||
func (dict *DictType) SetItem(key any, value any) (err error) {
|
||||
func (dict *DictType) SetItem(key any, value any) {
|
||||
(*dict)[key] = value
|
||||
return
|
||||
}
|
||||
|
||||
func (dict *DictType) GetItem(key any) (value any, err error) {
|
||||
value = (*dict)[key]
|
||||
func (dict *DictType) GetItem(key any) (value any, exists bool) {
|
||||
value, exists = (*dict)[key]
|
||||
return
|
||||
}
|
||||
|
||||
@@ -169,6 +168,24 @@ func (dict *DictType) Merge(second *DictType) {
|
||||
}
|
||||
}
|
||||
|
||||
func (dict *DictType) Equals(dict2 DictType) (answer bool) {
|
||||
if dict2 != nil && len(*dict) == len(dict2) {
|
||||
answer = true
|
||||
for key, value1 := range *dict {
|
||||
if value2, exists := dict2.GetItem(key); exists {
|
||||
if !Equal(value1, value2) {
|
||||
answer = false
|
||||
break
|
||||
}
|
||||
} else {
|
||||
answer = false
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
////////////////
|
||||
|
||||
type DictFormat interface {
|
||||
|
||||
Reference in New Issue
Block a user