class Oplogjam::Operators::UnsetIndex
Attributes
path[R]
Public Class Methods
new(path)
click to toggle source
# File lib/oplogjam/operators/unset_index.rb, line 6 def initialize(path) @path = path end
Public Instance Methods
delete(column)
click to toggle source
# File lib/oplogjam/operators/unset_index.rb, line 10 def delete(column) nullify_or_unset = Sequel.case( [ [ column[parent_path].array_length > index, column.set(path, NULL) ] ], column.delete_path(path) ) Sequel.pg_jsonb_op( Sequel.case( { ARRAY_TYPE => nullify_or_unset }, column.delete_path(path), column[parent_path].typeof ) ) end
index()
click to toggle source
# File lib/oplogjam/operators/unset_index.rb, line 34 def index Integer(path.last, 10) end
parent_path()
click to toggle source
# File lib/oplogjam/operators/unset_index.rb, line 30 def parent_path path[0...-1] end