squirrel

command module
v0.0.0-...-838b099 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2023 License: MIT Imports: 9 Imported by: 0

README

Squirrel

An example of connecting to a postgres database using the sqlx and squirrel packages

Requirements

  • Docker
  • Docker Compose

We will be using Docker to spin up a Postgres instance.

Setup

  1. Launch a new shell session and start Postgres:

    $ docker-compose up
    
  2. 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
    
  3. Run the program

    $ go run .
    
  4. When all is done, teardown Postgres.

    $ docker-compose down
    

Reference and Credits

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