Coder Social home page Coder Social logo

Comments (6)

rwynn avatar rwynn commented on May 26, 2024

I will look into adding support in gtm. For now could you use something like https://github.com/mitchellh/mapstructure?

from gtm.

sfreiberg avatar sfreiberg commented on May 26, 2024

Yeah I definitely could do that but like I said I don’t like the idea of having multiple ways to unmarshal data. I think I might just make a fork and stick the raw data in there and unmarshal that with the bson package.

The approach I mention above seems inelegant which is why I opened a ticket instead of a PR. I thought you might have a more elegant approach. I haven’t spent a lot of time looking at the code so if I get the chance and think of an nice way to handle it I’ll post it here.

from gtm.

rwynn avatar rwynn commented on May 26, 2024

Took a stab at this in a feature branch. Seems to work ok while keeping backwards compatibility. You set a new function in the options under Unmarshal that gets passed a namespace and a bson.Raw. Based on that you can unmarshal into whatever struct you want. Then the result should be in a new field on the op named Doc. Let me know if you notice any problems.

from gtm.

sfreiberg avatar sfreiberg commented on May 26, 2024

Yes that should work for my purposes. Thank you!

from gtm.

rwynn avatar rwynn commented on May 26, 2024

No problem. I'd like to get this merged into trunk but I need to make sure I didn't introduce any regressions. I depend on this project in a couple others.

from gtm.

rwynn avatar rwynn commented on May 26, 2024

@sfreiberg this has now been merged into master. Please let me know if you encounter any problems.

from gtm.

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.