Skip to content

nmabhinandan/goyesql

 
 

Repository files navigation

Build Status GoDoc

goyesql

Golang + Yesql

Parse a file and associate SQL queries to a map. Useful for separating SQL from code logic.

Installation

$ go get github.com/nleof/goyesql

Usage

Create a file containing your SQL queries

-- queries.sql

-- name: list
SELECT *
FROM foo;

-- name: get
SELECT *
FROM foo
WHERE bar = $1;

And just call them in your code!

queries := goyesql.MustParseFile("queries.sql")
// use queries["list"] with sql/database, sqlx ...

Enjoy!

Embedding

You can use bindata for embedding your queries in your binary.

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%