Merge pull request #4 from vulcanize/statedb

fix readme
This commit is contained in:
Ian Norden 2020-06-16 12:58:38 -05:00 committed by GitHub
commit d71e6b87ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -26,18 +26,23 @@ employ it as you would the usual [leveldb](https://github.com/ethereum/go-ethere
with a few exceptions: with a few exceptions:
```go ```go
package example package main
import ( import (
"github.com/ethereum/go-ethereum/trie" "github.com/ethereum/go-ethereum/trie"
"github.com/jmoiron/sqlx"
"github.com/vulcanize/pg-ipfs-ethdb" "github.com/vulcanize/pg-ipfs-ethdb"
) )
func main() {
connectStr := "postgresql://localhost:5432/vulcanize_testing?sslmode=disable" connectStr := "postgresql://localhost:5432/vulcanize_testing?sslmode=disable"
db, _ := sqlx.Connect("postgres", connectStr) db, _ := sqlx.Connect("postgres", connectStr)
kvs := ipfsethdb.NewKeyValueStore(db) kvs := ipfsethdb.NewKeyValueStore(db)
trieDB := trie.NewDatabase(db) trieDB := trie.NewDatabase(kvs)
// do stuff
}
``` ```
EXCEPTIONS: AncientReader, AncientWriter, and Iteratee interfaces are not functionally complete. EXCEPTIONS: AncientReader, AncientWriter, and Iteratee interfaces are not functionally complete.