X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=bindings%2Fgo%2Fsrc%2Fnotmuch%2Fnotmuch.go;h=b9230ad2c3455852724b3ea6b3ed2287acb65ecb;hb=f5db7ad7d243785c274a99734c681e69d13313d0;hp=12de4c8da0a39ce5634039e1ca69a70b3bedd2c0;hpb=1952889353becc7b3bd254ea2695eca04bb9491f;p=notmuch diff --git a/bindings/go/src/notmuch/notmuch.go b/bindings/go/src/notmuch/notmuch.go index 12de4c8d..b9230ad2 100644 --- a/bindings/go/src/notmuch/notmuch.go +++ b/bindings/go/src/notmuch/notmuch.go @@ -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.