# `PersonName`

A person's name: their given name and, where they have one, their family name. It has no single text form; `text.format` writes it in the order the reader's locale gives. Personal data.

[People and contact](types.md#people-and-contact); not ordered; since Jadpo 0.1.0.

## Make one

Build one from its fields, `PersonName { given: ... }`.

## Fields

| Field | Type |
|---|---|
| `given` | [`GivenName`](type-given-name.md) |
| `family` | [`FamilyName`](type-family-name.md)`?` |

## Text, JSON and storage

It has no single text form, so `text.from` and `text.parse` don't take it. JSON sends an object of its parts.

| JSON |
|---|
| `{"given":"Mary","family":"Somerville"}` |
| `{"given":"Sukarno","family":null}` |

It is stored in 2 columns, each named for the field, `_` and its suffix. This is `{"given":"Sukarno","family":null}`:

| Column | Type | Holds |
|---|---|---|
| `<field>_given` | `text` | `'Sukarno'` |
| `<field>_family` | `text` | `NULL::text` |

## Shown to people

`text.format(value, locale:)` shows it to people in their locale.

With `locale: Locale.en_gb`:

| Value | Shown |
|---|---|
| `{"given":"Mary","family":"Somerville"}` | `Mary Somerville` |
| `{"given":"Sukarno","family":null}` | `Sukarno` |

## Operations

It has the contract's own operations: `text.format`, `json.read`, `json.write` and `==`. It isn't ordered, so `<` and sorting don't take it. [Every standard type meets one contract](../topics/every-standard-type-meets-one-contract.md) says how they work.
