class AWS::SimpleDB::Domain
@see DomainCollection
domain = SimpleDB.new.domains[‘mydomain’]
@example Getting a domain
domain = SimpleDB.new.domains.create(‘mydomain’)
@example Creating a domain
Domains, like database tables, must exist before you can write to one.
Represents a domain in SimpleDB.
def == other
-
(Boolean)
- Returns true if the domains are the same.
def == other other.is_a?(Domain) and other.name == name and other.config.simple_db_endpoint == config.simple_db_endpoint end
def delete
-
(nil)
-
Raises:
-
(NonEmptyDeleteError)
- Raises if the domain is not empty.
Other tags:
- Note: - If you need to delete a domain with items, call {#delete!}
def delete unless empty? raise NonEmptyDeleteError, "delete called without :force " + "on a non-empty domain" end client.delete_domain(:domain_name => name) nil end
def delete!
-
(nil)
-
def delete! client.delete_domain(:domain_name => name) nil end
def empty?
-
(Boolean)
- Returns true if the domain has no items.
def empty? metadata.item_count == 0 end
def exists?
-
(Boolean)
- Returns true if the domain exists.
def exists? begin client.domain_metadata(:domain_name => name) true rescue Errors::NoSuchDomain false end end
def initialize(name, options = {})
-
name
(String
) -- The name of a SimpleDB domain to reference.
def initialize(name, options = {}) super(options) @name = name end
def inspect
- Api: - private
Returns:
-
(String)
-
def inspect "#<#{self.class}:#{name}>" end
def items
-
(ItemCollection)
-
def items ItemCollection.new(self) end
def metadata
-
(DomainMetadata)
-
def metadata DomainMetadata.new(self) end