Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tendant/dbpro
dbpro is a library which provides a set of utility function to simplify the task of generating data in database tables.
https://github.com/tendant/dbpro
Last synced: about 1 month ago
JSON representation
dbpro is a library which provides a set of utility function to simplify the task of generating data in database tables.
- Host: GitHub
- URL: https://github.com/tendant/dbpro
- Owner: tendant
- License: mit
- Created: 2022-12-02T18:46:34.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2022-12-19T21:03:16.000Z (about 2 years ago)
- Last Synced: 2024-10-12T13:31:21.252Z (2 months ago)
- Language: Go
- Homepage:
- Size: 49.8 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# dbpro
dbpro is a library which provides a set of utility function to simplify the task of generating data in database tables.## install
go get github.com/tendant/dbpro
## usage```go
type Person struct {
FirstName string
LastName string
Email string
}person := Person{
FirstName: "test first name"
LastName: "test last name"
Email: "[email protected]"
}// query, err := dbpro.GenInsertQuery("postgres", "person"", person)
// vals, err := dbpro.GenInsertValues(person)
// rows, err := db.NamedQuery(stmt, vals)
db, err := sqlx.Connect("postgres", "user=foo dbname=bar sslmode=disable")
if err != nil {
log.Fatalln(err)
}id, err := dbpro.InsertRow(db, "person", person)
```