Help us shape the future of Go! Take the 2026 Go Developer Survey

inflect

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package inflect defines the naming pipeline for every generated GraphQL identifier. All names produced by the schema builder flow through a chain of InflectionHook implementations, so plugins can override any name without touching core code. The chain types and string helpers live in pdbcore/inflect (shared with pdbr); this package owns pdbq's name kinds and the PostGraphile-flavoured Default.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Default

func Default(kind Kind, in Input) string

Default is the built-in PostGraphile-flavoured verbose naming.

Types

type Input

type Input = inflect.Input

Input carries everything a hook may need to build a name.

type Kind

type Kind = inflect.Kind

Kind identifies which name is being generated.

const (
	KindTypeName           Kind = "type_name"             // table -> object type (User)
	KindAllRowsField       Kind = "all_rows_field"        // table -> collection connection query (allUsers)
	KindRowByPKField       Kind = "row_by_pk_field"       // table -> single lookup (userById)
	KindRowByUniqueField   Kind = "row_by_unique_field"   // unique lookup (userByEmail)
	KindFieldName          Kind = "field_name"            // column -> field (firstName)
	KindEnumTypeName       Kind = "enum_type_name"        // pg enum -> GraphQL enum type
	KindEnumValueName      Kind = "enum_value_name"       // pg enum value -> GraphQL enum value
	KindFilterTypeName     Kind = "filter_type_name"      // UserFilter
	KindConditionTypeName  Kind = "condition_type_name"   // UserCondition
	KindOrderByTypeName    Kind = "order_by_type_name"    // UsersOrderBy
	KindDistinctOnTypeName Kind = "distinct_on_type_name" // UsersDistinctOn
	KindCreateMutation     Kind = "create_mutation"       // createUser
	KindUpdateMutation     Kind = "update_mutation"       // updateUserById (primary key)
	KindDeleteMutation     Kind = "delete_mutation"       // deleteUserById (primary key)
	// The by-unique variants are distinct kinds so naming plugins can shorten
	// the primary-key mutation without colliding with unique-constraint ones.
	KindUpdateByUniqueMutation Kind = "update_by_unique_mutation" // updateUserByEmail
	KindDeleteByUniqueMutation Kind = "delete_by_unique_mutation" // deleteUserByEmail
	KindUpsertMutation         Kind = "upsert_mutation"           // upsertUserById (primary key)
	KindUpsertByUniqueMutation Kind = "upsert_by_unique_mutation" // upsertUserByEmail
	KindCreateManyMutation     Kind = "create_many_mutation"      // createUsers
	KindUpdateManyMutation     Kind = "update_many_mutation"      // updateUsers (filtered)
	KindDeleteManyMutation     Kind = "delete_many_mutation"      // deleteUsers (filtered)
	KindCreateInput            Kind = "create_input"              // UserCreateInput
	KindUpdateInput            Kind = "update_input"              // UserUpdateInput
	KindPayloadTypeName        Kind = "payload_type_name"         // CreateUserPayload
	KindRelationForward        Kind = "relation_forward"          // FK column -> parent object field (author)
	KindRelationBackward       Kind = "relation_backward"         // reverse FK -> child list field (postsByAuthorId)
	KindFunctionField          Kind = "function_field"            // pg function -> query/mutation field
	KindFunctionInput          Kind = "function_input"            // volatile function -> input object type (LoginInput)
	KindFunctionPayload        Kind = "function_payload"          // volatile function -> payload object type (LoginPayload)
	KindComputedField          Kind = "computed_field"            // row-type function -> field on the row's type (postCount)
)

type Next

type Next = inflect.Next

Next continues the chain; the last Next is the default inflector.

Jump to

Keyboard shortcuts

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