igenutil

package
v0.29.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 29, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package igenutil contains internal generation utilities.

Index

Constants

View Source
const (
	// RootElementNodeName is the synthesised node name that is used for an
	// element that represents the root. Such an element is generated only
	// when the GenerateFakeRoot bool is set to true within the
	// YANGCodeGenerator instance used as a receiver.
	RootElementNodeName = "!fakeroot!"
	// DefaultRootName is the default name for the root structure if GenerateFakeRoot is
	// set to true.
	DefaultRootName = "device"
)

Variables

View Source
var (
	// TemplateHelperFunctions specifies a set of functions that are supplied as
	// helpers to the templates that are used within this file.
	TemplateHelperFunctions = template.FuncMap{

		"inc": func(i int) int {
			return i + 1
		},
		"toUpper": strings.ToUpper,
		"indentLines": func(s string) string {
			var b bytes.Buffer
			p := strings.Split(s, "\n")
			b.WriteRune('\n')
			for i, l := range p {
				if l == "" {
					continue
				}
				b.WriteString(fmt.Sprintf("  %s", l))
				if i != len(p)-1 {
					b.WriteRune('\n')
				}
			}
			return b.String()
		},

		"stripAsteriskPrefix": func(s string) string { return strings.TrimPrefix(s, "*") },
	}
)

Functions

func IsFakeRoot

func IsFakeRoot(e *yang.Entry) bool

IsFakeRoot checks whether a given entry is the generated fake root.

func MappableLeaf

func MappableLeaf(e *yang.Entry) *yang.Entry

MappableLeaf determines whether the yang.Entry e is leaf with an enumerated value, such that the referenced enumerated type (enumeration or identity) should have code generated for it. If it is an enumerated type the leaf is returned.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL