https://github.com/bsm/minisql
https://github.com/bsm/minisql
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/bsm/minisql
- Owner: bsm
- License: apache-2.0
- Created: 2020-05-07T12:22:20.000Z (about 6 years ago)
- Default Branch: main
- Last Pushed: 2022-09-01T12:31:24.000Z (almost 4 years ago)
- Last Synced: 2025-04-13T05:54:51.514Z (about 1 year ago)
- Language: Go
- Size: 14.6 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# MiniSQL
[](https://pkg.go.dev/github.com/bsm/minisql)
[](https://github.com/bsm/minisql/actions/workflows/test.yml)
[](https://opensource.org/licenses/Apache-2.0)
A minimal SQL query builder for [Go](https://golang.org/).
## Usage
```go
func GetUserName(ctx context.Context, db *sql.DB, userID int64) (string, error) {
query := minisql.Pooled()
defer minisql.Release(query)
query.AppendString(`SELECT user.name FROM users WHERE id = `)
query.AppendValue(userID)
var name string
err := query.QueryRowContext(ctx, db).Scan(&name)
return name, err
}
```
## Documentation
Please see the [API documentation](https://pkg.go.dev/github.com/bsm/minisql) for package and API descriptions and examples.