File: document.go

package info (click to toggle)
golang-github-pzhin-go-sophia 0.0~git20180715.8bdc218-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 924 kB
  • sloc: ansic: 23,001; makefile: 4
file content (26 lines) | stat: -rw-r--r-- 524 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package sophia

import (
	"errors"
	"unsafe"
)

// Document is a representation of a row in a database.
// Destroy should be called after Document usage.
type Document struct {
	*varStore
}

func newDocument(ptr unsafe.Pointer, size int) *Document {
	return &Document{
		varStore: newVarStore(ptr, size),
	}
}

// Destroy call C function that releases all resources associated with the Document
func (d *Document) Destroy() error {
	if !spDestroy(d.ptr) {
		return errors.New("document: failed to destroy")
	}
	return nil
}