write-about

command module
v0.0.0-...-3a27eef Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 24, 2020 License: GPL-3.0 Imports: 2 Imported by: 0

README

Install

  • Prepare your database (create a new database and role)
  • Clone or download repo
  • Go into project directory and install dependencies
$ go mod download
  • Install sql-migrate
$ go get -v github.com/rubenv/sql-migrate/...
  • Setup environment variables for your database
export DB_HOST=<YOUR HOST>
export DB_NAME=<YOUR NAME OF DATABASE>
export DB_USER=<YOUR NAME OF ROLE>
export DB_PASSWORD=<YOUR ROLE PASSWORD>
  • Run sql-migrate and check status of migrations
$ sql-migrate up
$ sql-migrate status
  • Install sqlboiler and driver for your database
$ go get -u -t github.com/volatiletech/sqlboiler
$ go get github.com/volatiletech/sqlboiler/drivers/sqlboiler-psql
  • Create sqlboiler configuration file from example (sqlboiler.toml.example)
output           = "models"
wipe             = true
no_tests         = false
no_context       = true
add_soft_deletes = true

[psql]
  dbname = "dbname"
  host   = "localhost"
  port   = 5432
  user   = "dbusername"
  pass   = "dbpassword"
  schema = "myschema"
  blacklist = ["migrations"]
  • Run sqlboiler to generate models from your database schema
$ sqlboiler psql --no-context --add-soft-deletes
$ go test ./<YOUR MODELS DIR>

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL