module MongoQL::StringOperators

Public Instance Methods

concat(*expressions) click to toggle source
# File lib/mongo_ql/string_operators.rb, line 20
def concat(*expressions)
  Expression::MethodCall.new "$concat", self, ast_template: -> (target, **_args) {
    [target, *expressions.map { |e| to_expression(e) }]
  }
end
substr(start, length) click to toggle source
# File lib/mongo_ql/string_operators.rb, line 5
def substr(start, length)
  Expression::MethodCall.new "$substr", self, ast_template: -> (target, **_args) {
    [target, to_expression(start), to_expression(length)]
  }
end
trim(chars) click to toggle source
# File lib/mongo_ql/string_operators.rb, line 11
def trim(chars)
  Expression::MethodCall.new "$trim", self, ast_template: -> (target, **_args) {
    {
      "input" => target,
      "chars" => to_expression(chars)
    }
  }
end