mirror of
https://github.com/dolthub/dolt.git
synced 2026-01-30 19:09:34 -06:00
48 lines
1.0 KiB
Cheetah
48 lines
1.0 KiB
Cheetah
// {{.Name}}
|
|
|
|
type {{.Name}} struct {
|
|
r ref.Ref
|
|
ref *ref.Ref
|
|
}
|
|
|
|
func New{{.Name}}(r ref.Ref) {{.Name}} {
|
|
return {{.Name}}{r, &ref.Ref{}}
|
|
}
|
|
|
|
func (r {{.Name}}) Ref() ref.Ref {
|
|
return types.EnsureRef(r.ref, r)
|
|
}
|
|
|
|
func (r {{.Name}}) Equals(other types.Value) bool {
|
|
if other, ok := other.({{.Name}}); ok {
|
|
return r.Ref() == other.Ref()
|
|
}
|
|
return false
|
|
}
|
|
|
|
func (r {{.Name}}) Chunks() []types.Future {
|
|
return r.TypeRef().Chunks()
|
|
}
|
|
|
|
func (r {{.Name}}) InternalImplementation() ref.Ref {
|
|
return r.r
|
|
}
|
|
|
|
func {{.Name}}FromVal(val types.Value) {{.Name}} {
|
|
// TODO: Do we still need FromVal?
|
|
if val, ok := val.({{.Name}}); ok {
|
|
return val
|
|
}
|
|
return {{.Name}}{val.(types.Ref).Ref(), &ref.Ref{}}
|
|
}
|
|
|
|
{{template "type_ref.tmpl" .}}
|
|
|
|
func (r {{.Name}}) GetValue(cs chunks.ChunkSource) {{userType .ElemType}} {
|
|
return {{valueToUser "types.ReadValue(r.r, cs)" .ElemType}}
|
|
}
|
|
|
|
func (r {{.Name}}) SetValue(val {{userType .ElemType}}, cs chunks.ChunkSink) {{.Name}} {
|
|
return {{.Name}}{types.WriteValue({{userToValue "val" .ElemType}}, cs), &ref.Ref{}}
|
|
}
|