namer

package
v0.1.0-alpha.0 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2018 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NameStrategy

type NameStrategy struct {
	*namer.NameStrategy
}

NameStrategy is a general Namer. The easiest way to use it is to copy the Public/PrivateNamer variables, and modify the members you wish to change.

The Name method produces a name for the given type, of the forms: Anonymous types: <Prefix><Type description><Suffix> Named types: <Prefix><Optional Prepended Package name(s)><Original name><Suffix>

In all cases, every part of the name is run through the capitalization functions.

The IgnoreWords map can be set if you have directory names that are semantically meaningless for naming purposes, e.g. "proto".

Prefix and Suffix can be used to disambiguate parallel systems of type names. For example, if you want to generate an interface and an implementation, you might want to suffix one with "Interface" and the other with "Implementation". Another common use-- if you want to generate private types, and one of your source types could be "string", you can't use the default lowercase private namer. You'll have to add a suffix or prefix.

func NewPrivateNamer

func NewPrivateNamer(prependPackageNames int, ignoreWords ...string) *NameStrategy

NewPrivateNamer is a helper function that returns a namer that makes camelCase names. See the NameStrategy struct for an explanation of the arguments to this constructor.

func NewPublicNamer

func NewPublicNamer(prependPackageNames int, ignoreWords ...string) *NameStrategy

NewPublicNamer is a helper function that returns a namer that makes CamelCase names. See the NameStrategy struct for an explanation of the arguments to this constructor.

func (*NameStrategy) Name

func (ns *NameStrategy) Name(t *types.Type) string

Jump to

Keyboard shortcuts

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