# bookclerk_library::entities::holdings

SeaORM entity for the `holdings` table: who holds a store listing.

| Item | Kind | Summary |
| --- | --- | --- |
| [`Model`](#model) | struct | Row shape for this table (`DeriveEntityModel`). |
| [`ColumnIter`](#columniter) | struct | An iterator over the variants of [Column] |
| [`Entity`](#entity) | struct | Generated by sea-orm-macros |
| [`PrimaryKeyIter`](#primarykeyiter) | struct | An iterator over the variants of [PrimaryKey] |
| [`ActiveModel`](#activemodel) | struct | Generated by sea-orm-macros |
| [`RelationIter`](#relationiter) | struct | An iterator over the variants of [Relation] |
| [`Column`](#column) | enum | Generated by sea-orm-macros |
| [`PrimaryKey`](#primarykey) | enum | Generated by sea-orm-macros |
| [`Relation`](#relation) | enum | Declared SeaORM relations (none unless FK edges are modeled). |

## Structs

### Model

```rust
pub struct Model {
    pub id: String,
    pub listing_id: String,
    pub holder: String,
    pub holder_kind: String,
    pub plugin_key: Option<String>,
    pub account_id: Option<String>,
    pub node_id: Option<String>,
    pub user_id: Option<i64>,
    pub entitlement: String,
    pub purchased_at: Option<String>,
    pub seen_pass: Option<String>,
    pub share_ref: Option<String>,
    pub share_title: Option<String>,
    pub share_digest: Option<String>,
    pub delivered_digest: Option<String>,
    pub delivered_at: Option<String>,
    pub created_at: String,
    pub updated_at: String,
}
```

Row shape for this table (`DeriveEntityModel`).

**Fields**

- `id`: Random id of this holding; a holding removed and added again gets a
  new one, so its `holding_added` event is published again.
- `listing_id`: The listing held.
- `holder`: Stored holder key, `account:<account_id>`, `node:<node_id>` or
  `patron:<user id>` (`bookclerk_resolve::Holder::stored`); unique with
  `listing_id`.
- `holder_kind`: `account`, `node` or `patron`: which of the typed holder columns is
  set.
- `plugin_key`: PluginKey of the holding account (the listing's plugin); `None` for a
  node holder.
- `account_id`: Holding store account, with `plugin_key` a foreign key into
  `accounts`; `None` for a node holder.
- `node_id`: Holding branch library node (`nodes.node_id`); `None` for an account
  holder.
- `user_id`: Holding patron (`users.id`) of an uploaded book; `None` for an
  account or node holder.
- `entitlement`: `purchase`, `plus`, `loan`, `free` or `own` (an upload).
- `purchased_at`: RFC 3339 time it was bought or added, when known.
- `seen_pass`: Id of the scan pass that last listed this holding
  (`account_scan_state.pass_id`, or the branch's catalog pass start for
  a node holding); `None` until a pass lists it.
- `share_ref`: For a node holding, `store:product_id` as the branch named the title
  (`CatalogRef`); `None` for an account holding.
- `share_title`: For a node holding, the title as the branch shared it (JSON
  `CatalogTitle`: metadata and file manifest), passed on unchanged
  when this library is itself a branch.
- `share_digest`: For a node holding, the digest of the shared manifest
  (`CatalogTitle::manifest_digest`).
- `delivered_digest`: For a node holding, the manifest digest whose files reached this
  library; equal to `share_digest` once the current files arrived.
- `delivered_at`: For a node holding, the RFC 3339 time its files last arrived.
- `created_at`: RFC 3339 timestamp when the row was inserted.
- `updated_at`: RFC 3339 timestamp when the row was last modified.

#### Model::into_ex

```rust
pub fn into_ex(self) -> Self
```

Generated by sea-orm-macros

Implements: `Clone`, `Debug`, `From<Model>`, `FromQueryResult`, `IntoActiveModel<ActiveModel>`, `ModelTrait`, `PartialEq`, `TryFrom<ActiveModel>`, `TryIntoModel<Model>`

### ColumnIter

```rust
pub struct ColumnIter {
    /* private fields */
}
```

An iterator over the variants of [Column](#column)

Implements: `Clone`, `Debug`, `DoubleEndedIterator`, `ExactSizeIterator`, `FusedIterator`, `Iterator`

### Entity

```rust
pub struct Entity;
```

Generated by sea-orm-macros

Implements: `Clone`, `Copy`, `Debug`, `Default`, `EntityName`, `EntityTrait`, `Iden`, `IdenStatic`

### PrimaryKeyIter

```rust
pub struct PrimaryKeyIter {
    /* private fields */
}
```

An iterator over the variants of [PrimaryKey](#primarykey)

Implements: `Clone`, `Debug`, `DoubleEndedIterator`, `ExactSizeIterator`, `FusedIterator`, `Iterator`

### ActiveModel

```rust
pub struct ActiveModel {
    pub id: ActiveValue<String>,
    pub listing_id: ActiveValue<String>,
    pub holder: ActiveValue<String>,
    pub holder_kind: ActiveValue<String>,
    pub plugin_key: ActiveValue<Option<String>>,
    pub account_id: ActiveValue<Option<String>>,
    pub node_id: ActiveValue<Option<String>>,
    pub user_id: ActiveValue<Option<i64>>,
    pub entitlement: ActiveValue<String>,
    pub purchased_at: ActiveValue<Option<String>>,
    pub seen_pass: ActiveValue<Option<String>>,
    pub share_ref: ActiveValue<Option<String>>,
    pub share_title: ActiveValue<Option<String>>,
    pub share_digest: ActiveValue<Option<String>>,
    pub delivered_digest: ActiveValue<Option<String>>,
    pub delivered_at: ActiveValue<Option<String>>,
    pub created_at: ActiveValue<String>,
    pub updated_at: ActiveValue<String>,
}
```

Generated by sea-orm-macros

**Fields**

- `id`: Generated by sea-orm-macros
- `listing_id`: Generated by sea-orm-macros
- `holder`: Generated by sea-orm-macros
- `holder_kind`: Generated by sea-orm-macros
- `plugin_key`: Generated by sea-orm-macros
- `account_id`: Generated by sea-orm-macros
- `node_id`: Generated by sea-orm-macros
- `user_id`: Generated by sea-orm-macros
- `entitlement`: Generated by sea-orm-macros
- `purchased_at`: Generated by sea-orm-macros
- `seen_pass`: Generated by sea-orm-macros
- `share_ref`: Generated by sea-orm-macros
- `share_title`: Generated by sea-orm-macros
- `share_digest`: Generated by sea-orm-macros
- `delivered_digest`: Generated by sea-orm-macros
- `delivered_at`: Generated by sea-orm-macros
- `created_at`: Generated by sea-orm-macros
- `updated_at`: Generated by sea-orm-macros

Implements: `ActiveModelBehavior`, `ActiveModelTrait`, `Clone`, `Debug`, `Default`, `From<Model>`, `IntoActiveModel<ActiveModel>`, `PartialEq`, `TryFrom<ActiveModel>`, `TryIntoModel<Model>`

### RelationIter

```rust
pub struct RelationIter {
    /* private fields */
}
```

An iterator over the variants of [Relation](#relation)

Implements: `Clone`, `Debug`, `DoubleEndedIterator`, `ExactSizeIterator`, `FusedIterator`, `Iterator`

## Enums

### Column

```rust
pub enum Column {
    Id,
    ListingId,
    Holder,
    HolderKind,
    PluginKey,
    AccountId,
    NodeId,
    UserId,
    Entitlement,
    PurchasedAt,
    SeenPass,
    ShareRef,
    ShareTitle,
    ShareDigest,
    DeliveredDigest,
    DeliveredAt,
    CreatedAt,
    UpdatedAt,
}
```

Generated by sea-orm-macros

**Variants**

- `Id`: Generated by sea-orm-macros
- `ListingId`: Generated by sea-orm-macros
- `Holder`: Generated by sea-orm-macros
- `HolderKind`: Generated by sea-orm-macros
- `PluginKey`: Generated by sea-orm-macros
- `AccountId`: Generated by sea-orm-macros
- `NodeId`: Generated by sea-orm-macros
- `UserId`: Generated by sea-orm-macros
- `Entitlement`: Generated by sea-orm-macros
- `PurchasedAt`: Generated by sea-orm-macros
- `SeenPass`: Generated by sea-orm-macros
- `ShareRef`: Generated by sea-orm-macros
- `ShareTitle`: Generated by sea-orm-macros
- `ShareDigest`: Generated by sea-orm-macros
- `DeliveredDigest`: Generated by sea-orm-macros
- `DeliveredAt`: Generated by sea-orm-macros
- `CreatedAt`: Generated by sea-orm-macros
- `UpdatedAt`: Generated by sea-orm-macros

Implements: `Clone`, `ColumnTrait`, `Copy`, `Debug`, `FromStr`, `Iden`, `IdenStatic`, `IntoEnumIterator`

### PrimaryKey

```rust
pub enum PrimaryKey {
    Id,
}
```

Generated by sea-orm-macros

**Variants**

- `Id`: Generated by sea-orm-macros

Implements: `Clone`, `Copy`, `Debug`, `Iden`, `IdenStatic`, `IntoEnumIterator`, `PrimaryKeyToColumn`, `PrimaryKeyTrait`

### Relation

```rust
pub enum Relation {}
```

Declared SeaORM relations (none unless FK edges are modeled).

Implements: `Clone`, `Copy`, `Debug`, `IntoEnumIterator`, `RelationTrait`
