mirror of
https://github.com/dolthub/dolt.git
synced 2026-01-26 18:59:08 -06:00
75 lines
1.4 KiB
Go
75 lines
1.4 KiB
Go
// This file was generated by nomdl/codegen.
|
|
|
|
package test
|
|
|
|
import (
|
|
"github.com/attic-labs/noms/ref"
|
|
"github.com/attic-labs/noms/types"
|
|
)
|
|
|
|
// EnumStruct
|
|
|
|
type EnumStructDef struct {
|
|
Hand Handedness
|
|
}
|
|
|
|
type EnumStruct struct {
|
|
m types.Map
|
|
}
|
|
|
|
func NewEnumStruct() EnumStruct {
|
|
return EnumStruct{types.NewMap(
|
|
types.NewString("$name"), types.NewString("EnumStruct"),
|
|
types.NewString("Hand"), types.Int32(0),
|
|
)}
|
|
}
|
|
|
|
func (def EnumStructDef) New() EnumStruct {
|
|
return EnumStruct{
|
|
types.NewMap(
|
|
types.NewString("$name"), types.NewString("EnumStruct"),
|
|
types.NewString("Hand"), types.Int32(def.Hand),
|
|
)}
|
|
}
|
|
|
|
func (self EnumStruct) Def() EnumStructDef {
|
|
return EnumStructDef{
|
|
Handedness(self.m.Get(types.NewString("Hand")).(types.Int32)),
|
|
}
|
|
}
|
|
|
|
func EnumStructFromVal(val types.Value) EnumStruct {
|
|
// TODO: Validate here
|
|
return EnumStruct{val.(types.Map)}
|
|
}
|
|
|
|
func (self EnumStruct) NomsValue() types.Value {
|
|
return self.m
|
|
}
|
|
|
|
func (self EnumStruct) Equals(other EnumStruct) bool {
|
|
return self.m.Equals(other.m)
|
|
}
|
|
|
|
func (self EnumStruct) Ref() ref.Ref {
|
|
return self.m.Ref()
|
|
}
|
|
|
|
func (self EnumStruct) Hand() Handedness {
|
|
return Handedness(self.m.Get(types.NewString("Hand")).(types.Int32))
|
|
}
|
|
|
|
func (self EnumStruct) SetHand(val Handedness) EnumStruct {
|
|
return EnumStruct{self.m.Set(types.NewString("Hand"), types.Int32(val))}
|
|
}
|
|
|
|
// Handedness
|
|
|
|
type Handedness uint32
|
|
|
|
const (
|
|
Right Handedness = iota
|
|
Left
|
|
Switch
|
|
)
|