mirror of
https://github.com/dolthub/dolt.git
synced 2026-01-26 10:37:04 -06:00
We want to explore encoding type information about Noms data in the Noms database. So, we need some way to describe types. This takes the shortest path to making a Noms type called "TypeRef" that is a peer of Set, Map et al and can describe all the types we currently use.
19 lines
422 B
Cheetah
19 lines
422 B
Cheetah
// {{.Name}}
|
|
|
|
type {{.Name}} uint32
|
|
|
|
{{$name := .Name}}
|
|
const ({{range $index, $id := .Ids}}
|
|
{{title $id}}{{if eq $index 0}} {{$name}} = iota{{end}}{{end}}
|
|
)
|
|
|
|
// Creates and returns a Noms Value that describes {{.Name}}.
|
|
func __typeRefOf{{.Name}}() types.TypeRef {
|
|
return types.MakeEnumTypeRef(types.NewString("{{.Name}}"), []types.String{
|
|
{{range $index, $id := .Ids}}
|
|
types.NewString("{{$id}}"),{{end}}
|
|
})
|
|
|
|
}
|
|
|