Class nnjl.licurgo.DataSource
Defined in: nnjl.licurgo.js.
| Constructor Attributes | Constructor Name and Description |
|---|---|
|
nnjl.licurgo.DataSource(props)
Creates a new Datasource
|
| Method Attributes | Method Name and Description |
|---|---|
|
createDataObject(typeName)
Create a new clean nnjl.licurgo.DataObject of the type defined by typeName
|
|
|
createQuery(typeName)
Create a nnjl.licurgo.Query
|
|
|
createTable(typeName, callback, table)
Create a table on the DataStore with the information defined in the nnjl.licurgo.Type
|
|
|
dropTable(typeName, callback, table)
Remove a table from the DataStore by its nnjl.licurgo.Type
|
|
|
get(typeName, key, callback, table)
Get a nnjl.licurgo.DataObject from the DataStore
|
|
|
getNewType(name)
Create a new empty type and store it on nnjl.licurgo.TypeRegistry
|
|
|
getPrimitiveType(type, size, nullable)
Create a @see nnjl.licurgo.PrimitiveType to define a property of a @see nnjl.licurgo.Type
|
|
|
Get a nnjl.licurgo.Transaction Object to fill with many nnjl.licurgo.TransactionStatement that will be executed in only one nnjl.licurgo.Transaction
|
|
|
getType(typeName)
Return a type by its names if it is store on the nnjl.licurgo.TypeRegistry
|
|
|
hasTable(typeName, callback, table)
Ask to the DataStore if one table exists on it or not
|
|
|
hasType(typeName)
Return true if the Type exist on the nnjl.licurgo.TypeRegistry
|
|
|
remove(dao, callback, table)
Remove a nnjl.licurgo.DataObject from the DataStore
|
|
|
removeById(key, callback, table, table)
Remove a nnjl.licurgo.DataObject in the DataStore
|
|
|
save(dao, callback, table)
Save a nnjl.licurgo.DataObject in the DataStore
|
|
|
select(query, callback)
Execute a select clause defined by the nnjl.licurgo.Query and return an array of nnjl.licurgo.DataObject.
|
|
|
shutdown()
Close the Datasource
|
Class Detail
nnjl.licurgo.DataSource(props)
Creates a new Datasource
- Parameters:
- {properties} props
- Configuration properties
Method Detail
{nnjl.licurgo.DataObject}
createDataObject(typeName)
Create a new clean nnjl.licurgo.DataObject of the type defined by typeName
- Parameters:
- {String} typeName
- Returns:
- {nnjl.licurgo.DataObject} New Clean nnjl.licurgo.DataObject if type exists else null.
{nnjl.licurgo.Query}
createQuery(typeName)
Create a nnjl.licurgo.Query
- Parameters:
- {String} typeName
- Returns:
- {nnjl.licurgo.Query} A new clean query
createTable(typeName, callback, table)
Create a table on the DataStore with the information defined in the nnjl.licurgo.Type
- Parameters:
- {String} typeName
- {Function} callback
- Function that will be called when the operation ends
- {String} table Optional
- pass the table name if it's different of Type.name
dropTable(typeName, callback, table)
Remove a table from the DataStore by its nnjl.licurgo.Type
- Parameters:
- {String} typeName
- {Function} callback
- Function that will be called when the operation ends
- {String} table Optional
- pass the table name if it's different of Type.name
get(typeName, key, callback, table)
Get a nnjl.licurgo.DataObject from the DataStore
- Parameters:
- {String} typeName
- {Object} key
- Primary key value
- {Function} callback
- function that will be called one licurgo has the nnjl.licurgo.DataObject. nnjl.licurgo.DataObject will be passed to the callback as a parameter
- {String} table Optional
- pass the table name if it's different of Type.name
getNewType(name)
Create a new empty type and store it on nnjl.licurgo.TypeRegistry
- Parameters:
- {String} name
getPrimitiveType(type, size, nullable)
Create a @see nnjl.licurgo.PrimitiveType to define a property of a @see nnjl.licurgo.Type
- Parameters:
- {String} type
- One of the type supported by licurgo that will be translated to the RDBMS types [string|int|double|date|boolean]
- {int} size
- max length of the type, usually goes with string type
- {boolean} nullable
- if it could have null value or not
{Transaction}
getTransaction()
Get a nnjl.licurgo.Transaction Object to fill with many nnjl.licurgo.TransactionStatement that will be executed in only one nnjl.licurgo.Transaction
- Returns:
- {Transaction} A nnjl.licurgo.Transaction without TransactionStatements
{nnjl.licurgo.Type}
getType(typeName)
Return a type by its names if it is store on the nnjl.licurgo.TypeRegistry
- Parameters:
- {String} typeName
- Returns:
- {nnjl.licurgo.Type} the type if exists on nnjl.licurgo.TypeRegistry otherwise an error so please, ask firts if the type exists or not
hasTable(typeName, callback, table)
Ask to the DataStore if one table exists on it or not
- Parameters:
- {String} typeName
- {Function} callback
- Function that will be called when the operation ends. It will receive true if the table exists.
- {String} table Optional
- pass the table name if it's different of Type.name
{boolean}
hasType(typeName)
Return true if the Type exist on the nnjl.licurgo.TypeRegistry
- Parameters:
- {String} typeName
- Returns:
- {boolean} true if type exists on nnjl.licurgo.TypeRegistry
remove(dao, callback, table)
Remove a nnjl.licurgo.DataObject from the DataStore
- Parameters:
- {nnjl.licurgo.DataObject} dao
- nnjl.licurgo.DataObject to be removed
- {Function} callback
- Callback function that will be called one licurgo removed the nnjl.licurgo.DataObject. The function will receive the number of nnjl.licurgo.DataObjects removed in the DataStore
- {String} table Optional
- pass the table name if it's different of Type.name
removeById(key, callback, table, table)
Remove a nnjl.licurgo.DataObject in the DataStore
- Parameters:
- {Object} key
- The nnjl.licurgo.DataObject primary key to be removed
- {Function} callback
- Callback function that will be called one licurgo saved the nnjl.licurgo.DataObject. The function will receive the number of nnjl.licurgo.DataObjects created in the DataStore
- {String} table Optional
- pass the table name if it's different of Type.name
- table
save(dao, callback, table)
Save a nnjl.licurgo.DataObject in the DataStore
- Parameters:
- {nnjl.licurgo.DataObject} dao
- {Function} callback
- Callback function that will be called one licurgo saved the nnjl.licurgo.DataObject. The function will receive the number of nnjl.licurgo.DataObjects created in the DataStore
- {String} table Optional
- pass the table name if it's different of Type.name
select(query, callback)
Execute a select clause defined by the nnjl.licurgo.Query and return an array of nnjl.licurgo.DataObject.
The select clause will be executed asynchronously by other thread so the result will be passed to the callback
when the query end.
- Parameters:
- {nnjl.licurgo.Query} query
- {Function} callback
- Pass the select results to the callback as a nnjl.licurgo.DataObject[]
shutdown()
Close the Datasource