Skip to content

Instantly share code, notes, and snippets.

@ali-ince
Last active November 9, 2018 18:05
Show Gist options
  • Save ali-ince/c29d71535b62cb5e05ea8a2518b3fd75 to your computer and use it in GitHub Desktop.
Save ali-ince/c29d71535b62cb5e05ea8a2518b3fd75 to your computer and use it in GitHub Desktop.
package main
import (
"flag"
"os"
"github.com/neo4j/neo4j-go-driver/neo4j"
)
var (
uri string
username string
password string
query string
)
func main() {
if !parseAndVerifyFlags() {
os.Exit(-1)
}
os.Exit(0)
}
func parseAndVerifyFlags() bool {
flag.Parse()
if uri == "" || username == "" || password == "" || query == "" {
flag.Usage()
return false
}
return true
}
func init() {
flag.StringVar(&uri, "uri", "bolt://localhost", "the bolt uri to connect to")
flag.StringVar(&username, "username", "neo4j", "the database username")
flag.StringVar(&password, "password", "", "the database password")
flag.StringVar(&query, "query", "", "the query to execute")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment