Code Monkey home page Code Monkey logo

Comments (7)

peergynt avatar peergynt commented on June 3, 2024 1

I did not really start anything yet. This is kind of a side-project of a side-project...
However I had some initial thoughts.

I was thinking that the json tag belonged to the 'encoding/json' package so it might make sense to use a new tag like ubjson. It is not uncommon for fields to have multiple tags: json, xml, form...
However I agree that since UBJSON is very much related to JSON, you can make a case for using the json tag.

As far as the design, I was thinking about imitating the 'encoding/json' implementation (i.e. tag caching...).

In any case, let me know what I can help with.

from ubjson.

peergynt avatar peergynt commented on June 3, 2024

Hi Jordan, are you still interested in implementing some support for field tags? I cannot use auto decoding when all my keys are lower case strings. I would be willing to take on this issue.

from ubjson.

jmank88 avatar jmank88 commented on June 3, 2024

Yes, I'm still interested in this. I didn't have firm plans for this when I wrote it up, so it may need some more design up front.

One thing I was wondering was if it make sense (and is it possible) to leverage the same json tag? Or would it be better to have a separate ubjson tag? It would be convenient to be able to use previously json tagged structs without any extra work, but I worry that options could become confusing or even incompatible. At the least, I think that we'd need to be able to override them with something specific to ubjson. Perhaps ubjson tags could override/augment json tags when both are on a single field. This would allow a simpler incremental first step of just leveraging the json tag names, which is most important, and the rest can be sorted out later.

Also related is #6. If there is a significant speed boost, it'd be neat to generate Value code from the structs, including tags. Mostly orthogonal to this, but some of the code would be leveraged from that pathway, so just something to keep in mind.

You are welcome to work on this issue. Feel free to put a WIP pull request, or let me know if you get stuck or need any help.

from ubjson.

jmank88 avatar jmank88 commented on June 3, 2024

@peergynt, have you started on this issue? If not, I prototyped something that I can put up soon.

from ubjson.

jmank88 avatar jmank88 commented on June 3, 2024

@peergynt I put up #8, if you'd like to take a look or test the branch.

After thinking more about it, the duplication from having a separate 'ubjson' tag isn't such a big deal, plus recognizing 'json' first could potentially force people to add an additional 'ubjson' tag just to get back to the original field name.

from ubjson.

peergynt avatar peergynt commented on June 3, 2024

@jmank88 I tested the struct_tag branch and the ubjson tag seems to work well!

from ubjson.

jmank88 avatar jmank88 commented on June 3, 2024

Closing this since basic support has been added. Can revisit if more options/extensions are needed later on.

from ubjson.

Related Issues (6)

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.