Esempio n. 1
0
// Returns true or false, depending on whether the specified key exists in the
// database.
func (db *Database) Exists(key string) bool {
	kcs := C.CString(key)
	k := C.mk_datum(kcs)
	defer C.free(unsafe.Pointer(kcs))

	e := C.gdbm_exists(db.dbf, k)
	if e == 1 {
		return true
	}
	return false
}
Esempio n. 2
0
// Returns true if the specified key is found in the database.
func (d *Database) Exists(key []byte) bool {
	ret := C.gdbm_exists(d.dbf, toDatum(key))
	return ret != 0
}