initial addition for exporting functionality
This commit is contained in:
parent
fa26e68773
commit
0c3757d48e
1 changed files with 18 additions and 0 deletions
|
|
@ -49,6 +49,8 @@ var (
|
||||||
configFile = flag.String("config", "", "Path to an explicit configuration file.")
|
configFile = flag.String("config", "", "Path to an explicit configuration file.")
|
||||||
databasePath = flag.String("dbpath", "/tmp/testdb", "Path to the database.")
|
databasePath = flag.String("dbpath", "/tmp/testdb", "Path to the database.")
|
||||||
databaseBackend = flag.String("db", "memstore", "Database Backend.")
|
databaseBackend = flag.String("db", "memstore", "Database Backend.")
|
||||||
|
dumpFile = flag.String("dump", "dbdump.nq", `Quad file to dump the database to (".gz" supported, "-" for stdout).`)
|
||||||
|
dumpType = flag.String("dump_type", "json", `Quad file format ("json", "nquad").`)
|
||||||
replicationBackend = flag.String("replication", "single", "Replication method.")
|
replicationBackend = flag.String("replication", "single", "Replication method.")
|
||||||
host = flag.String("host", "127.0.0.1", "Host to listen on (defaults to all).")
|
host = flag.String("host", "127.0.0.1", "Host to listen on (defaults to all).")
|
||||||
loadSize = flag.Int("load_size", 10000, "Size of quadsets to load")
|
loadSize = flag.Int("load_size", 10000, "Size of quadsets to load")
|
||||||
|
|
@ -72,6 +74,7 @@ Commands:
|
||||||
init Create an empty database.
|
init Create an empty database.
|
||||||
load Bulk-load a quad file into the database.
|
load Bulk-load a quad file into the database.
|
||||||
http Serve an HTTP endpoint on the given host and port.
|
http Serve an HTTP endpoint on the given host and port.
|
||||||
|
dump Bulk-dump the database into a quad file.
|
||||||
repl Drop into a REPL of the given query language.
|
repl Drop into a REPL of the given query language.
|
||||||
version Version information.
|
version Version information.
|
||||||
|
|
||||||
|
|
@ -204,6 +207,21 @@ func main() {
|
||||||
|
|
||||||
handle.Close()
|
handle.Close()
|
||||||
|
|
||||||
|
case "dump":
|
||||||
|
handle, err = db.Open(cfg)
|
||||||
|
if err != nil {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
if !graph.IsPersistent(cfg.DatabaseType) {
|
||||||
|
err = internal.Load(handle.QuadWriter, cfg, *quadFile, *quadType)
|
||||||
|
if err != nil {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// internal.Dump()
|
||||||
|
handle.Close()
|
||||||
|
|
||||||
case "repl":
|
case "repl":
|
||||||
handle, err = db.Open(cfg)
|
handle, err = db.Open(cfg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue