cloudwow-not_relational 0.1.9 → 0.1.11
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +59 -1
- data/VERSION.yml +1 -1
- data/lib/not_relational/sdb_monkey_patch.rb +1 -1
- metadata +2 -3
data/README.rdoc
CHANGED
@@ -1,7 +1,65 @@
|
|
1
1
|
= not_relational
|
2
|
+
== Domain model persistance on non relational databases.
|
3
|
+
Not Relational is a really good thing that you really want. It is in fact a ruby library for declaring and persisting domain models. It is similiar in some ways to Active Record but is oriented towards non-relational databases such as Amazon's Simple DB service. In version 1.x only SDBRepository and the MemoryRepository (a self contained repository for tests and small apps) are implemented.
|
2
4
|
|
3
|
-
|
5
|
+
=== Configuration
|
6
|
+
Add a section such as this to your yaml configuration file.
|
7
|
+
example here
|
8
|
+
=== Rails configuration
|
9
|
+
* NonRelational will look for it's configuration in config/database.yml .
|
10
|
+
* If you will not be using ActiveREcord, turn it off.
|
11
|
+
* Add the following to application.rb (or application_controller.rb)
|
12
|
+
=== Non-rails configuration
|
13
|
+
NonRelational will first check for ./database.yml and then ./config/database.yml for configuration.
|
14
|
+
=== Declare your models
|
15
|
+
You domain model classes must inherit from NonRelational::DomainModel
|
16
|
+
class Thingee
|
17
|
+
# declare a primary key.
|
18
|
+
# NonRelational will set the id to a guid if you try to save it
|
19
|
+
# without an id.
|
20
|
+
property :id, :string, :primary_key=true
|
21
|
+
|
22
|
+
property :name, :string
|
23
|
+
property :title, :string
|
24
|
+
property :the_time, :date
|
25
|
+
property :index, :int
|
4
26
|
|
27
|
+
# Declare a text field if the string may be too large for SDB.
|
28
|
+
# text properties will be stored in large object storage which
|
29
|
+
# usually means Amazon's S3.
|
30
|
+
property :index, :text
|
31
|
+
|
32
|
+
#declare an index
|
33
|
+
index :name_and_index,[:name,index]
|
34
|
+
|
35
|
+
#declare a one-to-many relationship
|
36
|
+
has_many :Widget
|
37
|
+
|
38
|
+
#declare a many-to-one relationship
|
39
|
+
belongs_to :Person
|
40
|
+
end
|
41
|
+
|
42
|
+
=== Create and Save
|
43
|
+
thingee=Thingee.new()
|
44
|
+
thingee2=Thingee.new(:name='my thingee',:index =>1,:the_time => TIme.now)
|
45
|
+
thingee2.save
|
46
|
+
=== Query
|
47
|
+
thingee1=Thingee.find('thingee_id_1')
|
48
|
+
thingee1=Thingee.find(:first,:conditions => {:name => 'david')
|
49
|
+
thingee1=Thingee.find(:all,
|
50
|
+
:limit=>3,:
|
51
|
+
order_by => :index,
|
52
|
+
order => :descending,
|
53
|
+
:conditions => {:name => 'david',:title=>'boss'})
|
54
|
+
thingees=Thingee.find_by_name('david')
|
55
|
+
thingees=Thingee.find_by_name_and_index('david',3)
|
56
|
+
|
57
|
+
=== Encryption
|
58
|
+
* Encrypt the whole model
|
59
|
+
* Encrypt individual property
|
60
|
+
* Remove encryption form individual property.
|
61
|
+
=== Unit tests
|
62
|
+
* MemoryRepository for fast or offline tests.
|
5
63
|
== Copyright
|
6
64
|
|
7
65
|
Copyright (c) 2009 David Knight. See LICENSE for details.
|
data/VERSION.yml
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cloudwow-not_relational
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- cloudwow
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-04-09 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -43,7 +43,6 @@ files:
|
|
43
43
|
- lib/not_relational/memory_repository.rb
|
44
44
|
- lib/not_relational/memory_storage.rb
|
45
45
|
- lib/not_relational/or_condition.rb
|
46
|
-
- lib/not_relational/property_bag.rb
|
47
46
|
- lib/not_relational/property_description.rb
|
48
47
|
- lib/not_relational/query_string_auth_generator.rb
|
49
48
|
- lib/not_relational/reference.rb
|