Repository: kyleconroy/sqlc
Pull request #313 (2020-01-30 20:28:07)

internal/config: Create new config package
In preparation for #302, I'm moving all configuration types and logic to a separate package.


Patch:
diff --git a/internal/cmd/cmd.go b/internal/cmd/cmd.go
index 487deb07e..ce064596b 100644
--- a/internal/cmd/cmd.go
+++ b/internal/cmd/cmd.go
@@ -9,11 +9,12 @@ import (
 	"os/exec"
 	"path/filepath"
 
-	"github.com/kyleconroy/sqlc/internal/dinosql"
-
 	"github.com/davecgh/go-spew/spew"
 	pg "github.com/lfittl/pg_query_go"
 	"github.com/spf13/cobra"
+
+	"github.com/kyleconroy/sqlc/internal/config"
+	"github.com/kyleconroy/sqlc/internal/dinosql"
 )
 
 // Do runs the command logic.
@@ -74,7 +75,7 @@ var initCmd = &cobra.Command{
 		if _, err := os.Stat("sqlc.json"); !os.IsNotExist(err) {
 			return nil
 		}
-		blob, err := json.MarshalIndent(dinosql.GenerateSettings{Version: "1"}, "", "  ")
+		blob, err := json.MarshalIndent(config.GenerateSettings{Version: "1"}, "", "  ")
 		if err != nil {
 			return err
 		}
@@ -117,7 +118,7 @@ var checkCmd = &cobra.Command{
 			return err
 		}
 
-		settings, err := dinosql.ParseConfig(file)
+		settings, err := config.ParseConfig(file)
 		if err != nil {
 			return err
 		}
diff --git a/internal/cmd/generate.go b/internal/cmd/generate.go
index dd3655ffe..b30a7c06e 100644
--- a/internal/cmd/generate.go
+++ b/internal/cmd/generate.go
@@ -8,6 +8,7 @@ import (
 	"path/filepath"
 	"strings"
 
+	"github.com/kyleconroy/sqlc/internal/config"
 	"github.com/kyleconroy/sqlc/internal/dinosql"
 	"github.com/kyleconroy/sqlc/internal/mysql"
 )
@@ -39,14 +40,14 @@ func Generate(dir string, stderr io.Writer) (map[string]string, error) {
 		return nil, err
 	}
 
-	settings, err := dinosql.ParseConfig(bytes.NewReader(blob))
+	settings, err := config.ParseConfig(bytes.NewReader(blob))
 	if err != nil {
 		switch err {
-		case dinosql.ErrMissingVersion:
+		case config.ErrMissingVersion:
 			fmt.Fprintf(stderr, errMessageNoVersion)
-		case dinosql.ErrUnknownVersion:
+		case config.ErrUnknownVersion:
 			fmt.Fprintf(stderr, errMessageUnknownVersion)
-		case dinosql.ErrNoPackages:
+		case config.ErrNoPackages:
 			fmt.Fprintf(stderr, errMessageNoPackages)
 		}
 		fmt.Fprintf(stderr, "error parsing sqlc.json: %s\n", err)
@@ -58,7 +59,7 @@ func Generate(dir string, stderr io.Writer) (map[string]string, error) {
 
 	for _, pkg := range settings.Packages {
 		name := pkg.Name
-		combo := dinosql.Combine(settings, pkg)
+		combo := config.Combine(settings, pkg)
 		var result dinosql.Generateable
 
 		// TODO: This feels like a hack that will bite us later
@@ -67,7 +68,7 @@ func Generate(dir string, stderr io.Writer) (map[string]string, error) {
 
 		switch pkg.Engine {
 
-		case dinosql.EngineMySQL:
+		case config.EngineMySQL:
 			// Experimental MySQL support
 			q, err := mysql.GeneratePkg(name, pkg.Schema, pkg.Queries, combo)
 			if err != nil {
@@ -84,7 +85,7 @@ func Generate(dir string, stderr io.Writer) (map[string]string, error) {
 			}
 			result = q
 
-		case dinosql.EnginePostgreSQL:
+		case config.EnginePostgreSQL:
 			c, err := dinosql.ParseCatalog(pkg.Schema)
 			if err != nil {
 				fmt.Fprintf(stderr, "# package %s\n", name)
diff --git a/internal/dinosql/config.go b/internal/config/config.go
similarity index 98%
rename from internal/dinosql/config.go
rename to internal/config/config.go
index c67ee63df..16cbf1852 100644
--- a/internal/dinosql/config.go
+++ b/internal/config/config.go
@@ -1,4 +1,4 @@
-package dinosql
+package config
 
 import (
 	"encoding/json"
@@ -74,8 +74,8 @@ type Override struct {
 	ColumnName  string
 	Table       pg.FQN
 	GoTypeName  string
-	goPackage   string
-	goBasicType bool
+	GoPackage   string
+	GoBasicType bool
 }
 
 func (c *GenerateSettings) ValidateGlobalOverrides() error {
@@ -154,7 +154,7 @@ func (o *Override) Parse() error {
 		if !found {
 			return fmt.Errorf("Package override `go_type` specifier %q is not a Go basic type e.g. 'string'", o.GoType)
 		}
-		o.goBasicType = true
+		o.GoBasicType = true
 	} else {
 		// assume the type lives in a Go package
 		if lastDot == -1 {
@@ -174,12 +174,12 @@ func (o *Override) Parse() error {
 		if strings.HasSuffix(typename, "-go") {
 			typename = typename[:len(typename)-len("-go")]
 		}
-		o.goPackage = o.GoType[:lastDot]
+		o.GoPackage = o.GoType[:lastDot]
 	}
 	o.GoTypeName = typename
 	isPointer := o.GoType[0] == '*'
 	if isPointer {
-		o.goPackage = o.goPackage[1:]
+		o.GoPackage = o.GoPackage[1:]
 		o.GoTypeName = "*" + o.GoTypeName
 	}
 
diff --git a/internal/dinosql/gen.go b/internal/dinosql/gen.go
index a8c88f55b..8c9dca8a2 100644
--- a/internal/dinosql/gen.go
+++ b/internal/dinosql/gen.go
@@ -13,6 +13,7 @@ import (
 	"unicode"
 
 	"github.com/kyleconroy/sqlc/internal/catalog"
+	"github.com/kyleconroy/sqlc/internal/config"
 	core "github.com/kyleconroy/sqlc/internal/pg"
 
 	"github.com/jinzhu/inflection"
@@ -159,12 +160,12 @@ type GoQuery struct {
 }
 
 type Generateable interface {
-	Structs(settings CombinedSettings) []GoStruct
-	GoQueries(settings CombinedSettings) []GoQuery
-	Enums(settings CombinedSettings) []GoEnum
+	Structs(settings config.CombinedSettings) []GoStruct
+	GoQueries(settings config.CombinedSettings) []GoQuery
+	Enums(settings config.CombinedSettings) []GoEnum
 }
 
-func UsesType(r Generateable, typ string, settings CombinedSettings) bool {
+func UsesType(r Generateable, typ string, settings config.CombinedSettings) bool {
 	for _, strct := range r.Structs(settings) {
 		for _, f := range strct.Fields {
 			fType := strings.TrimPrefix(f.Type, "[]")
@@ -176,7 +177,7 @@ func UsesType(r Generateable, typ string, settings CombinedSettings) bool {
 	return false
 }
 
-func UsesArrays(r Generateable, settings CombinedSettings) bool {
+func UsesArrays(r Generateable, settings config.CombinedSettings) bool {
 	for _, strct := range r.Structs(settings) {
 		for _, f := range strct.Fields {
 			if strings.HasPrefix(f.Type, "[]") {
@@ -187,7 +188,7 @@ func UsesArrays(r Generateable, settings CombinedSettings) bool {
 	return false
 }
 
-func Imports(r Generateable, settings CombinedSettings) func(string) [][]string {
+func Imports(r Generateable, settings config.CombinedSettings) func(string) [][]string {
 	return func(filename string) [][]string {
 		if filename == "db.go" {
 			imps := []string{"context", "database/sql"}
@@ -209,7 +210,7 @@ func Imports(r Generateable, settings CombinedSettings) func(string) [][]string
 	}
 }
 
-func InterfaceImports(r Generateable, settings CombinedSettings) [][]string {
+func InterfaceImports(r Generateable, settings config.CombinedSettings) [][]string {
 	gq := r.GoQueries(settings)
 	uses := func(name string) bool {
 		for _, q := range gq {
@@ -246,10 +247,10 @@ func InterfaceImports(r Generateable, settings CombinedSettings) [][]string {
 	pkg := make(map[string]struct{})
 	overrideTypes := map[string]string{}
 	for _, o := range settings.Overrides {
-		if o.goBasicType {
+		if o.GoBasicType {
 			continue
 		}
-		overrideTypes[o.GoTypeName] = o.goPackage
+		overrideTypes[o.GoTypeName] = o.GoPackage
 	}
 
 	_, overrideNullTime := overrideTypes["pq.NullTime"]
@@ -283,7 +284,7 @@ func InterfaceImports(r Generateable, settings CombinedSettings) [][]string {
 	return [][]string{stds, pkgs}
 }
 
-func ModelImports(r Generateable, settings CombinedSettings) [][]string {
+func ModelImports(r Generateable, settings config.CombinedSettings) [][]string {
 	std := make(map[string]struct{})
 	if UsesType(r, "sql.Null", settings) {
 		std["database/sql"] = struct{}{}
@@ -302,10 +303,10 @@ func ModelImports(r Generateable, settings CombinedSettings) [][]string {
 	pkg := make(map[string]struct{})
 	overrideTypes := map[string]string{}
 	for _, o := range settings.Overrides {
-		if o.goBasicType {
+		if o.GoBasicType {
 			continue
 		}
-		overrideTypes[o.GoTypeName] = o.goPackage
+		overrideTypes[o.GoTypeName] = o.GoPackage
 	}
 
 	_, overrideNullTime := overrideTypes["pq.NullTime"]
@@ -339,7 +340,7 @@ func ModelImports(r Generateable, settings CombinedSettings) [][]string {
 	return [][]string{stds, pkgs}
 }
 
-func QueryImports(r Generateable, settings CombinedSettings, filename string) [][]string {
+func QueryImports(r Generateable, settings config.CombinedSettings, filename string) [][]string {
 	// for _, strct := range r.Structs() {
 	// 	for _, f := range strct.Fields {
 	// 		if strings.HasPrefix(f.Type, "[]") {
@@ -437,10 +438,10 @@ func QueryImports(r Generateable, settings CombinedSettings, filename string) []
 	pkg := make(map[string]struct{})
 	overrideTypes := map[string]string{}
 	for _, o := range settings.Overrides {
-		if o.goBasicType {
+		if o.GoBasicType {
 			continue
 		}
-		overrideTypes[o.GoTypeName] = o.goPackage
+		overrideTypes[o.GoTypeName] = o.GoPackage
 	}
 
 	if sliceScan() {
@@ -489,7 +490,7 @@ func enumValueName(value string) string {
 	return name
 }
 
-func (r Result) Enums(settings CombinedSettings) []GoEnum {
+func (r Result) Enums(settings config.CombinedSettings) []GoEnum {
 	var enums []GoEnum
 	for name, schema := range r.Catalog.Schemas {
 		if name == "pg_catalog" {
@@ -522,7 +523,7 @@ func (r Result) Enums(settings CombinedSettings) []GoEnum {
 	return enums
 }
 
-func StructName(name string, settings CombinedSettings) string {
+func StructName(name string, settings config.CombinedSettings) string {
 	if rename := settings.Global.Rename[name]; rename != "" {
 		return rename
 	}
@@ -537,7 +538,7 @@ func StructName(name string, settings CombinedSettings) string {
 	return out
 }
 
-func (r Result) Structs(settings CombinedSettings) []GoStruct {
+func (r Result) Structs(settings config.CombinedSettings) []GoStruct {
 	var structs []GoStruct
 	for name, schema := range r.Catalog.Schemas {
 		if name == "pg_catalog" {
@@ -572,7 +573,7 @@ func (r Result) Structs(settings CombinedSettings) []GoStruct {
 	return structs
 }
 
-func (r Result) goType(col core.Column, settings CombinedSettings) string {
+func (r Result) goType(col core.Column, settings config.CombinedSettings) string {
 	// package overrides have a higher precedence
 	for _, oride := range settings.Overrides {
 		if oride.Column != "" && oride.ColumnName == col.Name && oride.Table == col.Table {
@@ -586,7 +587,7 @@ func (r Result) goType(col core.Column, settings CombinedSettings) string {
 	return typ
 }
 
-func (r Result) goInnerType(col core.Column, settings CombinedSettings) string {
+func (r Result) goInnerType(col core.Column, settings config.CombinedSettings) string {
 	columnType := col.DataType
 	notNull := col.NotNull || col.IsArray
 
@@ -741,7 +742,7 @@ func (r Result) goInnerType(col core.Column, settings CombinedSettings) string {
 // JSON tags: count, count_2, count_2
 //
 // This is unlikely to happen, so don't fix it yet
-func (r Result) columnsToStruct(name string, columns []core.Column, settings CombinedSettings) *GoStruct {
+func (r Result) columnsToStruct(name string, columns []core.Column, settings config.CombinedSettings) *GoStruct {
 	gs := GoStruct{
 		Name: name,
 	}
@@ -801,7 +802,7 @@ func compareFQN(a *core.FQN, b *core.FQN) bool {
 	return a.Catalog == b.Catalog && a.Schema == b.Schema && a.Rel == b.Rel
 }
 
-func (r Result) GoQueries(settings CombinedSettings) []GoQuery {
+func (r Result) GoQueries(settings config.CombinedSettings) []GoQuery {
 	structs := r.Structs(settings)
 
 	qs := make([]GoQuery, 0, len(r.Queries))
@@ -1182,7 +1183,7 @@ type tmplCtx struct {
 	Enums     []GoEnum
 	Structs   []GoStruct
 	GoQueries []GoQuery
-	Settings  GenerateSettings
+	Settings  config.GenerateSettings
 
 	// TODO: Race conditions
 	SourceName string
@@ -1198,7 +1199,7 @@ func LowerTitle(s string) string {
 	return string(a)
 }
 
-func Generate(r Generateable, settings CombinedSettings) (map[string]string, error) {
+func Generate(r Generateable, settings config.CombinedSettings) (map[string]string, error) {
 	funcMap := template.FuncMap{
 		"lowerTitle": LowerTitle,
 		"imports":    Imports(r, settings),
diff --git a/internal/dinosql/parser.go b/internal/dinosql/parser.go
index 8154f1a5c..381f41500 100644
--- a/internal/dinosql/parser.go
+++ b/internal/dinosql/parser.go
@@ -13,6 +13,7 @@ import (
 	"unicode"
 
 	"github.com/kyleconroy/sqlc/internal/catalog"
+	"github.com/kyleconroy/sqlc/internal/config"
 	core "github.com/kyleconroy/sqlc/internal/pg"
 	"github.com/kyleconroy/sqlc/internal/postgres"
 
@@ -188,7 +189,7 @@ type Result struct {
 	Catalog core.Catalog
 }
 
-func ParseQueries(c core.Catalog, pkg PackageSettings) (*Result, error) {
+func ParseQueries(c core.Catalog, pkg config.PackageSettings) (*Result, error) {
 	f, err := os.Stat(pkg.Queries)
 	if err != nil {
 		return nil, fmt.Errorf("path %s does not exist", pkg.Queries)
diff --git a/internal/mysql/gen.go b/internal/mysql/gen.go
index 31ba35f1e..17ebf51d5 100644
--- a/internal/mysql/gen.go
+++ b/internal/mysql/gen.go
@@ -6,14 +6,16 @@ import (
 	"strings"
 
 	"github.com/jinzhu/inflection"
+	"vitess.io/vitess/go/vt/sqlparser"
+
+	"github.com/kyleconroy/sqlc/internal/config"
 	"github.com/kyleconroy/sqlc/internal/dinosql"
 	core "github.com/kyleconroy/sqlc/internal/pg"
-	"vitess.io/vitess/go/vt/sqlparser"
 )
 
 type PackageGenerator struct {
 	*Schema
-	dinosql.CombinedSettings
+	config.CombinedSettings
 	packageName string
 }
 
@@ -23,7 +25,7 @@ type Result struct {
 }
 
 // Enums generates parser-agnostic GoEnum types
-func (r *Result) Enums(settings dinosql.CombinedSettings) []dinosql.GoEnum {
+func (r *Result) Enums(settings config.CombinedSettings) []dinosql.GoEnum {
 	var enums []dinosql.GoEnum
 	for _, table := range r.Schema.tables {
 		for _, col := range table {
@@ -62,7 +64,7 @@ func (pGen PackageGenerator) enumNameFromColDef(col *sqlparser.ColumnDefinition)
 }
 
 // Structs marshels each query into a go struct for generation
-func (r *Result) Structs(settings dinosql.CombinedSettings) []dinosql.GoStruct {
+func (r *Result) Structs(settings config.CombinedSettings) []dinosql.GoStruct {
 	var structs []dinosql.GoStruct
 	for tableName, cols := range r.Schema.tables {
 		s := dinosql.GoStruct{
@@ -85,7 +87,7 @@ func (r *Result) Structs(settings dinosql.CombinedSettings) []dinosql.GoStruct {
 }
 
 // GoQueries generates parser-agnostic query information for code generation
-func (r *Result) GoQueries(settings dinosql.CombinedSettings) []dinosql.GoQuery {
+func (r *Result) GoQueries(settings config.CombinedSettings) []dinosql.GoQuery {
 	structs := r.Structs(settings)
 
 	qs := make([]dinosql.GoQuery, 0, len(r.Queries))
@@ -195,7 +197,7 @@ type structParams struct {
 	goType       string
 }
 
-func (r *Result) columnsToStruct(name string, items []structParams, settings dinosql.CombinedSettings) *dinosql.GoStruct {
+func (r *Result) columnsToStruct(name string, items []structParams, settings config.CombinedSettings) *dinosql.GoStruct {
 	gs := dinosql.GoStruct{
 		Name: name,
 	}
diff --git a/internal/mysql/parse.go b/internal/mysql/parse.go
index 06441cc60..f1ddf6fdf 100644
--- a/internal/mysql/parse.go
+++ b/internal/mysql/parse.go
@@ -7,8 +7,10 @@ import (
 	"path/filepath"
 
 	"github.com/davecgh/go-spew/spew"
-	"github.com/kyleconroy/sqlc/internal/dinosql"
 	"vitess.io/vitess/go/vt/sqlparser"
+
+	"github.com/kyleconroy/sqlc/internal/config"
+	"github.com/kyleconroy/sqlc/internal/dinosql"
 )
 
 // Query holds the data for walking and validating mysql querys
@@ -468,7 +470,7 @@ func (pGen PackageGenerator) parseSelectAliasExpr(exprs sqlparser.SelectExprs, t
 }
 
 // GeneratePkg is the main entry to mysql generator package
-func GeneratePkg(pkgName, schemaPath, querysPath string, settings dinosql.CombinedSettings) (*Result, error) {
+func GeneratePkg(pkgName, schemaPath, querysPath string, settings config.CombinedSettings) (*Result, error) {
 	s := NewSchema()
 	generator := PackageGenerator{
 		Schema:           s,


Test patch:
diff --git a/internal/dinosql/config_test.go b/internal/config/config_test.go
similarity index 94%
rename from internal/dinosql/config_test.go
rename to internal/config/config_test.go
index 7fa548fe9..eeabb5d88 100644
--- a/internal/dinosql/config_test.go
+++ b/internal/config/config_test.go
@@ -1,4 +1,4 @@
-package dinosql
+package config
 
 import (
 	"strings"
@@ -107,10 +107,10 @@ func TestTypeOverrides(t *testing.T) {
 			if diff := cmp.Diff(tt.typeName, tt.override.GoTypeName); diff != "" {
 				t.Errorf("type name mismatch;\n%s", diff)
 			}
-			if diff := cmp.Diff(tt.pkg, tt.override.goPackage); diff != "" {
+			if diff := cmp.Diff(tt.pkg, tt.override.GoPackage); diff != "" {
 				t.Errorf("package mismatch;\n%s", diff)
 			}
-			if diff := cmp.Diff(tt.basic, tt.override.goBasicType); diff != "" {
+			if diff := cmp.Diff(tt.basic, tt.override.GoBasicType); diff != "" {
 				t.Errorf("basic mismatch;\n%s", diff)
 			}
 		})
diff --git a/internal/mysql/errors_test.go b/internal/mysql/errors_test.go
index 9727fa856..588f19f40 100644
--- a/internal/mysql/errors_test.go
+++ b/internal/mysql/errors_test.go
@@ -4,8 +4,9 @@ import (
 	"testing"
 
 	"github.com/google/go-cmp/cmp"
-	"github.com/kyleconroy/sqlc/internal/dinosql"
 	"vitess.io/vitess/go/vt/sqlparser"
+
+	"github.com/kyleconroy/sqlc/internal/config"
 )
 
 func TestCustomArgErr(t *testing.T) {
@@ -38,7 +39,7 @@ func TestCustomArgErr(t *testing.T) {
 			},
 		},
 	}
-	settings := dinosql.Combine(dinosql.GenerateSettings{}, dinosql.PackageSettings{})
+	settings := config.Combine(config.GenerateSettings{}, config.PackageSettings{})
 	generator := PackageGenerator{mockSchema, settings, "db"}
 	for _, tcase := range tests {
 		q, err := generator.parseContents("queries.sql", tcase.input)
@@ -82,7 +83,7 @@ func TestPositionedErr(t *testing.T) {
 		},
 	}
 
-	settings := dinosql.Combine(dinosql.GenerateSettings{}, dinosql.PackageSettings{})
+	settings := config.Combine(config.GenerateSettings{}, config.PackageSettings{})
 	for _, tcase := range tests {
 		generator := PackageGenerator{mockSchema, settings, "db"}
 		q, err := generator.parseContents("queries.sql", tcase.input)
diff --git a/internal/mysql/gen_test.go b/internal/mysql/gen_test.go
index 3c3efb726..8856c2435 100644
--- a/internal/mysql/gen_test.go
+++ b/internal/mysql/gen_test.go
@@ -4,9 +4,11 @@ import (
 	"testing"
 
 	"github.com/google/go-cmp/cmp"
+	"vitess.io/vitess/go/vt/sqlparser"
+
+	"github.com/kyleconroy/sqlc/internal/config"
 	"github.com/kyleconroy/sqlc/internal/dinosql"
 	"github.com/kyleconroy/sqlc/internal/pg"
-	"vitess.io/vitess/go/vt/sqlparser"
 )
 
 func TestArgName(t *testing.T) {
@@ -54,7 +56,7 @@ func TestEnumName(t *testing.T) {
 		},
 	}
 
-	generator := PackageGenerator{mockSchema, dinosql.CombinedSettings{}, ""}
+	generator := PackageGenerator{mockSchema, config.CombinedSettings{}, ""}
 	for _, tc := range tcase {
 		enumName := generator.enumNameFromColDef(&tc.input)
 		if diff := cmp.Diff(enumName, tc.output); diff != "" {
@@ -64,7 +66,7 @@ func TestEnumName(t *testing.T) {
 }
 
 func TestEnums(t *testing.T) {
-	generator := PackageGenerator{mockSchema, dinosql.CombinedSettings{}, ""}
+	generator := PackageGenerator{mockSchema, config.CombinedSettings{}, ""}
 	tcase := [...]struct {
 		input  Result
 		output []dinosql.GoEnum
@@ -84,7 +86,7 @@ func TestEnums(t *testing.T) {
 			},
 		},
 	}
-	settings := dinosql.Combine(dinosql.GenerateSettings{}, dinosql.PackageSettings{})
+	settings := config.Combine(config.GenerateSettings{}, config.PackageSettings{})
 	for _, tc := range tcase {
 		enums := tc.input.Enums(settings)
 		if diff := cmp.Diff(enums, tc.output); diff != "" {
@@ -94,7 +96,7 @@ func TestEnums(t *testing.T) {
 }
 
 func TestStructs(t *testing.T) {
-	settings := dinosql.Combine(dinosql.GenerateSettings{}, dinosql.PackageSettings{})
+	settings := config.Combine(config.GenerateSettings{}, config.PackageSettings{})
 	generator := PackageGenerator{mockSchema, settings, "db"}
 	tcase := [...]struct {
 		input  Result
@@ -136,12 +138,12 @@ func TestStructs(t *testing.T) {
 
 func TestTypeOverride(t *testing.T) {
 	tests := [...]struct {
-		overrides      []dinosql.Override
+		overrides      []config.Override
 		col            Column
 		expectedGoType string
 	}{
 		{
-			overrides: []dinosql.Override{
+			overrides: []config.Override{
 				{
 					DBType:     "uuid",
 					GoTypeName: "KSUID", // this is populated by the dinosql.Parse
@@ -158,7 +160,7 @@ func TestTypeOverride(t *testing.T) {
 			expectedGoType: "KSUID",
 		},
 		{
-			overrides: []dinosql.Override{
+			overrides: []config.Override{
 				{
 					ColumnName: "user_id", // this is populated by dinosql.Parse
 					GoTypeName: "uuid",    // this is populated by dinosql.Parse
@@ -178,7 +180,7 @@ func TestTypeOverride(t *testing.T) {
 	}
 
 	for _, tcase := range tests {
-		settings := dinosql.Combine(dinosql.GenerateSettings{}, dinosql.PackageSettings{Overrides: tcase.overrides})
+		settings := config.Combine(config.GenerateSettings{}, config.PackageSettings{Overrides: tcase.overrides})
 		gen := PackageGenerator{mockSchema, settings, "db"}
 		goType := gen.goTypeCol(tcase.col)
 
diff --git a/internal/mysql/param_test.go b/internal/mysql/param_test.go
index dd166ac8a..de0c39a67 100644
--- a/internal/mysql/param_test.go
+++ b/internal/mysql/param_test.go
@@ -5,8 +5,9 @@ import (
 	"testing"
 
 	"github.com/davecgh/go-spew/spew"
-	"github.com/kyleconroy/sqlc/internal/dinosql"
 	"vitess.io/vitess/go/vt/sqlparser"
+
+	"github.com/kyleconroy/sqlc/internal/config"
 )
 
 func TestSelectParamSearcher(t *testing.T) {
@@ -87,7 +88,7 @@ func TestSelectParamSearcher(t *testing.T) {
 			},
 		},
 	}
-	settings := dinosql.Combine(dinosql.GenerateSettings{}, dinosql.PackageSettings{})
+	settings := config.Combine(config.GenerateSettings{}, config.PackageSettings{})
 	for _, tCase := range tests {
 		generator := PackageGenerator{
 			Schema:           mockSchema,
@@ -151,7 +152,7 @@ func TestInsertParamSearcher(t *testing.T) {
 			expectedNames: []string{"first_name", "user_last_name"},
 		},
 	}
-	settings := dinosql.Combine(dinosql.GenerateSettings{}, dinosql.PackageSettings{})
+	settings := config.Combine(config.GenerateSettings{}, config.PackageSettings{})
 	for _, tCase := range tests {
 		generator := PackageGenerator{
 			Schema:           mockSchema,
diff --git a/internal/mysql/parse_test.go b/internal/mysql/parse_test.go
index 734df42e9..6486da2a9 100644
--- a/internal/mysql/parse_test.go
+++ b/internal/mysql/parse_test.go
@@ -5,6 +5,7 @@ import (
 	"testing"
 
 	"github.com/google/go-cmp/cmp"
+	"github.com/kyleconroy/sqlc/internal/config"
 	"github.com/kyleconroy/sqlc/internal/dinosql"
 	"vitess.io/vitess/go/vt/sqlparser"
 )
@@ -248,7 +249,7 @@ func TestParseSelect(t *testing.T) {
 		},
 	}
 
-	settings := dinosql.Combine(dinosql.GenerateSettings{}, dinosql.PackageSettings{})
+	settings := config.Combine(config.GenerateSettings{}, config.PackageSettings{})
 	for _, tt := range tests {
 		testCase := tt
 		generator := PackageGenerator{
@@ -423,7 +424,7 @@ func TestParseInsertUpdate(t *testing.T) {
 		},
 	}
 
-	settings := dinosql.Combine(dinosql.GenerateSettings{}, dinosql.PackageSettings{})
+	settings := config.Combine(config.GenerateSettings{}, config.PackageSettings{})
 	for _, tt := range tests {
 		testCase := tt
 		t.Run(tt.name, func(t *testing.T) {