Skip to content

lucastamoios/queryf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Queryf

This is a simple project to enable printing Go SQL queries into strings for debugging reasons.

Attention: This is not meant to be used in production. To avoid SQL injections you should bind the parameters usign the database/sql package. Read more about it here.

Usage

To use this package just get the resulting string from the Format function. After that you can print it or do whatever you want with it.

Example:

query := "SELECT * FROM users WHERE id = $1 AND name = $2"
args := []any{1, "John"}
fmt.Println(queryf.Format(query, args...))
// Output: SELECT * FROM users WHERE id = 1 AND name = 'John'

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages