# bookclerk_library::entities::library_work_rows

SeaORM entity for `library_work_rows`: the library's page index.

One row per held top-level work, refreshed from the library model by
[`crate::LibraryStore::refresh_library_works`](/docs/internals/crates/bookclerk_library/index.md#librarystorerefresh_library_works), so list views page one
table instead of joining works, editions, listings and holdings.

| 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 work_id: String,
    pub kind: String,
    pub title: String,
    pub sort_title: String,
    pub authors: Option<String>,
    pub sort_author: String,
    pub series: Option<String>,
    pub series_position: Option<String>,
    pub cover_edition_id: Option<String>,
    pub media_kinds: String,
    pub acquire_status: String,
    pub edition_count: i64,
    pub holding_count: i64,
    pub added_at: String,
    pub sort_series: String,
    pub length_minutes: i64,
    pub purchased_at: String,
    pub refreshed_at: String,
    pub facets_ready: i64,
}
```

Row shape for this table (`DeriveEntityModel`).

**Fields**

- `work_id`: The work (`works.id`); a top-level work, never a podcast episode.
- `kind`: Work kind (`WorkKind::as_str`): `book` or `podcast`.
- `title`: The work's display title.
- `sort_title`: Sort key of the title: lower case, a leading article dropped.
- `authors`: Authors (or a show's hosts) joined for display, in billing order.
- `sort_author`: Sort key of the first author; empty when the work names none.
- `series`: Name of the first series the work belongs to.
- `series_position`: The work's position in [`Self::series`](#model), as the store wrote it.
- `cover_edition_id`: The edition whose cover the list shows (`editions.id`).
- `media_kinds`: Sorted, comma-joined media kinds of the work's editions
  (`MediaKind::as_str`), such as `audio,ebook`.
- `acquire_status`: The furthest acquire state any edition of the work reached
  (`AcquireStatus::as_str`).
- `edition_count`: How many editions the work has.
- `holding_count`: How many holdings (account or node) the work's listings have.
- `added_at`: RFC 3339 timestamp of the work's newest holding, for "recently
  added".
- `sort_series`: Sort key of the series order: `0`, the lower-cased first series
  name, a separator and the zero-padded position; `1` when the work is
  in no series, so those sort last.
- `length_minutes`: Runtime in minutes of the work's longest held edition; 0 when no
  store reported one.
- `purchased_at`: RFC 3339 timestamp of the newest purchase a store reported for the
  work's holdings; empty when none did.
- `refreshed_at`: RFC 3339 timestamp at which the refresh that wrote this row read the
  model; a refresh that read earlier never overwrites it.
- `facets_ready`: 1 once every `library_work_facets` row of the refresh that wrote
  this row is in place, 0 while they are being replaced. A patron
  scope admits only rows at 1.

#### 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 work_id: ActiveValue<String>,
    pub kind: ActiveValue<String>,
    pub title: ActiveValue<String>,
    pub sort_title: ActiveValue<String>,
    pub authors: ActiveValue<Option<String>>,
    pub sort_author: ActiveValue<String>,
    pub series: ActiveValue<Option<String>>,
    pub series_position: ActiveValue<Option<String>>,
    pub cover_edition_id: ActiveValue<Option<String>>,
    pub media_kinds: ActiveValue<String>,
    pub acquire_status: ActiveValue<String>,
    pub edition_count: ActiveValue<i64>,
    pub holding_count: ActiveValue<i64>,
    pub added_at: ActiveValue<String>,
    pub sort_series: ActiveValue<String>,
    pub length_minutes: ActiveValue<i64>,
    pub purchased_at: ActiveValue<String>,
    pub refreshed_at: ActiveValue<String>,
    pub facets_ready: ActiveValue<i64>,
}
```

Generated by sea-orm-macros

**Fields**

- `work_id`: Generated by sea-orm-macros
- `kind`: Generated by sea-orm-macros
- `title`: Generated by sea-orm-macros
- `sort_title`: Generated by sea-orm-macros
- `authors`: Generated by sea-orm-macros
- `sort_author`: Generated by sea-orm-macros
- `series`: Generated by sea-orm-macros
- `series_position`: Generated by sea-orm-macros
- `cover_edition_id`: Generated by sea-orm-macros
- `media_kinds`: Generated by sea-orm-macros
- `acquire_status`: Generated by sea-orm-macros
- `edition_count`: Generated by sea-orm-macros
- `holding_count`: Generated by sea-orm-macros
- `added_at`: Generated by sea-orm-macros
- `sort_series`: Generated by sea-orm-macros
- `length_minutes`: Generated by sea-orm-macros
- `purchased_at`: Generated by sea-orm-macros
- `refreshed_at`: Generated by sea-orm-macros
- `facets_ready`: 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 {
    WorkId,
    Kind,
    Title,
    SortTitle,
    Authors,
    SortAuthor,
    Series,
    SeriesPosition,
    CoverEditionId,
    MediaKinds,
    AcquireStatus,
    EditionCount,
    HoldingCount,
    AddedAt,
    SortSeries,
    LengthMinutes,
    PurchasedAt,
    RefreshedAt,
    FacetsReady,
}
```

Generated by sea-orm-macros

**Variants**

- `WorkId`: Generated by sea-orm-macros
- `Kind`: Generated by sea-orm-macros
- `Title`: Generated by sea-orm-macros
- `SortTitle`: Generated by sea-orm-macros
- `Authors`: Generated by sea-orm-macros
- `SortAuthor`: Generated by sea-orm-macros
- `Series`: Generated by sea-orm-macros
- `SeriesPosition`: Generated by sea-orm-macros
- `CoverEditionId`: Generated by sea-orm-macros
- `MediaKinds`: Generated by sea-orm-macros
- `AcquireStatus`: Generated by sea-orm-macros
- `EditionCount`: Generated by sea-orm-macros
- `HoldingCount`: Generated by sea-orm-macros
- `AddedAt`: Generated by sea-orm-macros
- `SortSeries`: Generated by sea-orm-macros
- `LengthMinutes`: Generated by sea-orm-macros
- `PurchasedAt`: Generated by sea-orm-macros
- `RefreshedAt`: Generated by sea-orm-macros
- `FacetsReady`: Generated by sea-orm-macros

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

### PrimaryKey

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

Generated by sea-orm-macros

**Variants**

- `WorkId`: 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`
