Coder Social home page Coder Social logo

can't build go-api with mongoDB about spin HOT 3 OPEN

souravsk avatar souravsk commented on July 20, 2024
can't build go-api with mongoDB

from spin.

Comments (3)

itowlson avatar itowlson commented on July 20, 2024

Unfortunately, the current preview of WASI (WebAssembly System Interface) does not provide for outbound sockets, so TinyGo cannot emit socket code when targeting WASI. This means that libraries that depend on socket code do not compile (and the error, as you see, don't clearly identify the root cause). (This is why Spin has to special-case HTTP.)

As WASI Preview 2 stabilises, hopefully TinyGo will port their standard library to that, and sockets code will start working.

Sorry for the inconvenience and thanks for trying it out!

from spin.

souravsk avatar souravsk commented on July 20, 2024

Thanks @itowlson for your awesome explanation.
One more Question if I created a Postgres db locally instant of that MongoDB then it will work?

from spin.

itowlson avatar itowlson commented on July 20, 2024

Spin does have a Postgres interface (see https://developer.fermyon.com/spin/rdbms-storage) but, unfortunately, it's not surfaced in the Go SDK at the moment, only Rust (and C#, but that SDK is a bit out of date). And I don't think you'd be able to use the Go Postgres drivers, because even with a local instance they'll be using sockets.

I'm afraid Spin's Go relational database story is not great right now - MySQL is also Rust/C#-only, and SQLite doesn't yet have a Go SDK because of some implementation issues (hopefully soon though!). If a key-value store works for you then Go does have both Spin's built-in key-value storage, and "bring your own instance" Redis...?

from spin.

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.