Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nested create #44

Open
Brendonovich opened this issue Apr 27, 2022 · 5 comments
Open

Nested create #44

Brendonovich opened this issue Apr 27, 2022 · 5 comments

Comments

@Brendonovich
Copy link
Owner

Brendonovich commented Apr 27, 2022

The following should be possible:

client
    .user()
    .create(
        "Name".to_string(),
        user::image::create("some url".to_string(), vec![]),
    )
    .exec()
    .await;
@hodlen
Copy link

hodlen commented Sep 8, 2022

Hi! Is this feature in development or planned to be shipped recently? I am using this library to integrate with MongoDB, so nested creation is an essential feature to support my development.

I can see from the code, FieldTypeExt has not supported type(sub-docuemnt) for now.

Open to contributing some code here!

@Brendonovich
Copy link
Owner Author

Brendonovich commented Sep 8, 2022

From what I understand about MongoDB, I think you're referring to composite types. These are being tracked in #82.
This issue is for creating records for a relation in a relational DB.
Check #128 for the status on MongoDB support.

@escwxyz
Copy link

escwxyz commented Mar 9, 2023

Hello, any update on this? Will there be any estimated date for this? Thanks.

@Brendonovich
Copy link
Owner Author

@linsijia628 Nothing yet. Rest assured I'm aware of it.

@Brendonovich
Copy link
Owner Author

still got a lot to go but the types for these are completed

client.user().create(
    "Brendan".to_string(),
    vec![user::posts::connect(vec![
        post::id::equals("0".to_string()),
        post::id::equals("1".to_string()),
    ])],
);

client.user().create(
    "Brendan".to_string(),
    vec![user::posts::create_many(vec![
        user::posts::create("Brendan".to_string(), false, vec![]),
        user::posts::create("Brendan".to_string(), true, vec![]),
    ])],
);

client.user().create(
    "Brendan".to_string(),
    vec![user::posts::connect_or_create([
        (
            post::id::equals("bruh".to_string()),
            user::posts::create("Brendan".to_string(), false, vec![]),
        ),
        (
            post::id::equals("bruh".to_string()),
            user::posts::create("Brendan".to_string(), true, vec![]),
        ),
    ])],
);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

3 participants