renamed method

This commit is contained in:
marco 2016-02-06 22:27:43 +01:00
parent 0a3314337f
commit 5ecab372f9
2 changed files with 6 additions and 6 deletions

10
sql.go
View File

@ -2,12 +2,12 @@ package main
// Arguments to format are: // Arguments to format are:
// [1]: type name // [1]: type name
const valuer = `func (i %[1]s) Value() (driver.Value, error) { const valueMethod = `func (i %[1]s) Value() (driver.Value, error) {
return i.String(), nil return i.String(), nil
} }
` `
const scanner = `func (i %[1]s) Scan(value interface{}) error { const scanMethod = `func (i %[1]s) Scan(value interface{}) error {
bytes, ok := value.([]byte) bytes, ok := value.([]byte)
if !ok { if !ok {
return fmt.Errorf("value is not a byte slice") return fmt.Errorf("value is not a byte slice")
@ -25,9 +25,9 @@ const scanner = `func (i %[1]s) Scan(value interface{}) error {
} }
` `
func (g *Generator) addValuerAndScanner(typeName string) { func (g *Generator) addValueAndScanMethod(typeName string) {
g.Printf("\n") g.Printf("\n")
g.Printf(valuer, typeName) g.Printf(valueMethod, typeName)
g.Printf("\n\n") g.Printf("\n\n")
g.Printf(scanner, typeName) g.Printf(scanMethod, typeName)
} }

View File

@ -315,7 +315,7 @@ func (g *Generator) generate(typeName string) {
g.buildValueToNameMap(runs, typeName, 10) g.buildValueToNameMap(runs, typeName, 10)
// SQL // SQL
g.addValuerAndScanner(typeName) g.addValueAndScanMethod(typeName)
} }
// splitIntoRuns breaks the values into runs of contiguous sequences. // splitIntoRuns breaks the values into runs of contiguous sequences.