Giter VIP home page Giter VIP logo

Comments (2)

greenrobot avatar greenrobot commented on June 23, 2024

What's the current behavior? I think when reading a non-present field from FB e.g. into an int the resulting value should be the the default (zero).

Hmm, nullable... Would like to avoid that (first annotation specific to generator(?)), but I guess we don't have much choice? 🤔 To make things worse, there might be multiple options, e.g. raw pointer, std::unique_ptr and std::optional.

PS.: std::optional represents the FB behavior best. And, if we decide to add an annotation, I see "optional" are a more fitting name.

PSS.: In Java, there are some locations, where you have to provide a "null value". E.g. imagine an annotation on the fbs like "null-value: -1"; reading from FB without a value would result in an int value -1 (and vice versa). I'm not saying that this is the best idea ever, just to throw in some brainstorming here....

from objectbox-generator.

vaind avatar vaind commented on June 23, 2024

We could also make use of .fbs field "default" value being explicitly specified to mean the field is nullable and should be stored as null if its value equals to the default... Then the generated store/load code would behave pretty much like standard flatbuffers.

from objectbox-generator.

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.