Move State to the SQLBoiler file where it belongs

This commit is contained in:
Aaron L 2016-06-11 23:27:39 -07:00
parent e95331bcb8
commit fd7a564af4
2 changed files with 16 additions and 21 deletions

View file

@ -1,26 +1,5 @@
package sqlboiler
import (
"text/template"
"github.com/nullbio/sqlboiler/dbdrivers"
)
// State holds the global data needed by most pieces to run
type State struct {
Config *Config
Driver dbdrivers.Interface
Tables []dbdrivers.Table
Templates templateList
TestTemplates templateList
SingletonTemplates templateList
SingletonTestTemplates templateList
TestMainTemplate *template.Template
}
// Config for the running of the commands
type Config struct {
DriverName string `toml:"driver_name"`

View file

@ -5,6 +5,7 @@ package sqlboiler
import (
"errors"
"fmt"
"html/template"
"os"
"strings"
@ -19,6 +20,21 @@ const (
templatesSingletonTestDirectory = "cmds/templates_test/singleton"
)
// State holds the global data needed by most pieces to run
type State struct {
Config *Config
Driver dbdrivers.Interface
Tables []dbdrivers.Table
Templates templateList
TestTemplates templateList
SingletonTemplates templateList
SingletonTestTemplates templateList
TestMainTemplate *template.Template
}
// New creates a new state based off of the config
func New(config *Config) (*State, error) {
s := &State{}