golang-sqlc-use-example

module
v0.0.0-...-e0ad1fb Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2024 License: MIT

README

golang-sqlc-use-example

Example of using sqlc library with the Go.

sqlc

"sqlc generates fully type-safe idiomatic Go code from SQL."

Docs: https://docs.sqlc.dev/en/latest/#

commands:
# Generate sqlc code:
sqlc generate

golang-migrate

Migrate reads migrations from sources and applies them in correct order to a database.

Docs: https://github.com/golang-migrate/migrate

commands:
# create a migration
migrate create -ext=sql -dir=sql/migrations -seq init

# execute migrations
migrate -path=sql/migrations -database "mysql://root:root@tcp(localhost:3306)/courses" -verbose up

# restore migrations
migrate -path=sql/migrations -database "mysql://root:root@tcp(localhost:3306)/courses" -verbose down

Directories

Path Synopsis
cmd
internal

Jump to

Keyboard shortcuts

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