Giter VIP home page Giter VIP logo

Comments (6)

mfbx9da4 avatar mfbx9da4 commented on September 26, 2024 6

Any update on this one? Would be such a great feature as otherwise we lose all the awesome aliasing features in the deeper nested maps 😢.

from dynamodb-toolbox.

adikari avatar adikari commented on September 26, 2024 1

It would be handy to support list schema too. For eg.

someList: { type: 'list', schema: { name: 'string', enrolled: 'boolean' } }

the expected input for this would be:

const list = [{ name: 'foo', enrolled: true}, { name: 'bar', enrolled: false}]

from dynamodb-toolbox.

adikari avatar adikari commented on September 26, 2024

I am happy to create the PR for this. Let me know.

from dynamodb-toolbox.

garretcharp avatar garretcharp commented on September 26, 2024

+1 to this feature, typing on maps would be super useful

from dynamodb-toolbox.

garretcharp avatar garretcharp commented on September 26, 2024

To add to this being able to alias to a non-nested field would be super useful it doesnt seem like its possible right now?

I have here an example "Giveaway" model that has a winners object with the current winner and past winners (if any). And would like to alias winners.current to "winner", not sure if that is possible:

const giveaway = new Entity({
  table,
  name: 'Giveaway',
  attributes: {
    id: { partitionKey: true, prefix: 'Giveaway#' },
    sk: { sortKey: true, default: 'Giveaway#', hidden: true },

    winner: { type: 'map', dependsOn: 'winners', default: (item) => item.winners.current, save: false },
    winners: { type: 'map', default: { current: {}, pastWinners: [] } }
  }
})

Whenever I parse an item the winners.current value is correct, however, the default function for winner never gets called so the "winner" object is not populated. I assume I could probably put save to true and it would work via duplicating the value but not ideal.

from dynamodb-toolbox.

naorpeled avatar naorpeled commented on September 26, 2024

Done in v1 😎

from dynamodb-toolbox.

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.