genKindStringReprString.go 529 Bytes
Newer Older
Eric Myhre's avatar
Eric Myhre committed
1
package gengo
Eric Myhre's avatar
Eric Myhre committed
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24

import (
	"io"
	"text/template"

	wish "github.com/warpfork/go-wish"
)

func (gk generateKindString) EmitNodeType(w io.Writer) {
	template.Must(template.New("").Parse("\n"+wish.Dedent(`
		var _ ipld.Node = {{ .Name }}{}

		type {{ .Name }} struct { x string }
	`))).Execute(w, gk)
}

func (gk generateKindString) EmitNodeMethodReprKind(w io.Writer) {
	template.Must(template.New("").Parse("\n"+wish.Dedent(`
		func ({{ .Name }}) ReprKind() ipld.ReprKind {
			return ipld.ReprKind_String
		}
	`))).Execute(w, gk)
}