# bookclerk_library::entities::copy_grants

SeaORM entity for `copy_grants`: one reader's leave to download the
copy this library holds of one edition. Written by
`control_plane::copies`.

| Item | Kind | Summary |
| --- | --- | --- |
| [`Model`](#model) | struct | Row shape for one grant. |
| [`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 copy_id: String,
    pub token_hash: String,
    pub holder_kind: String,
    pub holder_id: String,
    pub user_id: i64,
    pub edition_id: String,
    pub serving_node_id: String,
    pub destination: String,
    pub files_digest: String,
    pub created_at: String,
    pub expires_at: String,
}
```

Row shape for one grant.

**Fields**

- `copy_id`: Copy id (hyphenated UUID).
- `token_hash`: `hash_token` of the bearer token; the token itself is never stored.
- `holder_kind`: What asked: `node` (a branch) or `card` (a clerk's library card).
- `holder_id`: The asking node's id, or the card's id.
- `user_id`: The person the copy is for (`users.id`).
- `edition_id`: The edition copied.
- `serving_node_id`: The node that answered the grant and serves the files.
- `destination`: The output destination on that node the files are read from.
- `files_digest`: Digest of the edition's file rows on that destination at grant, in
  download order; a download is refused once they differ.
- `created_at`: RFC 3339 grant time.
- `expires_at`: RFC 3339 time after which the token is refused.

#### 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 copy_id: ActiveValue<String>,
    pub token_hash: ActiveValue<String>,
    pub holder_kind: ActiveValue<String>,
    pub holder_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 created_at: ActiveValue<String>,
    pub expires_at: ActiveValue<String>,
}
```

Generated by sea-orm-macros

**Fields**

- `copy_id`: Generated by sea-orm-macros
- `token_hash`: Generated by sea-orm-macros
- `holder_kind`: Generated by sea-orm-macros
- `holder_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
- `created_at`: Generated by sea-orm-macros
- `expires_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 {
    CopyId,
    TokenHash,
    HolderKind,
    HolderId,
    UserId,
    EditionId,
    ServingNodeId,
    Destination,
    FilesDigest,
    CreatedAt,
    ExpiresAt,
}
```

Generated by sea-orm-macros

**Variants**

- `CopyId`: Generated by sea-orm-macros
- `TokenHash`: Generated by sea-orm-macros
- `HolderKind`: Generated by sea-orm-macros
- `HolderId`: 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
- `CreatedAt`: Generated by sea-orm-macros
- `ExpiresAt`: Generated by sea-orm-macros

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

### PrimaryKey

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

Generated by sea-orm-macros

**Variants**

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