Compare compares two value wrapper.
(v2 DataValue)
| 221 | |
| 222 | // Compare compares two value wrapper. |
| 223 | func (v1 DataValue) Compare(v2 DataValue) int { |
| 224 | if !v1.Valid || !v2.Valid { |
| 225 | return CompareBool(v1.Valid, v2.Valid) |
| 226 | } |
| 227 | if v1.IsBool { |
| 228 | return CompareBool(v1.BoolVal, v2.BoolVal) |
| 229 | } |
| 230 | if v1.CmpFunc != nil { |
| 231 | return v1.CmpFunc(v1.OtherVal, v2.OtherVal) |
| 232 | } |
| 233 | if IsArrayType(v1.DataType) { |
| 234 | return CompareArray(v1.DataType, v1.OtherVal, v2.OtherVal) |
| 235 | } |
| 236 | return 0 |
| 237 | } |
| 238 | |
| 239 | // ConvertToHumanReadable convert DataValue to meaningful golang data types |
| 240 | func (v1 DataValue) ConvertToHumanReadable(dataType DataType) interface{} { |
no test coverage detected