Giter Club home page Giter Club logo

Comments (4)

udosson avatar udosson commented on June 16, 2024

After some research and especially this article on medium, I recommend using UUID as PK.
Of course, compared to auto-increment keys or composite keys there are downsides like performance loss and the increased storage required. However, we can generate the UUID outside of the chaincode and its a create benefit to have a "globally" unique identifier in distributed systems.
I vote for UUID as pk.
What do other folks think about this?

Another scenrio could be to use auto-incremented integers as pk and UUID as a second identifier.

from blockchain-carbon-accounting.

michaelbauerinc avatar michaelbauerinc commented on June 16, 2024

I've gotten a working example of this going this morning. I don't have an opinion on whether we use PK or UUID, as the logic will basically be the same except for that one value. This will leave it flexible in the future, but just a few questions:

  1. For the query of ONE emission, would it require all of the same fields and then return the result ONLY unique to that?

  2. For querying ALL emissions, we can have any combination of values passed in (for example, utility id only, or perhaps utility ID AND user_id, etc), and it will return all entries that match those fields. Does this sound correct? This gives a super flexible, powerful, and reusable query that we can inherit from on other channels/cc.

from blockchain-carbon-accounting.

michaelbauerinc avatar michaelbauerinc commented on June 16, 2024

I am also looking at this for generating UUIDs: https://www.npmjs.com/package/uuid

from blockchain-carbon-accounting.

sichen1234 avatar sichen1234 commented on June 16, 2024
  1. To query one emission should only require the UUID key
  2. Yes, to query a list of emissions, use all the same current parameters to return a list of the emissions.

from blockchain-carbon-accounting.

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.