Skip to content

noborus/sqlss

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sqlss

PkgGoDev

Split SQL into statements.

Do not split within single quotes, double quotes, or back quotes. It also doesn't break at semicolons in comments.

Usage

package main

import (
	"fmt"

	"github.com/noborus/sqlss"
)

func main() {
	queries := sqlss.SplitQueries("SELECT * FROM table1;SELECT * FROM table2;")
	for _, query := range queries {
		fmt.Println(query)
	}
}

// Output:
// SELECT * FROM table1
// SELECT * FROM table2