good morning!!!!

Skip to content
Snippets Groups Projects
Commit d1ee10ab authored by José Carlos Nieto's avatar José Carlos Nieto
Browse files

Fixing #18.

parent 155e0ae7
Branches
Tags
No related merge requests found
......@@ -37,7 +37,7 @@ var (
ErrNotConnected = errors.New(`You're currently not connected.`)
ErrMissingDatabaseName = errors.New(`Missing database name.`)
ErrMissingCollectionName = errors.New(`Missing collection name.`)
ErrCollectionDoesNotExists = errors.New(`Collection does not exists.`)
ErrCollectionDoesNotExist = errors.New(`Collection does not exists.`)
ErrSockerOrHost = errors.New(`You may connect either to a unix socket or a tcp address, but not both.`)
ErrQueryLimitParam = errors.New(`A query can accept only one db.Limit() parameter.`)
ErrQuerySortParam = errors.New(`A query can accept only one db.Sort{} parameter.`)
......@@ -46,4 +46,7 @@ var (
ErrUnsupported = errors.New(`This action is currently unsupported on this database.`)
ErrQueryIsPending = errors.New(`Can't execute this instruction while the result set is still open.`)
ErrUnsupportedDestination = errors.New(`Unsupported destination type.`)
// Deprecated but kept for backwards compatibility. See: https://github.com/upper/db/issues/18
ErrCollectionDoesNotExists = ErrCollectionDoesNotExist
)
......@@ -395,7 +395,7 @@ func TestSimpleCRUD(t *testing.T) {
col, err := sess.Collection(`birthdays`)
if err != nil {
if wrapper == `mongo` && err == db.ErrCollectionDoesNotExists {
if wrapper == `mongo` && err == db.ErrCollectionDoesNotExist {
// Expected error with mongodb.
} else {
t.Fatalf(`Could not use collection with wrapper %s: %s`, wrapper, err.Error())
......@@ -513,7 +513,7 @@ func TestFibonacci(t *testing.T) {
col, err = sess.Collection("fibonacci")
if err != nil {
if wrapper == `mongo` && err == db.ErrCollectionDoesNotExists {
if wrapper == `mongo` && err == db.ErrCollectionDoesNotExist {
// Expected error with mongodb.
} else {
t.Fatalf(`Could not use collection with wrapper %s: %s`, wrapper, err.Error())
......@@ -697,7 +697,7 @@ func TestEven(t *testing.T) {
col, err = sess.Collection("is_even")
if err != nil {
if wrapper == `mongo` && err == db.ErrCollectionDoesNotExists {
if wrapper == `mongo` && err == db.ErrCollectionDoesNotExist {
// Expected error with mongodb.
} else {
t.Fatalf(`Could not use collection with wrapper %s: %s`, wrapper, err.Error())
......
......@@ -37,7 +37,7 @@ func main() {
birthdayCollection, err := sess.Collection("birthdays")
if err != nil {
if err != db.ErrCollectionDoesNotExists {
if err != db.ErrCollectionDoesNotExist {
log.Fatalf("Could not use collection: %q\n", err)
}
} else {
......
......@@ -206,7 +206,7 @@ func (self *Source) Collection(names ...string) (db.Collection, error) {
col.DB = self
if col.Exists() == false {
err = db.ErrCollectionDoesNotExists
err = db.ErrCollectionDoesNotExist
}
return col, err
......
......@@ -167,7 +167,7 @@ func TestAppend(t *testing.T) {
if err != nil {
// We can use the collection even if it does not exists.
if err != db.ErrCollectionDoesNotExists {
if err != db.ErrCollectionDoesNotExist {
t.Fatal(err)
}
}
......
......@@ -356,13 +356,13 @@ func (self *Source) tableExists(names ...string) error {
}, self.config.Database, name)
if err != nil {
return db.ErrCollectionDoesNotExists
return db.ErrCollectionDoesNotExist
}
defer rows.Close()
if rows.Next() == false {
return db.ErrCollectionDoesNotExists
return db.ErrCollectionDoesNotExist
}
}
......
......@@ -368,13 +368,13 @@ func (self *Source) tableExists(names ...string) error {
}, self.config.Database, name)
if err != nil {
return db.ErrCollectionDoesNotExists
return db.ErrCollectionDoesNotExist
}
defer rows.Close()
if rows.Next() == false {
return db.ErrCollectionDoesNotExists
return db.ErrCollectionDoesNotExist
}
}
......
......@@ -378,13 +378,13 @@ func (self *Source) tableExists(names ...string) error {
}, name)
if err != nil {
return db.ErrCollectionDoesNotExists
return db.ErrCollectionDoesNotExist
}
defer rows.Close()
if rows.Next() == false {
return db.ErrCollectionDoesNotExists
return db.ErrCollectionDoesNotExist
}
}
......
......@@ -350,13 +350,13 @@ func (self *Source) tableExists(names ...string) error {
}, `table`, name)
if err != nil {
return db.ErrCollectionDoesNotExists
return db.ErrCollectionDoesNotExist
}
defer rows.Close()
if rows.Next() == false {
return db.ErrCollectionDoesNotExists
return db.ErrCollectionDoesNotExist
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment