View on GitHub

Red

A WiP ORM for Raku

Red::ResultSeq

Class that represents a Seq of query results

sub comment-sql

sub comment-sql(
    :$meth-name,
    :$file,
    :$block,
    :$line
) returns Mu

Add a comment to SQL query

method of

method of() returns Mu

The type of the ResultSeq

method Seq

method Seq() returns Mu

Returns a Seq with the result of the SQL query

method grep

method grep(
    &filter
) returns Mu

Adds a new filter on the query (does not run the query)

method first

method first(
    &filter
) returns Red::Model

Changes the query to return only the first row that matches the condition and run it (.grep(…).head)

method map

method map(
    &filter
) returns Mu

Change what will be returned (does not run the query)

method sort

method sort(
    &order
) returns Red::ResultSeq

Defines the order of the query (does not run the query)

method pick

method pick(
    Whatever $
) returns Red::ResultSeq

Sets the query to return the rows in a randomic order (does not run the query)

method classify

method classify(
    &func,
    :&as = Code.new,
    :&reduce
) returns Red::ResultAssociative

Returns a ResultAssociative classified by the passed code (does not run the query)

method Bag

method Bag() returns Mu

Runs a query to create a Bag

method Set

method Set() returns Mu

Runs a query to create a Set

method head

method head() returns Mu

Gets the first row returned by the query (run the query)

method skip

method skip(
    Int:D $num where { ... }
) returns Red::ResultSeq

Skips the $num first items from ResultSeq (adds a limit on the SQL query)

method elems

method elems() returns Int(Any)

Returns the number of rows returned by the query (runs the query)

method Bool

method Bool() returns Bool

Returns True if there are lines returned by the query False otherwise (runs the query)

method batch

method batch(
    Int $size
) returns Red::ResultSeqSeq

Returns a ResultSeqSeq containing ResultSeq that will return ResultSeqs with $size rows each (do not run the query)

method create

method create(
    *%pars
) returns Mu

Creates a new element of that set

method push

method push(
    *%pars
) returns Mu

Alias for create

method delete

method delete() returns Mu

Deletes every row on that ResultSeq

method save

method save() returns Mu

Saves any change on any element of that ResultSet

method union

method union(
    $other
) returns Red::ResultSeq

unifies 2 ResultSeqs

method intersect

method intersect(
    $other
) returns Red::ResultSeq

intersects 2 ResultSeqs

method minus

method minus(
    $other
) returns Red::ResultSeq

Removes 1 ResultSeq elements from other ResultSeq

method join

method join(
    Str(Any) $sep
) returns Mu

Join (Positional join)

method join-model

method join-model(
    Str $model,
    |c
) returns Mu

Create a custom join (SQL join)

method join-model

method join-model(
    Red::Model \model,
    &on,
    :$name = Code.new,
    *%pars where { ... }
) returns Mu

Create a custom join (SQL join)

method ast

method ast(
    Bool :$sub-select
) returns Red::AST

Returns the AST that will generate the SQL