Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Column ¶
Column represents a single column for a record.
type ColumnFamily ¶
type ColumnFamily struct { // Name is the name of the column family. Name []byte // Columns is a list of columns in the column family. Columns []Column }
ColumnFamily is a group of columns for a single record.
type DB ¶
type DB interface { // ListTables lists all the table names in the database. ListTables() [][]byte // GetOrCreateTable returns a table and creating it if id doesn't exist. GetOrCreateTable(name []byte) (Table, error) // DropTable drops a table from the database. DropTable(name []byte) error // Close closes the database for future reads and writes. Close() error }
DB is a small database abstraction built on top of Bolt DB modelled after Google's Big Table.
type Row ¶
type Row struct { // RowKey is the unique record ID. RowKey []byte // ColumnFamilies is a list of column families for a single row. ColumnFamilies []ColumnFamily }
Row represents a single record in a Table.
func (Row) GetColumnFamily ¶
func (r Row) GetColumnFamily(name []byte) (ColumnFamily, error)
GetColumnFamily returns a column family by name if it exists for this row. Otherwise an error is returned.
type Table ¶
type Table interface { // GetName returns the name of the table. GetName() []byte // WriteRows writes a list of rows to the table overwritting any existing values that overlap. WriteRows(r ...Row) error // WriteColumns writes a column to a row and column family returning an error if there is one. The row and column family // will be created if they do not exist. WriteColumns(r []byte, cf []byte, c ...Column) error // IncrementColumn increments the value of a column by one. If the row or column family does not exist, they will be // created and return an error if it fails. If the column does not exist, a value will be created to store an // unsigned 64-bit integer. If the existing value is not 8 bytes, an error will be returned. Otherwise the value will be // incremented. IncrementColumn(r, cf, c []byte, v int) error // ReadRow reads a single row from the table. Returns an error if the row does not exist. ReadRow(key []byte) (Row, error) // ScanRows scans a table for all rows with the given prefix. Note: All rows should be read from the channel to avoid memory leak. ScanRows(prefix []byte) chan Row // ScanColumns scans a row and column family for all columns with the given prefix. Note: All columns should be read from the channel to avoid memory leaks. ScanColumns(r, cf []byte, prefix []byte) chan Column }
Table represents a table in the database.
Click to show internal directories.
Click to hide internal directories.