diff --git a/bob.go b/bob.go index 01d9b9e..e0b3da1 100644 --- a/bob.go +++ b/bob.go @@ -30,12 +30,12 @@ type BobBuilder interface { // CreateTable creates a table with CreateBuilder interface func (b BobBuilderType) CreateTable(table string) CreateBuilder { - return CreateBuilder(b).Name(table) + return CreateBuilder(b).name(table) } // CreateTableIfNotExists creates a table with CreateBuilder interface, if the table doesn't exists. func (b BobBuilderType) CreateTableIfNotExists(table string) CreateBuilder { - return CreateBuilder(b).Name(table).IfNotExists() + return CreateBuilder(b).name(table).ifNotExists() } // HasTable checks if a table exists with HasBuilder interface @@ -50,22 +50,22 @@ func (b BobBuilderType) HasColumn(column string) HasBuilder { // DropTable drops (delete contents & remove) a table from the database. func (b BobBuilderType) DropTable(table string) DropBuilder { - return DropBuilder(b).DropTable(table) + return DropBuilder(b).dropTable(table) } // DropTable drops (delete contents & remove) a table from the database if the table exists. func (b BobBuilderType) DropTableIfExists(table string) DropBuilder { - return DropBuilder(b).DropTable(table).IfExists() + return DropBuilder(b).dropTable(table).ifExists() } // RenameTable simply renames an exisisting table. func (b BobBuilderType) RenameTable(from, to string) RenameBuilder { - return RenameBuilder(b).From(from).To(to) + return RenameBuilder(b).from(from).to(to) } // Truncate performs TRUNCATE function. It deletes all contents from a table but not deleting the table. func (b BobBuilderType) Truncate(table string) TruncateBuilder { - return TruncateBuilder(b).Truncate(table) + return TruncateBuilder(b).truncate(table) } func (b BobBuilderType) Upsert(table string, dialect int) UpsertBuilder { diff --git a/create.go b/create.go index 1748e03..4ee2ad4 100644 --- a/create.go +++ b/create.go @@ -27,13 +27,13 @@ func init() { builder.Register(CreateBuilder{}, createData{}) } -// Name sets the table name -func (b CreateBuilder) Name(name string) CreateBuilder { +// name sets the table name +func (b CreateBuilder) name(name string) CreateBuilder { return builder.Set(b, "TableName", name).(CreateBuilder) } -// IfNotExists adds IF NOT EXISTS to the query -func (b CreateBuilder) IfNotExists() CreateBuilder { +// ifNotExists adds IF NOT EXISTS to the query +func (b CreateBuilder) ifNotExists() CreateBuilder { return builder.Set(b, "IfNotExists", true).(CreateBuilder) } diff --git a/drop.go b/drop.go index 2311c71..969051d 100644 --- a/drop.go +++ b/drop.go @@ -19,11 +19,11 @@ func init() { } // DropTable sets which table to be dropped -func (b DropBuilder) DropTable(name string) DropBuilder { +func (b DropBuilder) dropTable(name string) DropBuilder { return builder.Set(b, "TableName", name).(DropBuilder) } -func (b DropBuilder) IfExists() DropBuilder { +func (b DropBuilder) ifExists() DropBuilder { return builder.Set(b, "IfExists", true).(DropBuilder) } diff --git a/has.go b/has.go index 3f1616f..896127b 100644 --- a/has.go +++ b/has.go @@ -8,9 +8,6 @@ import ( "github.com/lann/builder" ) -// TODO - The whole file is a todo -// Meant to find two things: HasTable and HasColumn(s) - type HasBuilder builder.Builder type hasData struct { diff --git a/rename.go b/rename.go index 1cb4c80..38b59f1 100644 --- a/rename.go +++ b/rename.go @@ -17,13 +17,13 @@ func init() { builder.Register(RenameBuilder{}, renameData{}) } -// From sets existing table name -func (b RenameBuilder) From(name string) RenameBuilder { +// from sets existing table name +func (b RenameBuilder) from(name string) RenameBuilder { return builder.Set(b, "From", name).(RenameBuilder) } -// To sets desired table name -func (b RenameBuilder) To(name string) RenameBuilder { +// to sets desired table name +func (b RenameBuilder) to(name string) RenameBuilder { return builder.Set(b, "To", name).(RenameBuilder) } diff --git a/truncate.go b/truncate.go index 95c39c2..a12b9e4 100644 --- a/truncate.go +++ b/truncate.go @@ -17,7 +17,7 @@ func init() { } // Truncate sets which table to be dropped -func (b TruncateBuilder) Truncate(name string) TruncateBuilder { +func (b TruncateBuilder) truncate(name string) TruncateBuilder { return builder.Set(b, "TableName", name).(TruncateBuilder) }