本文整理匯總了Golang中C.lucy_Doc_IVARS函數的典型用法代碼示例。如果您正苦於以下問題:Golang lucy_Doc_IVARS函數的具體用法?Golang lucy_Doc_IVARS怎麽用?Golang lucy_Doc_IVARS使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了lucy_Doc_IVARS函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: GOLUCY_Doc_Equals
//export GOLUCY_Doc_Equals
func GOLUCY_Doc_Equals(d *C.lucy_Doc, other *C.cfish_Obj) C.bool {
twin := (*C.lucy_Doc)(unsafe.Pointer(other))
if twin == d {
return true
}
if !C.cfish_Obj_is_a(other, C.LUCY_DOC) {
return false
}
ivars := C.lucy_Doc_IVARS(d)
ovars := C.lucy_Doc_IVARS(twin)
hash := (*C.cfish_Hash)(ivars.fields)
otherHash := (*C.cfish_Obj)(ovars.fields)
return C.CFISH_Hash_Equals(hash, otherHash)
}
示例2: GOLUCY_Doc_Serialize
//export GOLUCY_Doc_Serialize
func GOLUCY_Doc_Serialize(d *C.lucy_Doc, outstream *C.lucy_OutStream) {
ivars := C.lucy_Doc_IVARS(d)
fields := fetchDocFields(d)
hash := clownfish.GoToClownfish(fields, unsafe.Pointer(C.CFISH_HASH), false)
defer C.cfish_decref(hash)
C.lucy_Freezer_serialize_hash((*C.cfish_Hash)(hash), outstream)
C.LUCY_OutStream_Write_C32(outstream, C.uint32_t(ivars.doc_id))
}
示例3: SetFields
func (d *DocIMP) SetFields(fields map[string]interface{}) {
self := (*C.lucy_Doc)(clownfish.Unwrap(d, "d"))
ivars := C.lucy_Doc_IVARS(self)
oldID := uintptr(unsafe.Pointer(ivars.fields))
newFieldsID := registry.store(fields)
ivars.fields = unsafe.Pointer(newFieldsID)
registry.delete(oldID)
}
示例4: fetchDocFields
func fetchDocFields(d *C.lucy_Doc) map[string]interface{} {
ivars := C.lucy_Doc_IVARS(d)
fieldsID := uintptr(ivars.fields)
fieldsGo, ok := registry.fetch(fieldsID).(map[string]interface{})
if !ok {
panic(clownfish.NewErr(fmt.Sprintf("Failed to fetch doc %d from registry ", fieldsID)))
}
return fieldsGo
}
示例5: GOLUCY_Doc_Deserialize
//export GOLUCY_Doc_Deserialize
func GOLUCY_Doc_Deserialize(d *C.lucy_Doc, instream *C.lucy_InStream) *C.lucy_Doc {
ivars := C.lucy_Doc_IVARS(d)
hash := unsafe.Pointer(C.lucy_Freezer_read_hash(instream))
defer C.cfish_decref(hash)
fields := clownfish.ToGo(hash)
fieldsID := registry.store(fields)
ivars.fields = unsafe.Pointer(fieldsID)
ivars.doc_id = C.int32_t(C.LUCY_InStream_Read_C32(instream))
return d
}
示例6: GOLUCY_Doc_init
//export GOLUCY_Doc_init
func GOLUCY_Doc_init(d *C.lucy_Doc, fields unsafe.Pointer, docID C.int32_t) *C.lucy_Doc {
ivars := C.lucy_Doc_IVARS(d)
if fields != nil {
ivars.fields = unsafe.Pointer(C.cfish_inc_refcount(fields))
} else {
ivars.fields = unsafe.Pointer(C.cfish_Hash_new(0))
}
ivars.doc_id = docID
return d
}
示例7: GOLUCY_Doc_init
//export GOLUCY_Doc_init
func GOLUCY_Doc_init(d *C.lucy_Doc, fields unsafe.Pointer, docID C.int32_t) *C.lucy_Doc {
ivars := C.lucy_Doc_IVARS(d)
if fields == nil {
fieldsGo := make(map[string]interface{})
fieldsID := registry.store(fieldsGo)
ivars.fields = unsafe.Pointer(fieldsID)
} else {
ivars.fields = fields
}
ivars.doc_id = docID
return d
}
示例8: GOLUCY_Doc_Destroy
//export GOLUCY_Doc_Destroy
func GOLUCY_Doc_Destroy(d *C.lucy_Doc) {
ivars := C.lucy_Doc_IVARS(d)
fieldsID := uintptr(ivars.fields)
registry.delete(fieldsID)
C.cfish_super_destroy(unsafe.Pointer(d), C.LUCY_DOC)
}
示例9: GOLUCY_Doc_Destroy
//export GOLUCY_Doc_Destroy
func GOLUCY_Doc_Destroy(d *C.lucy_Doc) {
ivars := C.lucy_Doc_IVARS(d)
C.cfish_decref(unsafe.Pointer(ivars.fields))
C.cfish_super_destroy(unsafe.Pointer(d), C.LUCY_DOC)
}
示例10: GOLUCY_Doc_Field_Names
//export GOLUCY_Doc_Field_Names
func GOLUCY_Doc_Field_Names(d *C.lucy_Doc) *C.cfish_Vector {
ivars := C.lucy_Doc_IVARS(d)
hash := (*C.cfish_Hash)(ivars.fields)
return C.CFISH_Hash_Keys(hash)
}
示例11: GOLUCY_Doc_Extract
//export GOLUCY_Doc_Extract
func GOLUCY_Doc_Extract(d *C.lucy_Doc, field *C.cfish_String) *C.cfish_Obj {
ivars := C.lucy_Doc_IVARS(d)
hash := (*C.cfish_Hash)(ivars.fields)
val := C.CFISH_Hash_Fetch(hash, field)
return C.cfish_inc_refcount(unsafe.Pointer(val))
}
示例12: GOLUCY_Doc_Deserialize
//export GOLUCY_Doc_Deserialize
func GOLUCY_Doc_Deserialize(d *C.lucy_Doc, instream *C.lucy_InStream) *C.lucy_Doc {
ivars := C.lucy_Doc_IVARS(d)
ivars.fields = unsafe.Pointer(C.lucy_Freezer_read_hash(instream))
ivars.doc_id = C.int32_t(C.LUCY_InStream_Read_C32(instream))
return d
}
示例13: GOLUCY_Doc_Serialize
//export GOLUCY_Doc_Serialize
func GOLUCY_Doc_Serialize(d *C.lucy_Doc, outstream *C.lucy_OutStream) {
ivars := C.lucy_Doc_IVARS(d)
hash := (*C.cfish_Hash)(ivars.fields)
C.lucy_Freezer_serialize_hash(hash, outstream)
C.LUCY_OutStream_Write_C32(outstream, C.uint32_t(ivars.doc_id))
}
示例14: GOLUCY_Doc_Store
//export GOLUCY_Doc_Store
func GOLUCY_Doc_Store(d *C.lucy_Doc, field *C.cfish_String, value *C.cfish_Obj) {
ivars := C.lucy_Doc_IVARS(d)
hash := (*C.cfish_Hash)(ivars.fields)
C.CFISH_Hash_Store(hash, field, C.cfish_inc_refcount(unsafe.Pointer(value)))
}
示例15: GOLUCY_Doc_Get_Size
//export GOLUCY_Doc_Get_Size
func GOLUCY_Doc_Get_Size(d *C.lucy_Doc) C.uint32_t {
ivars := C.lucy_Doc_IVARS(d)
hash := ((*C.cfish_Hash)(ivars.fields))
return C.uint32_t(C.CFISH_Hash_Get_Size(hash))
}