Skip to content

Tyil/perl6-SQL-QueryBuilder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SQL::QueryBuilder

Interfaces defined

There are different interfaces for each type of query. Each of these interfaces have at least a Str sub defined, which is the sub used to convert the object into the actual query. These queries can in turn be used with a database interfacing module, such as DBIish.

SQL::QueryBuilder::Abstract::Use

sub db(Str:D $database --> self)

SQL::QueryBuilder::Abstract::Insert

sub into(Str:D $table --> self)
sub record(Any:D %record --> self)
sub records(Hash:D @records --> self)

SQL::QueryBuilder::Abstract::Select

sub from(Str:D $table --> self)
sub select(Str:D $column --> self)
sub select(Str:D *@columns --> self)
sub select-as(Pair:D $column --> self)
sub select-as(Pair:D *@columns --> self)
sub where(Str:D $column, Any:D $value --> self)
sub where(Str:D $column, Str:D $check, Any:D $value --> self)
sub order-by(Str:D $column, Str:D $direction = "ASC" --> self)
sub skip(Int:D $amount --> self)
sub take(Int:D $amount --> self)

SQL::QueryBuilder::Abstract::Update

sub table(Str:D $table --> self)
sub set(Str:D $column, Any:D $value --> self)
sub set(Pair:D *@records --> self)
sub set(Any:D %record --> self)
sub where(Str:D $column, Any:D $value --> self)
sub where(Str:D $column, Str:D $check, Any:D $value --> self)

SQL::QueryBuilder::Abstract::Delete

sub from(Str:D $table --> self)
sub where(Str:D $column, Any:D $value --> self)
sub where(Str:D $column, Str:D $check, Any:D $value --> self)

SQL::QueryBuilder::Abstract::CreateTable

sub name(Str:D $table --> self)
sub primary-key(Str:D $column --> self)

# Column types
sub str(Str:D $name, Int:D :$length = 50, Bool:D :$nullable = False, Str :$default --> self)
sub int(Str:D $name, Bool:D :$nullable = False, Int :$default --> self)
sub uint(Str:D $name, Bool:D :$nullable = False, Int :$default --> self)
sub float(Str:D $name, Bool:D :$nullable = False, Num :$default --> self)
sub date(Str:D $name, Bool:D :$nullable = False, Date :$default --> self)

SQL::QueryBuilder::Abstract::DropTable

sub name(Str:D $table --> self)

License

This module is distributed under the terms of the LGPL version 3.0. See the LICENSE file in this repository for more details.

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Other 100.0%