X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=bindings%2Fgo%2Fsrc%2Fnotmuch%2Fnotmuch.go;h=4d8c2ceb8113917f337b52e595a091847c2880d7;hb=6a833a6e83865f6999707cc30768d07e1351c2cb;hp=00bd53acc3cab3f8866553ce4a3abe85a5ac6208;hpb=cdaf253c9995fe00b096052ab85f0b8d5c010e7c;p=notmuch diff --git a/bindings/go/src/notmuch/notmuch.go b/bindings/go/src/notmuch/notmuch.go index 00bd53ac..4d8c2ceb 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. @@ -351,7 +351,7 @@ func (self *Database) GetAllTags() *Tags { * completely in the future, but it's likely to be a specialized * version of the general Xapian query syntax: * - * http://xapian.org/docs/queryparser.html + * https://xapian.org/docs/queryparser.html * * As a special case, passing either a length-zero string, (that is ""), * or a string consisting of a single asterisk (that is "*"), will @@ -801,7 +801,22 @@ func (self *Message) SetFlag(flag Flag, value bool) { C.notmuch_message_set_flag(self.message, C.notmuch_message_flag_t(flag), v) } -// TODO: wrap notmuch_message_get_date +/* Get the timestamp (seconds since the epoch) of 'message'. + * + * Return status: + * + * NOTMUCH_STATUS_SUCCESS: Timestamp successfully retrieved + * + * NOTMUCH_STATUS_NULL_POINTER: The 'message' argument is NULL + * + */ +func (self *Message) GetDate() (int64, Status) { + if self.message == nil { + return -1, STATUS_NULL_POINTER + } + timestamp := C.notmuch_message_get_date(self.message) + return int64(timestamp), STATUS_SUCCESS +} /* Get the value of the specified header from 'message'. *