caser

package
v4.72.4 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: MPL-2.0 Imports: 4 Imported by: 13

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Caser

type Caser struct {
	// contains filtered or unexported fields
}

func New

func New(opts ...Option) *Caser

New creates a new instance of caser

func (*Caser) ToCamel

func (c *Caser) ToCamel(s string) string

ToCamel returns a string converted from snake case to camel case

func (*Caser) ToPascal

func (c *Caser) ToPascal(s string) string

ToPascal returns a string converted from snake case to pascal case

func (*Caser) ToSnake

func (c *Caser) ToSnake(s string) string

ToSnake converts a given string to snake case

func (*Caser) ToTitle

func (c *Caser) ToTitle(s string) string

ToTitle returns a string converted from snake case to title case. Title case is similar to camel case, but spaces are used in between words.

type Option

type Option func(*Caser)

func WithCustomExceptions

func WithCustomExceptions(fields map[string]string) Option

WithCustomExceptions allows to specify custom exceptions for caser. The parameter is a map of snake:camel values like map[string]string{"oauth":"OAuth"}

func WithCustomInitialisms

func WithCustomInitialisms(fields map[string]bool) Option

WithCustomInitialisms allows specifying custom initialisms for caser.

Jump to

Keyboard shortcuts

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