Cleanup and redesign config files

This commit is contained in:
Vikram Rangnekar
2019-04-08 02:47:59 -04:00
parent 8acc3ed08d
commit e3660473cc
11 changed files with 447 additions and 327 deletions

View File

@ -10,15 +10,18 @@ import (
"github.com/dosco/super-graph/util"
)
type Variables map[string]string
type Config struct {
Schema *DBSchema
Vars map[string]string
}
type Compiler struct {
schema *DBSchema
vars Variables
vars map[string]string
}
func NewCompiler(schema *DBSchema, vars Variables) *Compiler {
return &Compiler{schema, vars}
func NewCompiler(conf Config) *Compiler {
return &Compiler{conf.Schema, conf.Vars}
}
func (c *Compiler) Compile(w io.Writer, qc *qcode.QCode) error {
@ -607,7 +610,7 @@ func renderList(w io.Writer, ex *qcode.Exp) {
io.WriteString(w, `)`)
}
func renderVal(w io.Writer, ex *qcode.Exp, vars Variables) {
func renderVal(w io.Writer, ex *qcode.Exp, vars map[string]string) {
io.WriteString(w, ` (`)
switch ex.Type {
case qcode.ValBool, qcode.ValInt, qcode.ValFloat: