generator

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateEnumTypes

func GenerateEnumTypes(options Options, enums ...StringEnumDefinition)

GenerateEnumTypes scaffolds enum types for the given options and definitions

Types

type Options

type Options struct {
	// Filesystem path of the directory corresponding to the package to be used or created
	PackageDirectoryPath string
	// Import path of the package to be used or created. It must be a valid path according to the working module structure
	PackageImportPath string
	// Casing to be used on enum value identifier (eg: CamelCase -> MyEnumFoo; UpperCase -> MyEnumFOO).
	// Default is camel case
	ValueIdentifierCasing ValueIdentifierCasing
	// Whether to omit the generated code header on files. Default value is false
	OmitGeneratedNotice bool
	// Whether to omit tests for generated code. Default value is false
	OmitTests bool
	// Whether to omit generated source code formatting, which also detects compilation errors. Default value is false
	OmitSourceFormatting bool
	// Whether to omit field name sanitization, which prevents invalid name qualifiers during code generation. Default value is false
	OmitNameSanitization bool
}

Options defined the settings to be passed to the generator in order to configure certain aspects of the code generation

type StringEnumDefinition

type StringEnumDefinition struct {
	Name   string
	Values []string
}

StringEnumDefinition is the basic [name:values] definition of an enumeration. As the name implies, this is for string enumerations only

type ValueIdentifierCasing added in v0.4.0

type ValueIdentifierCasing int
const (
	CamelCase ValueIdentifierCasing = iota
	UpperCase
	LowerCase
	SnakeUpperCase
	SnakeCase
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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