boltdb on eventstore cli.
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1 +1,2 @@
|
|||||||
cmd/eventstore/eventstore
|
cmd/eventstore/eventstore
|
||||||
|
eventstore
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ func detect(dir string) (string, error) {
|
|||||||
if string(buf) == "SQLite format 3" {
|
if string(buf) == "SQLite format 3" {
|
||||||
return "sqlite", nil
|
return "sqlite", nil
|
||||||
}
|
}
|
||||||
return "", fmt.Errorf("unknown format")
|
return "bolt", nil
|
||||||
}
|
}
|
||||||
|
|
||||||
entries, err := os.ReadDir(dir)
|
entries, err := os.ReadDir(dir)
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import (
|
|||||||
|
|
||||||
"github.com/fiatjaf/eventstore"
|
"github.com/fiatjaf/eventstore"
|
||||||
"github.com/fiatjaf/eventstore/badger"
|
"github.com/fiatjaf/eventstore/badger"
|
||||||
|
"github.com/fiatjaf/eventstore/bolt"
|
||||||
"github.com/fiatjaf/eventstore/elasticsearch"
|
"github.com/fiatjaf/eventstore/elasticsearch"
|
||||||
"github.com/fiatjaf/eventstore/lmdb"
|
"github.com/fiatjaf/eventstore/lmdb"
|
||||||
"github.com/fiatjaf/eventstore/mysql"
|
"github.com/fiatjaf/eventstore/mysql"
|
||||||
@@ -32,7 +33,7 @@ var app = &cli.Command{
|
|||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "type",
|
Name: "type",
|
||||||
Aliases: []string{"t"},
|
Aliases: []string{"t"},
|
||||||
Usage: "store type ('sqlite', 'lmdb', 'badger', 'postgres', 'mysql', 'elasticsearch')",
|
Usage: "store type ('sqlite', 'lmdb', 'bolt', 'badger', 'postgres', 'mysql', 'elasticsearch')",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Before: func(ctx context.Context, c *cli.Command) error {
|
Before: func(ctx context.Context, c *cli.Command) error {
|
||||||
@@ -77,6 +78,8 @@ var app = &cli.Command{
|
|||||||
}
|
}
|
||||||
case "lmdb":
|
case "lmdb":
|
||||||
db = &lmdb.LMDBBackend{Path: path, MaxLimit: 1_000_000}
|
db = &lmdb.LMDBBackend{Path: path, MaxLimit: 1_000_000}
|
||||||
|
case "bolt":
|
||||||
|
db = &bolt.BoltBackend{Path: path, MaxLimit: 1_000_000}
|
||||||
case "badger":
|
case "badger":
|
||||||
db = &badger.BadgerBackend{Path: path, MaxLimit: 1_000_000}
|
db = &badger.BadgerBackend{Path: path, MaxLimit: 1_000_000}
|
||||||
case "postgres", "postgresql":
|
case "postgres", "postgresql":
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ var query = &cli.Command{
|
|||||||
Name: "query",
|
Name: "query",
|
||||||
Usage: "queries an eventstore for events, takes a Nostr filter as argument",
|
Usage: "queries an eventstore for events, takes a Nostr filter as argument",
|
||||||
Description: "unless specified to be smaller, up to a million results will be returned",
|
Description: "unless specified to be smaller, up to a million results will be returned",
|
||||||
|
UsageText: "eventstore query <nostr-filter>",
|
||||||
Action: func(ctx context.Context, c *cli.Command) error {
|
Action: func(ctx context.Context, c *cli.Command) error {
|
||||||
hasError := false
|
hasError := false
|
||||||
for line := range getStdinLinesOrFirstArgument(c) {
|
for line := range getStdinLinesOrFirstArgument(c) {
|
||||||
|
|||||||
Reference in New Issue
Block a user