Move State to the SQLBoiler file where it belongs
This commit is contained in:
parent
e95331bcb8
commit
fd7a564af4
2 changed files with 16 additions and 21 deletions
21
config.go
21
config.go
|
@ -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"`
|
||||
|
|
16
sqlboiler.go
16
sqlboiler.go
|
@ -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{}
|
||||
|
|
Loading…
Reference in a new issue