Skip to content

Commit

Permalink
Rename RawSql to RawSQL to follow conventions (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
stanislas-m authored Aug 20, 2018
1 parent 7dcea5e commit f3f4d6f
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
4 changes: 2 additions & 2 deletions bubbler.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ func (b *Bubbler) Bubble(s string) (string, error) {
"add_column": f.AddColumn,
"drop_column": f.DropColumn,
"rename_column": f.RenameColumn,
"raw": f.RawSql,
"sql": f.RawSql,
"raw": f.RawSQL,
"sql": f.RawSQL,
"add_index": f.AddIndex,
"drop_index": f.DropIndex,
"rename_index": f.RenameIndex,
Expand Down
2 changes: 2 additions & 0 deletions fizz.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ func (f fizzer) Exec(out io.Writer) func(string) error {
}
}

// AFile reads a fizz file, and translates its contents to SQL.
func AFile(f *os.File, t Translator) (string, error) {
b, err := ioutil.ReadAll(f)
if err != nil {
Expand All @@ -47,6 +48,7 @@ func AFile(f *os.File, t Translator) (string, error) {
return AString(string(b), t)
}

// AString reads a fizz string, and translates its contents to SQL.
func AString(s string, t Translator) (string, error) {
b := NewBubbler(t)
return b.Bubble(s)
Expand Down
7 changes: 6 additions & 1 deletion raw_sql.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,14 @@ import (
"strings"
)

func (f fizzer) RawSql(sql string) {
func (f fizzer) RawSQL(sql string) {
if !strings.HasSuffix(sql, ";") {
sql += ";"
}
f.add(sql, nil)
}

// Deprecated: use RawSQL instead.
func (f fizzer) RawSql(sql string) {
f.RawSQL(sql)
}
2 changes: 2 additions & 0 deletions translator.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package fizz

// Translator describes the common interface to define a fizz
// to SQL translator.
type Translator interface {
CreateTable(Table) (string, error)
DropTable(Table) (string, error)
Expand Down

0 comments on commit f3f4d6f

Please sign in to comment.