Code Monkey home page Code Monkey logo

Comments (2)

0xTim avatar 0xTim commented on June 6, 2024

I think this is expected behaviour. Fluent makes no guarantees about how eager loading works (we would like to use joins where possible in the future for example) and we can change the implementations under the hood. There are a lot of assumptions in Fluent about constraints as well so using an @OptionalParent with a ID that doesn't exist (instead of it being nil - that's your issue correct?) would break some of Fluent's internals.

You're probably best off using an @OptionalField instead to hold the ID and doing the lookups yourself, including handling if that ID is not valid

from fluent.

gwynne avatar gwynne commented on June 6, 2024

It sounds essentially as if you're hoping to get the effect of a left outer join, while the Fluent relation properties are designed to provide the effect of an inner join.

If you want this behavior, you can copy the contents of OptionalParent.swift into a new file in your project, rename the wrapper (maybe something like @UncheckedOptionalParent), and replace the logic that throws an error with your preferred outcome. This being said, Fluent does not officially support third-party packages providing custom property wrappers, so I can't promise that doing this will continue to work on an ongoing basis. (Although, I do use several custom wrappers in external projects myself, so odds are I won't break the ability to do so too badly 😅.)

from fluent.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.