• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang clownfish.TrapErr函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: Ordinal

func (s *SortCacheIMP) Ordinal(docId int32) (retval int32, err error) {
	err = clownfish.TrapErr(func() {
		self := (*C.lucy_SortCache)(clownfish.Unwrap(s, "s"))
		retvalCF := C.LUCY_SortCache_Ordinal(self, C.int32_t(docId))
		retval = int32(retvalCF)
	})
	return retval, err
}
开发者ID:rlugojr,项目名称:lucy,代码行数:8,代码来源:index.go


示例17: FetchDocVec

func (h *HighlightReaderIMP) FetchDocVec(docID int32) (retval DocVector, err error) {
	err = clownfish.TrapErr(func() {
		self := (*C.lucy_HighlightReader)(clownfish.Unwrap(h, "h"))
		retvalCF := C.LUCY_HLReader_Fetch_Doc_Vec(self, C.int32_t(docID))
		retval = WRAPDocVector(unsafe.Pointer(retvalCF))
	})
	return retval, err
}
开发者ID:rlugojr,项目名称:lucy,代码行数:8,代码来源:index.go


示例18: ReadI8

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


示例19: Value

func (s *SortCacheIMP) Value(ord int32) (retval interface{}, err error) {
	err = clownfish.TrapErr(func() {
		self := (*C.lucy_SortCache)(clownfish.Unwrap(s, "s"))
		retvalCF := C.LUCY_SortCache_Value(self, C.int32_t(ord))
		defer C.cfish_decref(unsafe.Pointer(retvalCF))
		retval = clownfish.ToGo(unsafe.Pointer(retvalCF))
	})
	return retval, err
}
开发者ID:rlugojr,项目名称:lucy,代码行数:9,代码来源:index.go


示例20: WriteString

func (out *OutStreamIMP) WriteString(content string) error {
	return clownfish.TrapErr(func() {
		self := (*C.lucy_OutStream)(clownfish.Unwrap(out, "out"))
		octets := C.CString(content)
		defer C.free(unsafe.Pointer(octets))
		size := len(content)
		C.LUCY_OutStream_Write_String(self, octets, C.size_t(size))
	})
}
开发者ID:rlugojr,项目名称:lucy,代码行数:9,代码来源:store.go



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang clownfish.Unwrap函数代码示例发布时间:2022-05-24
下一篇:
Golang clownfish.NewErr函数代码示例发布时间:2022-05-24
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap