https://github.com/danielgatis/go-asql
A Go package that makes it easier to run SQL queries async
https://github.com/danielgatis/go-asql
Last synced: about 1 year ago
JSON representation
A Go package that makes it easier to run SQL queries async
- Host: GitHub
- URL: https://github.com/danielgatis/go-asql
- Owner: danielgatis
- License: mit
- Created: 2023-08-08T02:52:59.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-08-08T02:53:33.000Z (almost 3 years ago)
- Last Synced: 2025-02-08T20:47:33.199Z (over 1 year ago)
- Language: Go
- Size: 6.84 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Go - Asql
[](https://goreportcard.com/report/github.com/danielgatis/go-asql)
[](https://raw.githubusercontent.com/danielgatis/go-asql/master/LICENSE)
[](https://godoc.org/github.com/danielgatis/go-asql)
A Go package that makes it easier to run SQL queries async
## Install
```bash
go get -u github.com/danielgatis/go-asql
```
And then import the package in your code:
```go
import "github.com/danielgatis/go-asql"
```
### Usage
```go
package main
import (
"fmt"
"github.com/danielgatis/go-asql"
_ "github.com/mattn/go-sqlite3"
)
func main() {
type TestTable struct {
ID int
Name string
}
db, _ := asql.Open("sqlite3", "file::memory:")
db.Load("testdata/schema.sql")
rc, _ := db.Query(`select * from test_table`)
rows := <-rc
records := make([]TestTable, 0)
for rows.Next() {
var record TestTable
rows.Scan(&record.ID, &record.Name)
records = append(records, record)
}
fmt.Print(records)
}
```
### License
Copyright (c) 2023-present [Daniel Gatis](https://github.com/danielgatis)
Licensed under [MIT License](./LICENSE)
### Buy me a coffee
Liked some of my work? Buy me a coffee (or more likely a beer)
