https://github.com/instance01/sqlconvenient
SQL conveniency functions: Query and exec in 2-3 lines
https://github.com/instance01/sqlconvenient
Last synced: 11 months ago
JSON representation
SQL conveniency functions: Query and exec in 2-3 lines
- Host: GitHub
- URL: https://github.com/instance01/sqlconvenient
- Owner: instance01
- License: mit
- Created: 2018-08-12T11:46:56.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-08-15T20:54:35.000Z (over 7 years ago)
- Last Synced: 2025-01-20T00:33:09.427Z (about 1 year ago)
- Language: Go
- Size: 4.88 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
This package exports two functions
```
SqlExec(db *sql.DB, query string, params ...interface{})
SqlQuery(db *sql.DB, rettype interface{}, query string, params ...interface{})
```
and allows querying/executing sql operations in just 2-3 lines, resulting in less boilerplate. Example:
```
var e Entry
var query = "select * from testtable"
return sqlconvenient.SqlQuery(db, &e, query)
```
See a more in depth example in \_example/ and documentation [over here](https://godoc.org/github.com/instance01/sqlconvenient).