func (db *DB) QueryCreate(queryString string) *Query { cstr := C.CString(queryString) defer C.free(unsafe.Pointer(cstr)) cquery := C.notmuch_query_create(db.toC(), cstr) query := &Query{ cptr: cquery, db: db, } runtime.SetFinalizer(query, func(q *Query) { C.notmuch_query_destroy(q.toC()) }) return query }
/* Destroy a notmuch_query_t along with any associated resources. * * This will in turn destroy any notmuch_threads_t and * notmuch_messages_t objects generated by this query, (and in * turn any notmuch_thread_t and notmuch_message_t objects generated * from those results, etc.), if such objects haven't already been * destroyed. */ func (self *Query) Destroy() { if self.query != nil { C.notmuch_query_destroy(self.query) } }
func (q *Query) Close() error { return (*cStruct)(q).doClose(func() error { C.notmuch_query_destroy(q.toC()) return nil }) }