Beispiel #1
0
// Threads returns the threads matching the query.
func (q *Query) Threads() (*Threads, error) {
	var cthreads *C.notmuch_threads_t
	err := statusErr(C.notmuch_query_search_threads_st(q.toC(), &cthreads))
	if err != nil {
		return nil, err
	}
	threads := &Threads{
		cptr:   unsafe.Pointer(cthreads),
		parent: (*cStruct)(q),
	}
	setGcClose(threads)
	return threads, nil
}
Beispiel #2
0
func (q *Query) SearchThreads() (*Threads, error) {
	threads := &Threads{query: q}
	cthreads := (**C.notmuch_threads_t)(unsafe.Pointer(&threads.cptr))
	cerr := C.notmuch_query_search_threads_st(q.toC(), cthreads)
	err := statusErr(cerr)
	if err != nil {
		return nil, err
	}
	runtime.SetFinalizer(threads, func(t *Threads) {
		C.notmuch_threads_destroy(t.toC())
	})
	return threads, nil
}