Skip to content

Nullable Vec<u8> type #3062

Description

@angrynode

On sea_orm 2 RC38.

I'm trying to implement a newtype that's not stringy, not an enum, but a binary type, TorrentFile.

I'm probably doing something wrong because i can't seem to be able to do Option<TorrentFile> in a sea_orm model. The type implements Nullable here.

In my model, i've tried to specify #[sea_orm(default_value = "None", nullable)] even though i don't think it would be necessary. In the migration, i've tried both var_binary(...).null() and binary(...).null()

The error i get at runtime is Type Error: A null value was encountered while decoding "resolved". It only occurs when loading the table, after a magnet was inserted with resolved = NULL.

My understanding is that this should only happening when encountering TryGetError::Null, but in that case the implementation for Option<T> should produce Ok(None).

There's probably something missing in my mental model. I'll be happy to help improve the docs about binary newtypes if i can understand what's wrong :)

I've added the label "bug" because it's a runtime error and not a compile-time error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions