liveBook · Manning

User-defined type

Also called custom type

A user-defined type is a type declared by a programmer or user, rather than supplied as a built-in type, to describe or constrain values.

How 5 Manning books explain it

Learn Go with Pocket-Sized Projects

A custom type is a programmer-defined Go type that gives a distinct name and type identity to an underlying representation.

How it is used
Uses defined types to clarify domain values and hide implementation details behind APIs.
How deep it goes
Explains declarations, typed parameters, conversions, methods, and private struct fields through implementations rather than a complete type-system treatment.
Examples
Uses a multilingual greeting, a habit domain model, a decimal representation, and a string-based error type.
What you can do after
Apply defined types in Go to give values meaningful names, implement an interface, and protect a representation behind an API.

Read how Learn Go with Pocket-Sized Projects explains user-defined type →

Go in Action, Second Edition

A defined type is a programmer-declared type that creates a distinct named type with an underlying type and can have its own methods.

How it is used
Models recipe-domain data with distinct names and compiler-checked types.
How deep it goes
Explains definitions, conversions and aliases, then builds composed structs and named collections into a recipe application.
Examples
Uses measurement types, recipe ingredients, embedded measurement variants and a grocery list.
What you can do after
Build from scratch a typed recipe model with measurements, collections and associated behavior.

Read how Go in Action, Second Edition explains user-defined type →

ScyllaDB in Action

A user-defined type is a named custom data type whose fields can have different types and that can be used as a column, collection element, or key value in ScyllaDB.

How it is used
Groups related, differently typed properties into one value for schemas such as contact details and image metadata.
How deep it goes
Defines creation, insertion, null behavior, frozen collection use, and Python driver mapping; defers required-field enforcement to application code.
Examples
Uses contact_info fields and an image type with path and caption in an article image gallery.
What you can do after
Apply it via CQL schemas and Python driver registration to store and retrieve structured image metadata.

Read how ScyllaDB in Action explains user-defined type →

Spring in Action, Sixth Edition

A Cassandra user-defined type is a schema-defined composite type whose fields can be stored together in a column.

How it is used
Stores denormalized composite data, especially copied related records inside Cassandra collection columns.
How deep it goes
Explains collection constraints, denormalization, annotation, separate classes, and optional fields without covering schema operations.
Examples
Uses taco ingredients, IngredientUDT, TacoUDT, and a stored ingredient collection as concrete mapping examples.
What you can do after
Build it from scratch by defining a separate annotated UDT class for structured values embedded in Cassandra columns.

Read how Spring in Action, Sixth Edition explains user-defined type →

React in Depth

A custom type is a programmer-defined type specification that restricts or describes the values permitted in a program.

How it is used
Constrains variables, function results, and React component props to documented value shapes.
How deep it goes
Explains unions, literal values, interfaces, optional properties, and unknown, but defers technical differences between interfaces and type aliases.
Examples
Uses nullable names, status literals, invalid assignments, and typed React component props with optional fields.
What you can do after
Apply it via TypeScript to reject invalid values and document React component interfaces.

Read how React in Depth explains user-defined type →

Also covered in

What to know first

Related concepts

Questions about user-defined type

What is user-defined type?

A user-defined type is a type declared by a programmer or user, rather than supplied as a built-in type, to describe or constrain values.

Which Manning books explain user-defined type?

Learn Go with Pocket-Sized Projects, Go in Action, Second Edition, ScyllaDB in Action, Spring in Action, Sixth Edition and React in Depth.

What should I know before learning user-defined type?

Manning books that teach user-defined type usually introduce primitive type, constant, floating-point arithmetic and JSON first.

What is the difference between user-defined type and dynamic key-value map?

A user-defined type is a type declared by a programmer or user, rather than supplied as a built-in type, to describe or constrain values. A dynamic key-value map is a map whose keys are arbitrary and not known when an API schema is defined.

What kinds of user-defined type are there?

Kinds of user-defined type include ingredient.

What is user-defined type a kind of?

User-defined type is a kind of atomic type. An atomic type is a type whose supported accesses and operations are indivisible with respect to concurrent execution and provide defined synchronization semantics.

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.