Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/miguelpragier/pgkebab
Golang wrapper over PostgreSQL driver
https://github.com/miguelpragier/pgkebab
go golang helper postgresql pq sql wrapper
Last synced: 3 months ago
JSON representation
Golang wrapper over PostgreSQL driver
- Host: GitHub
- URL: https://github.com/miguelpragier/pgkebab
- Owner: miguelpragier
- License: mit
- Created: 2020-04-20T18:30:48.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-11-10T17:27:27.000Z (about 4 years ago)
- Last Synced: 2024-06-21T18:06:20.454Z (7 months ago)
- Topics: go, golang, helper, postgresql, pq, sql, wrapper
- Language: Go
- Size: 50.8 KB
- Stars: 8
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
![GitHub](https://img.shields.io/github/license/mashape/apistatus.svg) ![GitHub](https://img.shields.io/badge/goDoc-Yes!-blue.svg)
[![Go Report Card](https://goreportcard.com/badge/github.com/miguelpragier/pgkebab?update)](https://goreportcard.com/report/github.com/miguelpragier/pgkebab)
![Go Version](https://img.shields.io/badge/GO%20version-%3E%3D1.13-blue)# PGKebab
### GOLang PostgreSQL Helper Over [PQ](https://github.com/lib/pq/)
##### Makes PostgreSQL handling as easy and simple as GOlang
Replace heavy ORMs and dense routines with simple SQL queries
---
![PGKebab](./etc/img/pgkebab.png "PGKebab")
##### Simple Sample
```golang
package mainimport (
"fmt"
"github.com/miguelpragier/pgkebab"
"log"
)func main() {
const (
connectionTimeout = 10
executiontionTimeout = 10
connectionMaxAttempts = 5
connectionMaxMinutesRetrying = 5
secondsBetweenReconnectionAttempts = 10
debugLogPrint = true
)var (
cs = pgkebab.ConnStringEnvVar("{YOURAPPCONNECTIONSTRING}")
opts = pgkebab.Options(cs, connectionTimeout, executiontionTimeout, connectionMaxAttempts, connectionMaxMinutesRetrying, secondsBetweenReconnectionAttempts, debugLogPrint)
customerID = 1
)db, errcnx := pgkebab.NewConnected(opts)
if errcnx != nil {
log.Fatal(errcnx)
}if row, err := db.GetOne("SELECT name, status_id FROM customers WHERE id=$1", customerID); err != nil {
log.Fatal(err)
} else {
fmt.Println("the customer", row.String("name"), "has status", row.Int64("status_id"))
}if n, err := db.GetCount("customers"); err != nil {
log.Fatal(err)
} else {
fmt.Println("table customer counts", n, "rows")
}
}
```
##### Dependencies:
[pq - Pure Go Postgres driver for database/sql](https://github.com/lib/pq)---