siesta

command module
v0.0.0-...-3907bf9 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2024 License: MIT Imports: 14 Imported by: 0

README

siesta

Intoduction

Siesta genarates type-safe REST APIs directly from your postgres DB instance 🐘

Installation

Siesta requires Go 1.22+

go install github.com/adisupe94/siesta

Usage

  • Create your database schema anyway you like.
  • Run siesta from your project( create one if needed) to generate type-safe code to access your database create http handlers.
    mkdir myapp && cd myapp
    go mod init myapp
    siesta -db=postgresql://username:password@host:5432/database_name
    
  • In your main func, import the GetRouter and call it with the postgres connection/pool. Hook it up to your http server like this.
    router := GetRouter(db)
    httpServer := &http.Server{
    	Addr:    ":8080",
    	Handler: router,
    }
    log.Fatal(httpServer.ListenAndServe())
    

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