caser

package
v4.92.0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2025 License: MPL-2.0 Imports: 4 Imported by: 13 modules, 13 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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