Skip to content

get all entities? #35

@open-schnick

Description

@open-schnick

Hi i have the following code expecting that i get one entity back which is not the case:

    let new_artist = Artist::create()
        .name("Artist")
        .exec(&db)
        .await
        .unwrap();
    
    Song::create()
        .title("Crazy Good Song")
        .artist(&new_artist)
        .exec(&db)
        .await
        .unwrap();

    let all_songs = Song::find_many_by_id()
        .all(&db)
        .await
        .unwrap()
        .collect::<Vec<Song>>()
        .await
        .unwrap();

    assert_eq!(all_songs.len(), 1);

Is this a api misuse by me or a bug in the application?
Also i think having a Song::find_all() would make sense from a readability and usability perspective

PS: I know logging is on the roadmap but here having tracing log the executed statement would make it easier to debug

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions