command
module
Version:
v0.0.0-...-838b099
Opens a new window with list of versions in this module.
Published: Oct 3, 2023
License: MIT
Opens a new window with license information.
Imports: 9
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
¶
Squirrel
An example of connecting to a postgres database using the sqlx
and squirrel
packages
Requirements
We will be using Docker to spin up a Postgres instance.
Setup
-
Launch a new shell session and start Postgres:
$ docker-compose up
-
You can connect to Postgres from the shell:
$ docker exec -it postgres psql postgres://pguser:password@localhost/db
psql (12.11)
Type "help" for help.
db=# SELECT * FROM users;
id | created_at | updated_at | email | username | first_name | last_name
-----+----------------------------+----------------------------+-----------------+----------+------------+-----------
123 | 2023-07-25 00:04:13.652829 | 2023-07-25 00:04:13.652829 | jon@example.com | jonny | Jon | Murphy
-
Run the program
$ go run .
-
When all is done, teardown Postgres.
$ docker-compose down
Reference and Credits
Documentation
¶
There is no documentation for this package.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.