You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
544 B
29 lines
544 B
package main
|
|
|
|
import (
|
|
"flag"
|
|
"fmt"
|
|
"os"
|
|
"qurl/storage"
|
|
)
|
|
|
|
func main() {
|
|
dburl := flag.String("u", "bolt:./qurl.db", "url to database")
|
|
jsonfile := flag.String("j", "", "path to json to load into database")
|
|
flag.Parse()
|
|
|
|
stor, err := storage.NewStorage(*dburl)
|
|
if err != nil {
|
|
fmt.Fprintf(os.Stderr, "Database connection error: %s", err.Error())
|
|
return
|
|
}
|
|
defer stor.Shutdown()
|
|
|
|
if *jsonfile != "" {
|
|
err := loadjson(stor, *jsonfile)
|
|
if err != nil {
|
|
fmt.Fprintf(os.Stderr, "Load error: %s", err.Error())
|
|
return
|
|
}
|
|
}
|
|
}
|