db

package
v0.0.0-...-6637160 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CollectionPresentError = "Collection '%s' already exists."
)

Variables

This section is empty.

Functions

func AddCollection

func AddCollection(label string) error

Types

type Collection

type Collection struct {
	DB      *DB
	Label   string
	Records map[id.Id]*Record
}

func (*Collection) HasRecord

func (collection *Collection) HasRecord(id id.Id) bool

func (*Collection) Redistribute

func (collection *Collection) Redistribute()

type DB

type DB struct {
	ParentNode   node
	MasterNode   id.Id
	SiblingNodes []SiblingNode
	Collections  map[string]*Collection
}

func Get

func Get() *DB

func New

func New() *DB

func (*DB) AddCollection

func (db *DB) AddCollection(label string) error

func (*DB) CollectionExists

func (db *DB) CollectionExists(label string) bool

func (*DB) GetRecordCount

func (db *DB) GetRecordCount() int

func (*DB) GetSiblingNodes

func (db *DB) GetSiblingNodes() []SiblingNode

func (*DB) HasCollection

func (db *DB) HasCollection(label string) bool

func (*DB) Insert

func (db *DB) Insert(record *Record) (*Record, error)

func (*DB) ParodySpan

func (db *DB) ParodySpan() int

func (*DB) TriggerParodyRedistrobution

func (db *DB) TriggerParodyRedistrobution()

func (*DB) UsesParody

func (db *DB) UsesParody() bool

type Record

type Record struct {
	Collection      *Collection
	CollectionLabel string
	Id              id.Id
	Nodes           []id.Id
	Body            interface{}
	SyncService     interface{}
}

func Insert

func Insert(record *Record) (*Record, error)

func (*Record) Redistribute

func (record *Record) Redistribute()

type SiblingNode

type SiblingNode struct {
	Id          id.Id
	RecordCount int
}

func (SiblingNode) GetId

func (s SiblingNode) GetId() id.Id

func (SiblingNode) GetRecordCount

func (s SiblingNode) GetRecordCount() int

Jump to

Keyboard shortcuts

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