mirror of
https://github.com/dolthub/dolt.git
synced 2026-04-26 11:39:05 -05:00
91ac2ef236
A Ref has a SetValue(v, cs) and a GetValue(cs) Fixes #306
35 lines
732 B
Cheetah
35 lines
732 B
Cheetah
// {{.Name}}
|
|
|
|
type {{.Name}} struct {
|
|
r ref.Ref
|
|
}
|
|
|
|
func New{{.Name}}(r ref.Ref) {{.Name}} {
|
|
return {{.Name}}{r}
|
|
}
|
|
|
|
func (r {{.Name}}) Ref() ref.Ref {
|
|
return r.r
|
|
}
|
|
|
|
func (r {{.Name}}) Equals(other {{.Name}}) bool {
|
|
return r.Ref() == other.Ref()
|
|
}
|
|
|
|
func (r {{.Name}}) NomsValue() types.Value {
|
|
return types.Ref{R: r.r}
|
|
}
|
|
|
|
func {{.Name}}FromVal(p types.Value) {{.Name}} {
|
|
return {{.Name}}{p.(types.Ref).Ref()}
|
|
}
|
|
|
|
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}} {
|
|
ref := types.WriteValue({{userToValue "val" .ElemType}}, cs)
|
|
return {{.Name}}{ref}
|
|
}
|