Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
memdb
✓ github.com/hashicorp/go-memdb
Creates an in-memory database with a schema, inserts a record, and commits.
package main
import (
"fmt"
"github.com/hashicorp/go-memdb"
)
func main() {
schema := &memdb.DBSchema{
Tables: map[string]*memdb.TableSchema{
"user": {
Name: "user",
Indexes: map[string]*memdb.IndexSchema{
"id": {
Name: "id",
Unique: true,
Indexer: &memdb.StringFieldIndex{Field: "ID"},
},
},
},
},
}
db, _ := memdb.NewMemDB(schema)
txn := db.Txn(true)
txn.Insert("user", &User{ID: "1"})
txn.Commit()
fmt.Println("done")
}
type User struct {
ID string
}
Debug
Known issues
No known issues recorded.
Upgrade
Version history
1.3.5latest on pkg.go.dev
Audit
Dependencies
No dependency data recorded yet.