mirror of
https://github.com/dolthub/dolt.git
synced 2026-04-29 03:06:35 -05:00
NomDL: Make NomsValue a Value
This means that when we ReadValue we can now return a NomsValue Towards #281
This commit is contained in:
@@ -66,6 +66,12 @@ func (m EnumStruct) TypeRef() types.TypeRef {
|
||||
return __typeRefForEnumStruct
|
||||
}
|
||||
|
||||
func init() {
|
||||
types.RegisterFromValFunction(__typeRefForEnumStruct, func(v types.Value) types.NomsValue {
|
||||
return EnumStructFromVal(v)
|
||||
})
|
||||
}
|
||||
|
||||
func EnumStructFromVal(val types.Value) EnumStruct {
|
||||
// TODO: Validate here
|
||||
return EnumStruct{val.(types.Map)}
|
||||
@@ -75,14 +81,21 @@ func (s EnumStruct) NomsValue() types.Value {
|
||||
return s.m
|
||||
}
|
||||
|
||||
func (s EnumStruct) Equals(other EnumStruct) bool {
|
||||
return s.m.Equals(other.m)
|
||||
func (s EnumStruct) Equals(other types.Value) bool {
|
||||
if other, ok := other.(EnumStruct); ok {
|
||||
return s.m.Equals(other.m)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (s EnumStruct) Ref() ref.Ref {
|
||||
return s.m.Ref()
|
||||
}
|
||||
|
||||
func (s EnumStruct) Chunks() []types.Future {
|
||||
return s.m.Chunks()
|
||||
}
|
||||
|
||||
func (s EnumStruct) Hand() Handedness {
|
||||
return Handedness(s.m.Get(types.NewString("hand")).(types.UInt32))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user