example

command
v1.0.16 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2025 License: Apache-2.0 Imports: 17 Imported by: 0

README

API Example

This example shows how to create a simple API gateway using the pg package. In order to run this example, you will need to have docker installed (since a new PostgreSQL database will be created for this example):

go run github.com/mutablelogic/go-pg/example@latest

A dataset of about 2.1 million baby names is ingested using a bulk insert operation. Then a HTTP server is started which allows you to perform the following operations:

# Get a list of baby names
curl http://localhost:8080/

# Get a baby name by ID
curl http://localhost:8080/{id}

# Delete a baby name by ID
curl -X DELETE http://localhost:8080/{id}

# Update a baby name by ID
curl -X PATCH http://localhost:8080/{id} -d '{"name": "new name"}'

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