dgraph-io / badger

Fast key-value DB in Go.
https://dgraph.io/badger
Apache License 2.0
13.98k stars 1.18k forks source link

[QUESTION]: Browser wasm support #1956

Closed omar391 closed 3 months ago

omar391 commented 1 year ago

Question.

Hi,

Is there any plan to support Browser IndexedDB via wasm? This would be very very interesting since several large projects like IPFS use badger DB.

Best.

mangalaman93 commented 1 year ago

Hi Omar, We don't have any such plans right now but feel free to give it a try and let us know what doesn't work.

tangxusc commented 5 months ago

env

go version go1.21.4 darwin/arm64

code

package main

import (
    "github.com/dgraph-io/badger/v4"
    "github.com/extism/go-pdk"
    "log"
)

var db *badger.DB

func main() {
    var err error
    db, err = badger.Open(badger.DefaultOptions("/tmp/badger"))
    if err != nil {
        log.Fatal(err)
    }
    fmt.Println(db)
}

Compile command


GOOS=wasip1 GOARCH=wasm go build -o main.wasm main.go

error out

package command-line-arguments imports github.com/dgraph-io/badger/v4 imports golang.org/x/sys/unix: build constraints exclude all Go files in /Users/tangxu/sdk/gopath/pkg/mod/golang.org/x/sys@v0.5.0/unix

result

It looks like golang.org/x/sys@v0.5.0/unix library not supported?

github-actions[bot] commented 3 months ago

This issue has been stale for 60 days and will be closed automatically in 7 days. Comment to keep it open.