name

package
v0.10.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddAcronym

func AddAcronym(lower, camel string)

AddAcronym is used to add exception words that will be used to intervene the conversion from lower case to camel case. It is suggested that users of this package make all AddAcronym calls before any usage (like init()) so that the conversions are consistent across the board.

Types

type Name

type Name struct {
	// Snake is the snake case version of the string: rds_instance
	Snake string

	// Camel is the camel case version of the string where known acronyms are
	// are uppercase: RDSInstance
	Camel string

	// LowerCamel is the camel case version with the first word being lower case
	// and the known acronyms are uppercase if they are not the first word: rdsInstance
	LowerCamel string

	// CamelComputed is the camel case version without any acronym changes: RdsInstance
	CamelComputed string

	// LowerCamelComputed is the camel case version without any acronym changes
	// and the first word is lower case: rdsInstance
	LowerCamelComputed string
}

Name holds different variants of a name.

func NewFromCamel

func NewFromCamel(s string) Name

NewFromCamel produces a Name, using given camel case string as source of truth.

func NewFromSnake

func NewFromSnake(s string) Name

NewFromSnake produces a Name, using given snake case string as source of truth.

func ReferenceFieldName

func ReferenceFieldName(n Name, plural bool, camelOverride string) Name

ReferenceFieldName returns the field name for a reference field whose value field name is given.

func SelectorFieldName

func SelectorFieldName(n Name, camelOverride string) Name

SelectorFieldName returns the field name for a selector field whose value field name is given.

Jump to

Keyboard shortcuts

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