Reusable mage tasks.
Import in your "magefiles/magefile.go" to add the tasks:
//go:build mage
// +build mage
package main
import (
//mage:import sql
_ "github.com/ttab/mage/sql"
//mage:import twirp
_ "github.com/ttab/mage/twirp"
//mage:import s3
_ "github.com/ttab/mage/s3"
)
This will allow you to run the sql targets using: mage sql:target-name
.
Stub generates a protobuf service stub in rpc/[application]/service.proto
.
Generate runs protoc to compile the service declaration and generate an openapi3 specification.
Generate uses sqlc to compile the SQL queries in postgres/queries.sql to Go, adding he default sqlc.yaml file if necessary.
Postgres creates a local Postgres instance using docker. Data will be stored in "~/localstate/postgres-[name]".
DB calls DBWithName using the current directory name as the database name.
Creates a local database and login role with the same name and the password 'pass'.
Migrate the database to the latest version using the migrations in "./schema".
Rollback to a specific schema version:
mage sql:rollback 1
DumpSchema writes the current database schema to "./postgres/schema.sql".
Minio creates a local minio instance using docker. Data will be stored in "~/localstate/minio".
Exposes an S3 compatible endpoint on http://localhost:9000 and a web GUI on http://localhost:9001.
Use minioadmin/minioadmin to log in, or as access key/secret for the API.
Creates a bucket in the local minio instance.