Example #1
0
// Returns the first row in the table that matches certain conditions.
func (t *SqliteTable) Find(terms ...interface{}) db.Item {

	var item db.Item

	terms = append(terms, db.Limit(1))

	result := t.invoke("FindAll", terms)

	if len(result) > 0 {
		response := result[0].Interface().([]db.Item)
		if len(response) > 0 {
			item = response[0]
		}
	}

	return item
}
Example #2
0
// Returns a document that matches all the provided conditions. db.Ordering of the terms doesn't matter but you must take in
// account that conditions are generally evaluated from left to right (or from top to bottom).
func (c *MongoDataSourceCollection) Find(terms ...interface{}) db.Item {

	var item db.Item

	terms = append(terms, db.Limit(1))

	result := c.invoke("FindAll", terms)

	if len(result) > 0 {
		response := result[0].Interface().([]db.Item)
		if len(response) > 0 {
			item = response[0]
		}
	}

	return item
}