Class: ROM::Memory::Relation

Inherits:
Relation show all
Includes:
Enumerable, ROM::Memory
Defined in:
lib/rom/memory/relation.rb

Overview

Relation subclass for memory adapter

Examples:

class Users < ROM::Relation[:memory]
end

Constant Summary

Constants inherited from Relation

Relation::NOOP_OUTPUT_SCHEMA

Constants included from Relation::ClassInterface

Relation::ClassInterface::DEFAULT_DATASET_PROC, Relation::ClassInterface::INVALID_RELATIONS_NAMES

Constants included from ROM::Memoizable

ROM::Memoizable::MEMOIZED_HASH

Instance Attribute Summary

Attributes inherited from Relation

#auto_map, #auto_struct, #commands, #dataset, #input_schema, #mappers, #meta, #name, #output_schema, #schema, #struct_namespace

Attributes included from Relation::ClassInterface

#schema_proc

Attributes included from ROM::Memoizable

#__memoized__

Instance Method Summary collapse

Methods inherited from Relation

#[], #adapter, #as, #associations, #attr_ast, auto_map, #auto_map?, auto_struct, #auto_struct?, #call, #combine, #combine_with, #curried?, #each, #eager_load, #foreign_key, gateway, #gateway, #graph?, #map_to, #map_with, #mapper, #meta_ast, #new, #node, #nodes, #preload_assoc, #schema?, #schemas, struct_namespace, #to_a, #to_ast, #with, #wrap, #wrap?, #wrap_around

Methods included from Initializer

extended

Methods included from Relation::ClassInterface

#[], #curried, #dataset, #default_name, #default_schema, #forward, #mapper_registry, #name, #relation_name, #schema, #schemas, #set_schema!, #use, #view, #view_methods

Methods included from Notifications::Listener

#subscribe

Methods included from AutoCurry

#auto_curried_methods, #auto_curry, #auto_curry_busy?, #auto_curry_guard, extended

Methods included from Pipeline

#map_with

Methods included from Pipeline::Operator

#>>

Methods included from Relation::Materializable

#each, #first, #one, #one!, #to_a

Methods included from ROM::Memoizable

included

Methods included from Relation::Commands

#command

Instance Method Details

#delete(*args) ⇒ Relation

Delete tuples from the relation

Examples:

users.insert(name: 'Jane')
users.delete(name: 'Jane')

Returns:



63
64
65
66
# File 'lib/rom/memory/relation.rb', line 63

def delete(*args)
  dataset.delete(*args)
  self
end

#insert(*args) ⇒ Relation Also known as: <<

Insert tuples into the relation

Examples:

users.insert(name: 'Jane')

Returns:



48
49
50
51
# File 'lib/rom/memory/relation.rb', line 48

def insert(*args)
  dataset.insert(*args)
  self
end

#project(*names) ⇒ Memory::Relation

Project a relation with provided attribute names

Parameters:

  • names (*Array)

    A list with attribute names

Returns:



29
30
31
# File 'lib/rom/memory/relation.rb', line 29

def project(*names)
  schema.project(*names).(self)
end

#rename(mapping) ⇒ Object

Rename attributes in a relation



36
37
38
# File 'lib/rom/memory/relation.rb', line 36

def rename(mapping)
  schema.rename(mapping).(self)
end