Documentation
¶
Overview ¶
Provides file-backed collections.
File backing for collections. File format:
| kind: 2 (uint16) | size: 8 (uint64) | object: n (gob encoded) | ...
Provides file-backed list.
// // New list. list := fb.NewList()
// // Append an object. list.Append(object)
// // Iterate the list. itr := list.Iter()
for i := 0; i < itr.Len(); i++ {
person := itr.At(i)
...
}
// // Iterate the list. itr := list.Iter()
for i := 0; i < itr.Len(); i++ {
person := Person{}
itr.AtWith(i, &person))
...
}
// // Iterate the list. itr := list.Iter()
for {
object, hasNext := itr.Next()
if !hasNext {
break
}
...
}
// // Iterate the list. itr := list.Iter()
for object, hasNext := itr.Next(); hasNext; object, hasNext = itr.Next() {
...
}
// // Iterate the list. itr := list.Iter()
for {
person := Person{}
hasNext := itr.NextWith(&person))
if !hasNext {
break
}
...
}
Index ¶
Constants ¶
View Source
const (
Extension = ".fb"
)
File extension.
Variables ¶
View Source
var WorkingDir = "/tmp"
Working Directory.
Functions ¶
This section is empty.
Types ¶
type EmptyIterator ¶
type EmptyIterator struct {
}
Empty.
func (*EmptyIterator) At ¶ added in v0.4.6
func (*EmptyIterator) At(int) interface{}
Object at index.
func (*EmptyIterator) AtWith ¶ added in v0.4.6
func (*EmptyIterator) AtWith(int, interface{})
Object at index.
func (*EmptyIterator) NextWith ¶
func (*EmptyIterator) NextWith(object interface{}) bool
Next object.
type FbIterator ¶ added in v0.4.6
type FbIterator struct {
// Reader.
*Reader
// contains filtered or unexported fields
}
Iterator.
func (*FbIterator) Next ¶ added in v0.4.6
func (r *FbIterator) Next() (object interface{}, hasNext bool)
Next object.
func (*FbIterator) NextWith ¶ added in v0.4.6
func (r *FbIterator) NextWith(object interface{}) (hasNext bool)
Next object.
type Iterator ¶
type Iterator interface {
// Number of items.
Len() int
// Reverse.
Reverse()
// Object at index.
At(index int) interface{}
// Object at index (with).
AtWith(int, interface{})
// Next object.
Next() (interface{}, bool)
// Next object (with).
NextWith(object interface{}) bool
// Close the iterator.
Close()
}
Iterator. Read-only collection with stateful iteration.
type List ¶
type List struct {
// contains filtered or unexported fields
}
File-backed list.
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader.
Click to show internal directories.
Click to hide internal directories.