db

package
v0.0.0-...-76f9891 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2017 License: MPL-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package db genereated with github.com/microo8/mimir DO NOT MODIFY!

Index

Constants

View Source
const (
	IntMin = 0x80

	IntMax = 0xfd
)

Constants for int encoding

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB struct {
	Persons *PersonCollection
	// contains filtered or unexported fields
}

DB handler to the db

func OpenDB

func OpenDB(path string) (*DB, error)

OpenDB opens the database

func (*DB) Close

func (db *DB) Close() error

Close closes the database

type Iter

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

Iter implemenst basic iterator functions

func (*Iter) ID

func (it *Iter) ID() int

ID returns id of object

func (*Iter) Next

func (it *Iter) Next() bool

Next sets the iterator to the next object, or returns false

func (*Iter) Release

func (it *Iter) Release()

Release closes the iterator

type IterIndexPerson

type IterIndexPerson struct {
	IterPerson
}

IterIndexPerson iterates trough an index for Person in db

func (*IterIndexPerson) Value

func (it *IterIndexPerson) Value() (*Person, error)

Value returns the Person on witch is the iterator

type IterPerson

type IterPerson struct {
	*Iter
	// contains filtered or unexported fields
}

IterPerson iterates trough all Person in db

func (*IterPerson) Value

func (it *IterPerson) Value() (*Person, error)

Value returns the Person on witch is the iterator

type Person

type Person struct {
	Name string
	Age  int `index:"Age"`
}

Person ...

type PersonCollection

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

PersonCollection represents the collection of Persons

func (*PersonCollection) Add

func (col *PersonCollection) Add(obj *Person) (int, error)

Add inserts new Person to the db

func (*PersonCollection) AgeEq

func (col *PersonCollection) AgeEq(val int) *IterIndexPerson

AgeEq iterates trough Person Age index with equal values

func (*PersonCollection) AgeRange

func (col *PersonCollection) AgeRange(start, limit *int) *IterIndexPerson

AgeRange iterates trough Person Age index in the specified range

func (*PersonCollection) All

func (col *PersonCollection) All() *IterPerson

All returns an iterator witch iterates trough all Persons

func (*PersonCollection) Delete

func (col *PersonCollection) Delete(id int) error

Delete remoces Person from the db with specified id

func (*PersonCollection) Get

func (col *PersonCollection) Get(id int) (*Person, error)

Get returns Person with specified id or an error

func (*PersonCollection) Update

func (col *PersonCollection) Update(id int, obj *Person) error

Update updates Person with specified id

Jump to

Keyboard shortcuts

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