mirror of
https://github.com/dolthub/dolt.git
synced 2026-01-27 18:59:23 -06:00
Due to limitations in Go we cannot create a Def for a Map or Set that has a key that is a Map, Set or a List. This is because the key if a Go map needs to be a comparable and maps and slices are not comparable.
221 lines
7.1 KiB
Go
221 lines
7.1 KiB
Go
// This file was generated by nomdl/codegen.
|
|
|
|
package test
|
|
|
|
import (
|
|
"github.com/attic-labs/noms/ref"
|
|
"github.com/attic-labs/noms/types"
|
|
)
|
|
|
|
// StructPrimitives
|
|
|
|
type StructPrimitives struct {
|
|
m types.Map
|
|
}
|
|
|
|
func NewStructPrimitives() StructPrimitives {
|
|
return StructPrimitives{types.NewMap(
|
|
types.NewString("$name"), types.NewString("StructPrimitives"),
|
|
types.NewString("Uint64"), types.UInt64(0),
|
|
types.NewString("Uint32"), types.UInt32(0),
|
|
types.NewString("Uint16"), types.UInt16(0),
|
|
types.NewString("Uint8"), types.UInt8(0),
|
|
types.NewString("Int64"), types.Int64(0),
|
|
types.NewString("Int32"), types.Int32(0),
|
|
types.NewString("Int16"), types.Int16(0),
|
|
types.NewString("Int8"), types.Int8(0),
|
|
types.NewString("Float64"), types.Float64(0),
|
|
types.NewString("Float32"), types.Float32(0),
|
|
types.NewString("Bool"), types.Bool(false),
|
|
types.NewString("String"), types.NewString(""),
|
|
types.NewString("Blob"), types.NewEmptyBlob(),
|
|
types.NewString("Value"), types.Bool(false),
|
|
)}
|
|
}
|
|
|
|
type StructPrimitivesDef struct {
|
|
Uint64 uint64
|
|
Uint32 uint32
|
|
Uint16 uint16
|
|
Uint8 uint8
|
|
Int64 int64
|
|
Int32 int32
|
|
Int16 int16
|
|
Int8 int8
|
|
Float64 float64
|
|
Float32 float32
|
|
Bool bool
|
|
String string
|
|
Blob types.Blob
|
|
Value types.Value
|
|
}
|
|
|
|
func (def StructPrimitivesDef) New() StructPrimitives {
|
|
return StructPrimitives{
|
|
types.NewMap(
|
|
types.NewString("$name"), types.NewString("StructPrimitives"),
|
|
types.NewString("Uint64"), types.UInt64(def.Uint64),
|
|
types.NewString("Uint32"), types.UInt32(def.Uint32),
|
|
types.NewString("Uint16"), types.UInt16(def.Uint16),
|
|
types.NewString("Uint8"), types.UInt8(def.Uint8),
|
|
types.NewString("Int64"), types.Int64(def.Int64),
|
|
types.NewString("Int32"), types.Int32(def.Int32),
|
|
types.NewString("Int16"), types.Int16(def.Int16),
|
|
types.NewString("Int8"), types.Int8(def.Int8),
|
|
types.NewString("Float64"), types.Float64(def.Float64),
|
|
types.NewString("Float32"), types.Float32(def.Float32),
|
|
types.NewString("Bool"), types.Bool(def.Bool),
|
|
types.NewString("String"), types.NewString(def.String),
|
|
types.NewString("Blob"), def.Blob,
|
|
types.NewString("Value"), def.Value,
|
|
)}
|
|
}
|
|
|
|
func (self StructPrimitives) Def() StructPrimitivesDef {
|
|
return StructPrimitivesDef{
|
|
uint64(self.m.Get(types.NewString("Uint64")).(types.UInt64)),
|
|
uint32(self.m.Get(types.NewString("Uint32")).(types.UInt32)),
|
|
uint16(self.m.Get(types.NewString("Uint16")).(types.UInt16)),
|
|
uint8(self.m.Get(types.NewString("Uint8")).(types.UInt8)),
|
|
int64(self.m.Get(types.NewString("Int64")).(types.Int64)),
|
|
int32(self.m.Get(types.NewString("Int32")).(types.Int32)),
|
|
int16(self.m.Get(types.NewString("Int16")).(types.Int16)),
|
|
int8(self.m.Get(types.NewString("Int8")).(types.Int8)),
|
|
float64(self.m.Get(types.NewString("Float64")).(types.Float64)),
|
|
float32(self.m.Get(types.NewString("Float32")).(types.Float32)),
|
|
bool(self.m.Get(types.NewString("Bool")).(types.Bool)),
|
|
self.m.Get(types.NewString("String")).(types.String).String(),
|
|
self.m.Get(types.NewString("Blob")).(types.Blob),
|
|
self.m.Get(types.NewString("Value")),
|
|
}
|
|
}
|
|
|
|
func StructPrimitivesFromVal(val types.Value) StructPrimitives {
|
|
// TODO: Validate here
|
|
return StructPrimitives{val.(types.Map)}
|
|
}
|
|
|
|
func (self StructPrimitives) NomsValue() types.Value {
|
|
return self.m
|
|
}
|
|
|
|
func (self StructPrimitives) Equals(other StructPrimitives) bool {
|
|
return self.m.Equals(other.m)
|
|
}
|
|
|
|
func (self StructPrimitives) Ref() ref.Ref {
|
|
return self.m.Ref()
|
|
}
|
|
|
|
func (self StructPrimitives) Uint64() uint64 {
|
|
return uint64(self.m.Get(types.NewString("Uint64")).(types.UInt64))
|
|
}
|
|
|
|
func (self StructPrimitives) SetUint64(val uint64) StructPrimitives {
|
|
return StructPrimitives{self.m.Set(types.NewString("Uint64"), types.UInt64(val))}
|
|
}
|
|
|
|
func (self StructPrimitives) Uint32() uint32 {
|
|
return uint32(self.m.Get(types.NewString("Uint32")).(types.UInt32))
|
|
}
|
|
|
|
func (self StructPrimitives) SetUint32(val uint32) StructPrimitives {
|
|
return StructPrimitives{self.m.Set(types.NewString("Uint32"), types.UInt32(val))}
|
|
}
|
|
|
|
func (self StructPrimitives) Uint16() uint16 {
|
|
return uint16(self.m.Get(types.NewString("Uint16")).(types.UInt16))
|
|
}
|
|
|
|
func (self StructPrimitives) SetUint16(val uint16) StructPrimitives {
|
|
return StructPrimitives{self.m.Set(types.NewString("Uint16"), types.UInt16(val))}
|
|
}
|
|
|
|
func (self StructPrimitives) Uint8() uint8 {
|
|
return uint8(self.m.Get(types.NewString("Uint8")).(types.UInt8))
|
|
}
|
|
|
|
func (self StructPrimitives) SetUint8(val uint8) StructPrimitives {
|
|
return StructPrimitives{self.m.Set(types.NewString("Uint8"), types.UInt8(val))}
|
|
}
|
|
|
|
func (self StructPrimitives) Int64() int64 {
|
|
return int64(self.m.Get(types.NewString("Int64")).(types.Int64))
|
|
}
|
|
|
|
func (self StructPrimitives) SetInt64(val int64) StructPrimitives {
|
|
return StructPrimitives{self.m.Set(types.NewString("Int64"), types.Int64(val))}
|
|
}
|
|
|
|
func (self StructPrimitives) Int32() int32 {
|
|
return int32(self.m.Get(types.NewString("Int32")).(types.Int32))
|
|
}
|
|
|
|
func (self StructPrimitives) SetInt32(val int32) StructPrimitives {
|
|
return StructPrimitives{self.m.Set(types.NewString("Int32"), types.Int32(val))}
|
|
}
|
|
|
|
func (self StructPrimitives) Int16() int16 {
|
|
return int16(self.m.Get(types.NewString("Int16")).(types.Int16))
|
|
}
|
|
|
|
func (self StructPrimitives) SetInt16(val int16) StructPrimitives {
|
|
return StructPrimitives{self.m.Set(types.NewString("Int16"), types.Int16(val))}
|
|
}
|
|
|
|
func (self StructPrimitives) Int8() int8 {
|
|
return int8(self.m.Get(types.NewString("Int8")).(types.Int8))
|
|
}
|
|
|
|
func (self StructPrimitives) SetInt8(val int8) StructPrimitives {
|
|
return StructPrimitives{self.m.Set(types.NewString("Int8"), types.Int8(val))}
|
|
}
|
|
|
|
func (self StructPrimitives) Float64() float64 {
|
|
return float64(self.m.Get(types.NewString("Float64")).(types.Float64))
|
|
}
|
|
|
|
func (self StructPrimitives) SetFloat64(val float64) StructPrimitives {
|
|
return StructPrimitives{self.m.Set(types.NewString("Float64"), types.Float64(val))}
|
|
}
|
|
|
|
func (self StructPrimitives) Float32() float32 {
|
|
return float32(self.m.Get(types.NewString("Float32")).(types.Float32))
|
|
}
|
|
|
|
func (self StructPrimitives) SetFloat32(val float32) StructPrimitives {
|
|
return StructPrimitives{self.m.Set(types.NewString("Float32"), types.Float32(val))}
|
|
}
|
|
|
|
func (self StructPrimitives) Bool() bool {
|
|
return bool(self.m.Get(types.NewString("Bool")).(types.Bool))
|
|
}
|
|
|
|
func (self StructPrimitives) SetBool(val bool) StructPrimitives {
|
|
return StructPrimitives{self.m.Set(types.NewString("Bool"), types.Bool(val))}
|
|
}
|
|
|
|
func (self StructPrimitives) String() string {
|
|
return self.m.Get(types.NewString("String")).(types.String).String()
|
|
}
|
|
|
|
func (self StructPrimitives) SetString(val string) StructPrimitives {
|
|
return StructPrimitives{self.m.Set(types.NewString("String"), types.NewString(val))}
|
|
}
|
|
|
|
func (self StructPrimitives) Blob() types.Blob {
|
|
return self.m.Get(types.NewString("Blob")).(types.Blob)
|
|
}
|
|
|
|
func (self StructPrimitives) SetBlob(val types.Blob) StructPrimitives {
|
|
return StructPrimitives{self.m.Set(types.NewString("Blob"), val)}
|
|
}
|
|
|
|
func (self StructPrimitives) Value() types.Value {
|
|
return self.m.Get(types.NewString("Value"))
|
|
}
|
|
|
|
func (self StructPrimitives) SetValue(val types.Value) StructPrimitives {
|
|
return StructPrimitives{self.m.Set(types.NewString("Value"), val)}
|
|
}
|