boltdb on eventstore cli.
Some checks failed
build cli / make-release (push) Has been cancelled
build cli / build-linux (push) Has been cancelled

This commit is contained in:
fiatjaf
2024-02-08 12:36:54 -03:00
parent 9d87d1fd8a
commit d7917cefd4
4 changed files with 7 additions and 2 deletions

1
.gitignore vendored
View File

@@ -1 +1,2 @@
cmd/eventstore/eventstore
eventstore

View File

@@ -30,7 +30,7 @@ func detect(dir string) (string, error) {
if string(buf) == "SQLite format 3" {
return "sqlite", nil
}
return "", fmt.Errorf("unknown format")
return "bolt", nil
}
entries, err := os.ReadDir(dir)

View File

@@ -8,6 +8,7 @@ import (
"github.com/fiatjaf/eventstore"
"github.com/fiatjaf/eventstore/badger"
"github.com/fiatjaf/eventstore/bolt"
"github.com/fiatjaf/eventstore/elasticsearch"
"github.com/fiatjaf/eventstore/lmdb"
"github.com/fiatjaf/eventstore/mysql"
@@ -32,7 +33,7 @@ var app = &cli.Command{
&cli.StringFlag{
Name: "type",
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 {
@@ -77,6 +78,8 @@ var app = &cli.Command{
}
case "lmdb":
db = &lmdb.LMDBBackend{Path: path, MaxLimit: 1_000_000}
case "bolt":
db = &bolt.BoltBackend{Path: path, MaxLimit: 1_000_000}
case "badger":
db = &badger.BadgerBackend{Path: path, MaxLimit: 1_000_000}
case "postgres", "postgresql":

View File

@@ -14,6 +14,7 @@ var query = &cli.Command{
Name: "query",
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",
UsageText: "eventstore query <nostr-filter>",
Action: func(ctx context.Context, c *cli.Command) error {
hasError := false
for line := range getStdinLinesOrFirstArgument(c) {