From 99ef15ddb5da71b9528cb0e2d8d29a93a3753a8f Mon Sep 17 00:00:00 2001 From: Patrick O'brien Date: Thu, 25 Feb 2016 10:20:39 +1000 Subject: [PATCH] Slightly change readme, add "mandatory" to -d flag --- README.md | 32 +++++++++++++++++--------------- cmds/sqlboiler.go | 2 +- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 03bf689..721a3f3 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,19 @@ I've included templates for struct definitions and select, delete and insert sta Because writing boilerplate is annoying, that's why! +# Config? + +To use SQLBoiler you need to create a ````config.toml```` in SQLBoiler's root directory. The file format looks like the following: + +```` +[postgres] + host="localhost" + port=5432 + user="dbusername" + pass="dbpassword" + dbname="dbname" +```` + # How? SQLBoiler connects to your database (defined in your config.toml file) to ascertain the structure of your tables, and builds your Go boilerplate code using the templates defined in the ````/templates```` folder. @@ -100,7 +113,9 @@ func SelectExampleFriend(id int, db *sqlx.DB) (ExampleFriend, error) { # Commands? -You have the ability to generate specific objects, or all objects by using the appropriate command. You can also choose to generate for all tables, a single table, or a group of tables using the ````--table```` flag. By default SQLBoiler outputs to Stdout, unless a file is specified with the ````--out```` flag. Before you use SQLBoiler make sure you create a ````config.toml```` configuration file with your database details, and specify your database by using the ````--driver```` flag. +You have the ability to generate specific objects, or all objects by using the appropriate command. You can also choose to generate for all tables, a single table, or a group of tables using the ````--table```` flag. By default SQLBoiler outputs to Stdout, unless a file is specified with the ````--out```` flag. + +Before you use SQLBoiler make sure you create a ````config.toml```` configuration file with your database details, and specify your database by using the ````--driver```` flag. For example: ````./sqlboiler all --driver="postgres" --out="filename.go" --table="my_table1, my_table2"```` @@ -116,26 +131,13 @@ Available Commands: struct Generate structs from table definitions Flags: - -d, --driver string The name of the driver in your config.toml + -d, --driver string The name of the driver in your config.toml (mandatory) -o, --out string The name of the output file -t, --table string A comma seperated list of table names Use "sqlboiler [command] --help" for more information about a command. ```` -# Config? - -To use SQLBoiler you need to create a ````config.toml```` in SQLBoiler's root directory. The file format looks like the following: - -```` -[postgres] - host="localhost" - port=5432 - user="dbusername" - pass="dbpassword" - dbname="dbname" -```` - # Templates? If you wish to modify the boilerplate that SQLBoiler provides you it's as simple as editing the relevant template in the ````/templates```` directory. diff --git a/cmds/sqlboiler.go b/cmds/sqlboiler.go index e180019..65a4045 100644 --- a/cmds/sqlboiler.go +++ b/cmds/sqlboiler.go @@ -29,7 +29,7 @@ var cmdData *CmdData // It also sets the global preRun hook and postRun hook. Every command will execute // these hooks before and after running to initialize the shared state. func init() { - SQLBoiler.PersistentFlags().StringP("driver", "d", "", "The name of the driver in your config.toml") + SQLBoiler.PersistentFlags().StringP("driver", "d", "", "The name of the driver in your config.toml (mandatory)") SQLBoiler.PersistentFlags().StringP("table", "t", "", "A comma seperated list of table names") SQLBoiler.PersistentFlags().StringP("out", "o", "", "The name of the output file") SQLBoiler.PersistentPreRun = sqlBoilerPreRun