Skip to content

Commit

Permalink
[database] Update more sqlbuilder callsites to use enum
Browse files Browse the repository at this point in the history
  • Loading branch information
dcsommer committed Feb 4, 2015
1 parent 072ed9b commit 7a518ea
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
6 changes: 3 additions & 3 deletions database/sqlbuilder/column_test.go
Expand Up @@ -21,13 +21,13 @@ var _ = gc.Suite(&ColumnSuite{})
//

func (s *ColumnSuite) TestRealColumnName(c *gc.C) {
col := IntColumn("col", true)
col := IntColumn("col", Nullable)

c.Assert(col.Name(), gc.Equals, "col")
}

func (s *ColumnSuite) TestRealColumnSerializeSqlForColumnList(c *gc.C) {
col := IntColumn("col", true)
col := IntColumn("col", Nullable)

// Without table name
buf := &bytes.Buffer{}
Expand All @@ -52,7 +52,7 @@ func (s *ColumnSuite) TestRealColumnSerializeSqlForColumnList(c *gc.C) {
}

func (s *ColumnSuite) TestRealColumnSerializeSql(c *gc.C) {
col := IntColumn("col", true)
col := IntColumn("col", Nullable)

// Without table name
buf := &bytes.Buffer{}
Expand Down
12 changes: 6 additions & 6 deletions database/sqlbuilder/example_test.go
Expand Up @@ -9,23 +9,23 @@ import (
func Example() {
t1 := sb.NewTable(
"parent_prefix",
sb.IntColumn("ns_id", false),
sb.IntColumn("hash", false),
sb.IntColumn("ns_id", sb.NotNullable),
sb.IntColumn("hash", sb.NotNullable),
sb.StrColumn(
"prefix",
sb.UTF8,
sb.UTF8CaseInsensitive,
false))
sb.NotNullable))

t2 := sb.NewTable(
"sfj",
sb.IntColumn("ns_id", false),
sb.IntColumn("sjid", false),
sb.IntColumn("ns_id", sb.NotNullable),
sb.IntColumn("sjid", sb.NotNullable),
sb.StrColumn(
"filename",
sb.UTF8,
sb.UTF8CaseInsensitive,
false))
sb.NotNullable))

ns_id1 := t1.C("ns_id")
prefix := t1.C("prefix")
Expand Down
16 changes: 8 additions & 8 deletions database/sqlbuilder/test_utils.go
@@ -1,25 +1,25 @@
package sqlbuilder

var table1Col1 = IntColumn("col1", true)
var table1Col2 = IntColumn("col2", true)
var table1Col3 = IntColumn("col3", true)
var table1Col4 = DateTimeColumn("col4", true)
var table1Col1 = IntColumn("col1", Nullable)
var table1Col2 = IntColumn("col2", Nullable)
var table1Col3 = IntColumn("col3", Nullable)
var table1Col4 = DateTimeColumn("col4", Nullable)
var table1 = NewTable(
"table1",
table1Col1,
table1Col2,
table1Col3,
table1Col4)

var table2Col3 = IntColumn("col3", true)
var table2Col4 = IntColumn("col4", true)
var table2Col3 = IntColumn("col3", Nullable)
var table2Col4 = IntColumn("col4", Nullable)
var table2 = NewTable(
"table2",
table2Col3,
table2Col4)

var table3Col1 = IntColumn("col1", true)
var table3Col2 = IntColumn("col2", true)
var table3Col1 = IntColumn("col1", Nullable)
var table3Col2 = IntColumn("col2", Nullable)
var table3 = NewTable(
"table3",
table3Col1,
Expand Down

0 comments on commit 7a518ea

Please sign in to comment.