mirror of
https://github.com/neilotoole/sq.git
synced 2024-11-24 11:54:37 +03:00
moved pkg libsq/sqlmodel to libsq/core/sqlmodel (#68)
This commit is contained in:
parent
38be39a12f
commit
1818d50546
@ -16,8 +16,8 @@ import (
|
||||
|
||||
"github.com/neilotoole/sq/cli"
|
||||
"github.com/neilotoole/sq/libsq/core/kind"
|
||||
"github.com/neilotoole/sq/libsq/core/sqlmodel"
|
||||
"github.com/neilotoole/sq/libsq/core/stringz"
|
||||
"github.com/neilotoole/sq/libsq/sqlmodel"
|
||||
"github.com/neilotoole/sq/testh"
|
||||
"github.com/neilotoole/sq/testh/fixt"
|
||||
"github.com/neilotoole/sq/testh/proj"
|
||||
|
@ -14,11 +14,11 @@ import (
|
||||
"github.com/neilotoole/sq/libsq/core/errz"
|
||||
"github.com/neilotoole/sq/libsq/core/kind"
|
||||
"github.com/neilotoole/sq/libsq/core/options"
|
||||
"github.com/neilotoole/sq/libsq/core/sqlmodel"
|
||||
"github.com/neilotoole/sq/libsq/core/sqlz"
|
||||
"github.com/neilotoole/sq/libsq/core/stringz"
|
||||
"github.com/neilotoole/sq/libsq/driver"
|
||||
"github.com/neilotoole/sq/libsq/source"
|
||||
"github.com/neilotoole/sq/libsq/sqlmodel"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -13,11 +13,11 @@ import (
|
||||
"github.com/neilotoole/sq/libsq/ast/sqlbuilder"
|
||||
"github.com/neilotoole/sq/libsq/core/errz"
|
||||
"github.com/neilotoole/sq/libsq/core/kind"
|
||||
"github.com/neilotoole/sq/libsq/core/sqlmodel"
|
||||
"github.com/neilotoole/sq/libsq/core/sqlz"
|
||||
"github.com/neilotoole/sq/libsq/core/stringz"
|
||||
"github.com/neilotoole/sq/libsq/driver"
|
||||
"github.com/neilotoole/sq/libsq/source"
|
||||
"github.com/neilotoole/sq/libsq/sqlmodel"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -5,8 +5,8 @@ import (
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/neilotoole/sq/libsq/core/sqlmodel"
|
||||
"github.com/neilotoole/sq/libsq/core/stringz"
|
||||
"github.com/neilotoole/sq/libsq/sqlmodel"
|
||||
"github.com/neilotoole/sq/testh"
|
||||
"github.com/neilotoole/sq/testh/fixt"
|
||||
"github.com/neilotoole/sq/testh/sakila"
|
||||
|
@ -11,7 +11,7 @@ import (
|
||||
"github.com/neilotoole/lg"
|
||||
|
||||
"github.com/neilotoole/sq/libsq/core/errz"
|
||||
"github.com/neilotoole/sq/libsq/sqlmodel"
|
||||
"github.com/neilotoole/sq/libsq/core/sqlmodel"
|
||||
)
|
||||
|
||||
func newFragmentBuilder(log lg.Log) *sqlbuilder.BaseFragmentBuilder {
|
||||
|
@ -15,11 +15,11 @@ import (
|
||||
"github.com/neilotoole/sq/libsq/ast/sqlbuilder"
|
||||
"github.com/neilotoole/sq/libsq/core/errz"
|
||||
"github.com/neilotoole/sq/libsq/core/kind"
|
||||
"github.com/neilotoole/sq/libsq/core/sqlmodel"
|
||||
"github.com/neilotoole/sq/libsq/core/sqlz"
|
||||
"github.com/neilotoole/sq/libsq/core/stringz"
|
||||
"github.com/neilotoole/sq/libsq/driver"
|
||||
"github.com/neilotoole/sq/libsq/source"
|
||||
"github.com/neilotoole/sq/libsq/sqlmodel"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -11,8 +11,8 @@ import (
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/neilotoole/sq/drivers/postgres"
|
||||
"github.com/neilotoole/sq/libsq/core/sqlmodel"
|
||||
"github.com/neilotoole/sq/libsq/core/stringz"
|
||||
"github.com/neilotoole/sq/libsq/sqlmodel"
|
||||
"github.com/neilotoole/sq/testh"
|
||||
"github.com/neilotoole/sq/testh/fixt"
|
||||
"github.com/neilotoole/sq/testh/sakila"
|
||||
|
@ -11,7 +11,7 @@ import (
|
||||
"github.com/neilotoole/lg"
|
||||
|
||||
"github.com/neilotoole/sq/libsq/core/errz"
|
||||
"github.com/neilotoole/sq/libsq/sqlmodel"
|
||||
"github.com/neilotoole/sq/libsq/core/sqlmodel"
|
||||
)
|
||||
|
||||
func newFragmentBuilder(log lg.Log) *sqlbuilder.BaseFragmentBuilder {
|
||||
|
@ -10,7 +10,7 @@ import (
|
||||
"github.com/neilotoole/lg"
|
||||
|
||||
"github.com/neilotoole/sq/libsq/core/errz"
|
||||
"github.com/neilotoole/sq/libsq/sqlmodel"
|
||||
"github.com/neilotoole/sq/libsq/core/sqlmodel"
|
||||
)
|
||||
|
||||
func newFragmentBuilder(log lg.Log) *sqlbuilder.BaseFragmentBuilder {
|
||||
|
@ -17,11 +17,11 @@ import (
|
||||
"github.com/neilotoole/sq/libsq/ast/sqlbuilder"
|
||||
"github.com/neilotoole/sq/libsq/core/errz"
|
||||
"github.com/neilotoole/sq/libsq/core/kind"
|
||||
"github.com/neilotoole/sq/libsq/core/sqlmodel"
|
||||
"github.com/neilotoole/sq/libsq/core/sqlz"
|
||||
"github.com/neilotoole/sq/libsq/core/stringz"
|
||||
"github.com/neilotoole/sq/libsq/driver"
|
||||
"github.com/neilotoole/sq/libsq/source"
|
||||
"github.com/neilotoole/sq/libsq/sqlmodel"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -8,10 +8,10 @@ import (
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/neilotoole/sq/drivers/sqlite3"
|
||||
"github.com/neilotoole/sq/libsq/core/sqlmodel"
|
||||
"github.com/neilotoole/sq/libsq/core/sqlz"
|
||||
"github.com/neilotoole/sq/libsq/core/stringz"
|
||||
"github.com/neilotoole/sq/libsq/source"
|
||||
"github.com/neilotoole/sq/libsq/sqlmodel"
|
||||
"github.com/neilotoole/sq/testh"
|
||||
"github.com/neilotoole/sq/testh/fixt"
|
||||
"github.com/neilotoole/sq/testh/sakila"
|
||||
|
@ -13,7 +13,7 @@ import (
|
||||
|
||||
"github.com/neilotoole/sq/libsq/ast"
|
||||
"github.com/neilotoole/sq/libsq/core/errz"
|
||||
"github.com/neilotoole/sq/libsq/sqlmodel"
|
||||
"github.com/neilotoole/sq/libsq/core/sqlmodel"
|
||||
)
|
||||
|
||||
type fragBuilder struct {
|
||||
|
@ -15,11 +15,11 @@ import (
|
||||
"github.com/neilotoole/sq/libsq/ast/sqlbuilder"
|
||||
"github.com/neilotoole/sq/libsq/core/errz"
|
||||
"github.com/neilotoole/sq/libsq/core/kind"
|
||||
"github.com/neilotoole/sq/libsq/core/sqlmodel"
|
||||
"github.com/neilotoole/sq/libsq/core/sqlz"
|
||||
"github.com/neilotoole/sq/libsq/core/stringz"
|
||||
"github.com/neilotoole/sq/libsq/driver"
|
||||
"github.com/neilotoole/sq/libsq/source"
|
||||
"github.com/neilotoole/sq/libsq/sqlmodel"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -8,8 +8,8 @@ import (
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/neilotoole/sq/libsq/core/kind"
|
||||
"github.com/neilotoole/sq/libsq/core/sqlmodel"
|
||||
"github.com/neilotoole/sq/libsq/core/stringz"
|
||||
"github.com/neilotoole/sq/libsq/sqlmodel"
|
||||
"github.com/neilotoole/sq/testh"
|
||||
"github.com/neilotoole/sq/testh/fixt"
|
||||
"github.com/neilotoole/sq/testh/sakila"
|
||||
|
@ -6,8 +6,8 @@ import (
|
||||
|
||||
"github.com/neilotoole/sq/libsq/core/errz"
|
||||
"github.com/neilotoole/sq/libsq/core/kind"
|
||||
"github.com/neilotoole/sq/libsq/core/sqlmodel"
|
||||
"github.com/neilotoole/sq/libsq/core/stringz"
|
||||
"github.com/neilotoole/sq/libsq/sqlmodel"
|
||||
)
|
||||
|
||||
// DriverDef is a user-defined driver definition.
|
||||
|
@ -17,8 +17,8 @@ import (
|
||||
"github.com/neilotoole/sq/libsq/core/cleanup"
|
||||
"github.com/neilotoole/sq/libsq/core/errz"
|
||||
"github.com/neilotoole/sq/libsq/core/kind"
|
||||
"github.com/neilotoole/sq/libsq/core/sqlmodel"
|
||||
"github.com/neilotoole/sq/libsq/driver"
|
||||
"github.com/neilotoole/sq/libsq/sqlmodel"
|
||||
)
|
||||
|
||||
// Genre is the user driver genre that this package supports.
|
||||
|
@ -15,9 +15,9 @@ import (
|
||||
|
||||
"github.com/neilotoole/lg"
|
||||
|
||||
"github.com/neilotoole/sq/libsq/core/sqlmodel"
|
||||
"github.com/neilotoole/sq/libsq/core/stringz"
|
||||
"github.com/neilotoole/sq/libsq/driver"
|
||||
"github.com/neilotoole/sq/libsq/sqlmodel"
|
||||
)
|
||||
|
||||
// xlsxToScratch loads the data in xlFile into scratchDB.
|
||||
|
@ -1,4 +1,5 @@
|
||||
// Package kind encapsulate data kind, that is data types.
|
||||
// Package kind encapsulates the notion of data "kind": that is, it
|
||||
// is an abstraction over data types across implementations.
|
||||
package kind
|
||||
|
||||
import (
|
||||
|
@ -6,14 +6,14 @@ import (
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/neilotoole/sq/libsq/sqlmodel"
|
||||
"github.com/neilotoole/sq/libsq/core/sqlmodel"
|
||||
"github.com/neilotoole/sq/testh/proj"
|
||||
)
|
||||
|
||||
func TestSplitInput(t *testing.T) {
|
||||
const sel, other = sqlmodel.StmtSelect, sqlmodel.StmtOther
|
||||
|
||||
// convenience func to return a slice of n sqlmodel.StmtType.
|
||||
// convenience func to return a slice of n core.sqlmodel.StmtType.
|
||||
nTypes := func(n int, typ sqlmodel.StmtType) []sqlmodel.StmtType {
|
||||
types := make([]sqlmodel.StmtType, n)
|
||||
for i := range types {
|
||||
@ -78,21 +78,21 @@ func TestSplitInput(t *testing.T) {
|
||||
{
|
||||
name: "sqlite3_type_test.sql",
|
||||
delim: ";",
|
||||
input: string(proj.ReadFile("libsq/sqlmodel/testdata/sqlite3_type_test.sql")),
|
||||
input: string(proj.ReadFile("libsq/core/sqlmodel/testdata/sqlite3_type_test.sql")),
|
||||
wantCount: 4,
|
||||
wantTypes: nTypes(4, other),
|
||||
},
|
||||
{
|
||||
name: "sqlite3_address.sql",
|
||||
delim: ";",
|
||||
input: string(proj.ReadFile("libsq/sqlmodel/testdata/sqlite3_address.sql")),
|
||||
input: string(proj.ReadFile("libsq/core/sqlmodel/testdata/sqlite3_address.sql")),
|
||||
wantCount: 4,
|
||||
wantTypes: nTypes(4, other),
|
||||
},
|
||||
{
|
||||
name: "sqlite3_person.sql",
|
||||
delim: ";",
|
||||
input: string(proj.ReadFile("libsq/sqlmodel/testdata/sqlite3_person.sql")),
|
||||
input: string(proj.ReadFile("libsq/core/sqlmodel/testdata/sqlite3_person.sql")),
|
||||
wantCount: 10,
|
||||
wantTypes: nTypes(10, other),
|
||||
},
|
||||
@ -101,21 +101,21 @@ func TestSplitInput(t *testing.T) {
|
||||
{
|
||||
name: "sqtype_public_type_test.sql",
|
||||
delim: ";",
|
||||
input: string(proj.ReadFile("libsq/sqlmodel/testdata/postgres_public_type_test.sql")),
|
||||
input: string(proj.ReadFile("libsq/core/sqlmodel/testdata/postgres_public_type_test.sql")),
|
||||
wantCount: 5,
|
||||
wantTypes: nTypes(5, other),
|
||||
},
|
||||
{
|
||||
name: "sqtest_public_address.sql",
|
||||
delim: ";",
|
||||
input: string(proj.ReadFile("libsq/sqlmodel/testdata/postgres_public_address.sql")),
|
||||
input: string(proj.ReadFile("libsq/core/sqlmodel/testdata/postgres_public_address.sql")),
|
||||
wantCount: 5,
|
||||
wantTypes: nTypes(5, other),
|
||||
},
|
||||
{
|
||||
name: "sqtest_public_person.sql",
|
||||
delim: ";",
|
||||
input: string(proj.ReadFile("libsq/sqlmodel/testdata/postgres_public_person.sql")),
|
||||
input: string(proj.ReadFile("libsq/core/sqlmodel/testdata/postgres_public_person.sql")),
|
||||
wantCount: 11,
|
||||
wantTypes: nTypes(11, other),
|
||||
},
|
||||
@ -143,7 +143,7 @@ func TestSplitInput(t *testing.T) {
|
||||
name: "sqtype_dbo_type_test.sql",
|
||||
delim: ";",
|
||||
moreDelims: []string{"go"},
|
||||
input: string(proj.ReadFile("libsq/sqlmodel/testdata/sqlserver_dbo_type_test.sql")),
|
||||
input: string(proj.ReadFile("libsq/core/sqlmodel/testdata/sqlserver_dbo_type_test.sql")),
|
||||
wantCount: 5,
|
||||
wantTypes: nTypes(5, other),
|
||||
},
|
||||
@ -151,7 +151,7 @@ func TestSplitInput(t *testing.T) {
|
||||
name: "sqtest_dbo_address.sql",
|
||||
delim: ";",
|
||||
moreDelims: []string{"go"},
|
||||
input: string(proj.ReadFile("libsq/sqlmodel/testdata/sqlserver_dbo_address.sql")),
|
||||
input: string(proj.ReadFile("libsq/core/sqlmodel/testdata/sqlserver_dbo_address.sql")),
|
||||
wantCount: 4,
|
||||
wantTypes: nTypes(5, other),
|
||||
},
|
||||
@ -159,7 +159,7 @@ func TestSplitInput(t *testing.T) {
|
||||
name: "sqtest_dbo_person.sql",
|
||||
delim: ";",
|
||||
moreDelims: []string{"go"},
|
||||
input: string(proj.ReadFile("libsq/sqlmodel/testdata/sqlserver_dbo_person.sql")),
|
||||
input: string(proj.ReadFile("libsq/core/sqlmodel/testdata/sqlserver_dbo_person.sql")),
|
||||
wantCount: 10,
|
||||
wantTypes: nTypes(10, other),
|
||||
},
|
||||
@ -168,21 +168,21 @@ func TestSplitInput(t *testing.T) {
|
||||
{
|
||||
name: "mysql_type_test.sql",
|
||||
delim: ";",
|
||||
input: string(proj.ReadFile("libsq/sqlmodel/testdata/mysql_type_test.sql")),
|
||||
input: string(proj.ReadFile("libsq/core/sqlmodel/testdata/mysql_type_test.sql")),
|
||||
wantCount: 5,
|
||||
wantTypes: nTypes(5, other),
|
||||
},
|
||||
{
|
||||
name: "mysql_address.sql",
|
||||
delim: ";",
|
||||
input: string(proj.ReadFile("libsq/sqlmodel/testdata/mysql_address.sql")),
|
||||
input: string(proj.ReadFile("libsq/core/sqlmodel/testdata/mysql_address.sql")),
|
||||
wantCount: 4,
|
||||
wantTypes: nTypes(5, other),
|
||||
},
|
||||
{
|
||||
name: "mysql_person.sql",
|
||||
delim: ";",
|
||||
input: string(proj.ReadFile("libsq/sqlmodel/testdata/mysql_person.sql")),
|
||||
input: string(proj.ReadFile("libsq/core/sqlmodel/testdata/mysql_person.sql")),
|
||||
wantCount: 9,
|
||||
wantTypes: nTypes(9, other),
|
||||
},
|
@ -1,4 +1,4 @@
|
||||
// Package sqlmodel provides functionality for modeling SQL constructs.
|
||||
// Package core.sqlmodel provides functionality for modeling SQL constructs.
|
||||
package sqlmodel
|
||||
|
||||
import (
|
@ -16,9 +16,9 @@ import (
|
||||
"github.com/neilotoole/sq/libsq/core/errz"
|
||||
|
||||
"github.com/neilotoole/sq/libsq/ast/sqlbuilder"
|
||||
"github.com/neilotoole/sq/libsq/core/sqlmodel"
|
||||
"github.com/neilotoole/sq/libsq/core/sqlz"
|
||||
"github.com/neilotoole/sq/libsq/source"
|
||||
"github.com/neilotoole/sq/libsq/sqlmodel"
|
||||
)
|
||||
|
||||
// Provider is a factory that returns Driver instances.
|
||||
|
@ -14,10 +14,10 @@ import (
|
||||
"github.com/neilotoole/sq/drivers/xlsx"
|
||||
"github.com/neilotoole/sq/libsq/core/kind"
|
||||
|
||||
"github.com/neilotoole/sq/libsq/core/sqlmodel"
|
||||
"github.com/neilotoole/sq/libsq/core/stringz"
|
||||
"github.com/neilotoole/sq/libsq/driver"
|
||||
"github.com/neilotoole/sq/libsq/source"
|
||||
"github.com/neilotoole/sq/libsq/sqlmodel"
|
||||
"github.com/neilotoole/sq/testh"
|
||||
"github.com/neilotoole/sq/testh/fixt"
|
||||
"github.com/neilotoole/sq/testh/sakila"
|
||||
|
@ -9,10 +9,10 @@ import (
|
||||
|
||||
"github.com/neilotoole/sq/libsq/ast"
|
||||
"github.com/neilotoole/sq/libsq/core/errz"
|
||||
"github.com/neilotoole/sq/libsq/core/sqlmodel"
|
||||
"github.com/neilotoole/sq/libsq/core/sqlz"
|
||||
"github.com/neilotoole/sq/libsq/driver"
|
||||
"github.com/neilotoole/sq/libsq/source"
|
||||
"github.com/neilotoole/sq/libsq/sqlmodel"
|
||||
)
|
||||
|
||||
// engine executes a queryModel and writes to a RecordWriter.
|
||||
|
@ -34,10 +34,10 @@ import (
|
||||
"github.com/neilotoole/sq/libsq"
|
||||
"github.com/neilotoole/sq/libsq/core/cleanup"
|
||||
"github.com/neilotoole/sq/libsq/core/errz"
|
||||
"github.com/neilotoole/sq/libsq/core/sqlmodel"
|
||||
"github.com/neilotoole/sq/libsq/core/stringz"
|
||||
"github.com/neilotoole/sq/libsq/driver"
|
||||
"github.com/neilotoole/sq/libsq/source"
|
||||
"github.com/neilotoole/sq/libsq/sqlmodel"
|
||||
"github.com/neilotoole/sq/testh/proj"
|
||||
"github.com/neilotoole/sq/testh/sakila"
|
||||
"github.com/neilotoole/sq/testh/testsrc"
|
||||
|
Loading…
Reference in New Issue
Block a user