An open API service indexing awesome lists of open source software.

https://github.com/touyu/sqlinterpolator

Generate full query from placeholder query and args.
https://github.com/touyu/sqlinterpolator

go query sql sqlboiler

Last synced: 27 days ago
JSON representation

Generate full query from placeholder query and args.

Awesome Lists containing this project

README

          

# sqlinterpolator
Generate full query from placeholder query and args.

## Install
```
$ go get -u github.com/touyu/sqlinterpolator
```

## Examples
```golang
func main() {
query := "select * from users where id = ?;"
args := []interface{}{6}

res, _ := sqlinterpolator.Interpolate(query, args)
fmt.Println(res) // select * from users where id = 6;
}
```

### SQLBoiler
```golang
queryObject := models.NewQuery(From("users"), models.UserWhere.ID.EQ(6))
query, args := queries.BuildQuery(queryObject)
res, _ := sqlinterpolator.Interpolate(raw, args)
fmt.Println(res) // select * from users where id < 6;
```