CreDB  0.1.0
Public Member Functions | List of all members
credb.Collection Class Reference

Handle to access and modify a collection A collection corresponds to a "table" in RDBMs. More...

Public Member Functions

def add (path, doc)
 Increment the vale of an object. More...
 
def call ()
 Call a function that is stored as an object on the server. More...
 
def clear ()
 Remove all objects stored in this collection.
 
def count ()
 Return the number of objects in this collection matching a specified predicate. More...
 
def create_index (name, paths)
 Create a secondary index for this collection This index will cover all objects containing the paths specified. More...
 
def diff ()
 Get the changes between two versions of the same object. More...
 
def drop_index (name)
 Remove the specified secondary index. More...
 
def find (predicates, projection, limit)
 find all objects that fit a predicate More...
 
def find_one (predicates, projection)
 returns the first object that fits a predicate More...
 
def get (key)
 Get a value of an object. More...
 
def get_history ()
 Get the history of changes to a specified object.
 
def put (key, doc)
 Insert or update the value of an object. More...
 
def put_code (key, code)
 Create a new object holding executable code. More...
 
def put_code_from_file (key, filename)
 Create a new object holding executable code loaded from a specified file. More...
 
def put_from_file (key, filename)
 Insert or update an object to store the contents in a file. More...
 
def remove (key, key)
 Remove an object from the collection. More...
 

Detailed Description

Handle to access and modify a collection A collection corresponds to a "table" in RDBMs.

Member Function Documentation

◆ add()

def credb.Collection.add (   path,
  doc 
)

Increment the vale of an object.

Parameters
pathThe path of the object. Should be of form "name[.field]*"
docThe value to be incremented with. Should either be numeric or string (strings will be appened)

◆ call()

def credb.Collection.call ( )

Call a function that is stored as an object on the server.

If the function executes successfully the return value of this call will be the return value of the serve side function. Otherwise, this call will throw an exception.

◆ count()

def credb.Collection.count ( )

Return the number of objects in this collection matching a specified predicate.

Return the number of objects in this collection matching a specified predicate

◆ create_index()

def credb.Collection.create_index (   name,
  paths 
)

Create a secondary index for this collection This index will cover all objects containing the paths specified.

Parameters
nameThe identifier of the index. Must be unique for this collection
pathsThe paths the index will cover

◆ diff()

def credb.Collection.diff ( )

Get the changes between two versions of the same object.

Get the changes between two versions of the same object

◆ drop_index()

def credb.Collection.drop_index (   name)

Remove the specified secondary index.

Parameters
nameThe identifier of the index to be removed

◆ find()

def credb.Collection.find (   predicates,
  projection,
  limit 
)

find all objects that fit a predicate

Parameters
predicates[optional] the object has to match all specified predicates. if no predicate is specified all objects in the collection are returned.
projection[optional] only return the fields specified
limit[optional] only return up to a certain number of objects

◆ find_one()

def credb.Collection.find_one (   predicates,
  projection 
)

returns the first object that fits a predicate

Parameters
predicates[optional] the object has to match all specified predicates
projection[optional] only return the fields specified

◆ get()

def credb.Collection.get (   key)

Get a value of an object.

Parameters
keyThe primary key of the object

◆ put()

def credb.Collection.put (   key,
  doc 
)

Insert or update the value of an object.

Parameters
keyThe path of the object. Should be of form "name[.field]*"
docThe value to be stored

◆ put_code()

def credb.Collection.put_code (   key,
  code 
)

Create a new object holding executable code.

Parameters
keyThe key to store the new object in
codeSource code of the code to be stored. Will be compiled to byte code on the client side.

◆ put_code_from_file()

def credb.Collection.put_code_from_file (   key,
  filename 
)

Create a new object holding executable code loaded from a specified file.

Parameters
keyThe key to store the new object in
filenameName of the file that contains the sourcecode

◆ put_from_file()

def credb.Collection.put_from_file (   key,
  filename 
)

Insert or update an object to store the contents in a file.

Parameters
keyThe identifier of the object
filenameName of the file containing the JSON data

◆ remove()

def credb.Collection.remove (   key,
  key 
)

Remove an object from the collection.

Parameters
keyThe identifier of the object to be removed

Remove an object from the collection

Parameters
keyThe identifier of the object to be removed

The documentation for this class was generated from the following file: