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.
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.
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.
Also covered in
- API Design Patterns
- Java Persistence with Spring Data and Hibernate epub
- Rust Web Development
- Functional Programming in C#, Second Edition
- 100 C++ Mistakes and How to Avoid Them
- PostgreSQL Mistakes and How to Avoid Them
What to know first
- primitive typeA primitive type is a predefined basic data type representing a simple value rather than a composite structure of multiple values or fields.
- constantA constant is a value or named binding treated as fixed rather than reassigned or modified during a computation, whether this is enforced by a language or followed by convention.
- floating-point arithmeticFloating-point arithmetic is numerical computation using finite-precision representations of real numbers, which can introduce rounding and range errors.
- JSONJSON is a language-independent text-based data-interchange format that represents structured values using objects, arrays, strings, numbers, booleans, and null.
Related concepts
- atomic typekind of · An atomic type is a type whose supported accesses and operations are indivisible with respect to concurrent execution and provide defined synchronization semantics.
- dynamic key-value mapcontrasts with · A dynamic key-value map is a map whose keys are arbitrary and not known when an API schema is defined.
- impl blockimplemented by · An impl block is a Rust construct that defines associated functions and methods for a type or implements a trait for that type.
- ingredientincludes · An ingredient is a material or item used as an input in preparing a product, dish, or completed work.
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.




