@@ -13,46 +13,44 @@ import (
13
13
)
14
14
15
15
func CompareAttributeValues (a , b AttributeValue ) bool {
16
- araw := a .Raw ()
17
- braw := b .Raw ()
18
- switch na := araw .(type ) {
19
- case bool :
20
- nb , btype := braw .(bool )
16
+ switch na := a .(type ) {
17
+ case AttributeValueBool :
18
+ nb , btype := b .(AttributeValueBool )
21
19
if btype {
22
20
return na == nb
23
21
}
24
- case string :
25
- nb , btype := braw .( string )
22
+ case AttributeValueString :
23
+ nb , btype := b .( AttributeValueString )
26
24
if btype {
27
- return strings .EqualFold (na , nb )
25
+ return strings .EqualFold (string ( na ), string ( nb ) )
28
26
}
29
- case int64 :
30
- nb , btype := braw .( int64 )
27
+ case AttributeValueInt :
28
+ nb , btype := b .( AttributeValueInt )
31
29
if btype {
32
30
return na == nb
33
31
}
34
- case time. Time :
35
- nb , btype := braw .(time. Time )
32
+ case AttributeValueTime :
33
+ nb , btype := b .( AttributeValueTime )
36
34
if btype {
37
- return na .Equal (nb )
35
+ return time . Time ( na ) .Equal (time . Time ( nb ) )
38
36
}
39
- case [] byte :
40
- nb , btype := braw .([] byte )
37
+ case AttributeValueBlob :
38
+ nb , btype := b .( AttributeValueBlob )
41
39
if btype {
42
- return bytes .Equal (na , nb )
40
+ return bytes .Equal ([] byte ( na ), [] byte ( nb ) )
43
41
}
44
- case windowssecurity. SID :
45
- nb , btype := braw .(windowssecurity. SID )
42
+ case AttributeValueSID :
43
+ nb , btype := b .( AttributeValueSID )
46
44
if btype {
47
45
return string (na ) == string (nb )
48
46
}
49
- case uuid. UUID :
50
- nb , btype := braw .(uuid. UUID )
47
+ case AttributeValueGUID :
48
+ nb , btype := b .( AttributeValueGUID )
51
49
if btype {
52
50
return na == nb
53
51
}
54
- case * Object :
55
- nb , btype := braw .( * Object )
52
+ case AttributeValueObject :
53
+ nb , btype := b .( AttributeValueObject )
56
54
if btype {
57
55
return na == nb // Exact same object pointed to in memory
58
56
}
@@ -171,6 +169,7 @@ type AttributeValue interface {
171
169
String () string
172
170
Raw () interface {}
173
171
IsZero () bool
172
+ // Compare(other AttributeValue) bool
174
173
}
175
174
176
175
type AttributeValueObject struct {
@@ -189,7 +188,7 @@ func (avo AttributeValueObject) IsZero() bool {
189
188
if avo .Object == nil {
190
189
return true
191
190
}
192
- return len ( avo .values ) == 0
191
+ return avo .values . Len ( ) == 0
193
192
}
194
193
195
194
type AttributeValueString string
0 commit comments