Skip to content

begor/gogres

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gogres

Build Status

gogres - REST API generator for PostgreSQL databases.

Overview

gogres generates REST API for existing PostgreSQL databases.

It uses pgx for establishing connections and echo for API generation.

Features:

  • Multiple database support
  • Specified schemas (default - public schema)
  • Configurable size of connection pools
  • LIMIT and OFFSET as query params for every generated endpoint

Installation

go get github.com/begor/gogres

Configuration

Sample configuration file looks like this:

{
    "databases": {
        "first": {
            "database": "first",
            "user": "begor", 
            "host": "localhost",
            "schemas": ["public", "private"], 
            "poolSize": 5
        },
        "second": {
            "database": "second", 
            "user": "begor", 
            "host": "some.host",
            "poolSize": 10
        }
    },
    "port": ":5050"
}

It states that gogres should generate API for two databases: first on localhost and second on some.host.

For first it'll reflect two schemas: public and private and put them into /api/first/public/ and /api/first/private API namespaces.

For second it'll use default schema (namely, public).

gogres also supports different pool settings for each database in a config. Here, first will be server via pool of 5 connections, and second of 10 connections.

As a result, API will be available at localhost:5050. You can visit localhost:5050/api/ to see a list of generated endpoints.

About

REST API generator for PostgreSQL databases

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages