当前位置: 首页>>代码示例>>Golang>>正文


Golang clownfish.TrapErr函数代码示例

本文整理汇总了Golang中git-wip-us/apache/org/repos/asf/lucy-clownfish/git/runtime/go/clownfish.TrapErr函数的典型用法代码示例。如果您正苦于以下问题:Golang TrapErr函数的具体用法?Golang TrapErr怎么用?Golang TrapErr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了TrapErr函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: DeleteByQuery

func (obj *IndexerIMP) DeleteByQuery(query Query) error {
	return clownfish.TrapErr(func() {
		self := (*C.lucy_Indexer)(clownfish.Unwrap(obj, "obj"))
		queryC := (*C.lucy_Query)(clownfish.Unwrap(query, "query"))
		C.LUCY_Indexer_Delete_By_Query(self, queryC)
	})
}
开发者ID:rlugojr,项目名称:lucy,代码行数:7,代码来源:index.go

示例2: OpenIndexer

func OpenIndexer(args *OpenIndexerArgs) (obj Indexer, err error) {
	var schemaC *C.lucy_Schema = nil
	if args.Schema != nil {
		schemaC = (*C.lucy_Schema)(unsafe.Pointer(args.Schema.TOPTR()))
	}
	switch args.Index.(type) {
	case string:
	default:
		panic("TODO: support Folder")
	}
	ixLoc := clownfish.NewString(args.Index.(string))
	var managerC *C.lucy_IndexManager = nil
	if args.Manager != nil {
		managerC = (*C.lucy_IndexManager)(unsafe.Pointer(args.Manager.TOPTR()))
	}
	var flags int32
	if args.Create {
		flags = flags | int32(C.lucy_Indexer_CREATE)
	}
	if args.Truncate {
		flags = flags | int32(C.lucy_Indexer_TRUNCATE)
	}
	err = clownfish.TrapErr(func() {
		cfObj := C.lucy_Indexer_new(schemaC,
			(*C.cfish_Obj)(unsafe.Pointer(ixLoc.TOPTR())),
			managerC, C.int32_t(flags))
		obj = WRAPIndexer(unsafe.Pointer(cfObj))
	})
	return obj, err
}
开发者ID:kidaa,项目名称:lucy,代码行数:30,代码来源:index.go

示例3: readRecord

func (s *StepperIMP) readRecord(instream InStream) error {
	return clownfish.TrapErr(func() {
		self := (*C.lucy_Stepper)(clownfish.Unwrap(s, "s"))
		instreamCF := (*C.lucy_InStream)(clownfish.Unwrap(instream, "instream"))
		C.LUCY_Stepper_Read_Record(self, instreamCF)
	})
}
开发者ID:rlugojr,项目名称:lucy,代码行数:7,代码来源:util.go

示例4: Absorb

func (out *OutStreamIMP) Absorb(in InStream) error {
	return clownfish.TrapErr(func() {
		self := (*C.lucy_OutStream)(clownfish.Unwrap(out, "out"))
		inStreamC := (*C.lucy_InStream)(clownfish.Unwrap(in, "in"))
		C.LUCY_OutStream_Absorb(self, inStreamC)
	})
}
开发者ID:rlugojr,项目名称:lucy,代码行数:7,代码来源:store.go

示例5: DeleteSegment

func (d *DataWriterIMP) DeleteSegment(reader SegReader) error {
	return clownfish.TrapErr(func() {
		self := (*C.lucy_DataWriter)(clownfish.Unwrap(d, "d"))
		readerCF := (*C.lucy_SegReader)(clownfish.Unwrap(reader, "reader"))
		C.LUCY_DataWriter_Delete_Segment(self, readerCF)
	})
}
开发者ID:rlugojr,项目名称:lucy,代码行数:7,代码来源:index.go

示例6: addDocObj

func (obj *IndexerIMP) addDocObj(doc Doc, boost float32) error {
	self := (*C.lucy_Indexer)(clownfish.Unwrap(obj, "obj"))
	d := (*C.lucy_Doc)(clownfish.Unwrap(doc, "doc"))
	return clownfish.TrapErr(func() {
		C.LUCY_Indexer_Add_Doc(self, d, C.float(boost))
	})
}
开发者ID:rlugojr,项目名称:lucy,代码行数:7,代码来源:index.go

示例7: ReadFile

func (s *SegmentIMP) ReadFile(folder Folder) error {
	return clownfish.TrapErr(func() {
		self := (*C.lucy_Segment)(clownfish.Unwrap(s, "s"))
		folderC := (*C.lucy_Folder)(clownfish.Unwrap(folder, "folder"))
		C.LUCY_Seg_Read_File(self, folderC)
	})
}
开发者ID:rlugojr,项目名称:lucy,代码行数:7,代码来源:index.go

示例8: AddDoc

func (s *SegWriterIMP) AddDoc(doc Doc, boost float32) error {
	return clownfish.TrapErr(func() {
		self := (*C.lucy_SegWriter)(clownfish.Unwrap(s, "s"))
		docCF := (*C.lucy_Doc)(clownfish.Unwrap(doc, "doc"))
		C.LUCY_SegWriter_Add_Doc(self, docCF, C.float(boost))
	})
}
开发者ID:rlugojr,项目名称:lucy,代码行数:7,代码来源:index.go

示例9: addInvertedDoc

func (d *DataWriterIMP) addInvertedDoc(inverter Inverter, docId int32) error {
	return clownfish.TrapErr(func() {
		self := (*C.lucy_DataWriter)(clownfish.Unwrap(d, "d"))
		inverterCF := (*C.lucy_Inverter)(clownfish.Unwrap(inverter, "inverter"))
		C.LUCY_DataWriter_Add_Inverted_Doc(self, inverterCF, C.int32_t(docId))
	})
}
开发者ID:rlugojr,项目名称:lucy,代码行数:7,代码来源:index.go

示例10: ReadCU32

func (in *InStreamIMP) ReadCU32() (uint32, error) {
	var retval uint32
	err := clownfish.TrapErr(func() {
		self := (*C.lucy_InStream)(clownfish.Unwrap(in, "in"))
		retval = uint32(C.LUCY_InStream_Read_CU32(self))
	})
	return retval, err
}
开发者ID:rlugojr,项目名称:lucy,代码行数:8,代码来源:store.go

示例11: FetchDoc

func (d *DocReaderIMP) FetchDoc(docID int32) (doc HitDoc, err error) {
	err = clownfish.TrapErr(func() {
		self := (*C.lucy_DocReader)(clownfish.Unwrap(d, "d"))
		docC := C.LUCY_DocReader_Fetch_Doc(self, C.int32_t(docID))
		doc = WRAPHitDoc(unsafe.Pointer(docC))
	})
	return doc, err
}
开发者ID:rlugojr,项目名称:lucy,代码行数:8,代码来源:index.go

示例12: AddIndex

func (obj *IndexerIMP) AddIndex(index interface{}) error {
	return clownfish.TrapErr(func() {
		self := (*C.lucy_Indexer)(clownfish.Unwrap(obj, "obj"))
		indexC := (*C.cfish_Obj)(clownfish.GoToClownfish(index, unsafe.Pointer(C.CFISH_OBJ), false))
		defer C.cfish_decref(unsafe.Pointer(indexC))
		C.LUCY_Indexer_Add_Index(self, indexC)
	})
}
开发者ID:rlugojr,项目名称:lucy,代码行数:8,代码来源:index.go

示例13: fetchDocVec

func (s *SearcherIMP) fetchDocVec(docID int32) (dv DocVector, err error) {
	err = clownfish.TrapErr(func() {
		self := (*C.lucy_Searcher)(clownfish.Unwrap(s, "s"))
		dvC := C.LUCY_Searcher_Fetch_Doc_Vec(self, C.int32_t(docID))
		dv = WRAPDocVector(unsafe.Pointer(dvC))
	})
	return dv, err
}
开发者ID:rlugojr,项目名称:lucy,代码行数:8,代码来源:search.go

示例14: Consolidate

func (f *FolderIMP) Consolidate(path string) error {
	return clownfish.TrapErr(func() {
		self := (*C.lucy_Folder)(clownfish.Unwrap(f, "f"))
		pathC := (*C.cfish_String)(clownfish.GoToClownfish(path, unsafe.Pointer(C.CFISH_STRING), false))
		defer C.cfish_decref(unsafe.Pointer(pathC))
		C.LUCY_Folder_Consolidate(self, pathC)
	})
}
开发者ID:rlugojr,项目名称:lucy,代码行数:8,代码来源:store.go

示例15: ReadF64

func (in *InStreamIMP) ReadF64() (float64, error) {
	var retval float64
	err := clownfish.TrapErr(func() {
		self := (*C.lucy_InStream)(clownfish.Unwrap(in, "in"))
		retval = float64(C.LUCY_InStream_Read_F64(self))
	})
	return retval, err
}
开发者ID:rlugojr,项目名称:lucy,代码行数:8,代码来源:store.go


注:本文中的git-wip-us/apache/org/repos/asf/lucy-clownfish/git/runtime/go/clownfish.TrapErr函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。