unqlite

package module
v0.0.0-...-d18a53e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 26, 2014 License: BSD-2-Clause Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	O_READONLY        uint = C.UNQLITE_OPEN_READONLY        /* Read only mode. Ok for [unqlite_open] */
	O_READWRITE       uint = C.UNQLITE_OPEN_READWRITE       /* Ok for [unqlite_open] */
	O_CREATE          uint = C.UNQLITE_OPEN_CREATE          /* Ok for [unqlite_open] */
	O_EXCLUSIVE       uint = C.UNQLITE_OPEN_EXCLUSIVE       /* VFS only */
	O_TEMP_DB         uint = C.UNQLITE_OPEN_TEMP_DB         /* VFS only */
	O_NOMUTEX         uint = C.UNQLITE_OPEN_NOMUTEX         /* Ok for [unqlite_open] */
	O_OMIT_JOURNALING uint = C.UNQLITE_OPEN_OMIT_JOURNALING /* Omit journaling for this database. Ok for [unqlite_open] */
	O_IN_MEMORY       uint = C.UNQLITE_OPEN_IN_MEMORY       /* An in memory database. Ok for [unqlite_open]*/
	O_MMAP            uint = C.UNQLITE_OPEN_MMAP            /* Obtain a memory view of the whole file. Ok for [unqlite_open] */
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrCode

type ErrCode int
const (
	OK             ErrCode = C.UNQLITE_OK             /* Successful result */
	NOMEM          ErrCode = C.UNQLITE_NOMEM          /* Out of memory */
	ABORT          ErrCode = C.UNQLITE_ABORT          /* Another thread have released this instance */
	IOERR          ErrCode = C.UNQLITE_IOERR          /* IO error */
	CORRUPT        ErrCode = C.UNQLITE_CORRUPT        /* Corrupt pointer */
	LOCKED         ErrCode = C.UNQLITE_LOCKED         /* Forbidden Operation */
	BUSY           ErrCode = C.UNQLITE_BUSY           /* The database file is locked */
	DONE           ErrCode = C.UNQLITE_DONE           /* Operation done */
	PERM           ErrCode = C.UNQLITE_PERM           /* Permission error */
	NOTIMPLEMENint ErrCode = C.UNQLITE_NOTIMPLEMENTED /* Method not implemented by the underlying Key/Value storage engine */
	NOTFOUND       ErrCode = C.UNQLITE_NOTFOUND       /* No such record */
	NOOP           ErrCode = C.UNQLITE_NOOP           /* No such method */
	INVALID        ErrCode = C.UNQLITE_INVALID        /* Invalid parameter */
	EOF            ErrCode = C.UNQLITE_EOF            /* End Of Input */
	UNKNOWN        ErrCode = C.UNQLITE_UNKNOWN        /* Unknown configuration option */
	LIMIT          ErrCode = C.UNQLITE_LIMIT          /* Database limit reached */
	EXISTS         ErrCode = C.UNQLITE_EXISTS         /* Record exists */
	EMPTY          ErrCode = C.UNQLITE_EMPTY          /* Empty record */
	COMPILE_ERRint ErrCode = C.UNQLITE_COMPILE_ERR    /* Compilation error */
	VM_ERR         ErrCode = C.UNQLITE_VM_ERR         /* Virtual machine error */
	FULL           ErrCode = C.UNQLITE_FULL           /* Full database (unlikely) */
	CANTOPEN       ErrCode = C.UNQLITE_CANTOPEN       /* Unable to open the database file */
	READ_ONLY      ErrCode = C.UNQLITE_READ_ONLY      /* Read only Key/Value storage engine */
	LOCKERR        ErrCode = C.UNQLITE_LOCKERR        /* Locking protocol error */
)

func (ErrCode) Error

func (err ErrCode) Error() string

type Unqlite

type Unqlite struct {
	// contains filtered or unexported fields
}

func OpenUnqlite

func OpenUnqlite(fileName string, mode uint) (*Unqlite, error)

Open a database and return unqite object. If fileName is ":mem:", then a private, in-memory database is created for the connection. See: http://unqlite.org/c_api/unqlite_open.html

func (*Unqlite) Close

func (u *Unqlite) Close() error

Close the database. See: http://unqlite.org/c_api/unqlite_close.html

func (*Unqlite) KvAppend

func (u *Unqlite) KvAppend(key []byte, value []byte) error

KvStore write a new record into the database. If the record does not exists, it is created. Otherwise, the new data chunk is appended to the end of the old chunk. See: http://unqlite.org/c_api/unqlite_kv_append.html

func (*Unqlite) KvDelete

func (u *Unqlite) KvDelete(key []byte) error

KvDelete remove a particular record from the database, you can use this high-level thread-safe routine to perform the deletion. See: http://unqlite.org/c_api/unqlite_kv_delete.html

func (*Unqlite) KvFetch

func (u *Unqlite) KvFetch(key []byte) ([]byte, error)

KvFetch a record from the database See: http://unqlite.org/c_api/unqlite_kv_fetch.html

func (*Unqlite) KvFetchCallback

func (u *Unqlite) KvFetchCallback(key []byte, f kvFetchCallbackFunc) error

TODO: temporary variables might be destroyed by GC?

func (*Unqlite) KvStore

func (u *Unqlite) KvStore(key []byte, value []byte) error

KvStore write a new record into the database. If the record does not exists, it is created. Otherwise, it is replaced. See: http://unqlite.org/c_api/unqlite_kv_store.html

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL