# bookclerk_library::entities::playback_sessions

SeaORM entity for `playback_sessions`: one stretch of listening by one
person on one player. A session is also the leave to stream the
edition's files from one destination, checked afresh on every request
(`control_plane::copies::authorize_playback`).

| Item | Kind | Summary |
| --- | --- | --- |
| [`Model`](#model) | struct | Row shape for one play session. |
| [`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). |

## Structs

### Model

```rust
pub struct Model {
    pub id: String,
    pub user_id: i64,
    pub edition_id: String,
    pub serving_node_id: String,
    pub destination: String,
    pub files_digest: String,
    pub client_kind: String,
    pub client_name: String,
    pub start_position_ms: i64,
    pub position_ms: i64,
    pub listened_ms: i64,
    pub started_at: String,
    pub updated_at: String,
    pub closed_at: Option<String>,
}
```

Row shape for one play session.

**Fields**

- `id`: Session id (hyphenated UUID).
- `user_id`: The listener (`users.id`).
- `edition_id`: The edition (`editions.id`) being played.
- `serving_node_id`: The node that opened the session and streams its files.
- `destination`: The output destination the files are read from.
- `files_digest`: Digest of the edition's file rows on that destination when the
  session opened; a stream request is refused once they differ.
- `client_kind`: What kind of player opened it ([`crate::PlayerKind`](/docs/internals/crates/bookclerk_library/index.md#playerkind)).
- `client_name`: The player's own name for itself, shown in listening history.
- `start_position_ms`: Position the session started from, in milliseconds.
- `position_ms`: Position at the last sync, in milliseconds.
- `listened_ms`: Time spent listening in this session, in milliseconds of wall
  clock as the player counted it.
- `started_at`: RFC 3339 time the session opened.
- `updated_at`: RFC 3339 time of the last sync.
- `closed_at`: RFC 3339 time the player closed the session; `None` while open.

#### Model::into_ex

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

Generated by sea-orm-macros

Implements: `Clone`, `Debug`, `Eq`, `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 user_id: ActiveValue<i64>,
    pub edition_id: ActiveValue<String>,
    pub serving_node_id: ActiveValue<String>,
    pub destination: ActiveValue<String>,
    pub files_digest: ActiveValue<String>,
    pub client_kind: ActiveValue<String>,
    pub client_name: ActiveValue<String>,
    pub start_position_ms: ActiveValue<i64>,
    pub position_ms: ActiveValue<i64>,
    pub listened_ms: ActiveValue<i64>,
    pub started_at: ActiveValue<String>,
    pub updated_at: ActiveValue<String>,
    pub closed_at: ActiveValue<Option<String>>,
}
```

Generated by sea-orm-macros

**Fields**

- `id`: Generated by sea-orm-macros
- `user_id`: Generated by sea-orm-macros
- `edition_id`: Generated by sea-orm-macros
- `serving_node_id`: Generated by sea-orm-macros
- `destination`: Generated by sea-orm-macros
- `files_digest`: Generated by sea-orm-macros
- `client_kind`: Generated by sea-orm-macros
- `client_name`: Generated by sea-orm-macros
- `start_position_ms`: Generated by sea-orm-macros
- `position_ms`: Generated by sea-orm-macros
- `listened_ms`: Generated by sea-orm-macros
- `started_at`: Generated by sea-orm-macros
- `updated_at`: Generated by sea-orm-macros
- `closed_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,
    UserId,
    EditionId,
    ServingNodeId,
    Destination,
    FilesDigest,
    ClientKind,
    ClientName,
    StartPositionMs,
    PositionMs,
    ListenedMs,
    StartedAt,
    UpdatedAt,
    ClosedAt,
}
```

Generated by sea-orm-macros

**Variants**

- `Id`: Generated by sea-orm-macros
- `UserId`: Generated by sea-orm-macros
- `EditionId`: Generated by sea-orm-macros
- `ServingNodeId`: Generated by sea-orm-macros
- `Destination`: Generated by sea-orm-macros
- `FilesDigest`: Generated by sea-orm-macros
- `ClientKind`: Generated by sea-orm-macros
- `ClientName`: Generated by sea-orm-macros
- `StartPositionMs`: Generated by sea-orm-macros
- `PositionMs`: Generated by sea-orm-macros
- `ListenedMs`: Generated by sea-orm-macros
- `StartedAt`: Generated by sea-orm-macros
- `UpdatedAt`: Generated by sea-orm-macros
- `ClosedAt`: 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).

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