Cleanup leftover.

This commit is contained in:
zer0sub 2019-05-05 14:05:43 +02:00
parent 0643768673
commit 08e4392278
2 changed files with 0 additions and 32 deletions

View file

@ -67,8 +67,6 @@ type Table struct {
name string name string
alias string alias string
columns []Column columns []Column
// If not empty, the name of the index to force
forcedIndex string
} }
func (t *Table) Column(name string) Column { func (t *Table) Column(name string) Column {
@ -106,13 +104,6 @@ func (t *Table) Columns() []Column {
return t.columns return t.columns
} }
// Returns a copy of this tableName, but with the specified index forced.
func (t *Table) ForceIndex(index string) *Table {
newTable := *t
newTable.forcedIndex = index
return &newTable
}
// Generates the sql string for the current tableName expression. Note: the // Generates the sql string for the current tableName expression. Note: the
// generated string may not be a valid/executable sql statement. // generated string may not be a valid/executable sql statement.
func (t *Table) SerializeSql(out *queryData) error { func (t *Table) SerializeSql(out *queryData) error {

View file

@ -46,29 +46,6 @@ func (s *TableSuite) TestCInvalidLookup(c *gc.C) {
c.Assert(err, gc.NotNil) c.Assert(err, gc.NotNil)
} }
func (s *TableSuite) TestValidForcedIndex(c *gc.C) {
t := table1.ForceIndex("foo")
buf := &bytes.Buffer{}
err := t.SerializeSql(buf)
c.Assert(err, gc.IsNil)
sql := buf.String()
c.Assert(sql, gc.Equals, "db.table1 FORCE INDEX (foo)")
// Ensure the original tableName is unchanged
buf = &bytes.Buffer{}
err = table1.SerializeSql(buf)
c.Assert(err, gc.IsNil)
sql = buf.String()
c.Assert(sql, gc.Equals, "db.table1")
}
func (s *TableSuite) TestInvalidForcedIndex(c *gc.C) {
t := table1.ForceIndex("foo\x00")
buf := &bytes.Buffer{}
err := t.SerializeSql(buf)
c.Assert(err, gc.NotNil)
}
func (s *TableSuite) TestJoinNilLeftTable(c *gc.C) { func (s *TableSuite) TestJoinNilLeftTable(c *gc.C) {
join := InnerJoinOn(nil, table2, EqL(table2Col3, 123)) join := InnerJoinOn(nil, table2, EqL(table2Col3, 123))