Skip to content

Commit

Permalink
clanup
Browse files Browse the repository at this point in the history
  • Loading branch information
gernest committed Mar 29, 2017
1 parent 02429ad commit 304a5b1
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions ql.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,7 @@ func (q *QL) DataTypeOf(field *model.StructField) (string, error) {
func (q *QL) HasIndex(tableName string, indexName string) bool {
query := "select count() from __Index where Name=$1 && TableName=$2"
var count int
err := q.db.QueryRow(query, indexName, tableName).Scan(&count)
if err != nil {
//TODO; Ropery log or return this error?
}
_ = q.db.QueryRow(query, indexName, tableName).Scan(&count)
return count > 0
}

Expand All @@ -156,21 +153,15 @@ func (q *QL) RemoveIndex(tableName string, indexName string) error {
func (q *QL) HasTable(tableName string) bool {
query := "select count() from __Table where Name=$1"
var count int
err := q.db.QueryRow(query, tableName).Scan(&count)
if err != nil {
//TODO; Ropery log or return this error?
}
_ = q.db.QueryRow(query, tableName).Scan(&count)
return count > 0
}

// HasColumn check has column or not
func (q *QL) HasColumn(tableName string, columnName string) bool {
query := "select count() from __Column where Name=$1 && TableName=$2"
var count int
err := q.db.QueryRow(query, columnName, tableName).Scan(&count)
if err != nil {
//TODO; Ropery log or return this error?
}
_ = q.db.QueryRow(query, columnName, tableName).Scan(&count)
return count > 0
}

Expand Down

0 comments on commit 304a5b1

Please sign in to comment.