Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
9
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
Open sidebar
pushrocks
smartdata
Compare Revisions
v2.0.3...v2.0.4
Commits (2)
docs(README): update
· aca9817c
Phil Kunz
authored
Jan 14, 2018
aca9817c
2.0.4
· 3d8f8646
Phil Kunz
authored
Jan 14, 2018
3d8f8646
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
10 deletions
+12
-10
README.md
README.md
+10
-8
package-lock.json
package-lock.json
+1
-1
package.json
package.json
+1
-1
No files found.
README.md
View file @
3d8f8646
...
...
@@ -47,7 +47,7 @@ How RethinkDB's terms map to the ones of smartdata:
represents a Database. Naturally it has .connect() etc. methods on it.
```
java
script
```
type
script
import
*
as
smartdata
from
"
smartdata
"
;
let
myRethinkDb1
=
new
smartdata
.
Db
({
...
...
@@ -64,19 +64,18 @@ A collection is defined by the object class (that is extending smartdata.dbdoc)
So to get to get access to a specific collection you document
```
java
script
```
type
script
// continues from the block before...
@
Collection
(
myRethinkDb1
)
@
smartdata
.
Table
(
myRethinkDb1
)
class
MyObject
extends
smartdata
.
DbDoc
<
myObject
>
{
// read the next block about DbDoc
@
smartdata
.
svDb
()
property1
:
string
;
// @smartdata.svDb() marks the property for db save
property2
:
number
;
// this one is not marked, so it won't be save upon calling this.save()
constructor
(
optionsArg
:
{
property1
:
string
,
property2
:
number
})
{
constructor
(
optionsArg
:
{
property1
:
string
;
property2
:
number
})
{
super
();
}
}
let
myCollection
=
myRethinkDb1
.
getCollectionByName
<
myObject
>
myObject
;
// start to instantiate instances of classes from scratch or database
...
...
@@ -85,10 +84,13 @@ let localObject = new MyObject({
property2
:
2
});
localObject
.
save
();
// saves the object to the database
```
> Alert: You NEVER instantiate a collection.
> This is done for you!!!
// start retrieving instances
MyObject
.
getInstance
<
MyObject
>
({
property
:
"
hi
"
});
// outputs a new instance of MyObject with the values from db assigned
```
### class DbDoc
...
...
package-lock.json
View file @
3d8f8646
{
"name"
:
"smartdata"
,
"version"
:
"2.0.
3
"
,
"version"
:
"2.0.
4
"
,
"lockfileVersion"
:
1
,
"requires"
:
true
,
"dependencies"
:
{
...
...
package.json
View file @
3d8f8646
{
"name"
:
"smartdata"
,
"version"
:
"2.0.
3
"
,
"version"
:
"2.0.
4
"
,
"description"
:
"do more with data"
,
"main"
:
"dist/index.js"
,
"typings"
:
"dist/index.d.ts"
,
...
...