]> git.notmuchmail.org Git - notmuch/blobdiff - bindings/go/src/notmuch/notmuch.go
Merge tag '0.18.2_rc1'
[notmuch] / bindings / go / src / notmuch / notmuch.go
index 12de4c8da0a39ce5634039e1ca69a70b3bedd2c0..b9230ad2c3455852724b3ea6b3ed2287acb65ecb 100644 (file)
@@ -144,8 +144,8 @@ func OpenDatabase(path string, mode DatabaseMode) (*Database, Status) {
 
 /* Close the given notmuch database, freeing all associated
  * resources. See notmuch_database_open. */
-func (self *Database) Close() {
-       C.notmuch_database_destroy(self.db)
+func (self *Database) Close() Status {
+       return Status(C.notmuch_database_destroy(self.db))
 }
 
 /* Return the database path of the given database.
@@ -191,19 +191,20 @@ func (self *Database) NeedsUpgrade() bool {
  *
  * Can return NULL if a Xapian exception occurs.
  */
-func (self *Database) GetDirectory(path string) *Directory {
+func (self *Database) GetDirectory(path string) (*Directory, Status) {
        var c_path *C.char = C.CString(path)
        defer C.free(unsafe.Pointer(c_path))
 
        if c_path == nil {
-               return nil
+               return nil, STATUS_OUT_OF_MEMORY
        }
 
-       c_dir := C.notmuch_database_get_directory(self.db, c_path)
-       if c_dir == nil {
-               return nil
+       var c_dir *C.notmuch_directory_t
+       st := Status(C.notmuch_database_get_directory(self.db, c_path, &c_dir))
+       if st != STATUS_SUCCESS || c_dir == nil {
+               return nil, st
        }
-       return &Directory{dir: c_dir}
+       return &Directory{dir: c_dir}, st
 }
 
 /* Add a new message to the given notmuch database.