graphql: github.com/shurcooL/graphql/ident Index | Examples | Files

package ident

import "github.com/shurcooL/graphql/ident"

Package ident provides functions for parsing and converting identifier names between various naming convention. It has support for MixedCaps, lowerCamelCase, and SCREAMING_SNAKE_CASE naming conventions.

Code:

fmt.Println(ident.ParseLowerCamelCase("clientMutationId").ToMixedCaps())

Output:

ClientMutationID

Code:

fmt.Println(ident.ParseMixedCaps("ClientMutationID").ToLowerCamelCase())

Output:

clientMutationId

Code:

fmt.Println(ident.ParseScreamingSnakeCase("CLIENT_MUTATION_ID").ToMixedCaps())

Output:

ClientMutationID

Index

Examples

Package Files

ident.go

type Name Uses

type Name []string

Name is an identifier name, broken up into individual words.

func ParseLowerCamelCase Uses

func ParseLowerCamelCase(name string) Name

ParseLowerCamelCase parses a lowerCamelCase identifier name.

E.g., "clientMutationId" -> {"client", "Mutation", "Id"}.

func ParseMixedCaps Uses

func ParseMixedCaps(name string) Name

ParseMixedCaps parses a MixedCaps identifier name.

E.g., "ClientMutationID" -> {"Client", "Mutation", "ID"}.

func ParseScreamingSnakeCase Uses

func ParseScreamingSnakeCase(name string) Name

ParseScreamingSnakeCase parses a SCREAMING_SNAKE_CASE identifier name.

E.g., "CLIENT_MUTATION_ID" -> {"CLIENT", "MUTATION", "ID"}.

func (Name) ToLowerCamelCase Uses

func (n Name) ToLowerCamelCase() string

ToLowerCamelCase expresses identifer name in lowerCamelCase naming convention.

E.g., "clientMutationId".

func (Name) ToMixedCaps Uses

func (n Name) ToMixedCaps() string

ToMixedCaps expresses identifer name in MixedCaps naming convention.

E.g., "ClientMutationID".

Package ident imports 3 packages (graph) and is imported by 2 packages. Updated 2017-12-11. Refresh now. Tools for package owners.