diff --git a/404.html b/404.html new file mode 100644 index 000000000..253e98230 --- /dev/null +++ b/404.html @@ -0,0 +1,1532 @@ + + + + + + + + + + + + + + + + + clear develop + + + + + + + + + + +
+

+ 404 Not Found +

+ +

+ This page is unavailable in this version of the API docs. +

+ +

+ You can use the sidebar to search for your page, or try a different + Crystal version. +

+ +
+ + diff --git a/BigDecimal.html b/BigDecimal.html new file mode 100644 index 000000000..fe549f590 --- /dev/null +++ b/BigDecimal.html @@ -0,0 +1,1796 @@ + + + + + + + + + + + + + + + + + BigDecimal - clear develop + + + + + + + + + + +
+

+ + struct BigDecimal + +

+ + + + + + + +

+ + + + Overview +

+ +

A BigDecimal can represent arbitrarily large precision decimals.

+

It is internally represented by a pair of BigInt and UInt64: value and scale. +Value contains the actual value, and scale tells the decimal point place. +E.g. when value is 1234 and scale 2, the result is 12.34.

+

NOTE To use BigDecimal, you must explicitly import it with require "big"

+

The general idea and some of the arithmetic algorithms were adapted from +the MIT/APACHE-licensed bigdecimal-rs.

+ + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/extensions/core_ext.cr + + +
+ + + + + + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def to_json(json : JSON::Builder) + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Char.html b/Char.html new file mode 100644 index 000000000..85c4d9850 --- /dev/null +++ b/Char.html @@ -0,0 +1,1736 @@ + + + + + + + + + + + + + + + + + Char - clear develop + + + + + + + + + + +
+

+ + struct Char + +

+ + + + + + + +

+ + + + Overview +

+ +

A Char represents a Unicode code point. +It occupies 32 bits.

+

It is created by enclosing an UTF-8 character in single quotes.

+
'a'
+'z'
+'0'
+'_'
+'あ'
+

You can use a backslash to denote some characters:

+
'\'' # single quote
+'\\' # backslash
+'\e' # escape
+'\f' # form feed
+'\n' # newline
+'\r' # carriage return
+'\t' # tab
+'\v' # vertical tab
+

You can use a backslash followed by an u and four hexadecimal characters to denote a unicode codepoint written:

+
'\u0041' # == 'A'
+

Or you can use curly braces and specify up to four hexadecimal numbers:

+
'\u{41}' # == 'A'
+

See Char literals in the language reference.

+ + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + lib/inflector/src/inflector/string.cr + + +
+ + + + clear/extensions/core_ext.cr + + +
+ + + + + + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def to_json(json : JSON::Builder) + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Citext.html b/Citext.html new file mode 100644 index 000000000..dfc92ef51 --- /dev/null +++ b/Citext.html @@ -0,0 +1,1808 @@ + + + + + + + + + + + + + + + + + Citext - clear develop + + + + + + + + + + +
+

+ + struct Citext + +

+ + + + + + + +

+ + + + Overview +

+ +

Represents a case insensitive text, used by Postgres +Wrap a string and basically change the equality check to make it case insensitive.s

+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/extensions/citext/citext.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Macro Summary +

+ + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(string : String) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + +

+ + + + Macro Detail +

+ +
+
+ + macro method_missing(call) + + # +
+ +
+
+ + [View source] + +
+
+ + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def !=(x : String | Citext) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def ==(x : String | Citext) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def string : String + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear.html b/Clear.html new file mode 100644 index 000000000..77c78b4d0 --- /dev/null +++ b/Clear.html @@ -0,0 +1,1902 @@ + + + + + + + + + + + + + + + + + Clear - clear develop + + + + + + + + + + +
+

+ + module Clear + +

+ + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/cli.cr + + +
+ + + + clear/extensions/enum/enum.cr + + +
+ + + + clear/log.cr + + +
+ + + + clear/model/converters/json_any_converter.cr + + +
+ + + + clear/seed.cr + + +
+ + + + clear/sql/lock.cr + + +
+ + + + clear/sql/sql.cr + + +
+ + + + clear/sql/truncate.cr + + +
+ + + + clear/version.cr + + +
+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ Log = ::Log.for("clear") +
+ + +
+ VERSION = {{ (`shards version /home/runner/work/clear/clear/src/clear`).chomp.stringify }} +
+ + +
+ + + + + +

+ + + + Class Method Summary +

+ + + + +

+ + + + Macro Summary +

+ + + + + + +
+ +
+ + + + +

+ + + + Class Method Detail +

+ +
+
+ + def self.apply_seeds + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.seed(&block) + + # +
+ +
+ +

Register a seed block. +this block will be called by Clear.apply_seeds +or conveniently by the CLI +using $cli_cmd migrate seeds

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.with_cli(&) + + # +
+ +
+ +

Check for the CLI. If the CLI is not triggered, yield the block passed as parameter

+
+ +
+
+ + [View source] + +
+
+ + + + +

+ + + + Macro Detail +

+ +
+
+ + macro enum(name, *values, &block) + + # +
+ +
+ +

+Enum

+

Clear offers full support of postgres enum strings.

+

+ +Example

+

Let's say you need to define an enum for genders:

+
# Define the enum
+Clear.enum MyApp::Gender, "male", "female" # , ...
+

In migration, we tell Postgres about the enum:

+
create_enum :gender, MyApp::Gender # < Create the new type `gender` in the database
+
+create_table :users do |t|
+  # ...
+  t.gender "gender" # < first `gender` is the type of column, while second is the name of the column
+end
+

Finally in your model, simply add the enum as column:

+
class User
+  include Clear::Model
+  # ...
+
+  column gender : MyApp::Gender
+end
+

Now, you can assign the enum:

+
u = User.new
+u.gender = MyApp::Gender::Male
+

You can dynamically check and build the enumeration values:

+
MyApp::Gender.authorized_values # < return ["male", "female"]
+MyApp::Gender.all               # < return [MyApp::Gender::Male, MyApp::Gender::Female]
+
+MyApp::Gender.from_string("male")    # < return MyApp::Gender::Male
+MyApp::Gender.from_string("unknown") # < throw Clear::IllegalEnumValueError
+
+MyApp::Gender.valid?("female")  # < Return true
+MyApp::Gender.valid?("unknown") # < Return false
+

However, you cannot write:

+
u = User.new
+u.gender = "male"
+

But instead:

+
u = User.new
+u.gender = MyApp::Gender::Male
+
+ +
+
+ + [View source] + +
+
+ +
+
+ + macro json_serializable_converter(type) + + # +
+ +
+ +

Register a type to allow use in Clear column system. +Type must include JSON::Serializable. +More info about how to use JSON::Serializable it can be found here

+
Clear.json_serializable_converter(MyJsonType)
+
+# ...
+
+class YourModel
+  include Clear::Model
+  # ...
+  column my_column : MyJsonType # jsonb (recommended), json or string column in postgresql.
+end
+
+ +
+
+ + [View source] + +
+
+ + + + + +
+ + + diff --git a/Clear/CLI.html b/Clear/CLI.html new file mode 100644 index 000000000..caeba632e --- /dev/null +++ b/Clear/CLI.html @@ -0,0 +1,1634 @@ + + + + + + + + + + + + + + + + + Clear::CLI - clear develop + + + + + + + + + + +
+

+ + module Clear::CLI + +

+ + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/cli.cr + + +
+ + + + clear/cli/command.cr + + +
+ + + + + + + + +

+ + + + Class Method Summary +

+ + + + + + + + +
+ +
+ + + + +

+ + + + Class Method Detail +

+ +
+
+ + def self.run + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + +
+ + + diff --git a/Clear/CLI/Base.html b/Clear/CLI/Base.html new file mode 100644 index 000000000..278aaaa0c --- /dev/null +++ b/Clear/CLI/Base.html @@ -0,0 +1,1983 @@ + + + + + + + + + + + + + + + + + Clear::CLI::Base - clear develop + + + + + + + + + + +
+

+ + class Clear::CLI::Base + +

+ + + + + + + + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/cli.cr + + +
+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ HELP = {"description" => ""} +
+ + +
+ + + + + +

+ + + + Class Method Summary +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +

+ + + + Class Method Detail +

+ +
+
+ + def self.description + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.run(*args, **params) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def __rescue_from___Admiral__Error(e) + + # +
+ +
+
+ +
+
+ +
+
+ + def arguments + + # +
+ +
+ +
+ Description copied from class Admiral::Command +
+ +

Returns the commands Arguments object.

+

You can access names arguments by name. +You can also access the remaning arguments using .arguments[index].

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def flags + + # +
+ +
+ +
+ Description copied from class Admiral::Command +
+ +

Returns the commands Flags object.

+

You can access names flags by name.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def help + + # +
+ +
+
+ +
+
+ +
+
+ + def run + + # +
+ +
+ +
+ Description copied from class Admiral::Command +
+ +

The run command.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def run_impl + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def sub(command, *args, **params) + + # +
+ +
+ +
+ Description copied from class Admiral::Command +
+ +

Invokes a sub command by name, passing self as the parent.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def version + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/CLI/Base/Arguments.html b/Clear/CLI/Base/Arguments.html new file mode 100644 index 000000000..fe27267b4 --- /dev/null +++ b/Clear/CLI/Base/Arguments.html @@ -0,0 +1,1962 @@ + + + + + + + + + + + + + + + + + Clear::CLI::Base::Arguments - clear develop + + + + + + + + + + +
+

+ + struct Clear::CLI::Base::Arguments + +

+ + + + + + + + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/cli.cr + + +
+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ SPECS = {} of String => NamedTuple(type: String, description: Tuple(String, String | ::Nil), default: String, is_required: Bool) +
+ + +
+ + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(command : Admiral::Command) + + # +
+ +
+
+ +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def [](*args, **options) + + # +
+ +
+
+ +
+
+ +
+
+ + def [](*args, **options, &) + + # +
+ +
+
+ +
+
+ +
+
+ + def each(*args, **options) + + # +
+ +
+
+ +
+
+ +
+
+ + def each(*args, **options, &) + + # +
+ +
+
+ +
+
+ +
+
+ + def exists?(name : Symbol) + + # +
+ +
+
+ +
+
+ +
+
+ + def get(name : Symbol) + + # +
+ +
+
+ +
+
+ +
+
+ + def get?(name : Symbol) + + # +
+ +
+
+ +
+
+ +
+
+ + def inspect(io) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def rest : Array(String) + + # +
+ +
+
+ +
+
+ +
+
+ + def validate!(command : Admiral::Command) + + # +
+ +
+
+ +
+
+ +
+
+ + def value_from_spec(command : Admiral::Command, *, arg : String, type, default, is_required : Bool) + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/CLI/Base/Flags.html b/Clear/CLI/Base/Flags.html new file mode 100644 index 000000000..f0c12607a --- /dev/null +++ b/Clear/CLI/Base/Flags.html @@ -0,0 +1,1839 @@ + + + + + + + + + + + + + + + + + Clear::CLI::Base::Flags - clear develop + + + + + + + + + + +
+

+ + struct Clear::CLI::Base::Flags + +

+ + + + + + + +

+ + + + Overview +

+ +

Extend the flags struct to include the flag

+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/cli.cr + + +
+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ DESCRIPTIONS = {} of String => String +
+ + +
+ SPECS = {"verbose" => {kind: "bool", type: "Bool", default: "false", description: {"--verbose, -v", "Display verbose informations during execution"}, short: "v", long: "verbose", is_required: true}, "no_color" => {kind: "bool", type: "Bool", default: "false", description: {"--no-color", "Cancel color output"}, short: "nil", long: "no-color", is_required: true}, "__version__" => {kind: "bool", type: "Bool", default: "false", description: {"--version", "Displays the version of the current application."}, short: "nil", long: "version", is_required: true}, "__help__" => {kind: "bool", type: "Bool", default: "false", description: {"--help", "Displays help for the current command."}, short: "nil", long: "help", is_required: true}} of String => NamedTuple(kind: String, type: String, default: String, description: Tuple(String, String | ::Nil), short: String | ::Nil, long: String, is_required: Bool) +
+ + +
+ + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(command : Admiral::Command) + + # +
+ +
+
+ +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def __help__ + + # +
+ +
+
+ +
+
+ +
+
+ + def __version__ + + # +
+ +
+
+ +
+
+ +
+
+ + def inspect(io) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def no_color + + # +
+ +
+
+ +
+
+ +
+
+ + def validate!(command) + + # +
+ +
+
+ +
+
+ +
+
+ + def verbose + + # +
+ +
+
+ +
+
+ + + +
+ + + diff --git a/Clear/CLI/Command.html b/Clear/CLI/Command.html new file mode 100644 index 000000000..cd70615d6 --- /dev/null +++ b/Clear/CLI/Command.html @@ -0,0 +1,1624 @@ + + + + + + + + + + + + + + + + + Clear::CLI::Command - clear develop + + + + + + + + + + +
+

+ + module Clear::CLI::Command + +

+ + + + + + + + + + + + + + + +

+ + + + Direct including types +

+ + + + + +

+ + + + Defined in: +

+ + + + clear/cli/command.cr + + +
+ + + + + + + + + + + + + + +
+ +
+ + + + + + + + + +
+ + + diff --git a/Clear/CLI/Generator.html b/Clear/CLI/Generator.html new file mode 100644 index 000000000..94457f72f --- /dev/null +++ b/Clear/CLI/Generator.html @@ -0,0 +1,2110 @@ + + + + + + + + + + + + + + + + + Clear::CLI::Generator - clear develop + + + + + + + + + + +
+

+ + class Clear::CLI::Generator + +

+ + + + + + + + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/cli/generator.cr + + +
+ + + + clear/cli/generators/migration.cr + + +
+ + + + clear/cli/generators/model.cr + + +
+ + + + clear/cli/generators/new/kemal.cr + + +
+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ HELP = {"description" => ""} +
+ + +
+ + + + + +

+ + + + Class Method Summary +

+ + + + +

+ + + + Macro Summary +

+ + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +

+ + + + Class Method Detail +

+ +
+
+ + def self.[](name) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.[]?(name) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.add(name, desc, &block : Array(String) -> Nil) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.description + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.generators + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.run(*args, **params) + + # +
+ +
+
+ + [View source] + +
+
+ + + + +

+ + + + Macro Detail +

+ +
+
+ + macro ecr_to_s(string, opts) + + # +
+ +
+
+ + [View source] + +
+
+ + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def __rescue_from___Admiral__Error(e) + + # +
+ +
+
+ +
+
+ +
+
+ + def arguments + + # +
+ +
+ +
+ Description copied from class Admiral::Command +
+ +

Returns the commands Arguments object.

+

You can access names arguments by name. +You can also access the remaning arguments using .arguments[index].

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def flags + + # +
+ +
+ +
+ Description copied from class Admiral::Command +
+ +

Returns the commands Flags object.

+

You can access names flags by name.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def help + + # +
+ +
+
+ +
+
+ +
+
+ + def run + + # +
+ +
+ +
+ Description copied from class Admiral::Command +
+ +

The run command.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def run_impl + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def sub(command, *args, **params) + + # +
+ +
+ +
+ Description copied from class Admiral::Command +
+ +

Invokes a sub command by name, passing self as the parent.

+
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/CLI/Generator/Arguments.html b/Clear/CLI/Generator/Arguments.html new file mode 100644 index 000000000..2cb742959 --- /dev/null +++ b/Clear/CLI/Generator/Arguments.html @@ -0,0 +1,1962 @@ + + + + + + + + + + + + + + + + + Clear::CLI::Generator::Arguments - clear develop + + + + + + + + + + +
+

+ + struct Clear::CLI::Generator::Arguments + +

+ + + + + + + + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/cli/generator.cr + + +
+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ SPECS = {} of String => NamedTuple(type: String, description: Tuple(String, String | ::Nil), default: String, is_required: Bool) +
+ + +
+ + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(command : Admiral::Command) + + # +
+ +
+
+ +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def [](*args, **options) + + # +
+ +
+
+ +
+
+ +
+
+ + def [](*args, **options, &) + + # +
+ +
+
+ +
+
+ +
+
+ + def each(*args, **options) + + # +
+ +
+
+ +
+
+ +
+
+ + def each(*args, **options, &) + + # +
+ +
+
+ +
+
+ +
+
+ + def exists?(name : Symbol) + + # +
+ +
+
+ +
+
+ +
+
+ + def get(name : Symbol) + + # +
+ +
+
+ +
+
+ +
+
+ + def get?(name : Symbol) + + # +
+ +
+
+ +
+
+ +
+
+ + def inspect(io) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def rest : Array(String) + + # +
+ +
+
+ +
+
+ +
+
+ + def validate!(command : Admiral::Command) + + # +
+ +
+
+ +
+
+ +
+
+ + def value_from_spec(command : Admiral::Command, *, arg : String, type, default, is_required : Bool) + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/CLI/Generator/Flags.html b/Clear/CLI/Generator/Flags.html new file mode 100644 index 000000000..dd14e8034 --- /dev/null +++ b/Clear/CLI/Generator/Flags.html @@ -0,0 +1,1820 @@ + + + + + + + + + + + + + + + + + Clear::CLI::Generator::Flags - clear develop + + + + + + + + + + +
+

+ + struct Clear::CLI::Generator::Flags + +

+ + + + + + + +

+ + + + Overview +

+ +

Extend the flags struct to include the flag

+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/cli/generator.cr + + +
+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ DESCRIPTIONS = {} of String => String +
+ + +
+ SPECS = {"verbose" => {kind: "bool", type: "Bool", default: "false", description: {"--verbose, -v", "Display verbose informations during execution"}, short: "v", long: "verbose", is_required: true}, "no_color" => {kind: "bool", type: "Bool", default: "false", description: {"--no-color", "Cancel color output"}, short: "nil", long: "no-color", is_required: true}, "__help__" => {kind: "bool", type: "Bool", default: "false", description: {"--help", "Displays help for the current command."}, short: "nil", long: "help", is_required: true}} of String => NamedTuple(kind: String, type: String, default: String, description: Tuple(String, String | ::Nil), short: String | ::Nil, long: String, is_required: Bool) +
+ + +
+ + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(command : Admiral::Command) + + # +
+ +
+
+ +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def __help__ + + # +
+ +
+
+ +
+
+ +
+
+ + def inspect(io) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def no_color + + # +
+ +
+
+ +
+
+ +
+
+ + def validate!(command) + + # +
+ +
+
+ +
+
+ +
+
+ + def verbose + + # +
+ +
+
+ +
+
+ + + +
+ + + diff --git a/Clear/CLI/Generator/Migration.html b/Clear/CLI/Generator/Migration.html new file mode 100644 index 000000000..4a981cfda --- /dev/null +++ b/Clear/CLI/Generator/Migration.html @@ -0,0 +1,1947 @@ + + + + + + + + + + + + + + + + + Clear::CLI::Generator::Migration - clear develop + + + + + + + + + + +
+

+ + class Clear::CLI::Generator::Migration + +

+ + + + + + + + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/cli/generators/migration.cr + + +
+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ HELP = {"description" => ""} +
+ + +
+ + + + + +

+ + + + Class Method Summary +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +

+ + + + Class Method Detail +

+ +
+
+ + def self.description + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.run(*args, **params) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def __rescue_from___Admiral__Error(e) + + # +
+ +
+
+ +
+
+ +
+
+ + def arguments + + # +
+ +
+ +
+ Description copied from class Admiral::Command +
+ +

Returns the commands Arguments object.

+

You can access names arguments by name. +You can also access the remaning arguments using .arguments[index].

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def flags + + # +
+ +
+ +
+ Description copied from class Admiral::Command +
+ +

Returns the commands Flags object.

+

You can access names flags by name.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def help + + # +
+ +
+
+ +
+
+ +
+
+ + def run + + # +
+ +
+ +
+ Description copied from class Admiral::Command +
+ +

The run command.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def run_impl + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def sub(command, *args, **params) + + # +
+ +
+ +
+ Description copied from class Admiral::Command +
+ +

Invokes a sub command by name, passing self as the parent.

+
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/CLI/Generator/Migration/Arguments.html b/Clear/CLI/Generator/Migration/Arguments.html new file mode 100644 index 000000000..de3a9b70b --- /dev/null +++ b/Clear/CLI/Generator/Migration/Arguments.html @@ -0,0 +1,1990 @@ + + + + + + + + + + + + + + + + + Clear::CLI::Generator::Migration::Arguments - clear develop + + + + + + + + + + +
+

+ + struct Clear::CLI::Generator::Migration::Arguments + +

+ + + + + + + + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/cli/generators/migration.cr:6 + + +
+ + + + clear/cli/generators/migration.cr:17 + + +
+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ SPECS = {"name" => {type: "String", description: {"name", ""}, default: "nil", is_required: false}} of String => NamedTuple(type: String, description: Tuple(String, String | ::Nil), default: String, is_required: Bool) +
+ + +
+ + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(command : Admiral::Command) + + # +
+ +
+
+ +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def [](*args, **options) + + # +
+ +
+
+ +
+
+ +
+
+ + def [](*args, **options, &) + + # +
+ +
+
+ +
+
+ +
+
+ + def each(*args, **options) + + # +
+ +
+
+ +
+
+ +
+
+ + def each(*args, **options, &) + + # +
+ +
+
+ +
+
+ +
+
+ + def exists?(name : Symbol) + + # +
+ +
+
+ +
+
+ +
+
+ + def get(name : Symbol) + + # +
+ +
+
+ +
+
+ +
+
+ + def get?(name : Symbol) + + # +
+ +
+
+ +
+
+ +
+
+ + def inspect(io) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def name : String | Nil + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def rest : Array(String) + + # +
+ +
+
+ +
+
+ +
+
+ + def validate!(command : Admiral::Command) + + # +
+ +
+
+ +
+
+ +
+
+ + def value_from_spec(command : Admiral::Command, *, arg : String, type, default, is_required : Bool) + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/CLI/Generator/Migration/Flags.html b/Clear/CLI/Generator/Migration/Flags.html new file mode 100644 index 000000000..8b18decd6 --- /dev/null +++ b/Clear/CLI/Generator/Migration/Flags.html @@ -0,0 +1,1848 @@ + + + + + + + + + + + + + + + + + Clear::CLI::Generator::Migration::Flags - clear develop + + + + + + + + + + +
+

+ + struct Clear::CLI::Generator::Migration::Flags + +

+ + + + + + + +

+ + + + Overview +

+ +

Extend the flags struct to include the flag

+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/cli/generators/migration.cr:6 + + +
+ + + + clear/cli/generators/migration.cr:11 + + +
+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ DESCRIPTIONS = {} of String => String +
+ + +
+ SPECS = {"verbose" => {kind: "bool", type: "Bool", default: "false", description: {"--verbose, -v", "Display verbose informations during execution"}, short: "v", long: "verbose", is_required: true}, "no_color" => {kind: "bool", type: "Bool", default: "false", description: {"--no-color", "Cancel color output"}, short: "nil", long: "no-color", is_required: true}, "__help__" => {kind: "bool", type: "Bool", default: "false", description: {"--help", "Displays help for the current command."}, short: "nil", long: "help", is_required: true}, "directory" => {kind: "nil", type: "String", default: "\".\"", description: {"--directory, -d (default: \".\")", "Set target directory"}, short: "d", long: "directory", is_required: true}} of String => NamedTuple(kind: String, type: String, default: String, description: Tuple(String, String | ::Nil), short: String | ::Nil, long: String, is_required: Bool) +
+ + +
+ + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(command : Admiral::Command) + + # +
+ +
+
+ +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def __help__ + + # +
+ +
+
+ +
+
+ +
+
+ + def directory + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def inspect(io) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def no_color + + # +
+ +
+
+ +
+
+ +
+
+ + def validate!(command) + + # +
+ +
+
+ +
+
+ +
+
+ + def verbose + + # +
+ +
+
+ +
+
+ + + +
+ + + diff --git a/Clear/CLI/Generator/Model.html b/Clear/CLI/Generator/Model.html new file mode 100644 index 000000000..4221b2fb3 --- /dev/null +++ b/Clear/CLI/Generator/Model.html @@ -0,0 +1,1947 @@ + + + + + + + + + + + + + + + + + Clear::CLI::Generator::Model - clear develop + + + + + + + + + + +
+

+ + class Clear::CLI::Generator::Model + +

+ + + + + + + + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/cli/generators/model.cr + + +
+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ HELP = {"description" => ""} +
+ + +
+ + + + + +

+ + + + Class Method Summary +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +

+ + + + Class Method Detail +

+ +
+
+ + def self.description + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.run(*args, **params) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def __rescue_from___Admiral__Error(e) + + # +
+ +
+
+ +
+
+ +
+
+ + def arguments + + # +
+ +
+ +
+ Description copied from class Admiral::Command +
+ +

Returns the commands Arguments object.

+

You can access names arguments by name. +You can also access the remaning arguments using .arguments[index].

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def flags + + # +
+ +
+ +
+ Description copied from class Admiral::Command +
+ +

Returns the commands Flags object.

+

You can access names flags by name.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def help + + # +
+ +
+
+ +
+
+ +
+
+ + def run + + # +
+ +
+ +
+ Description copied from class Admiral::Command +
+ +

The run command.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def run_impl + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def sub(command, *args, **params) + + # +
+ +
+ +
+ Description copied from class Admiral::Command +
+ +

Invokes a sub command by name, passing self as the parent.

+
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/CLI/Generator/Model/Arguments.html b/Clear/CLI/Generator/Model/Arguments.html new file mode 100644 index 000000000..f2863a0c9 --- /dev/null +++ b/Clear/CLI/Generator/Model/Arguments.html @@ -0,0 +1,1990 @@ + + + + + + + + + + + + + + + + + Clear::CLI::Generator::Model::Arguments - clear develop + + + + + + + + + + +
+

+ + struct Clear::CLI::Generator::Model::Arguments + +

+ + + + + + + + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/cli/generators/model.cr:6 + + +
+ + + + clear/cli/generators/model.cr:17 + + +
+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ SPECS = {"name" => {type: "String", description: {"name", ""}, default: "nil", is_required: false}} of String => NamedTuple(type: String, description: Tuple(String, String | ::Nil), default: String, is_required: Bool) +
+ + +
+ + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(command : Admiral::Command) + + # +
+ +
+
+ +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def [](*args, **options) + + # +
+ +
+
+ +
+
+ +
+
+ + def [](*args, **options, &) + + # +
+ +
+
+ +
+
+ +
+
+ + def each(*args, **options) + + # +
+ +
+
+ +
+
+ +
+
+ + def each(*args, **options, &) + + # +
+ +
+
+ +
+
+ +
+
+ + def exists?(name : Symbol) + + # +
+ +
+
+ +
+
+ +
+
+ + def get(name : Symbol) + + # +
+ +
+
+ +
+
+ +
+
+ + def get?(name : Symbol) + + # +
+ +
+
+ +
+
+ +
+
+ + def inspect(io) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def name : String | Nil + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def rest : Array(String) + + # +
+ +
+
+ +
+
+ +
+
+ + def validate!(command : Admiral::Command) + + # +
+ +
+
+ +
+
+ +
+
+ + def value_from_spec(command : Admiral::Command, *, arg : String, type, default, is_required : Bool) + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/CLI/Generator/Model/Flags.html b/Clear/CLI/Generator/Model/Flags.html new file mode 100644 index 000000000..c62026074 --- /dev/null +++ b/Clear/CLI/Generator/Model/Flags.html @@ -0,0 +1,1848 @@ + + + + + + + + + + + + + + + + + Clear::CLI::Generator::Model::Flags - clear develop + + + + + + + + + + +
+

+ + struct Clear::CLI::Generator::Model::Flags + +

+ + + + + + + +

+ + + + Overview +

+ +

Extend the flags struct to include the flag

+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/cli/generators/model.cr:6 + + +
+ + + + clear/cli/generators/model.cr:11 + + +
+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ DESCRIPTIONS = {} of String => String +
+ + +
+ SPECS = {"verbose" => {kind: "bool", type: "Bool", default: "false", description: {"--verbose, -v", "Display verbose informations during execution"}, short: "v", long: "verbose", is_required: true}, "no_color" => {kind: "bool", type: "Bool", default: "false", description: {"--no-color", "Cancel color output"}, short: "nil", long: "no-color", is_required: true}, "__help__" => {kind: "bool", type: "Bool", default: "false", description: {"--help", "Displays help for the current command."}, short: "nil", long: "help", is_required: true}, "directory" => {kind: "nil", type: "String", default: "\".\"", description: {"--directory, -d (default: \".\")", "Set target directory"}, short: "d", long: "directory", is_required: true}} of String => NamedTuple(kind: String, type: String, default: String, description: Tuple(String, String | ::Nil), short: String | ::Nil, long: String, is_required: Bool) +
+ + +
+ + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(command : Admiral::Command) + + # +
+ +
+
+ +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def __help__ + + # +
+ +
+
+ +
+
+ +
+
+ + def directory + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def inspect(io) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def no_color + + # +
+ +
+
+ +
+
+ +
+
+ + def validate!(command) + + # +
+ +
+
+ +
+
+ +
+
+ + def verbose + + # +
+ +
+
+ +
+
+ + + +
+ + + diff --git a/Clear/CLI/Generator/NewKemal.html b/Clear/CLI/Generator/NewKemal.html new file mode 100644 index 000000000..7d2a02b82 --- /dev/null +++ b/Clear/CLI/Generator/NewKemal.html @@ -0,0 +1,1928 @@ + + + + + + + + + + + + + + + + + Clear::CLI::Generator::NewKemal - clear develop + + + + + + + + + + +
+

+ + class Clear::CLI::Generator::NewKemal + +

+ + + + + + + + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/cli/generators/new/kemal.cr + + +
+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ HELP = {"description" => ""} +
+ + +
+ + + + + +

+ + + + Class Method Summary +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +

+ + + + Class Method Detail +

+ +
+
+ + def self.description + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.run(*args, **params) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def __rescue_from___Admiral__Error(e) + + # +
+ +
+
+ +
+
+ +
+
+ + def arguments + + # +
+ +
+ +
+ Description copied from class Admiral::Command +
+ +

Returns the commands Arguments object.

+

You can access names arguments by name. +You can also access the remaning arguments using .arguments[index].

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def flags + + # +
+ +
+ +
+ Description copied from class Admiral::Command +
+ +

Returns the commands Flags object.

+

You can access names flags by name.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def run + + # +
+ +
+ +
+ Description copied from class Admiral::Command +
+ +

The run command.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def run_impl + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def sub(command, *args, **params) + + # +
+ +
+ +
+ Description copied from class Admiral::Command +
+ +

Invokes a sub command by name, passing self as the parent.

+
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/CLI/Generator/NewKemal/Arguments.html b/Clear/CLI/Generator/NewKemal/Arguments.html new file mode 100644 index 000000000..3d5314018 --- /dev/null +++ b/Clear/CLI/Generator/NewKemal/Arguments.html @@ -0,0 +1,1990 @@ + + + + + + + + + + + + + + + + + Clear::CLI::Generator::NewKemal::Arguments - clear develop + + + + + + + + + + +
+

+ + struct Clear::CLI::Generator::NewKemal::Arguments + +

+ + + + + + + + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/cli/generators/new/kemal.cr:6 + + +
+ + + + clear/cli/generators/new/kemal.cr:15 + + +
+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ SPECS = {"name" => {type: "String", description: {"name", ""}, default: "nil", is_required: false}} of String => NamedTuple(type: String, description: Tuple(String, String | ::Nil), default: String, is_required: Bool) +
+ + +
+ + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(command : Admiral::Command) + + # +
+ +
+
+ +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def [](*args, **options) + + # +
+ +
+
+ +
+
+ +
+
+ + def [](*args, **options, &) + + # +
+ +
+
+ +
+
+ +
+
+ + def each(*args, **options) + + # +
+ +
+
+ +
+
+ +
+
+ + def each(*args, **options, &) + + # +
+ +
+
+ +
+
+ +
+
+ + def exists?(name : Symbol) + + # +
+ +
+
+ +
+
+ +
+
+ + def get(name : Symbol) + + # +
+ +
+
+ +
+
+ +
+
+ + def get?(name : Symbol) + + # +
+ +
+
+ +
+
+ +
+
+ + def inspect(io) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def name : String | Nil + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def rest : Array(String) + + # +
+ +
+
+ +
+
+ +
+
+ + def validate!(command : Admiral::Command) + + # +
+ +
+
+ +
+
+ +
+
+ + def value_from_spec(command : Admiral::Command, *, arg : String, type, default, is_required : Bool) + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/CLI/Generator/NewKemal/Flags.html b/Clear/CLI/Generator/NewKemal/Flags.html new file mode 100644 index 000000000..5f2fc005a --- /dev/null +++ b/Clear/CLI/Generator/NewKemal/Flags.html @@ -0,0 +1,1829 @@ + + + + + + + + + + + + + + + + + Clear::CLI::Generator::NewKemal::Flags - clear develop + + + + + + + + + + +
+

+ + struct Clear::CLI::Generator::NewKemal::Flags + +

+ + + + + + + +

+ + + + Overview +

+ +

Extend the flags struct to include the flag

+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/cli/generators/new/kemal.cr:6 + + +
+ + + + clear/cli/generators/new/kemal.cr:9 + + +
+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ DESCRIPTIONS = {} of String => String +
+ + +
+ SPECS = {"verbose" => {kind: "bool", type: "Bool", default: "false", description: {"--verbose, -v", "Display verbose informations during execution"}, short: "v", long: "verbose", is_required: true}, "no_color" => {kind: "bool", type: "Bool", default: "false", description: {"--no-color", "Cancel color output"}, short: "nil", long: "no-color", is_required: true}, "directory" => {kind: "nil", type: "String", default: "\".\"", description: {"--directory, -d (default: \".\")", "Set target directory"}, short: "d", long: "directory", is_required: true}} of String => NamedTuple(kind: String, type: String, default: String, description: Tuple(String, String | ::Nil), short: String | ::Nil, long: String, is_required: Bool) +
+ + +
+ + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(command : Admiral::Command) + + # +
+ +
+
+ +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def directory + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def inspect(io) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def no_color + + # +
+ +
+
+ +
+
+ +
+
+ + def validate!(command) + + # +
+ +
+
+ +
+
+ +
+
+ + def verbose + + # +
+ +
+
+ +
+
+ + + +
+ + + diff --git a/Clear/CLI/Generator/Record.html b/Clear/CLI/Generator/Record.html new file mode 100644 index 000000000..c62b6222a --- /dev/null +++ b/Clear/CLI/Generator/Record.html @@ -0,0 +1,1789 @@ + + + + + + + + + + + + + + + + + Clear::CLI::Generator::Record - clear develop + + + + + + + + + + +
+

+ + struct Clear::CLI::Generator::Record + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/cli/generator.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(name : String, desc : String, callback : Array(String) -> Nil) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def callback : Array(String) -> Nil + + # +
+ +
+
+ +
+
+ +
+
+ + def clone + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def copy_with(name _name = @name, desc _desc = @desc, callback _callback = @callback) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def desc : String + + # +
+ +
+
+ +
+
+ +
+
+ + def name : String + + # +
+ +
+
+ +
+
+ + + +
+ + + diff --git a/Clear/CLI/Migration.html b/Clear/CLI/Migration.html new file mode 100644 index 000000000..365fdc9a6 --- /dev/null +++ b/Clear/CLI/Migration.html @@ -0,0 +1,1962 @@ + + + + + + + + + + + + + + + + + Clear::CLI::Migration - clear develop + + + + + + + + + + +
+

+ + class Clear::CLI::Migration + +

+ + + + + + + + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/cli/migration.cr + + +
+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ HELP = {"description" => ""} +
+ + +
+ + + + + +

+ + + + Class Method Summary +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +

+ + + + Class Method Detail +

+ +
+
+ + def self.description + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.run(*args, **params) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def __rescue_from___Admiral__Error(e) + + # +
+ +
+
+ +
+
+ +
+
+ + def arguments + + # +
+ +
+ +
+ Description copied from class Admiral::Command +
+ +

Returns the commands Arguments object.

+

You can access names arguments by name. +You can also access the remaning arguments using .arguments[index].

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def flags + + # +
+ +
+ +
+ Description copied from class Admiral::Command +
+ +

Returns the commands Flags object.

+

You can access names flags by name.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def help + + # +
+ +
+
+ +
+
+ +
+
+ + def run + + # +
+ +
+ +
+ Description copied from class Admiral::Command +
+ +

The run command.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def run_impl + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def sub(command, *args, **params) + + # +
+ +
+ +
+ Description copied from class Admiral::Command +
+ +

Invokes a sub command by name, passing self as the parent.

+
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/CLI/Migration/Arguments.html b/Clear/CLI/Migration/Arguments.html new file mode 100644 index 000000000..074875283 --- /dev/null +++ b/Clear/CLI/Migration/Arguments.html @@ -0,0 +1,1962 @@ + + + + + + + + + + + + + + + + + Clear::CLI::Migration::Arguments - clear develop + + + + + + + + + + +
+

+ + struct Clear::CLI::Migration::Arguments + +

+ + + + + + + + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/cli/migration.cr + + +
+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ SPECS = {} of String => NamedTuple(type: String, description: Tuple(String, String | ::Nil), default: String, is_required: Bool) +
+ + +
+ + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(command : Admiral::Command) + + # +
+ +
+
+ +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def [](*args, **options) + + # +
+ +
+
+ +
+
+ +
+
+ + def [](*args, **options, &) + + # +
+ +
+
+ +
+
+ +
+
+ + def each(*args, **options) + + # +
+ +
+
+ +
+
+ +
+
+ + def each(*args, **options, &) + + # +
+ +
+
+ +
+
+ +
+
+ + def exists?(name : Symbol) + + # +
+ +
+
+ +
+
+ +
+
+ + def get(name : Symbol) + + # +
+ +
+
+ +
+
+ +
+
+ + def get?(name : Symbol) + + # +
+ +
+
+ +
+
+ +
+
+ + def inspect(io) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def rest : Array(String) + + # +
+ +
+
+ +
+
+ +
+
+ + def validate!(command : Admiral::Command) + + # +
+ +
+
+ +
+
+ +
+
+ + def value_from_spec(command : Admiral::Command, *, arg : String, type, default, is_required : Bool) + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/CLI/Migration/Down.html b/Clear/CLI/Migration/Down.html new file mode 100644 index 000000000..10dc67f06 --- /dev/null +++ b/Clear/CLI/Migration/Down.html @@ -0,0 +1,1947 @@ + + + + + + + + + + + + + + + + + Clear::CLI::Migration::Down - clear develop + + + + + + + + + + +
+

+ + class Clear::CLI::Migration::Down + +

+ + + + + + + + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/cli/migration.cr + + +
+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ HELP = {"description" => ""} +
+ + +
+ + + + + +

+ + + + Class Method Summary +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +

+ + + + Class Method Detail +

+ +
+
+ + def self.description + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.run(*args, **params) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def __rescue_from___Admiral__Error(e) + + # +
+ +
+
+ +
+
+ +
+
+ + def arguments + + # +
+ +
+ +
+ Description copied from class Admiral::Command +
+ +

Returns the commands Arguments object.

+

You can access names arguments by name. +You can also access the remaning arguments using .arguments[index].

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def flags + + # +
+ +
+ +
+ Description copied from class Admiral::Command +
+ +

Returns the commands Flags object.

+

You can access names flags by name.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def help + + # +
+ +
+
+ +
+
+ +
+
+ + def run + + # +
+ +
+ +
+ Description copied from class Admiral::Command +
+ +

The run command.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def run_impl + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def sub(command, *args, **params) + + # +
+ +
+ +
+ Description copied from class Admiral::Command +
+ +

Invokes a sub command by name, passing self as the parent.

+
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/CLI/Migration/Down/Arguments.html b/Clear/CLI/Migration/Down/Arguments.html new file mode 100644 index 000000000..a0f7bb882 --- /dev/null +++ b/Clear/CLI/Migration/Down/Arguments.html @@ -0,0 +1,1990 @@ + + + + + + + + + + + + + + + + + Clear::CLI::Migration::Down::Arguments - clear develop + + + + + + + + + + +
+

+ + struct Clear::CLI::Migration::Down::Arguments + +

+ + + + + + + + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/cli/migration.cr:37 + + +
+ + + + clear/cli/migration.cr:40 + + +
+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ SPECS = {"migration_number" => {type: "Int64", description: {"migration_number (required)", ""}, default: "nil", is_required: true}} of String => NamedTuple(type: String, description: Tuple(String, String | ::Nil), default: String, is_required: Bool) +
+ + +
+ + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(command : Admiral::Command) + + # +
+ +
+
+ +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def [](*args, **options) + + # +
+ +
+
+ +
+
+ +
+
+ + def [](*args, **options, &) + + # +
+ +
+
+ +
+
+ +
+
+ + def each(*args, **options) + + # +
+ +
+
+ +
+
+ +
+
+ + def each(*args, **options, &) + + # +
+ +
+
+ +
+
+ +
+
+ + def exists?(name : Symbol) + + # +
+ +
+
+ +
+
+ +
+
+ + def get(name : Symbol) + + # +
+ +
+
+ +
+
+ +
+
+ + def get?(name : Symbol) + + # +
+ +
+
+ +
+
+ +
+
+ + def inspect(io) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def migration_number : Int64 + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def rest : Array(String) + + # +
+ +
+
+ +
+
+ +
+
+ + def validate!(command : Admiral::Command) + + # +
+ +
+
+ +
+
+ +
+
+ + def value_from_spec(command : Admiral::Command, *, arg : String, type, default, is_required : Bool) + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/CLI/Migration/Down/Flags.html b/Clear/CLI/Migration/Down/Flags.html new file mode 100644 index 000000000..ae5d18b3b --- /dev/null +++ b/Clear/CLI/Migration/Down/Flags.html @@ -0,0 +1,1820 @@ + + + + + + + + + + + + + + + + + Clear::CLI::Migration::Down::Flags - clear develop + + + + + + + + + + +
+

+ + struct Clear::CLI::Migration::Down::Flags + +

+ + + + + + + +

+ + + + Overview +

+ +

Extend the flags struct to include the flag

+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/cli/migration.cr + + +
+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ DESCRIPTIONS = {} of String => String +
+ + +
+ SPECS = {"verbose" => {kind: "bool", type: "Bool", default: "false", description: {"--verbose, -v", "Display verbose informations during execution"}, short: "v", long: "verbose", is_required: true}, "no_color" => {kind: "bool", type: "Bool", default: "false", description: {"--no-color", "Cancel color output"}, short: "nil", long: "no-color", is_required: true}, "__help__" => {kind: "bool", type: "Bool", default: "false", description: {"--help", "Displays help for the current command."}, short: "nil", long: "help", is_required: true}} of String => NamedTuple(kind: String, type: String, default: String, description: Tuple(String, String | ::Nil), short: String | ::Nil, long: String, is_required: Bool) +
+ + +
+ + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(command : Admiral::Command) + + # +
+ +
+
+ +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def __help__ + + # +
+ +
+
+ +
+
+ +
+
+ + def inspect(io) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def no_color + + # +
+ +
+
+ +
+
+ +
+
+ + def validate!(command) + + # +
+ +
+
+ +
+
+ +
+
+ + def verbose + + # +
+ +
+
+ +
+
+ + + +
+ + + diff --git a/Clear/CLI/Migration/Flags.html b/Clear/CLI/Migration/Flags.html new file mode 100644 index 000000000..c37163f29 --- /dev/null +++ b/Clear/CLI/Migration/Flags.html @@ -0,0 +1,1820 @@ + + + + + + + + + + + + + + + + + Clear::CLI::Migration::Flags - clear develop + + + + + + + + + + +
+

+ + struct Clear::CLI::Migration::Flags + +

+ + + + + + + +

+ + + + Overview +

+ +

Extend the flags struct to include the flag

+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/cli/migration.cr + + +
+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ DESCRIPTIONS = {} of String => String +
+ + +
+ SPECS = {"verbose" => {kind: "bool", type: "Bool", default: "false", description: {"--verbose, -v", "Display verbose informations during execution"}, short: "v", long: "verbose", is_required: true}, "no_color" => {kind: "bool", type: "Bool", default: "false", description: {"--no-color", "Cancel color output"}, short: "nil", long: "no-color", is_required: true}, "__help__" => {kind: "bool", type: "Bool", default: "false", description: {"--help", "Displays help for the current command."}, short: "nil", long: "help", is_required: true}} of String => NamedTuple(kind: String, type: String, default: String, description: Tuple(String, String | ::Nil), short: String | ::Nil, long: String, is_required: Bool) +
+ + +
+ + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(command : Admiral::Command) + + # +
+ +
+
+ +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def __help__ + + # +
+ +
+
+ +
+
+ +
+
+ + def inspect(io) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def no_color + + # +
+ +
+
+ +
+
+ +
+
+ + def validate!(command) + + # +
+ +
+
+ +
+
+ +
+
+ + def verbose + + # +
+ +
+
+ +
+
+ + + +
+ + + diff --git a/Clear/CLI/Migration/Migrate.html b/Clear/CLI/Migration/Migrate.html new file mode 100644 index 000000000..3b193019c --- /dev/null +++ b/Clear/CLI/Migration/Migrate.html @@ -0,0 +1,1928 @@ + + + + + + + + + + + + + + + + + Clear::CLI::Migration::Migrate - clear develop + + + + + + + + + + +
+

+ + class Clear::CLI::Migration::Migrate + +

+ + + + + + + + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/cli/migration.cr + + +
+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ HELP = {"description" => ""} +
+ + +
+ + + + + +

+ + + + Class Method Summary +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +

+ + + + Class Method Detail +

+ +
+
+ + def self.description + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.run(*args, **params) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def __rescue_from___Admiral__Error(e) + + # +
+ +
+
+ +
+
+ +
+
+ + def arguments + + # +
+ +
+ +
+ Description copied from class Admiral::Command +
+ +

Returns the commands Arguments object.

+

You can access names arguments by name. +You can also access the remaning arguments using .arguments[index].

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def flags + + # +
+ +
+ +
+ Description copied from class Admiral::Command +
+ +

Returns the commands Flags object.

+

You can access names flags by name.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def run + + # +
+ +
+ +
+ Description copied from class Admiral::Command +
+ +

The run command.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def run_impl + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def sub(command, *args, **params) + + # +
+ +
+ +
+ Description copied from class Admiral::Command +
+ +

Invokes a sub command by name, passing self as the parent.

+
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/CLI/Migration/Migrate/Arguments.html b/Clear/CLI/Migration/Migrate/Arguments.html new file mode 100644 index 000000000..4de2b69e5 --- /dev/null +++ b/Clear/CLI/Migration/Migrate/Arguments.html @@ -0,0 +1,1962 @@ + + + + + + + + + + + + + + + + + Clear::CLI::Migration::Migrate::Arguments - clear develop + + + + + + + + + + +
+

+ + struct Clear::CLI::Migration::Migrate::Arguments + +

+ + + + + + + + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/cli/migration.cr + + +
+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ SPECS = {} of String => NamedTuple(type: String, description: Tuple(String, String | ::Nil), default: String, is_required: Bool) +
+ + +
+ + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(command : Admiral::Command) + + # +
+ +
+
+ +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def [](*args, **options) + + # +
+ +
+
+ +
+
+ +
+
+ + def [](*args, **options, &) + + # +
+ +
+
+ +
+
+ +
+
+ + def each(*args, **options) + + # +
+ +
+
+ +
+
+ +
+
+ + def each(*args, **options, &) + + # +
+ +
+
+ +
+
+ +
+
+ + def exists?(name : Symbol) + + # +
+ +
+
+ +
+
+ +
+
+ + def get(name : Symbol) + + # +
+ +
+
+ +
+
+ +
+
+ + def get?(name : Symbol) + + # +
+ +
+
+ +
+
+ +
+
+ + def inspect(io) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def rest : Array(String) + + # +
+ +
+
+ +
+
+ +
+
+ + def validate!(command : Admiral::Command) + + # +
+ +
+
+ +
+
+ +
+
+ + def value_from_spec(command : Admiral::Command, *, arg : String, type, default, is_required : Bool) + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/CLI/Migration/Migrate/Flags.html b/Clear/CLI/Migration/Migrate/Flags.html new file mode 100644 index 000000000..c35e0db2b --- /dev/null +++ b/Clear/CLI/Migration/Migrate/Flags.html @@ -0,0 +1,1801 @@ + + + + + + + + + + + + + + + + + Clear::CLI::Migration::Migrate::Flags - clear develop + + + + + + + + + + +
+

+ + struct Clear::CLI::Migration::Migrate::Flags + +

+ + + + + + + +

+ + + + Overview +

+ +

Extend the flags struct to include the flag

+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/cli/migration.cr + + +
+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ DESCRIPTIONS = {} of String => String +
+ + +
+ SPECS = {"verbose" => {kind: "bool", type: "Bool", default: "false", description: {"--verbose, -v", "Display verbose informations during execution"}, short: "v", long: "verbose", is_required: true}, "no_color" => {kind: "bool", type: "Bool", default: "false", description: {"--no-color", "Cancel color output"}, short: "nil", long: "no-color", is_required: true}} of String => NamedTuple(kind: String, type: String, default: String, description: Tuple(String, String | ::Nil), short: String | ::Nil, long: String, is_required: Bool) +
+ + +
+ + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(command : Admiral::Command) + + # +
+ +
+
+ +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def inspect(io) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def no_color + + # +
+ +
+
+ +
+
+ +
+
+ + def validate!(command) + + # +
+ +
+
+ +
+
+ +
+
+ + def verbose + + # +
+ +
+
+ +
+
+ + + +
+ + + diff --git a/Clear/CLI/Migration/Rollback.html b/Clear/CLI/Migration/Rollback.html new file mode 100644 index 000000000..137de738c --- /dev/null +++ b/Clear/CLI/Migration/Rollback.html @@ -0,0 +1,1947 @@ + + + + + + + + + + + + + + + + + Clear::CLI::Migration::Rollback - clear develop + + + + + + + + + + +
+

+ + class Clear::CLI::Migration::Rollback + +

+ + + + + + + + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/cli/migration.cr + + +
+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ HELP = {"description" => ""} +
+ + +
+ + + + + +

+ + + + Class Method Summary +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +

+ + + + Class Method Detail +

+ +
+
+ + def self.description + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.run(*args, **params) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def __rescue_from___Admiral__Error(e) + + # +
+ +
+
+ +
+
+ +
+
+ + def arguments + + # +
+ +
+ +
+ Description copied from class Admiral::Command +
+ +

Returns the commands Arguments object.

+

You can access names arguments by name. +You can also access the remaning arguments using .arguments[index].

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def flags + + # +
+ +
+ +
+ Description copied from class Admiral::Command +
+ +

Returns the commands Flags object.

+

You can access names flags by name.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def help + + # +
+ +
+
+ +
+
+ +
+
+ + def run + + # +
+ +
+ +
+ Description copied from class Admiral::Command +
+ +

The run command.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def run_impl + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def sub(command, *args, **params) + + # +
+ +
+ +
+ Description copied from class Admiral::Command +
+ +

Invokes a sub command by name, passing self as the parent.

+
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/CLI/Migration/Rollback/Arguments.html b/Clear/CLI/Migration/Rollback/Arguments.html new file mode 100644 index 000000000..edecff052 --- /dev/null +++ b/Clear/CLI/Migration/Rollback/Arguments.html @@ -0,0 +1,1990 @@ + + + + + + + + + + + + + + + + + Clear::CLI::Migration::Rollback::Arguments - clear develop + + + + + + + + + + +
+

+ + struct Clear::CLI::Migration::Rollback::Arguments + +

+ + + + + + + + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/cli/migration.cr:79 + + +
+ + + + clear/cli/migration.cr:83 + + +
+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ SPECS = {"num" => {type: "Int64", description: {"num", ""}, default: "nil", is_required: false}} of String => NamedTuple(type: String, description: Tuple(String, String | ::Nil), default: String, is_required: Bool) +
+ + +
+ + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(command : Admiral::Command) + + # +
+ +
+
+ +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def [](*args, **options) + + # +
+ +
+
+ +
+
+ +
+
+ + def [](*args, **options, &) + + # +
+ +
+
+ +
+
+ +
+
+ + def each(*args, **options) + + # +
+ +
+
+ +
+
+ +
+
+ + def each(*args, **options, &) + + # +
+ +
+
+ +
+
+ +
+
+ + def exists?(name : Symbol) + + # +
+ +
+
+ +
+
+ +
+
+ + def get(name : Symbol) + + # +
+ +
+
+ +
+
+ +
+
+ + def get?(name : Symbol) + + # +
+ +
+
+ +
+
+ +
+
+ + def inspect(io) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def num : Int64 | Nil + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def rest : Array(String) + + # +
+ +
+
+ +
+
+ +
+
+ + def validate!(command : Admiral::Command) + + # +
+ +
+
+ +
+
+ +
+
+ + def value_from_spec(command : Admiral::Command, *, arg : String, type, default, is_required : Bool) + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/CLI/Migration/Rollback/Flags.html b/Clear/CLI/Migration/Rollback/Flags.html new file mode 100644 index 000000000..e54dfc860 --- /dev/null +++ b/Clear/CLI/Migration/Rollback/Flags.html @@ -0,0 +1,1820 @@ + + + + + + + + + + + + + + + + + Clear::CLI::Migration::Rollback::Flags - clear develop + + + + + + + + + + +
+

+ + struct Clear::CLI::Migration::Rollback::Flags + +

+ + + + + + + +

+ + + + Overview +

+ +

Extend the flags struct to include the flag

+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/cli/migration.cr + + +
+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ DESCRIPTIONS = {} of String => String +
+ + +
+ SPECS = {"verbose" => {kind: "bool", type: "Bool", default: "false", description: {"--verbose, -v", "Display verbose informations during execution"}, short: "v", long: "verbose", is_required: true}, "no_color" => {kind: "bool", type: "Bool", default: "false", description: {"--no-color", "Cancel color output"}, short: "nil", long: "no-color", is_required: true}, "__help__" => {kind: "bool", type: "Bool", default: "false", description: {"--help", "Displays help for the current command."}, short: "nil", long: "help", is_required: true}} of String => NamedTuple(kind: String, type: String, default: String, description: Tuple(String, String | ::Nil), short: String | ::Nil, long: String, is_required: Bool) +
+ + +
+ + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(command : Admiral::Command) + + # +
+ +
+
+ +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def __help__ + + # +
+ +
+
+ +
+
+ +
+
+ + def inspect(io) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def no_color + + # +
+ +
+
+ +
+
+ +
+
+ + def validate!(command) + + # +
+ +
+
+ +
+
+ +
+
+ + def verbose + + # +
+ +
+
+ +
+
+ + + +
+ + + diff --git a/Clear/CLI/Migration/Seed.html b/Clear/CLI/Migration/Seed.html new file mode 100644 index 000000000..4344f6aee --- /dev/null +++ b/Clear/CLI/Migration/Seed.html @@ -0,0 +1,1947 @@ + + + + + + + + + + + + + + + + + Clear::CLI::Migration::Seed - clear develop + + + + + + + + + + +
+

+ + class Clear::CLI::Migration::Seed + +

+ + + + + + + + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/cli/migration.cr + + +
+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ HELP = {"description" => ""} +
+ + +
+ + + + + +

+ + + + Class Method Summary +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +

+ + + + Class Method Detail +

+ +
+
+ + def self.description + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.run(*args, **params) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def __rescue_from___Admiral__Error(e) + + # +
+ +
+
+ +
+
+ +
+
+ + def arguments + + # +
+ +
+ +
+ Description copied from class Admiral::Command +
+ +

Returns the commands Arguments object.

+

You can access names arguments by name. +You can also access the remaning arguments using .arguments[index].

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def flags + + # +
+ +
+ +
+ Description copied from class Admiral::Command +
+ +

Returns the commands Flags object.

+

You can access names flags by name.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def help + + # +
+ +
+
+ +
+
+ +
+
+ + def run + + # +
+ +
+ +
+ Description copied from class Admiral::Command +
+ +

The run command.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def run_impl + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def sub(command, *args, **params) + + # +
+ +
+ +
+ Description copied from class Admiral::Command +
+ +

Invokes a sub command by name, passing self as the parent.

+
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/CLI/Migration/Seed/Arguments.html b/Clear/CLI/Migration/Seed/Arguments.html new file mode 100644 index 000000000..46c387f23 --- /dev/null +++ b/Clear/CLI/Migration/Seed/Arguments.html @@ -0,0 +1,1962 @@ + + + + + + + + + + + + + + + + + Clear::CLI::Migration::Seed::Arguments - clear develop + + + + + + + + + + +
+

+ + struct Clear::CLI::Migration::Seed::Arguments + +

+ + + + + + + + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/cli/migration.cr + + +
+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ SPECS = {} of String => NamedTuple(type: String, description: Tuple(String, String | ::Nil), default: String, is_required: Bool) +
+ + +
+ + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(command : Admiral::Command) + + # +
+ +
+
+ +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def [](*args, **options) + + # +
+ +
+
+ +
+
+ +
+
+ + def [](*args, **options, &) + + # +
+ +
+
+ +
+
+ +
+
+ + def each(*args, **options) + + # +
+ +
+
+ +
+
+ +
+
+ + def each(*args, **options, &) + + # +
+ +
+
+ +
+
+ +
+
+ + def exists?(name : Symbol) + + # +
+ +
+
+ +
+
+ +
+
+ + def get(name : Symbol) + + # +
+ +
+
+ +
+
+ +
+
+ + def get?(name : Symbol) + + # +
+ +
+
+ +
+
+ +
+
+ + def inspect(io) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def rest : Array(String) + + # +
+ +
+
+ +
+
+ +
+
+ + def validate!(command : Admiral::Command) + + # +
+ +
+
+ +
+
+ +
+
+ + def value_from_spec(command : Admiral::Command, *, arg : String, type, default, is_required : Bool) + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/CLI/Migration/Seed/Flags.html b/Clear/CLI/Migration/Seed/Flags.html new file mode 100644 index 000000000..d5acfc7ca --- /dev/null +++ b/Clear/CLI/Migration/Seed/Flags.html @@ -0,0 +1,1820 @@ + + + + + + + + + + + + + + + + + Clear::CLI::Migration::Seed::Flags - clear develop + + + + + + + + + + +
+

+ + struct Clear::CLI::Migration::Seed::Flags + +

+ + + + + + + +

+ + + + Overview +

+ +

Extend the flags struct to include the flag

+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/cli/migration.cr + + +
+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ DESCRIPTIONS = {} of String => String +
+ + +
+ SPECS = {"verbose" => {kind: "bool", type: "Bool", default: "false", description: {"--verbose, -v", "Display verbose informations during execution"}, short: "v", long: "verbose", is_required: true}, "no_color" => {kind: "bool", type: "Bool", default: "false", description: {"--no-color", "Cancel color output"}, short: "nil", long: "no-color", is_required: true}, "__help__" => {kind: "bool", type: "Bool", default: "false", description: {"--help", "Displays help for the current command."}, short: "nil", long: "help", is_required: true}} of String => NamedTuple(kind: String, type: String, default: String, description: Tuple(String, String | ::Nil), short: String | ::Nil, long: String, is_required: Bool) +
+ + +
+ + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(command : Admiral::Command) + + # +
+ +
+
+ +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def __help__ + + # +
+ +
+
+ +
+
+ +
+
+ + def inspect(io) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def no_color + + # +
+ +
+
+ +
+
+ +
+
+ + def validate!(command) + + # +
+ +
+
+ +
+
+ +
+
+ + def verbose + + # +
+ +
+
+ +
+
+ + + +
+ + + diff --git a/Clear/CLI/Migration/Set.html b/Clear/CLI/Migration/Set.html new file mode 100644 index 000000000..3f34fe435 --- /dev/null +++ b/Clear/CLI/Migration/Set.html @@ -0,0 +1,1928 @@ + + + + + + + + + + + + + + + + + Clear::CLI::Migration::Set - clear develop + + + + + + + + + + +
+

+ + class Clear::CLI::Migration::Set + +

+ + + + + + + + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/cli/migration.cr + + +
+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ HELP = {"description" => ""} +
+ + +
+ + + + + +

+ + + + Class Method Summary +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +

+ + + + Class Method Detail +

+ +
+
+ + def self.description + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.run(*args, **params) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def __rescue_from___Admiral__Error(e) + + # +
+ +
+
+ +
+
+ +
+
+ + def arguments + + # +
+ +
+ +
+ Description copied from class Admiral::Command +
+ +

Returns the commands Arguments object.

+

You can access names arguments by name. +You can also access the remaning arguments using .arguments[index].

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def flags + + # +
+ +
+ +
+ Description copied from class Admiral::Command +
+ +

Returns the commands Flags object.

+

You can access names flags by name.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def run + + # +
+ +
+ +
+ Description copied from class Admiral::Command +
+ +

The run command.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def run_impl + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def sub(command, *args, **params) + + # +
+ +
+ +
+ Description copied from class Admiral::Command +
+ +

Invokes a sub command by name, passing self as the parent.

+
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/CLI/Migration/Set/Arguments.html b/Clear/CLI/Migration/Set/Arguments.html new file mode 100644 index 000000000..44c056c51 --- /dev/null +++ b/Clear/CLI/Migration/Set/Arguments.html @@ -0,0 +1,1990 @@ + + + + + + + + + + + + + + + + + Clear::CLI::Migration::Set::Arguments - clear develop + + + + + + + + + + +
+

+ + struct Clear::CLI::Migration::Set::Arguments + +

+ + + + + + + + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/cli/migration.cr:48 + + +
+ + + + clear/cli/migration.cr:52 + + +
+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ SPECS = {"to" => {type: "Int64", description: {"to (required)", ""}, default: "nil", is_required: true}} of String => NamedTuple(type: String, description: Tuple(String, String | ::Nil), default: String, is_required: Bool) +
+ + +
+ + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(command : Admiral::Command) + + # +
+ +
+
+ +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def [](*args, **options) + + # +
+ +
+
+ +
+
+ +
+
+ + def [](*args, **options, &) + + # +
+ +
+
+ +
+
+ +
+
+ + def each(*args, **options) + + # +
+ +
+
+ +
+
+ +
+
+ + def each(*args, **options, &) + + # +
+ +
+
+ +
+
+ +
+
+ + def exists?(name : Symbol) + + # +
+ +
+
+ +
+
+ +
+
+ + def get(name : Symbol) + + # +
+ +
+
+ +
+
+ +
+
+ + def get?(name : Symbol) + + # +
+ +
+
+ +
+
+ +
+
+ + def inspect(io) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def rest : Array(String) + + # +
+ +
+
+ +
+
+ +
+
+ + def to : Int64 + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def validate!(command : Admiral::Command) + + # +
+ +
+
+ +
+
+ +
+
+ + def value_from_spec(command : Admiral::Command, *, arg : String, type, default, is_required : Bool) + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/CLI/Migration/Set/Flags.html b/Clear/CLI/Migration/Set/Flags.html new file mode 100644 index 000000000..4e8f5da17 --- /dev/null +++ b/Clear/CLI/Migration/Set/Flags.html @@ -0,0 +1,1829 @@ + + + + + + + + + + + + + + + + + Clear::CLI::Migration::Set::Flags - clear develop + + + + + + + + + + +
+

+ + struct Clear::CLI::Migration::Set::Flags + +

+ + + + + + + +

+ + + + Overview +

+ +

Extend the flags struct to include the flag

+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/cli/migration.cr:48 + + +
+ + + + clear/cli/migration.cr:51 + + +
+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ DESCRIPTIONS = {} of String => String +
+ + +
+ SPECS = {"verbose" => {kind: "bool", type: "Bool", default: "false", description: {"--verbose, -v", "Display verbose informations during execution"}, short: "v", long: "verbose", is_required: true}, "no_color" => {kind: "bool", type: "Bool", default: "false", description: {"--no-color", "Cancel color output"}, short: "nil", long: "no-color", is_required: true}, "direction" => {kind: "nil", type: "String", default: "\"both\"", description: {"--direction, -d (default: \"both\")", ""}, short: "d", long: "direction", is_required: true}} of String => NamedTuple(kind: String, type: String, default: String, description: Tuple(String, String | ::Nil), short: String | ::Nil, long: String, is_required: Bool) +
+ + +
+ + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(command : Admiral::Command) + + # +
+ +
+
+ +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def direction + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def inspect(io) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def no_color + + # +
+ +
+
+ +
+
+ +
+
+ + def validate!(command) + + # +
+ +
+
+ +
+
+ +
+
+ + def verbose + + # +
+ +
+
+ +
+
+ + + +
+ + + diff --git a/Clear/CLI/Migration/Status.html b/Clear/CLI/Migration/Status.html new file mode 100644 index 000000000..72da9a5a8 --- /dev/null +++ b/Clear/CLI/Migration/Status.html @@ -0,0 +1,1947 @@ + + + + + + + + + + + + + + + + + Clear::CLI::Migration::Status - clear develop + + + + + + + + + + +
+

+ + class Clear::CLI::Migration::Status + +

+ + + + + + + + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/cli/migration.cr + + +
+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ HELP = {"description" => ""} +
+ + +
+ + + + + +

+ + + + Class Method Summary +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +

+ + + + Class Method Detail +

+ +
+
+ + def self.description + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.run(*args, **params) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def __rescue_from___Admiral__Error(e) + + # +
+ +
+
+ +
+
+ +
+
+ + def arguments + + # +
+ +
+ +
+ Description copied from class Admiral::Command +
+ +

Returns the commands Arguments object.

+

You can access names arguments by name. +You can also access the remaning arguments using .arguments[index].

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def flags + + # +
+ +
+ +
+ Description copied from class Admiral::Command +
+ +

Returns the commands Flags object.

+

You can access names flags by name.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def help + + # +
+ +
+
+ +
+
+ +
+
+ + def run + + # +
+ +
+ +
+ Description copied from class Admiral::Command +
+ +

The run command.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def run_impl + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def sub(command, *args, **params) + + # +
+ +
+ +
+ Description copied from class Admiral::Command +
+ +

Invokes a sub command by name, passing self as the parent.

+
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/CLI/Migration/Status/Arguments.html b/Clear/CLI/Migration/Status/Arguments.html new file mode 100644 index 000000000..42d38ee28 --- /dev/null +++ b/Clear/CLI/Migration/Status/Arguments.html @@ -0,0 +1,1962 @@ + + + + + + + + + + + + + + + + + Clear::CLI::Migration::Status::Arguments - clear develop + + + + + + + + + + +
+

+ + struct Clear::CLI::Migration::Status::Arguments + +

+ + + + + + + + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/cli/migration.cr + + +
+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ SPECS = {} of String => NamedTuple(type: String, description: Tuple(String, String | ::Nil), default: String, is_required: Bool) +
+ + +
+ + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(command : Admiral::Command) + + # +
+ +
+
+ +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def [](*args, **options) + + # +
+ +
+
+ +
+
+ +
+
+ + def [](*args, **options, &) + + # +
+ +
+
+ +
+
+ +
+
+ + def each(*args, **options) + + # +
+ +
+
+ +
+
+ +
+
+ + def each(*args, **options, &) + + # +
+ +
+
+ +
+
+ +
+
+ + def exists?(name : Symbol) + + # +
+ +
+
+ +
+
+ +
+
+ + def get(name : Symbol) + + # +
+ +
+
+ +
+
+ +
+
+ + def get?(name : Symbol) + + # +
+ +
+
+ +
+
+ +
+
+ + def inspect(io) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def rest : Array(String) + + # +
+ +
+
+ +
+
+ +
+
+ + def validate!(command : Admiral::Command) + + # +
+ +
+
+ +
+
+ +
+
+ + def value_from_spec(command : Admiral::Command, *, arg : String, type, default, is_required : Bool) + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/CLI/Migration/Status/Flags.html b/Clear/CLI/Migration/Status/Flags.html new file mode 100644 index 000000000..9f3f8a6f7 --- /dev/null +++ b/Clear/CLI/Migration/Status/Flags.html @@ -0,0 +1,1820 @@ + + + + + + + + + + + + + + + + + Clear::CLI::Migration::Status::Flags - clear develop + + + + + + + + + + +
+

+ + struct Clear::CLI::Migration::Status::Flags + +

+ + + + + + + +

+ + + + Overview +

+ +

Extend the flags struct to include the flag

+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/cli/migration.cr + + +
+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ DESCRIPTIONS = {} of String => String +
+ + +
+ SPECS = {"verbose" => {kind: "bool", type: "Bool", default: "false", description: {"--verbose, -v", "Display verbose informations during execution"}, short: "v", long: "verbose", is_required: true}, "no_color" => {kind: "bool", type: "Bool", default: "false", description: {"--no-color", "Cancel color output"}, short: "nil", long: "no-color", is_required: true}, "__help__" => {kind: "bool", type: "Bool", default: "false", description: {"--help", "Displays help for the current command."}, short: "nil", long: "help", is_required: true}} of String => NamedTuple(kind: String, type: String, default: String, description: Tuple(String, String | ::Nil), short: String | ::Nil, long: String, is_required: Bool) +
+ + +
+ + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(command : Admiral::Command) + + # +
+ +
+
+ +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def __help__ + + # +
+ +
+
+ +
+
+ +
+
+ + def inspect(io) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def no_color + + # +
+ +
+
+ +
+
+ +
+
+ + def validate!(command) + + # +
+ +
+
+ +
+
+ +
+
+ + def verbose + + # +
+ +
+
+ +
+
+ + + +
+ + + diff --git a/Clear/CLI/Migration/Up.html b/Clear/CLI/Migration/Up.html new file mode 100644 index 000000000..4d0409667 --- /dev/null +++ b/Clear/CLI/Migration/Up.html @@ -0,0 +1,1947 @@ + + + + + + + + + + + + + + + + + Clear::CLI::Migration::Up - clear develop + + + + + + + + + + +
+

+ + class Clear::CLI::Migration::Up + +

+ + + + + + + + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/cli/migration.cr + + +
+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ HELP = {"description" => ""} +
+ + +
+ + + + + +

+ + + + Class Method Summary +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +

+ + + + Class Method Detail +

+ +
+
+ + def self.description + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.run(*args, **params) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def __rescue_from___Admiral__Error(e) + + # +
+ +
+
+ +
+
+ +
+
+ + def arguments + + # +
+ +
+ +
+ Description copied from class Admiral::Command +
+ +

Returns the commands Arguments object.

+

You can access names arguments by name. +You can also access the remaning arguments using .arguments[index].

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def flags + + # +
+ +
+ +
+ Description copied from class Admiral::Command +
+ +

Returns the commands Flags object.

+

You can access names flags by name.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def help + + # +
+ +
+
+ +
+
+ +
+
+ + def run + + # +
+ +
+ +
+ Description copied from class Admiral::Command +
+ +

The run command.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def run_impl + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def sub(command, *args, **params) + + # +
+ +
+ +
+ Description copied from class Admiral::Command +
+ +

Invokes a sub command by name, passing self as the parent.

+
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/CLI/Migration/Up/Arguments.html b/Clear/CLI/Migration/Up/Arguments.html new file mode 100644 index 000000000..e935ce0ed --- /dev/null +++ b/Clear/CLI/Migration/Up/Arguments.html @@ -0,0 +1,1990 @@ + + + + + + + + + + + + + + + + + Clear::CLI::Migration::Up::Arguments - clear develop + + + + + + + + + + +
+

+ + struct Clear::CLI::Migration::Up::Arguments + +

+ + + + + + + + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/cli/migration.cr:26 + + +
+ + + + clear/cli/migration.cr:29 + + +
+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ SPECS = {"migration_number" => {type: "Int64", description: {"migration_number (required)", ""}, default: "nil", is_required: true}} of String => NamedTuple(type: String, description: Tuple(String, String | ::Nil), default: String, is_required: Bool) +
+ + +
+ + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(command : Admiral::Command) + + # +
+ +
+
+ +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def [](*args, **options) + + # +
+ +
+
+ +
+
+ +
+
+ + def [](*args, **options, &) + + # +
+ +
+
+ +
+
+ +
+
+ + def each(*args, **options) + + # +
+ +
+
+ +
+
+ +
+
+ + def each(*args, **options, &) + + # +
+ +
+
+ +
+
+ +
+
+ + def exists?(name : Symbol) + + # +
+ +
+
+ +
+
+ +
+
+ + def get(name : Symbol) + + # +
+ +
+
+ +
+
+ +
+
+ + def get?(name : Symbol) + + # +
+ +
+
+ +
+
+ +
+
+ + def inspect(io) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def migration_number : Int64 + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def rest : Array(String) + + # +
+ +
+
+ +
+
+ +
+
+ + def validate!(command : Admiral::Command) + + # +
+ +
+
+ +
+
+ +
+
+ + def value_from_spec(command : Admiral::Command, *, arg : String, type, default, is_required : Bool) + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/CLI/Migration/Up/Flags.html b/Clear/CLI/Migration/Up/Flags.html new file mode 100644 index 000000000..d5f775157 --- /dev/null +++ b/Clear/CLI/Migration/Up/Flags.html @@ -0,0 +1,1820 @@ + + + + + + + + + + + + + + + + + Clear::CLI::Migration::Up::Flags - clear develop + + + + + + + + + + +
+

+ + struct Clear::CLI::Migration::Up::Flags + +

+ + + + + + + +

+ + + + Overview +

+ +

Extend the flags struct to include the flag

+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/cli/migration.cr + + +
+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ DESCRIPTIONS = {} of String => String +
+ + +
+ SPECS = {"verbose" => {kind: "bool", type: "Bool", default: "false", description: {"--verbose, -v", "Display verbose informations during execution"}, short: "v", long: "verbose", is_required: true}, "no_color" => {kind: "bool", type: "Bool", default: "false", description: {"--no-color", "Cancel color output"}, short: "nil", long: "no-color", is_required: true}, "__help__" => {kind: "bool", type: "Bool", default: "false", description: {"--help", "Displays help for the current command."}, short: "nil", long: "help", is_required: true}} of String => NamedTuple(kind: String, type: String, default: String, description: Tuple(String, String | ::Nil), short: String | ::Nil, long: String, is_required: Bool) +
+ + +
+ + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(command : Admiral::Command) + + # +
+ +
+
+ +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def __help__ + + # +
+ +
+
+ +
+
+ +
+
+ + def inspect(io) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def no_color + + # +
+ +
+
+ +
+
+ +
+
+ + def validate!(command) + + # +
+ +
+
+ +
+
+ +
+
+ + def verbose + + # +
+ +
+
+ +
+
+ + + +
+ + + diff --git a/Clear/CLI/Seed.html b/Clear/CLI/Seed.html new file mode 100644 index 000000000..05b72469c --- /dev/null +++ b/Clear/CLI/Seed.html @@ -0,0 +1,1947 @@ + + + + + + + + + + + + + + + + + Clear::CLI::Seed - clear develop + + + + + + + + + + +
+

+ + class Clear::CLI::Seed + +

+ + + + + + + + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/cli/seed.cr + + +
+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ HELP = {"description" => ""} +
+ + +
+ + + + + +

+ + + + Class Method Summary +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +

+ + + + Class Method Detail +

+ +
+
+ + def self.description + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.run(*args, **params) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def __rescue_from___Admiral__Error(e) + + # +
+ +
+
+ +
+
+ +
+
+ + def arguments + + # +
+ +
+ +
+ Description copied from class Admiral::Command +
+ +

Returns the commands Arguments object.

+

You can access names arguments by name. +You can also access the remaning arguments using .arguments[index].

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def flags + + # +
+ +
+ +
+ Description copied from class Admiral::Command +
+ +

Returns the commands Flags object.

+

You can access names flags by name.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def help + + # +
+ +
+
+ +
+
+ +
+
+ + def run + + # +
+ +
+ +
+ Description copied from class Admiral::Command +
+ +

The run command.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def run_impl + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def sub(command, *args, **params) + + # +
+ +
+ +
+ Description copied from class Admiral::Command +
+ +

Invokes a sub command by name, passing self as the parent.

+
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/CLI/Seed/Arguments.html b/Clear/CLI/Seed/Arguments.html new file mode 100644 index 000000000..bf9b6b6ee --- /dev/null +++ b/Clear/CLI/Seed/Arguments.html @@ -0,0 +1,1962 @@ + + + + + + + + + + + + + + + + + Clear::CLI::Seed::Arguments - clear develop + + + + + + + + + + +
+

+ + struct Clear::CLI::Seed::Arguments + +

+ + + + + + + + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/cli/seed.cr + + +
+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ SPECS = {} of String => NamedTuple(type: String, description: Tuple(String, String | ::Nil), default: String, is_required: Bool) +
+ + +
+ + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(command : Admiral::Command) + + # +
+ +
+
+ +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def [](*args, **options) + + # +
+ +
+
+ +
+
+ +
+
+ + def [](*args, **options, &) + + # +
+ +
+
+ +
+
+ +
+
+ + def each(*args, **options) + + # +
+ +
+
+ +
+
+ +
+
+ + def each(*args, **options, &) + + # +
+ +
+
+ +
+
+ +
+
+ + def exists?(name : Symbol) + + # +
+ +
+
+ +
+
+ +
+
+ + def get(name : Symbol) + + # +
+ +
+
+ +
+
+ +
+
+ + def get?(name : Symbol) + + # +
+ +
+
+ +
+
+ +
+
+ + def inspect(io) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def rest : Array(String) + + # +
+ +
+
+ +
+
+ +
+
+ + def validate!(command : Admiral::Command) + + # +
+ +
+
+ +
+
+ +
+
+ + def value_from_spec(command : Admiral::Command, *, arg : String, type, default, is_required : Bool) + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/CLI/Seed/Flags.html b/Clear/CLI/Seed/Flags.html new file mode 100644 index 000000000..7ba567186 --- /dev/null +++ b/Clear/CLI/Seed/Flags.html @@ -0,0 +1,1820 @@ + + + + + + + + + + + + + + + + + Clear::CLI::Seed::Flags - clear develop + + + + + + + + + + +
+

+ + struct Clear::CLI::Seed::Flags + +

+ + + + + + + +

+ + + + Overview +

+ +

Extend the flags struct to include the flag

+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/cli/seed.cr + + +
+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ DESCRIPTIONS = {} of String => String +
+ + +
+ SPECS = {"verbose" => {kind: "bool", type: "Bool", default: "false", description: {"--verbose, -v", "Display verbose informations during execution"}, short: "v", long: "verbose", is_required: true}, "no_color" => {kind: "bool", type: "Bool", default: "false", description: {"--no-color", "Cancel color output"}, short: "nil", long: "no-color", is_required: true}, "__help__" => {kind: "bool", type: "Bool", default: "false", description: {"--help", "Displays help for the current command."}, short: "nil", long: "help", is_required: true}} of String => NamedTuple(kind: String, type: String, default: String, description: Tuple(String, String | ::Nil), short: String | ::Nil, long: String, is_required: Bool) +
+ + +
+ + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(command : Admiral::Command) + + # +
+ +
+
+ +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def __help__ + + # +
+ +
+
+ +
+
+ +
+
+ + def inspect(io) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def no_color + + # +
+ +
+
+ +
+
+ +
+
+ + def validate!(command) + + # +
+ +
+
+ +
+
+ +
+
+ + def verbose + + # +
+ +
+
+ +
+
+ + + +
+ + + diff --git a/Clear/Enum.html b/Clear/Enum.html new file mode 100644 index 000000000..35752a15b --- /dev/null +++ b/Clear/Enum.html @@ -0,0 +1,1868 @@ + + + + + + + + + + + + + + + + + Clear::Enum - clear develop + + + + + + + + + + +
+

+ + abstract struct Clear::Enum + +

+ + + + + + + +

+ + + + Overview +

+ +

Clear::Enum wrap the enums used in PostgreSQL. +See Clear.enum macro helper.

+ + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/extensions/enum/enum.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + +

Instance methods inherited from module Clear::Expression::Literal

+ + + + to_json(json : JSON::Builder) + to_json, + + + + to_sql + to_sql + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(value : JSON::PullParser | String) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def ==(x) + + # +
+ +
+ +
+ Description copied from struct Struct +
+ +

Returns true if this struct is equal to other.

+

Both structs' instance vars are compared to each other. Thus, two +structs are considered equal if each of their instance variables are +equal. Subclasses should override this method to provide specific +equality semantics.

+
struct Point
+  def initialize(@x : Int32, @y : Int32)
+  end
+end
+
+p1 = Point.new 1, 2
+p2 = Point.new 1, 2
+p3 = Point.new 3, 4
+
+p1 == p2 # => true
+p1 == p3 # => false
+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def to_json(json : JSON::Builder) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def to_s : String + + # +
+ +
+ +
+ Description copied from class Object +
+ +

Returns a nicely readable and concise string representation of this object, +typically intended for users.

+

This method should usually not be overridden. It delegates to +#to_s(IO) which can be overridden for custom implementations.

+

Also see #inspect.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def to_sql : String + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/Enum/Converter.html b/Clear/Enum/Converter.html new file mode 100644 index 000000000..aa3fee172 --- /dev/null +++ b/Clear/Enum/Converter.html @@ -0,0 +1,1627 @@ + + + + + + + + + + + + + + + + + Clear::Enum::Converter(T) - clear develop + + + + + + + + + + +
+

+ + module Clear::Enum::Converter(T) + +

+ + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/extensions/enum/enum.cr + + +
+ + + + + + + + +

+ + + + Class Method Summary +

+ + + + + + + + +
+ +
+ + + + +

+ + + + Class Method Detail +

+ +
+
+ + def self.to_column(x) : T | Nil + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + +
+ + + diff --git a/Clear/ErrorMessages.html b/Clear/ErrorMessages.html new file mode 100644 index 000000000..58a0c925f --- /dev/null +++ b/Clear/ErrorMessages.html @@ -0,0 +1,2033 @@ + + + + + + + + + + + + + + + + + Clear::ErrorMessages - clear develop + + + + + + + + + + +
+

+ + module Clear::ErrorMessages + +

+ + + + + +

+ + + + Overview +

+ +

This module list most of the runtime errors happening in Clear. +It's an attempt to make Clear user friendly by enabling advanced resolution +of problems when they raise.

+ + + + + + + +

+ + + + Extended Modules +

+ + + + + + +

+ + + + Direct including types +

+ + + + + +

+ + + + Defined in: +

+ + + + clear/error_messages.cr + + +
+ + + + + + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ +
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def build_error_message(message : String, ways_to_resolve : Tuple | Array = Tuple.new, manual_pages : Tuple | Array = Tuple.new) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def converter_error(from, to) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def format_width(x, w = 80) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def illegal_setter_access_to_undefined_column(name) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def lack_of_primary_key(model_name) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def migration_already_down(number) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def migration_already_up(number) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def migration_irreversible(name = nil, operation = nil) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def migration_not_found(number) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def migration_not_unique(numbers) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def no_migration_yet(version) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def null_column_mapping_error(name, type) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def order_by_error_invalid_order(current_order) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def polymorphic_nil(through) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def polymorphic_unknown_class(class_name) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def query_building_error(message) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def uid_not_found(class_name) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def uninitialized_db_connection(connection) + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/Expression.html b/Clear/Expression.html new file mode 100644 index 000000000..ed564857e --- /dev/null +++ b/Clear/Expression.html @@ -0,0 +1,2210 @@ + + + + + + + + + + + + + + + + + Clear::Expression - clear develop + + + + + + + + + + +
+

+ + class Clear::Expression + +

+ + + + + + + +

+ + + + Overview +

+ +

+Clear's Expression engine

+

The goal of this module is to offer the most natural way to write down your +query in crystal.

+

If you're familiar with Sequel on Ruby, then here you have !

+

Instead of writing:

+
model_collection.where("created_at BETWEEN ? AND ?", 1.day.ago, DateTime.local)
+

You can write:

+
model_collection.where { created_at.between(1.day.ago, DateTime.local) }
+

or even:

+
model_collection.where { created_at.in?(1.day.ago..DateTime.local) }
+

(Note for the later, it will generate created_at > 1.day.ago AND created_at < DateTime.local)

+

+ +Limitations

+

Due to the use of missing_method macro, some case can be confusing.

+

+ +Existing local variable / instance method

+
id = 1
+model_collection.where { id > 100 } # Will raise an error, because the expression is resolved by Crystal !
+# Should be:
+id = 1
+model_collection.where { var("id") > 100 } # Will works
+

+ +Usage of AND / OR

+

And/Or can be used using the bitwises operators & and |. +Due to the impossibility to reuse || and &&, beware the operator precendance +rules are changed.

+
# v-- This below will not works, as we cannot redefine the `or` operator
+model_collection.where { first_name == "yacine" || last_name == "petitprez" }
+# v-- This will works, but beware of the parenthesis between each terms, as `|` is prioritary on `==`
+model.collection.where { (firt_name == "yacine") | (last_name == "petitprez") }
+# ^-- ... WHERE first_name = 'yacine' OR last_name == ''
+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/expression/expression.cr + + +
+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ DATABASE_DATE_FORMAT = "%Y-%m-%d" +
+ + +
+ DATABASE_DATE_TIME_FORMAT = "%Y-%m-%d %H:%M:%S.%L %:z" +
+ + +
+ + + + + +

+ + + + Class Method Summary +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +

+ + + + Class Method Detail +

+ +
+
+ + def self.[](arg) + + # +
+ +
+ +

A fast way to call self.safe_literal +See .safe_literal(x : _)

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.ensure_node!(any) + + # +
+ +
+ +

This method will raise error on compilation if discovered in the code. +This allow to avoid issues like this one at compile type:

+
id = 1
+# ... and later
+User.query.where { id == 2 }
+

In this case, the local var id will be evaluated in the expression engine. +leading to buggy code.

+

Having this method prevent the code to compile.

+

To be able to pass a literal or values other than node, please use #raw +method.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.raw(x : String, *args) + + # +
+ +
+ +

In case the name of the variable is a reserved word (e.g. #not, #var, #raw) +or in case of a complex piece of computation impossible to express with the expression engine +(e.g. usage of functions) you can use then raw to pass the String.

+

BE AWARE than the String is pasted AS-IS and can lead to SQL injection if not used properly.

+
having { raw("COUNT(*)") > 5 }           # SELECT ... FROM ... HAVING COUNT(*) > 5
+where { raw("func(?, ?) = ?", a, b, c) } # SELECT ... FROM ... WHERE function(a, b) = c
+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.raw(__template : String, **tuple) + + # +
+ +
+ +

In case the name of the variable is a reserved word (e.g. #not, #var, #raw) +or in case of a complex piece of computation impossible to express with the expression engine +(e.g. usage of functions) you can use then raw to pass the String.

+

BE AWARE than the String is pasted AS-IS and can lead to SQL injection if not used properly.

+
having { raw("COUNT(*)") > 5 }                       # SELECT ... FROM ... HAVING COUNT(*) > 5
+where { raw("func(:a, :b) = :c", a: a, b: b, c: c) } # SELECT ... FROM ... WHERE function(a, b) = c
+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.raw_enum(x : String, args) + + # +
+ +
+ +

See self.raw +Can pass an array to this version

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.safe_literal(x : Enumerable(AvailableLiteral)) : Enumerable(String) + + # +
+ +
+ +

Transform multiple objects into a string which is SQL-Injection safe.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.safe_literal(x : Time, date : Bool = false) : String + + # +
+ +
+ +

Safe literal of a time return a string representation of time in the format understood by postgresql.

+

If the optional parameter date is passed, the time is truncated and only the date is passed:

+

+ +Example

+
Clear::Expression[Time.local]             # < "2017-04-03 23:04:43.234 +08:00"
+Clear::Expression[Time.local, date: true] # < "2017-04-03"
+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.safe_literal(x : _) : String + + # +
+ +
+ +

Sanitize an object and return a String representation of itself which is proofed against SQL injections.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.unsafe(x) + + # +
+ +
+ +

Return unsafe string injected to the query. +can be used for example in insert query building

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.where(&) : Node + + # +
+ +
+ +

Return a node of the expression engine +This node can then be combined with others node +in case of chain request creation where {...}.where {...} +through the chaining engine

+
+ +
+
+ + [View source] + +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def not(x : Node) + + # +
+ +
+ +

NOT operator

+

Return an logically reversed version of the contained Node

+

+ +Example

+
Clear::Expression.where { not(a == b) }.resolve # >> "WHERE NOT( a = b )
+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def op(a : Node | AvailableLiteral, b : Node | AvailableLiteral, op : String) + + # +
+ +
+ +

Because many postgresql operators are not transcriptable in Crystal lang, +this helpers helps to write the expressions:

+
where { op(jsonb_field, "something", "?") } # << Return "jsonb_field ? 'something'"
+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def raw(x : String, *args) + + # +
+ +
+ +

In case the name of the variable is a reserved word (e.g. #not, #var, #raw) +or in case of a complex piece of computation impossible to express with the expression engine +(e.g. usage of functions) you can use then raw to pass the String.

+

BE AWARE than the String is pasted AS-IS and can lead to SQL injection if not used properly.

+
having { raw("COUNT(*)") > 5 }           # SELECT ... FROM ... HAVING COUNT(*) > 5
+where { raw("func(?, ?) = ?", a, b, c) } # SELECT ... FROM ... WHERE function(a, b) = c
+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def raw(__template : String, **tuple) + + # +
+ +
+ +

In case the name of the variable is a reserved word (e.g. #not, #var, #raw) +or in case of a complex piece of computation impossible to express with the expression engine +(e.g. usage of functions) you can use then raw to pass the String.

+

BE AWARE than the String is pasted AS-IS and can lead to SQL injection if not used properly.

+
having { raw("COUNT(*)") > 5 }                       # SELECT ... FROM ... HAVING COUNT(*) > 5
+where { raw("func(:a, :b) = :c", a: a, b: b, c: c) } # SELECT ... FROM ... WHERE function(a, b) = c
+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def var(*parts) + + # +
+ +
+ +

Use var to create expression of variable. Variables are columns with or without the namespace and tablename:

+

It escapes each part of the expression with double-quote as requested by PostgreSQL. +This is useful to escape SQL keywords or . and " character in the name of a column.

+
var("template1", "users", "name")        # "template1"."users"."name"
+var("template1", "users.table2", "name") # "template1"."users.table2"."name"
+var("order")                             # "order"
+
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/Expression/AvailableLiteral.html b/Clear/Expression/AvailableLiteral.html new file mode 100644 index 000000000..49da91923 --- /dev/null +++ b/Clear/Expression/AvailableLiteral.html @@ -0,0 +1,1594 @@ + + + + + + + + + + + + + + + + + Clear::Expression::AvailableLiteral - clear develop + + + + + + + + + + +
+

+ + alias Clear::Expression::AvailableLiteral + +

+ + + + + + + +

+ + + + Alias Definition +

+ Bool | Clear::Expression::Literal | Float32 | Float64 | Int16 | Int32 | Int64 | Int8 | String | Symbol | Time | UInt16 | UInt32 | UInt64 | UInt8 | Nil + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/expression/expression.cr + + +
+ + + + + + + + + + + + + + +
+ +
+ + + + + + + + + +
+ + + diff --git a/Clear/Expression/JSONB.html b/Clear/Expression/JSONB.html new file mode 100644 index 000000000..1e8d24ff2 --- /dev/null +++ b/Clear/Expression/JSONB.html @@ -0,0 +1,1584 @@ + + + + + + + + + + + + + + + + + Clear::Expression::JSONB - clear develop + + + + + + + + + + +
+

+ + module Clear::Expression::JSONB + +

+ + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/extensions/jsonb/node.cr + + +
+ + + + + + + + + + + + + + +
+ +
+ + + + + + + + + +
+ + + diff --git a/Clear/Expression/JSONB/Node.html b/Clear/Expression/JSONB/Node.html new file mode 100644 index 000000000..d28ac512d --- /dev/null +++ b/Clear/Expression/JSONB/Node.html @@ -0,0 +1,1704 @@ + + + + + + + + + + + + + + + + + Clear::Expression::JSONB::Node - clear develop + + + + + + + + + + +
+

+ + module Clear::Expression::JSONB::Node + +

+ + + + + + + + + + + + + + + +

+ + + + Direct including types +

+ + + + + +

+ + + + Defined in: +

+ + + + clear/extensions/jsonb/node.cr + + +
+ + + + + + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ +
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def jsonb(key : String) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def jsonb_all_keys_exists?(keys : Array(T)) forall T + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def jsonb_any_key_exists?(keys : Array(T)) forall T + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def jsonb_key_exists?(key : String) + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/Expression/Literal.html b/Clear/Expression/Literal.html new file mode 100644 index 000000000..81d7a7da0 --- /dev/null +++ b/Clear/Expression/Literal.html @@ -0,0 +1,1677 @@ + + + + + + + + + + + + + + + + + Clear::Expression::Literal - clear develop + + + + + + + + + + +
+

+ + module Clear::Expression::Literal + +

+ + + + + +

+ + + + Overview +

+ +

Allow any type to be used into the expression engine +by including the module Clear::Expression::Literal +and defining the method #to_sql.

+ + + + + + + + + + + +

+ + + + Direct including types +

+ + + + + +

+ + + + Defined in: +

+ + + + clear/expression/expression.cr + + +
+ + + + + + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ +
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ abstract + def to_json(json : JSON::Builder) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ abstract + def to_sql + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/Expression/Node.html b/Clear/Expression/Node.html new file mode 100644 index 000000000..ca9ce9fb8 --- /dev/null +++ b/Clear/Expression/Node.html @@ -0,0 +1,2644 @@ + + + + + + + + + + + + + + + + + Clear::Expression::Node - clear develop + + + + + + + + + + +
+

+ + abstract class Clear::Expression::Node + +

+ + + + + + + +

+ + + + Overview +

+ +

Mother class of all the rendering nodes

+ + + + + +

+ + + + Included Modules +

+ + + + + + +

+ + + + Direct Known Subclasses +

+ + + + + + + +

+ + + + Defined in: +

+ + + + clear/expression/nodes/node.cr + + +
+ + + + clear/extensions/jsonb/jsonb.cr + + +
+ + + + + + + + + + +

+ + + + Macro Summary +

+ + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + +

Instance methods inherited from module Clear::Expression::JSONB::Node

+ + + + jsonb(key : String) + jsonb, + + + + jsonb_all_keys_exists?(keys : Array(T)) forall T + jsonb_all_keys_exists?, + + + + jsonb_any_key_exists?(keys : Array(T)) forall T + jsonb_any_key_exists?, + + + + jsonb_key_exists?(key : String) + jsonb_key_exists? + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + +

+ + + + Macro Detail +

+ +
+
+ + macro define_operator(op_name, sql_name, null = false) + + # +
+ +
+
+ + [View source] + +
+
+ + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def !=(any : Node) : Node + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def !=(some_nil : Nil) : Node + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def !=(any : T) : Node forall T + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def !~(any : Node) : Node + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def !~(regexp : Regex) : Node + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def &(any : Node) : Node + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def &(any : T) : Node forall T + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def *(any : Node) : Node + + # +
+ +
+
+ +
+
+ +
+
+ + def *(any : T) : Node forall T + + # +
+ +
+
+ +
+
+ +
+
+ + def +(any : Node) : Node + + # +
+ +
+
+ +
+
+ +
+
+ + def +(any : T) : Node forall T + + # +
+ +
+
+ +
+
+ +
+
+ + def -(any : Node) : Node + + # +
+ +
+
+ +
+
+ +
+
+ + def -(any : T) : Node forall T + + # +
+ +
+
+ +
+
+ +
+
+ + def - + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def /(any : Node) : Node + + # +
+ +
+
+ +
+
+ +
+
+ + def /(any : T) : Node forall T + + # +
+ +
+
+ +
+
+ +
+
+ + def <(any : Node) : Node + + # +
+ +
+
+ +
+
+ +
+
+ + def <(any : T) : Node forall T + + # +
+ +
+
+ +
+
+ +
+
+ + def <=(any : Node) : Node + + # +
+ +
+
+ +
+
+ +
+
+ + def <=(any : T) : Node forall T + + # +
+ +
+
+ +
+
+ +
+
+ + def ==(any : Node) : Node + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def ==(some_nil : Nil) : Node + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def ==(any : T) : Node forall T + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def =~(any : Node) : Node + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def =~(regexp : Regex) : Node + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def >(any : Node) : Node + + # +
+ +
+
+ +
+
+ +
+
+ + def >(any : T) : Node forall T + + # +
+ +
+
+ +
+
+ +
+
+ + def >=(any : Node) : Node + + # +
+ +
+
+ +
+
+ +
+
+ + def >=(any : T) : Node forall T + + # +
+ +
+
+ +
+
+ +
+
+ + def |(any : Node) : Node + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def |(any : T) : Node forall T + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def ~ + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def between(a, b) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def ilike(any : Node) : Node + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def ilike(any : T) : Node forall T + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def in?(range : Range(B, E)) forall B, E + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def in?(arr : Array(T)) forall T + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def in?(tuple : Tuple(*T)) forall T + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def in?(request : Clear::SQL::SelectBuilder) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def like(any : Node) : Node + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def like(any : T) : Node forall T + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ abstract + def resolve : String + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/Expression/Node/Between.html b/Clear/Expression/Node/Between.html new file mode 100644 index 000000000..971b7e694 --- /dev/null +++ b/Clear/Expression/Node/Between.html @@ -0,0 +1,1873 @@ + + + + + + + + + + + + + + + + + Clear::Expression::Node::Between - clear develop + + + + + + + + + + +
+

+ + class Clear::Expression::Node::Between + +

+ + + + + + + +

+ + + + Overview +

+ +

A node managing the rendering of (var BETWEEN a AND b) +expressions.

+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/expression/nodes/between.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + +

Instance methods inherited from class Clear::Expression::Node

+ + + + !=(any : Node) : Node
!=(some_nil : Nil) : Node
!=(any : T) : Node forall T
+ !=
, + + + + !~(any : Node) : Node
!~(regexp : Regex) : Node
+ !~
, + + + + &(any : Node) : Node
&(any : T) : Node forall T
+ &
, + + + + *(any : Node) : Node
*(any : T) : Node forall T
+ *
, + + + + +(any : Node) : Node
+(any : T) : Node forall T
+ +
, + + + + -(any : Node) : Node
-(any : T) : Node forall T
-
+ -
, + + + + /(any : Node) : Node
/(any : T) : Node forall T
+ /
, + + + + <(any : Node) : Node
<(any : T) : Node forall T
+ <
, + + + + <=(any : Node) : Node
<=(any : T) : Node forall T
+ <=
, + + + + ==(any : Node) : Node
==(some_nil : Nil) : Node
==(any : T) : Node forall T
+ ==
, + + + + =~(any : Node) : Node
=~(regexp : Regex) : Node
+ =~
, + + + + >(any : Node) : Node
>(any : T) : Node forall T
+ >
, + + + + >=(any : Node) : Node
>=(any : T) : Node forall T
+ >=
, + + + + |(any : Node) : Node
|(any : T) : Node forall T
+ |
, + + + + ~ + ~, + + + + between(a, b) + between, + + + + ilike(any : Node) : Node
ilike(any : T) : Node forall T
+ ilike
, + + + + in?(range : Range(B, E)) forall B, E
in?(arr : Array(T)) forall T
in?(tuple : Tuple(*T)) forall T
in?(request : Clear::SQL::SelectBuilder)
+ in?
, + + + + like(any : Node) : Node
like(any : T) : Node forall T
+ like
, + + + + resolve : String + resolve + + + + + + + + + + + + +

Macros inherited from class Clear::Expression::Node

+ + + + define_operator(op_name, sql_name, null = false) + define_operator + + + + + + + +

Instance methods inherited from module Clear::Expression::JSONB::Node

+ + + + jsonb(key : String) + jsonb, + + + + jsonb_all_keys_exists?(keys : Array(T)) forall T + jsonb_all_keys_exists?, + + + + jsonb_any_key_exists?(keys : Array(T)) forall T + jsonb_any_key_exists?, + + + + jsonb_key_exists?(key : String) + jsonb_key_exists? + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(target : Node, starts : BetweenType, ends : BetweenType) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def resolve : String + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/Expression/Node/Between/BetweenType.html b/Clear/Expression/Node/Between/BetweenType.html new file mode 100644 index 000000000..89c286bd6 --- /dev/null +++ b/Clear/Expression/Node/Between/BetweenType.html @@ -0,0 +1,1594 @@ + + + + + + + + + + + + + + + + + Clear::Expression::Node::Between::BetweenType - clear develop + + + + + + + + + + +
+

+ + alias Clear::Expression::Node::Between::BetweenType + +

+ + + + + + + +

+ + + + Alias Definition +

+ Clear::Expression::Node | Float32 | Float64 | Int32 | Int64 | String | Time + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/expression/nodes/between.cr + + +
+ + + + + + + + + + + + + + +
+ +
+ + + + + + + + + +
+ + + diff --git a/Clear/Expression/Node/DoubleOperator.html b/Clear/Expression/Node/DoubleOperator.html new file mode 100644 index 000000000..b3eb34758 --- /dev/null +++ b/Clear/Expression/Node/DoubleOperator.html @@ -0,0 +1,1873 @@ + + + + + + + + + + + + + + + + + Clear::Expression::Node::DoubleOperator - clear develop + + + + + + + + + + +
+

+ + class Clear::Expression::Node::DoubleOperator + +

+ + + + + + + +

+ + + + Overview +

+ +

A node managing the rendering of +combination operations like <val1> <op> <val2>

+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/expression/nodes/double_operator.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + +

Instance methods inherited from class Clear::Expression::Node

+ + + + !=(any : Node) : Node
!=(some_nil : Nil) : Node
!=(any : T) : Node forall T
+ !=
, + + + + !~(any : Node) : Node
!~(regexp : Regex) : Node
+ !~
, + + + + &(any : Node) : Node
&(any : T) : Node forall T
+ &
, + + + + *(any : Node) : Node
*(any : T) : Node forall T
+ *
, + + + + +(any : Node) : Node
+(any : T) : Node forall T
+ +
, + + + + -(any : Node) : Node
-(any : T) : Node forall T
-
+ -
, + + + + /(any : Node) : Node
/(any : T) : Node forall T
+ /
, + + + + <(any : Node) : Node
<(any : T) : Node forall T
+ <
, + + + + <=(any : Node) : Node
<=(any : T) : Node forall T
+ <=
, + + + + ==(any : Node) : Node
==(some_nil : Nil) : Node
==(any : T) : Node forall T
+ ==
, + + + + =~(any : Node) : Node
=~(regexp : Regex) : Node
+ =~
, + + + + >(any : Node) : Node
>(any : T) : Node forall T
+ >
, + + + + >=(any : Node) : Node
>=(any : T) : Node forall T
+ >=
, + + + + |(any : Node) : Node
|(any : T) : Node forall T
+ |
, + + + + ~ + ~, + + + + between(a, b) + between, + + + + ilike(any : Node) : Node
ilike(any : T) : Node forall T
+ ilike
, + + + + in?(range : Range(B, E)) forall B, E
in?(arr : Array(T)) forall T
in?(tuple : Tuple(*T)) forall T
in?(request : Clear::SQL::SelectBuilder)
+ in?
, + + + + like(any : Node) : Node
like(any : T) : Node forall T
+ like
, + + + + resolve : String + resolve + + + + + + + + + + + + +

Macros inherited from class Clear::Expression::Node

+ + + + define_operator(op_name, sql_name, null = false) + define_operator + + + + + + + +

Instance methods inherited from module Clear::Expression::JSONB::Node

+ + + + jsonb(key : String) + jsonb, + + + + jsonb_all_keys_exists?(keys : Array(T)) forall T + jsonb_all_keys_exists?, + + + + jsonb_any_key_exists?(keys : Array(T)) forall T + jsonb_any_key_exists?, + + + + jsonb_key_exists?(key : String) + jsonb_key_exists? + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(a : Node, b : Node, op : String) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def resolve : String + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/Expression/Node/Function.html b/Clear/Expression/Node/Function.html new file mode 100644 index 000000000..2dad38a49 --- /dev/null +++ b/Clear/Expression/Node/Function.html @@ -0,0 +1,1872 @@ + + + + + + + + + + + + + + + + + Clear::Expression::Node::Function - clear develop + + + + + + + + + + +
+

+ + class Clear::Expression::Node::Function + +

+ + + + + + + +

+ + + + Overview +

+ +

A node managing the rendering of functions in Postgres.

+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/expression/nodes/function.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + +

Instance methods inherited from class Clear::Expression::Node

+ + + + !=(any : Node) : Node
!=(some_nil : Nil) : Node
!=(any : T) : Node forall T
+ !=
, + + + + !~(any : Node) : Node
!~(regexp : Regex) : Node
+ !~
, + + + + &(any : Node) : Node
&(any : T) : Node forall T
+ &
, + + + + *(any : Node) : Node
*(any : T) : Node forall T
+ *
, + + + + +(any : Node) : Node
+(any : T) : Node forall T
+ +
, + + + + -(any : Node) : Node
-(any : T) : Node forall T
-
+ -
, + + + + /(any : Node) : Node
/(any : T) : Node forall T
+ /
, + + + + <(any : Node) : Node
<(any : T) : Node forall T
+ <
, + + + + <=(any : Node) : Node
<=(any : T) : Node forall T
+ <=
, + + + + ==(any : Node) : Node
==(some_nil : Nil) : Node
==(any : T) : Node forall T
+ ==
, + + + + =~(any : Node) : Node
=~(regexp : Regex) : Node
+ =~
, + + + + >(any : Node) : Node
>(any : T) : Node forall T
+ >
, + + + + >=(any : Node) : Node
>=(any : T) : Node forall T
+ >=
, + + + + |(any : Node) : Node
|(any : T) : Node forall T
+ |
, + + + + ~ + ~, + + + + between(a, b) + between, + + + + ilike(any : Node) : Node
ilike(any : T) : Node forall T
+ ilike
, + + + + in?(range : Range(B, E)) forall B, E
in?(arr : Array(T)) forall T
in?(tuple : Tuple(*T)) forall T
in?(request : Clear::SQL::SelectBuilder)
+ in?
, + + + + like(any : Node) : Node
like(any : T) : Node forall T
+ like
, + + + + resolve : String + resolve + + + + + + + + + + + + +

Macros inherited from class Clear::Expression::Node

+ + + + define_operator(op_name, sql_name, null = false) + define_operator + + + + + + + +

Instance methods inherited from module Clear::Expression::JSONB::Node

+ + + + jsonb(key : String) + jsonb, + + + + jsonb_all_keys_exists?(keys : Array(T)) forall T + jsonb_all_keys_exists?, + + + + jsonb_any_key_exists?(keys : Array(T)) forall T + jsonb_any_key_exists?, + + + + jsonb_key_exists?(key : String) + jsonb_key_exists? + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(name : String, args : Array(String)) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def resolve : String + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/Expression/Node/InArray.html b/Clear/Expression/Node/InArray.html new file mode 100644 index 000000000..677bdd982 --- /dev/null +++ b/Clear/Expression/Node/InArray.html @@ -0,0 +1,1876 @@ + + + + + + + + + + + + + + + + + Clear::Expression::Node::InArray - clear develop + + + + + + + + + + +
+

+ + class Clear::Expression::Node::InArray + +

+ + + + + + + +

+ + + + Overview +

+ +

A node managing the rendering of array in Postgres.

+ + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/expression/nodes/in_array.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + +

Instance methods inherited from class Clear::Expression::Node

+ + + + !=(any : Node) : Node
!=(some_nil : Nil) : Node
!=(any : T) : Node forall T
+ !=
, + + + + !~(any : Node) : Node
!~(regexp : Regex) : Node
+ !~
, + + + + &(any : Node) : Node
&(any : T) : Node forall T
+ &
, + + + + *(any : Node) : Node
*(any : T) : Node forall T
+ *
, + + + + +(any : Node) : Node
+(any : T) : Node forall T
+ +
, + + + + -(any : Node) : Node
-(any : T) : Node forall T
-
+ -
, + + + + /(any : Node) : Node
/(any : T) : Node forall T
+ /
, + + + + <(any : Node) : Node
<(any : T) : Node forall T
+ <
, + + + + <=(any : Node) : Node
<=(any : T) : Node forall T
+ <=
, + + + + ==(any : Node) : Node
==(some_nil : Nil) : Node
==(any : T) : Node forall T
+ ==
, + + + + =~(any : Node) : Node
=~(regexp : Regex) : Node
+ =~
, + + + + >(any : Node) : Node
>(any : T) : Node forall T
+ >
, + + + + >=(any : Node) : Node
>=(any : T) : Node forall T
+ >=
, + + + + |(any : Node) : Node
|(any : T) : Node forall T
+ |
, + + + + ~ + ~, + + + + between(a, b) + between, + + + + ilike(any : Node) : Node
ilike(any : T) : Node forall T
+ ilike
, + + + + in?(range : Range(B, E)) forall B, E
in?(arr : Array(T)) forall T
in?(tuple : Tuple(*T)) forall T
in?(request : Clear::SQL::SelectBuilder)
+ in?
, + + + + like(any : Node) : Node
like(any : T) : Node forall T
+ like
, + + + + resolve : String + resolve + + + + + + + + + + + + +

Macros inherited from class Clear::Expression::Node

+ + + + define_operator(op_name, sql_name, null = false) + define_operator + + + + + + + +

Instance methods inherited from module Clear::Expression::JSONB::Node

+ + + + jsonb(key : String) + jsonb, + + + + jsonb_all_keys_exists?(keys : Array(T)) forall T + jsonb_all_keys_exists?, + + + + jsonb_any_key_exists?(keys : Array(T)) forall T + jsonb_any_key_exists?, + + + + jsonb_key_exists?(key : String) + jsonb_key_exists? + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(target : Node, array : Array(String)) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def resolve : String + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/Expression/Node/InRange.html b/Clear/Expression/Node/InRange.html new file mode 100644 index 000000000..cd6c8f31b --- /dev/null +++ b/Clear/Expression/Node/InRange.html @@ -0,0 +1,1877 @@ + + + + + + + + + + + + + + + + + Clear::Expression::Node::InRange - clear develop + + + + + + + + + + +
+

+ + class Clear::Expression::Node::InRange + +

+ + + + + + + +

+ + + + Overview +

+ +

A node managing the rendering a range in Postgres.

+

Example:

+
value.in?(1..5)
+

will render:

+
value >= 1 AND value < 5
+

Inclusion and exclusion of the last number of the range is featured

+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/expression/nodes/in_range.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + +

Instance methods inherited from class Clear::Expression::Node

+ + + + !=(any : Node) : Node
!=(some_nil : Nil) : Node
!=(any : T) : Node forall T
+ !=
, + + + + !~(any : Node) : Node
!~(regexp : Regex) : Node
+ !~
, + + + + &(any : Node) : Node
&(any : T) : Node forall T
+ &
, + + + + *(any : Node) : Node
*(any : T) : Node forall T
+ *
, + + + + +(any : Node) : Node
+(any : T) : Node forall T
+ +
, + + + + -(any : Node) : Node
-(any : T) : Node forall T
-
+ -
, + + + + /(any : Node) : Node
/(any : T) : Node forall T
+ /
, + + + + <(any : Node) : Node
<(any : T) : Node forall T
+ <
, + + + + <=(any : Node) : Node
<=(any : T) : Node forall T
+ <=
, + + + + ==(any : Node) : Node
==(some_nil : Nil) : Node
==(any : T) : Node forall T
+ ==
, + + + + =~(any : Node) : Node
=~(regexp : Regex) : Node
+ =~
, + + + + >(any : Node) : Node
>(any : T) : Node forall T
+ >
, + + + + >=(any : Node) : Node
>=(any : T) : Node forall T
+ >=
, + + + + |(any : Node) : Node
|(any : T) : Node forall T
+ |
, + + + + ~ + ~, + + + + between(a, b) + between, + + + + ilike(any : Node) : Node
ilike(any : T) : Node forall T
+ ilike
, + + + + in?(range : Range(B, E)) forall B, E
in?(arr : Array(T)) forall T
in?(tuple : Tuple(*T)) forall T
in?(request : Clear::SQL::SelectBuilder)
+ in?
, + + + + like(any : Node) : Node
like(any : T) : Node forall T
+ like
, + + + + resolve : String + resolve + + + + + + + + + + + + +

Macros inherited from class Clear::Expression::Node

+ + + + define_operator(op_name, sql_name, null = false) + define_operator + + + + + + + +

Instance methods inherited from module Clear::Expression::JSONB::Node

+ + + + jsonb(key : String) + jsonb, + + + + jsonb_all_keys_exists?(keys : Array(T)) forall T + jsonb_all_keys_exists?, + + + + jsonb_any_key_exists?(keys : Array(T)) forall T + jsonb_any_key_exists?, + + + + jsonb_key_exists?(key : String) + jsonb_key_exists? + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(target : Node, range : Range(String, String), exclusive : Bool = false) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def resolve : String + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/Expression/Node/InSelect.html b/Clear/Expression/Node/InSelect.html new file mode 100644 index 000000000..f4fe513b3 --- /dev/null +++ b/Clear/Expression/Node/InSelect.html @@ -0,0 +1,1872 @@ + + + + + + + + + + + + + + + + + Clear::Expression::Node::InSelect - clear develop + + + + + + + + + + +
+

+ + class Clear::Expression::Node::InSelect + +

+ + + + + + + +

+ + + + Overview +

+ +

A node managing the rendering of value IN ( <SUBQUERY> )

+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/expression/nodes/in_select.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + +

Instance methods inherited from class Clear::Expression::Node

+ + + + !=(any : Node) : Node
!=(some_nil : Nil) : Node
!=(any : T) : Node forall T
+ !=
, + + + + !~(any : Node) : Node
!~(regexp : Regex) : Node
+ !~
, + + + + &(any : Node) : Node
&(any : T) : Node forall T
+ &
, + + + + *(any : Node) : Node
*(any : T) : Node forall T
+ *
, + + + + +(any : Node) : Node
+(any : T) : Node forall T
+ +
, + + + + -(any : Node) : Node
-(any : T) : Node forall T
-
+ -
, + + + + /(any : Node) : Node
/(any : T) : Node forall T
+ /
, + + + + <(any : Node) : Node
<(any : T) : Node forall T
+ <
, + + + + <=(any : Node) : Node
<=(any : T) : Node forall T
+ <=
, + + + + ==(any : Node) : Node
==(some_nil : Nil) : Node
==(any : T) : Node forall T
+ ==
, + + + + =~(any : Node) : Node
=~(regexp : Regex) : Node
+ =~
, + + + + >(any : Node) : Node
>(any : T) : Node forall T
+ >
, + + + + >=(any : Node) : Node
>=(any : T) : Node forall T
+ >=
, + + + + |(any : Node) : Node
|(any : T) : Node forall T
+ |
, + + + + ~ + ~, + + + + between(a, b) + between, + + + + ilike(any : Node) : Node
ilike(any : T) : Node forall T
+ ilike
, + + + + in?(range : Range(B, E)) forall B, E
in?(arr : Array(T)) forall T
in?(tuple : Tuple(*T)) forall T
in?(request : Clear::SQL::SelectBuilder)
+ in?
, + + + + like(any : Node) : Node
like(any : T) : Node forall T
+ like
, + + + + resolve : String + resolve + + + + + + + + + + + + +

Macros inherited from class Clear::Expression::Node

+ + + + define_operator(op_name, sql_name, null = false) + define_operator + + + + + + + +

Instance methods inherited from module Clear::Expression::JSONB::Node

+ + + + jsonb(key : String) + jsonb, + + + + jsonb_all_keys_exists?(keys : Array(T)) forall T + jsonb_all_keys_exists?, + + + + jsonb_any_key_exists?(keys : Array(T)) forall T + jsonb_any_key_exists?, + + + + jsonb_key_exists?(key : String) + jsonb_key_exists? + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(target : Node, select __arg0 : Clear::SQL::SelectBuilder) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def resolve : String + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/Expression/Node/JSONB.html b/Clear/Expression/Node/JSONB.html new file mode 100644 index 000000000..1f2118547 --- /dev/null +++ b/Clear/Expression/Node/JSONB.html @@ -0,0 +1,1584 @@ + + + + + + + + + + + + + + + + + Clear::Expression::Node::JSONB - clear develop + + + + + + + + + + +
+

+ + module Clear::Expression::Node::JSONB + +

+ + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/extensions/jsonb/expression.cr + + +
+ + + + + + + + + + + + + + +
+ +
+ + + + + + + + + +
+ + + diff --git a/Clear/Expression/Node/JSONB/ArrayContains.html b/Clear/Expression/Node/JSONB/ArrayContains.html new file mode 100644 index 000000000..3b79c4b4a --- /dev/null +++ b/Clear/Expression/Node/JSONB/ArrayContains.html @@ -0,0 +1,1914 @@ + + + + + + + + + + + + + + + + + Clear::Expression::Node::JSONB::ArrayContains - clear develop + + + + + + + + + + +
+

+ + class Clear::Expression::Node::JSONB::ArrayContains + +

+ + + + + + + +

+ + + + Overview +

+ +

Define a array contains? (?) operation between a jsonb column and a json hash

+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/extensions/jsonb/expression.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + +

Instance methods inherited from class Clear::Expression::Node

+ + + + !=(any : Node) : Node
!=(some_nil : Nil) : Node
!=(any : T) : Node forall T
+ !=
, + + + + !~(any : Node) : Node
!~(regexp : Regex) : Node
+ !~
, + + + + &(any : Node) : Node
&(any : T) : Node forall T
+ &
, + + + + *(any : Node) : Node
*(any : T) : Node forall T
+ *
, + + + + +(any : Node) : Node
+(any : T) : Node forall T
+ +
, + + + + -(any : Node) : Node
-(any : T) : Node forall T
-
+ -
, + + + + /(any : Node) : Node
/(any : T) : Node forall T
+ /
, + + + + <(any : Node) : Node
<(any : T) : Node forall T
+ <
, + + + + <=(any : Node) : Node
<=(any : T) : Node forall T
+ <=
, + + + + ==(any : Node) : Node
==(some_nil : Nil) : Node
==(any : T) : Node forall T
+ ==
, + + + + =~(any : Node) : Node
=~(regexp : Regex) : Node
+ =~
, + + + + >(any : Node) : Node
>(any : T) : Node forall T
+ >
, + + + + >=(any : Node) : Node
>=(any : T) : Node forall T
+ >=
, + + + + |(any : Node) : Node
|(any : T) : Node forall T
+ |
, + + + + ~ + ~, + + + + between(a, b) + between, + + + + ilike(any : Node) : Node
ilike(any : T) : Node forall T
+ ilike
, + + + + in?(range : Range(B, E)) forall B, E
in?(arr : Array(T)) forall T
in?(tuple : Tuple(*T)) forall T
in?(request : Clear::SQL::SelectBuilder)
+ in?
, + + + + like(any : Node) : Node
like(any : T) : Node forall T
+ like
, + + + + resolve : String + resolve + + + + + + + + + + + + +

Macros inherited from class Clear::Expression::Node

+ + + + define_operator(op_name, sql_name, null = false) + define_operator + + + + + + + +

Instance methods inherited from module Clear::Expression::JSONB::Node

+ + + + jsonb(key : String) + jsonb, + + + + jsonb_all_keys_exists?(keys : Array(T)) forall T + jsonb_all_keys_exists?, + + + + jsonb_any_key_exists?(keys : Array(T)) forall T + jsonb_any_key_exists?, + + + + jsonb_key_exists?(key : String) + jsonb_key_exists? + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(jsonb_field : String, value : String) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def jsonb_field : String + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def resolve : String + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def value : String + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/Expression/Node/JSONB/Equality.html b/Clear/Expression/Node/JSONB/Equality.html new file mode 100644 index 000000000..6f021e9ea --- /dev/null +++ b/Clear/Expression/Node/JSONB/Equality.html @@ -0,0 +1,1975 @@ + + + + + + + + + + + + + + + + + Clear::Expression::Node::JSONB::Equality - clear develop + + + + + + + + + + +
+

+ + class Clear::Expression::Node::JSONB::Equality + +

+ + + + + + + +

+ + + + Overview +

+ +

Define a value match? (@>) operation between a jsonb column and a json hash

+ + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/extensions/jsonb/expression.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + +

Instance methods inherited from module Clear::SQL::JSONB

+ + + + jsonb_all_exists?(field, keys : Array(String)) + jsonb_all_exists?, + + + + jsonb_any_exists?(field, keys : Array(String)) + jsonb_any_exists?, + + + + jsonb_eq(field, key, value) + jsonb_eq, + + + + jsonb_exists?(field, value) + jsonb_exists?, + + + + jsonb_k2h(key : String, value : JSONBKey) : JSONBHash + jsonb_k2h, + + + + jsonb_resolve(field, arr : Array(String), cast = nil) : String
jsonb_resolve(field, key : String, cast = nil)
+ jsonb_resolve
+ + + + + + + + + + + + + + + + +

Instance methods inherited from class Clear::Expression::Node

+ + + + !=(any : Node) : Node
!=(some_nil : Nil) : Node
!=(any : T) : Node forall T
+ !=
, + + + + !~(any : Node) : Node
!~(regexp : Regex) : Node
+ !~
, + + + + &(any : Node) : Node
&(any : T) : Node forall T
+ &
, + + + + *(any : Node) : Node
*(any : T) : Node forall T
+ *
, + + + + +(any : Node) : Node
+(any : T) : Node forall T
+ +
, + + + + -(any : Node) : Node
-(any : T) : Node forall T
-
+ -
, + + + + /(any : Node) : Node
/(any : T) : Node forall T
+ /
, + + + + <(any : Node) : Node
<(any : T) : Node forall T
+ <
, + + + + <=(any : Node) : Node
<=(any : T) : Node forall T
+ <=
, + + + + ==(any : Node) : Node
==(some_nil : Nil) : Node
==(any : T) : Node forall T
+ ==
, + + + + =~(any : Node) : Node
=~(regexp : Regex) : Node
+ =~
, + + + + >(any : Node) : Node
>(any : T) : Node forall T
+ >
, + + + + >=(any : Node) : Node
>=(any : T) : Node forall T
+ >=
, + + + + |(any : Node) : Node
|(any : T) : Node forall T
+ |
, + + + + ~ + ~, + + + + between(a, b) + between, + + + + ilike(any : Node) : Node
ilike(any : T) : Node forall T
+ ilike
, + + + + in?(range : Range(B, E)) forall B, E
in?(arr : Array(T)) forall T
in?(tuple : Tuple(*T)) forall T
in?(request : Clear::SQL::SelectBuilder)
+ in?
, + + + + like(any : Node) : Node
like(any : T) : Node forall T
+ like
, + + + + resolve : String + resolve + + + + + + + + + + + + +

Macros inherited from class Clear::Expression::Node

+ + + + define_operator(op_name, sql_name, null = false) + define_operator + + + + + + + +

Instance methods inherited from module Clear::Expression::JSONB::Node

+ + + + jsonb(key : String) + jsonb, + + + + jsonb_all_keys_exists?(keys : Array(T)) forall T + jsonb_all_keys_exists?, + + + + jsonb_any_key_exists?(keys : Array(T)) forall T + jsonb_any_key_exists?, + + + + jsonb_key_exists?(key : String) + jsonb_key_exists? + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(jsonb_field : String, value : Hash(String, Clear::SQL::JSONB::JSONBKey)) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def jsonb_field : String + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def resolve : String + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def value : JSONBHash + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/Expression/Node/JSONB/Field.html b/Clear/Expression/Node/JSONB/Field.html new file mode 100644 index 000000000..fc3941765 --- /dev/null +++ b/Clear/Expression/Node/JSONB/Field.html @@ -0,0 +1,2090 @@ + + + + + + + + + + + + + + + + + Clear::Expression::Node::JSONB::Field - clear develop + + + + + + + + + + +
+

+ + class Clear::Expression::Node::JSONB::Field + +

+ + + + + + + + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/extensions/jsonb/expression.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + +

Instance methods inherited from module Clear::SQL::JSONB

+ + + + jsonb_all_exists?(field, keys : Array(String)) + jsonb_all_exists?, + + + + jsonb_any_exists?(field, keys : Array(String)) + jsonb_any_exists?, + + + + jsonb_eq(field, key, value) + jsonb_eq, + + + + jsonb_exists?(field, value) + jsonb_exists?, + + + + jsonb_k2h(key : String, value : JSONBKey) : JSONBHash + jsonb_k2h, + + + + jsonb_resolve(field, arr : Array(String), cast = nil) : String
jsonb_resolve(field, key : String, cast = nil)
+ jsonb_resolve
+ + + + + + + + + + + + + + + + +

Instance methods inherited from class Clear::Expression::Node

+ + + + !=(any : Node) : Node
!=(some_nil : Nil) : Node
!=(any : T) : Node forall T
+ !=
, + + + + !~(any : Node) : Node
!~(regexp : Regex) : Node
+ !~
, + + + + &(any : Node) : Node
&(any : T) : Node forall T
+ &
, + + + + *(any : Node) : Node
*(any : T) : Node forall T
+ *
, + + + + +(any : Node) : Node
+(any : T) : Node forall T
+ +
, + + + + -(any : Node) : Node
-(any : T) : Node forall T
-
+ -
, + + + + /(any : Node) : Node
/(any : T) : Node forall T
+ /
, + + + + <(any : Node) : Node
<(any : T) : Node forall T
+ <
, + + + + <=(any : Node) : Node
<=(any : T) : Node forall T
+ <=
, + + + + ==(any : Node) : Node
==(some_nil : Nil) : Node
==(any : T) : Node forall T
+ ==
, + + + + =~(any : Node) : Node
=~(regexp : Regex) : Node
+ =~
, + + + + >(any : Node) : Node
>(any : T) : Node forall T
+ >
, + + + + >=(any : Node) : Node
>=(any : T) : Node forall T
+ >=
, + + + + |(any : Node) : Node
|(any : T) : Node forall T
+ |
, + + + + ~ + ~, + + + + between(a, b) + between, + + + + ilike(any : Node) : Node
ilike(any : T) : Node forall T
+ ilike
, + + + + in?(range : Range(B, E)) forall B, E
in?(arr : Array(T)) forall T
in?(tuple : Tuple(*T)) forall T
in?(request : Clear::SQL::SelectBuilder)
+ in?
, + + + + like(any : Node) : Node
like(any : T) : Node forall T
+ like
, + + + + resolve : String + resolve + + + + + + + + + + + + +

Macros inherited from class Clear::Expression::Node

+ + + + define_operator(op_name, sql_name, null = false) + define_operator + + + + + + + +

Instance methods inherited from module Clear::Expression::JSONB::Node

+ + + + jsonb(key : String) + jsonb, + + + + jsonb_all_keys_exists?(keys : Array(T)) forall T + jsonb_all_keys_exists?, + + + + jsonb_any_key_exists?(keys : Array(T)) forall T + jsonb_any_key_exists?, + + + + jsonb_key_exists?(key : String) + jsonb_key_exists? + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(field : Clear::Expression::Node, key : String, cast : Nil | String = nil) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def ==(value : Clear::Expression::Node) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def ==(value : _) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def cast(cast : Nil | String) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def cast : String | Nil + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def contains?(expression : Clear::Expression::Node) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def contains?(expression) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def field : Node + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def key : String + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def resolve : String + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/Expression/Node/Literal.html b/Clear/Expression/Node/Literal.html new file mode 100644 index 000000000..4dbdd6471 --- /dev/null +++ b/Clear/Expression/Node/Literal.html @@ -0,0 +1,1893 @@ + + + + + + + + + + + + + + + + + Clear::Expression::Node::Literal - clear develop + + + + + + + + + + +
+

+ + class Clear::Expression::Node::Literal + +

+ + + + + + + +

+ + + + Overview +

+ +

Management of rendering of literal values.

+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/expression/nodes/literal.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + +

Instance methods inherited from class Clear::Expression::Node

+ + + + !=(any : Node) : Node
!=(some_nil : Nil) : Node
!=(any : T) : Node forall T
+ !=
, + + + + !~(any : Node) : Node
!~(regexp : Regex) : Node
+ !~
, + + + + &(any : Node) : Node
&(any : T) : Node forall T
+ &
, + + + + *(any : Node) : Node
*(any : T) : Node forall T
+ *
, + + + + +(any : Node) : Node
+(any : T) : Node forall T
+ +
, + + + + -(any : Node) : Node
-(any : T) : Node forall T
-
+ -
, + + + + /(any : Node) : Node
/(any : T) : Node forall T
+ /
, + + + + <(any : Node) : Node
<(any : T) : Node forall T
+ <
, + + + + <=(any : Node) : Node
<=(any : T) : Node forall T
+ <=
, + + + + ==(any : Node) : Node
==(some_nil : Nil) : Node
==(any : T) : Node forall T
+ ==
, + + + + =~(any : Node) : Node
=~(regexp : Regex) : Node
+ =~
, + + + + >(any : Node) : Node
>(any : T) : Node forall T
+ >
, + + + + >=(any : Node) : Node
>=(any : T) : Node forall T
+ >=
, + + + + |(any : Node) : Node
|(any : T) : Node forall T
+ |
, + + + + ~ + ~, + + + + between(a, b) + between, + + + + ilike(any : Node) : Node
ilike(any : T) : Node forall T
+ ilike
, + + + + in?(range : Range(B, E)) forall B, E
in?(arr : Array(T)) forall T
in?(tuple : Tuple(*T)) forall T
in?(request : Clear::SQL::SelectBuilder)
+ in?
, + + + + like(any : Node) : Node
like(any : T) : Node forall T
+ like
, + + + + resolve : String + resolve + + + + + + + + + + + + +

Macros inherited from class Clear::Expression::Node

+ + + + define_operator(op_name, sql_name, null = false) + define_operator + + + + + + + +

Instance methods inherited from module Clear::Expression::JSONB::Node

+ + + + jsonb(key : String) + jsonb, + + + + jsonb_all_keys_exists?(keys : Array(T)) forall T + jsonb_all_keys_exists?, + + + + jsonb_any_key_exists?(keys : Array(T)) forall T + jsonb_any_key_exists?, + + + + jsonb_key_exists?(key : String) + jsonb_key_exists? + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(value) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def resolve : String + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def value : AvailableLiteral + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/Expression/Node/Minus.html b/Clear/Expression/Node/Minus.html new file mode 100644 index 000000000..724daa7c4 --- /dev/null +++ b/Clear/Expression/Node/Minus.html @@ -0,0 +1,1872 @@ + + + + + + + + + + + + + + + + + Clear::Expression::Node::Minus - clear develop + + + + + + + + + + +
+

+ + class Clear::Expression::Node::Minus + +

+ + + + + + + +

+ + + + Overview +

+ +

A node managing the unary - operator.

+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/expression/nodes/minus.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + +

Instance methods inherited from class Clear::Expression::Node

+ + + + !=(any : Node) : Node
!=(some_nil : Nil) : Node
!=(any : T) : Node forall T
+ !=
, + + + + !~(any : Node) : Node
!~(regexp : Regex) : Node
+ !~
, + + + + &(any : Node) : Node
&(any : T) : Node forall T
+ &
, + + + + *(any : Node) : Node
*(any : T) : Node forall T
+ *
, + + + + +(any : Node) : Node
+(any : T) : Node forall T
+ +
, + + + + -(any : Node) : Node
-(any : T) : Node forall T
-
+ -
, + + + + /(any : Node) : Node
/(any : T) : Node forall T
+ /
, + + + + <(any : Node) : Node
<(any : T) : Node forall T
+ <
, + + + + <=(any : Node) : Node
<=(any : T) : Node forall T
+ <=
, + + + + ==(any : Node) : Node
==(some_nil : Nil) : Node
==(any : T) : Node forall T
+ ==
, + + + + =~(any : Node) : Node
=~(regexp : Regex) : Node
+ =~
, + + + + >(any : Node) : Node
>(any : T) : Node forall T
+ >
, + + + + >=(any : Node) : Node
>=(any : T) : Node forall T
+ >=
, + + + + |(any : Node) : Node
|(any : T) : Node forall T
+ |
, + + + + ~ + ~, + + + + between(a, b) + between, + + + + ilike(any : Node) : Node
ilike(any : T) : Node forall T
+ ilike
, + + + + in?(range : Range(B, E)) forall B, E
in?(arr : Array(T)) forall T
in?(tuple : Tuple(*T)) forall T
in?(request : Clear::SQL::SelectBuilder)
+ in?
, + + + + like(any : Node) : Node
like(any : T) : Node forall T
+ like
, + + + + resolve : String + resolve + + + + + + + + + + + + +

Macros inherited from class Clear::Expression::Node

+ + + + define_operator(op_name, sql_name, null = false) + define_operator + + + + + + + +

Instance methods inherited from module Clear::Expression::JSONB::Node

+ + + + jsonb(key : String) + jsonb, + + + + jsonb_all_keys_exists?(keys : Array(T)) forall T + jsonb_all_keys_exists?, + + + + jsonb_any_key_exists?(keys : Array(T)) forall T + jsonb_any_key_exists?, + + + + jsonb_key_exists?(key : String) + jsonb_key_exists? + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(a : Node) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def resolve : String + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/Expression/Node/NodeArray.html b/Clear/Expression/Node/NodeArray.html new file mode 100644 index 000000000..b65239dd4 --- /dev/null +++ b/Clear/Expression/Node/NodeArray.html @@ -0,0 +1,1956 @@ + + + + + + + + + + + + + + + + + Clear::Expression::Node::NodeArray - clear develop + + + + + + + + + + +
+

+ + class Clear::Expression::Node::NodeArray + +

+ + + + + + + +

+ + + + Overview +

+ +

This node is used to generate expression like ( a AND b AND ... AND k )

+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/expression/nodes/node_array.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + +

Instance methods inherited from class Clear::Expression::Node

+ + + + !=(any : Node) : Node
!=(some_nil : Nil) : Node
!=(any : T) : Node forall T
+ !=
, + + + + !~(any : Node) : Node
!~(regexp : Regex) : Node
+ !~
, + + + + &(any : Node) : Node
&(any : T) : Node forall T
+ &
, + + + + *(any : Node) : Node
*(any : T) : Node forall T
+ *
, + + + + +(any : Node) : Node
+(any : T) : Node forall T
+ +
, + + + + -(any : Node) : Node
-(any : T) : Node forall T
-
+ -
, + + + + /(any : Node) : Node
/(any : T) : Node forall T
+ /
, + + + + <(any : Node) : Node
<(any : T) : Node forall T
+ <
, + + + + <=(any : Node) : Node
<=(any : T) : Node forall T
+ <=
, + + + + ==(any : Node) : Node
==(some_nil : Nil) : Node
==(any : T) : Node forall T
+ ==
, + + + + =~(any : Node) : Node
=~(regexp : Regex) : Node
+ =~
, + + + + >(any : Node) : Node
>(any : T) : Node forall T
+ >
, + + + + >=(any : Node) : Node
>=(any : T) : Node forall T
+ >=
, + + + + |(any : Node) : Node
|(any : T) : Node forall T
+ |
, + + + + ~ + ~, + + + + between(a, b) + between, + + + + ilike(any : Node) : Node
ilike(any : T) : Node forall T
+ ilike
, + + + + in?(range : Range(B, E)) forall B, E
in?(arr : Array(T)) forall T
in?(tuple : Tuple(*T)) forall T
in?(request : Clear::SQL::SelectBuilder)
+ in?
, + + + + like(any : Node) : Node
like(any : T) : Node forall T
+ like
, + + + + resolve : String + resolve + + + + + + + + + + + + +

Macros inherited from class Clear::Expression::Node

+ + + + define_operator(op_name, sql_name, null = false) + define_operator + + + + + + + +

Instance methods inherited from module Clear::Expression::JSONB::Node

+ + + + jsonb(key : String) + jsonb, + + + + jsonb_all_keys_exists?(keys : Array(T)) forall T + jsonb_all_keys_exists?, + + + + jsonb_any_key_exists?(keys : Array(T)) forall T + jsonb_any_key_exists?, + + + + jsonb_key_exists?(key : String) + jsonb_key_exists? + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(expression : Array(Node), link : String) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def expression : Array(Node) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def expression=(expression : Array(Node)) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def link : String + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def link=(link : String) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def resolve : String + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/Expression/Node/Not.html b/Clear/Expression/Node/Not.html new file mode 100644 index 000000000..af25ebe2f --- /dev/null +++ b/Clear/Expression/Node/Not.html @@ -0,0 +1,1872 @@ + + + + + + + + + + + + + + + + + Clear::Expression::Node::Not - clear develop + + + + + + + + + + +
+

+ + class Clear::Expression::Node::Not + +

+ + + + + + + +

+ + + + Overview +

+ +

A node managing the unary NOT operator.

+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/expression/nodes/not.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + +

Instance methods inherited from class Clear::Expression::Node

+ + + + !=(any : Node) : Node
!=(some_nil : Nil) : Node
!=(any : T) : Node forall T
+ !=
, + + + + !~(any : Node) : Node
!~(regexp : Regex) : Node
+ !~
, + + + + &(any : Node) : Node
&(any : T) : Node forall T
+ &
, + + + + *(any : Node) : Node
*(any : T) : Node forall T
+ *
, + + + + +(any : Node) : Node
+(any : T) : Node forall T
+ +
, + + + + -(any : Node) : Node
-(any : T) : Node forall T
-
+ -
, + + + + /(any : Node) : Node
/(any : T) : Node forall T
+ /
, + + + + <(any : Node) : Node
<(any : T) : Node forall T
+ <
, + + + + <=(any : Node) : Node
<=(any : T) : Node forall T
+ <=
, + + + + ==(any : Node) : Node
==(some_nil : Nil) : Node
==(any : T) : Node forall T
+ ==
, + + + + =~(any : Node) : Node
=~(regexp : Regex) : Node
+ =~
, + + + + >(any : Node) : Node
>(any : T) : Node forall T
+ >
, + + + + >=(any : Node) : Node
>=(any : T) : Node forall T
+ >=
, + + + + |(any : Node) : Node
|(any : T) : Node forall T
+ |
, + + + + ~ + ~, + + + + between(a, b) + between, + + + + ilike(any : Node) : Node
ilike(any : T) : Node forall T
+ ilike
, + + + + in?(range : Range(B, E)) forall B, E
in?(arr : Array(T)) forall T
in?(tuple : Tuple(*T)) forall T
in?(request : Clear::SQL::SelectBuilder)
+ in?
, + + + + like(any : Node) : Node
like(any : T) : Node forall T
+ like
, + + + + resolve : String + resolve + + + + + + + + + + + + +

Macros inherited from class Clear::Expression::Node

+ + + + define_operator(op_name, sql_name, null = false) + define_operator + + + + + + + +

Instance methods inherited from module Clear::Expression::JSONB::Node

+ + + + jsonb(key : String) + jsonb, + + + + jsonb_all_keys_exists?(keys : Array(T)) forall T + jsonb_all_keys_exists?, + + + + jsonb_any_key_exists?(keys : Array(T)) forall T + jsonb_any_key_exists?, + + + + jsonb_key_exists?(key : String) + jsonb_key_exists? + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(a : Node) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def resolve : String + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/Expression/Node/NotBetween.html b/Clear/Expression/Node/NotBetween.html new file mode 100644 index 000000000..a933754d2 --- /dev/null +++ b/Clear/Expression/Node/NotBetween.html @@ -0,0 +1,1873 @@ + + + + + + + + + + + + + + + + + Clear::Expression::Node::NotBetween - clear develop + + + + + + + + + + +
+

+ + class Clear::Expression::Node::NotBetween + +

+ + + + + + + +

+ + + + Overview +

+ +

A node managing the rendering of (var NOT BETWEEN a AND b) +expressions.

+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/expression/nodes/not_between.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + +

Instance methods inherited from class Clear::Expression::Node

+ + + + !=(any : Node) : Node
!=(some_nil : Nil) : Node
!=(any : T) : Node forall T
+ !=
, + + + + !~(any : Node) : Node
!~(regexp : Regex) : Node
+ !~
, + + + + &(any : Node) : Node
&(any : T) : Node forall T
+ &
, + + + + *(any : Node) : Node
*(any : T) : Node forall T
+ *
, + + + + +(any : Node) : Node
+(any : T) : Node forall T
+ +
, + + + + -(any : Node) : Node
-(any : T) : Node forall T
-
+ -
, + + + + /(any : Node) : Node
/(any : T) : Node forall T
+ /
, + + + + <(any : Node) : Node
<(any : T) : Node forall T
+ <
, + + + + <=(any : Node) : Node
<=(any : T) : Node forall T
+ <=
, + + + + ==(any : Node) : Node
==(some_nil : Nil) : Node
==(any : T) : Node forall T
+ ==
, + + + + =~(any : Node) : Node
=~(regexp : Regex) : Node
+ =~
, + + + + >(any : Node) : Node
>(any : T) : Node forall T
+ >
, + + + + >=(any : Node) : Node
>=(any : T) : Node forall T
+ >=
, + + + + |(any : Node) : Node
|(any : T) : Node forall T
+ |
, + + + + ~ + ~, + + + + between(a, b) + between, + + + + ilike(any : Node) : Node
ilike(any : T) : Node forall T
+ ilike
, + + + + in?(range : Range(B, E)) forall B, E
in?(arr : Array(T)) forall T
in?(tuple : Tuple(*T)) forall T
in?(request : Clear::SQL::SelectBuilder)
+ in?
, + + + + like(any : Node) : Node
like(any : T) : Node forall T
+ like
, + + + + resolve : String + resolve + + + + + + + + + + + + +

Macros inherited from class Clear::Expression::Node

+ + + + define_operator(op_name, sql_name, null = false) + define_operator + + + + + + + +

Instance methods inherited from module Clear::Expression::JSONB::Node

+ + + + jsonb(key : String) + jsonb, + + + + jsonb_all_keys_exists?(keys : Array(T)) forall T + jsonb_all_keys_exists?, + + + + jsonb_any_key_exists?(keys : Array(T)) forall T + jsonb_any_key_exists?, + + + + jsonb_key_exists?(key : String) + jsonb_key_exists? + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(target : Node, starts : BetweenType, ends : BetweenType) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def resolve : String + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/Expression/Node/NotBetween/BetweenType.html b/Clear/Expression/Node/NotBetween/BetweenType.html new file mode 100644 index 000000000..36fca913a --- /dev/null +++ b/Clear/Expression/Node/NotBetween/BetweenType.html @@ -0,0 +1,1594 @@ + + + + + + + + + + + + + + + + + Clear::Expression::Node::NotBetween::BetweenType - clear develop + + + + + + + + + + +
+

+ + alias Clear::Expression::Node::NotBetween::BetweenType + +

+ + + + + + + +

+ + + + Alias Definition +

+ Clear::Expression::Node | Float32 | Float64 | Int32 | Int64 | String | Time + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/expression/nodes/not_between.cr + + +
+ + + + + + + + + + + + + + +
+ +
+ + + + + + + + + +
+ + + diff --git a/Clear/Expression/Node/Null.html b/Clear/Expression/Node/Null.html new file mode 100644 index 000000000..a3ff8e07e --- /dev/null +++ b/Clear/Expression/Node/Null.html @@ -0,0 +1,1872 @@ + + + + + + + + + + + + + + + + + Clear::Expression::Node::Null - clear develop + + + + + + + + + + +
+

+ + class Clear::Expression::Node::Null + +

+ + + + + + + +

+ + + + Overview +

+ +

Render NULL !

+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/expression/nodes/null.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + +

Instance methods inherited from class Clear::Expression::Node

+ + + + !=(any : Node) : Node
!=(some_nil : Nil) : Node
!=(any : T) : Node forall T
+ !=
, + + + + !~(any : Node) : Node
!~(regexp : Regex) : Node
+ !~
, + + + + &(any : Node) : Node
&(any : T) : Node forall T
+ &
, + + + + *(any : Node) : Node
*(any : T) : Node forall T
+ *
, + + + + +(any : Node) : Node
+(any : T) : Node forall T
+ +
, + + + + -(any : Node) : Node
-(any : T) : Node forall T
-
+ -
, + + + + /(any : Node) : Node
/(any : T) : Node forall T
+ /
, + + + + <(any : Node) : Node
<(any : T) : Node forall T
+ <
, + + + + <=(any : Node) : Node
<=(any : T) : Node forall T
+ <=
, + + + + ==(any : Node) : Node
==(some_nil : Nil) : Node
==(any : T) : Node forall T
+ ==
, + + + + =~(any : Node) : Node
=~(regexp : Regex) : Node
+ =~
, + + + + >(any : Node) : Node
>(any : T) : Node forall T
+ >
, + + + + >=(any : Node) : Node
>=(any : T) : Node forall T
+ >=
, + + + + |(any : Node) : Node
|(any : T) : Node forall T
+ |
, + + + + ~ + ~, + + + + between(a, b) + between, + + + + ilike(any : Node) : Node
ilike(any : T) : Node forall T
+ ilike
, + + + + in?(range : Range(B, E)) forall B, E
in?(arr : Array(T)) forall T
in?(tuple : Tuple(*T)) forall T
in?(request : Clear::SQL::SelectBuilder)
+ in?
, + + + + like(any : Node) : Node
like(any : T) : Node forall T
+ like
, + + + + resolve : String + resolve + + + + + + + + + + + + +

Macros inherited from class Clear::Expression::Node

+ + + + define_operator(op_name, sql_name, null = false) + define_operator + + + + + + + +

Instance methods inherited from module Clear::Expression::JSONB::Node

+ + + + jsonb(key : String) + jsonb, + + + + jsonb_all_keys_exists?(keys : Array(T)) forall T + jsonb_all_keys_exists?, + + + + jsonb_any_key_exists?(keys : Array(T)) forall T + jsonb_any_key_exists?, + + + + jsonb_key_exists?(key : String) + jsonb_key_exists? + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def resolve : String + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/Expression/Node/PGArray.html b/Clear/Expression/Node/PGArray.html new file mode 100644 index 000000000..210e0563b --- /dev/null +++ b/Clear/Expression/Node/PGArray.html @@ -0,0 +1,1873 @@ + + + + + + + + + + + + + + + + + Clear::Expression::Node::PGArray(T) - clear develop + + + + + + + + + + +
+

+ + class Clear::Expression::Node::PGArray(T) + +

+ + + + + + + +

+ + + + Overview +

+ +

A node managing PG structure array[args...] +Named PGArray instead of Array to avoid issue with naming

+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/expression/nodes/pg_array.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + +

Instance methods inherited from class Clear::Expression::Node

+ + + + !=(any : Node) : Node
!=(some_nil : Nil) : Node
!=(any : T) : Node forall T
+ !=
, + + + + !~(any : Node) : Node
!~(regexp : Regex) : Node
+ !~
, + + + + &(any : Node) : Node
&(any : T) : Node forall T
+ &
, + + + + *(any : Node) : Node
*(any : T) : Node forall T
+ *
, + + + + +(any : Node) : Node
+(any : T) : Node forall T
+ +
, + + + + -(any : Node) : Node
-(any : T) : Node forall T
-
+ -
, + + + + /(any : Node) : Node
/(any : T) : Node forall T
+ /
, + + + + <(any : Node) : Node
<(any : T) : Node forall T
+ <
, + + + + <=(any : Node) : Node
<=(any : T) : Node forall T
+ <=
, + + + + ==(any : Node) : Node
==(some_nil : Nil) : Node
==(any : T) : Node forall T
+ ==
, + + + + =~(any : Node) : Node
=~(regexp : Regex) : Node
+ =~
, + + + + >(any : Node) : Node
>(any : T) : Node forall T
+ >
, + + + + >=(any : Node) : Node
>=(any : T) : Node forall T
+ >=
, + + + + |(any : Node) : Node
|(any : T) : Node forall T
+ |
, + + + + ~ + ~, + + + + between(a, b) + between, + + + + ilike(any : Node) : Node
ilike(any : T) : Node forall T
+ ilike
, + + + + in?(range : Range(B, E)) forall B, E
in?(arr : Array(T)) forall T
in?(tuple : Tuple(*T)) forall T
in?(request : Clear::SQL::SelectBuilder)
+ in?
, + + + + like(any : Node) : Node
like(any : T) : Node forall T
+ like
, + + + + resolve : String + resolve + + + + + + + + + + + + +

Macros inherited from class Clear::Expression::Node

+ + + + define_operator(op_name, sql_name, null = false) + define_operator + + + + + + + +

Instance methods inherited from module Clear::Expression::JSONB::Node

+ + + + jsonb(key : String) + jsonb, + + + + jsonb_all_keys_exists?(keys : Array(T)) forall T + jsonb_all_keys_exists?, + + + + jsonb_any_key_exists?(keys : Array(T)) forall T + jsonb_any_key_exists?, + + + + jsonb_key_exists?(key : String) + jsonb_key_exists? + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(arr : Array(T)) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def resolve : String + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/Expression/Node/Raw.html b/Clear/Expression/Node/Raw.html new file mode 100644 index 000000000..e21a0072a --- /dev/null +++ b/Clear/Expression/Node/Raw.html @@ -0,0 +1,1872 @@ + + + + + + + + + + + + + + + + + Clear::Expression::Node::Raw - clear develop + + + + + + + + + + +
+

+ + class Clear::Expression::Node::Raw + +

+ + + + + + + +

+ + + + Overview +

+ +

This node manage the rendering of a raw SQL fragment.

+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/expression/nodes/raw.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + +

Instance methods inherited from class Clear::Expression::Node

+ + + + !=(any : Node) : Node
!=(some_nil : Nil) : Node
!=(any : T) : Node forall T
+ !=
, + + + + !~(any : Node) : Node
!~(regexp : Regex) : Node
+ !~
, + + + + &(any : Node) : Node
&(any : T) : Node forall T
+ &
, + + + + *(any : Node) : Node
*(any : T) : Node forall T
+ *
, + + + + +(any : Node) : Node
+(any : T) : Node forall T
+ +
, + + + + -(any : Node) : Node
-(any : T) : Node forall T
-
+ -
, + + + + /(any : Node) : Node
/(any : T) : Node forall T
+ /
, + + + + <(any : Node) : Node
<(any : T) : Node forall T
+ <
, + + + + <=(any : Node) : Node
<=(any : T) : Node forall T
+ <=
, + + + + ==(any : Node) : Node
==(some_nil : Nil) : Node
==(any : T) : Node forall T
+ ==
, + + + + =~(any : Node) : Node
=~(regexp : Regex) : Node
+ =~
, + + + + >(any : Node) : Node
>(any : T) : Node forall T
+ >
, + + + + >=(any : Node) : Node
>=(any : T) : Node forall T
+ >=
, + + + + |(any : Node) : Node
|(any : T) : Node forall T
+ |
, + + + + ~ + ~, + + + + between(a, b) + between, + + + + ilike(any : Node) : Node
ilike(any : T) : Node forall T
+ ilike
, + + + + in?(range : Range(B, E)) forall B, E
in?(arr : Array(T)) forall T
in?(tuple : Tuple(*T)) forall T
in?(request : Clear::SQL::SelectBuilder)
+ in?
, + + + + like(any : Node) : Node
like(any : T) : Node forall T
+ like
, + + + + resolve : String + resolve + + + + + + + + + + + + +

Macros inherited from class Clear::Expression::Node

+ + + + define_operator(op_name, sql_name, null = false) + define_operator + + + + + + + +

Instance methods inherited from module Clear::Expression::JSONB::Node

+ + + + jsonb(key : String) + jsonb, + + + + jsonb_all_keys_exists?(keys : Array(T)) forall T + jsonb_all_keys_exists?, + + + + jsonb_any_key_exists?(keys : Array(T)) forall T + jsonb_any_key_exists?, + + + + jsonb_key_exists?(key : String) + jsonb_key_exists? + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(raw : String) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def resolve : String + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/Expression/Node/Variable.html b/Clear/Expression/Node/Variable.html new file mode 100644 index 000000000..ca01d233d --- /dev/null +++ b/Clear/Expression/Node/Variable.html @@ -0,0 +1,1924 @@ + + + + + + + + + + + + + + + + + Clear::Expression::Node::Variable - clear develop + + + + + + + + + + +
+

+ + class Clear::Expression::Node::Variable + +

+ + + + + + + +

+ + + + Overview +

+ +

A variable AST node. +It's what's created under the hood when you use a non-existent variable:

+
where { users.id != nil }
+
+will produce this tree:
+
+# => double_operator('<>')
+#   # => variable('id', parent: 'users')
+#   # => null
+
+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/expression/nodes/variable.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Macro Summary +

+ + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + +

Instance methods inherited from class Clear::Expression::Node

+ + + + !=(any : Node) : Node
!=(some_nil : Nil) : Node
!=(any : T) : Node forall T
+ !=
, + + + + !~(any : Node) : Node
!~(regexp : Regex) : Node
+ !~
, + + + + &(any : Node) : Node
&(any : T) : Node forall T
+ &
, + + + + *(any : Node) : Node
*(any : T) : Node forall T
+ *
, + + + + +(any : Node) : Node
+(any : T) : Node forall T
+ +
, + + + + -(any : Node) : Node
-(any : T) : Node forall T
-
+ -
, + + + + /(any : Node) : Node
/(any : T) : Node forall T
+ /
, + + + + <(any : Node) : Node
<(any : T) : Node forall T
+ <
, + + + + <=(any : Node) : Node
<=(any : T) : Node forall T
+ <=
, + + + + ==(any : Node) : Node
==(some_nil : Nil) : Node
==(any : T) : Node forall T
+ ==
, + + + + =~(any : Node) : Node
=~(regexp : Regex) : Node
+ =~
, + + + + >(any : Node) : Node
>(any : T) : Node forall T
+ >
, + + + + >=(any : Node) : Node
>=(any : T) : Node forall T
+ >=
, + + + + |(any : Node) : Node
|(any : T) : Node forall T
+ |
, + + + + ~ + ~, + + + + between(a, b) + between, + + + + ilike(any : Node) : Node
ilike(any : T) : Node forall T
+ ilike
, + + + + in?(range : Range(B, E)) forall B, E
in?(arr : Array(T)) forall T
in?(tuple : Tuple(*T)) forall T
in?(request : Clear::SQL::SelectBuilder)
+ in?
, + + + + like(any : Node) : Node
like(any : T) : Node forall T
+ like
, + + + + resolve : String + resolve + + + + + + + + + + + + +

Macros inherited from class Clear::Expression::Node

+ + + + define_operator(op_name, sql_name, null = false) + define_operator + + + + + + + +

Instance methods inherited from module Clear::Expression::JSONB::Node

+ + + + jsonb(key : String) + jsonb, + + + + jsonb_all_keys_exists?(keys : Array(T)) forall T + jsonb_all_keys_exists?, + + + + jsonb_any_key_exists?(keys : Array(T)) forall T + jsonb_any_key_exists?, + + + + jsonb_key_exists?(key : String) + jsonb_key_exists? + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(name : String, parent : Variable | Nil = nil) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + +

+ + + + Macro Detail +

+ +
+
+ + macro method_missing(call) + + # +
+ +
+
+ + [View source] + +
+
+ + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def resolve : String + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/Expression/UnsafeSql.html b/Clear/Expression/UnsafeSql.html new file mode 100644 index 000000000..9fb6fef93 --- /dev/null +++ b/Clear/Expression/UnsafeSql.html @@ -0,0 +1,1809 @@ + + + + + + + + + + + + + + + + + Clear::Expression::UnsafeSql - clear develop + + + + + + + + + + +
+

+ + class Clear::Expression::UnsafeSql + +

+ + + + + + + +

+ + + + Overview +

+ +

Wrap an unsafe string. Useful to cancel-out the +safe_literal function used internally. +Obviously, this can lead to SQL injection, so beware!

+ + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/expression/expression.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + +

Instance methods inherited from module Clear::Expression::Literal

+ + + + to_json(json : JSON::Builder) + to_json, + + + + to_sql + to_sql + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(value : String) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def to_json(json = nil) : String + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def to_s : String + + # +
+ +
+ +
+ Description copied from class Object +
+ +

Returns a nicely readable and concise string representation of this object, +typically intended for users.

+

This method should usually not be overridden. It delegates to +#to_s(IO) which can be overridden for custom implementations.

+

Also see #inspect.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def to_sql : String + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/IllegalEnumValueError.html b/Clear/IllegalEnumValueError.html new file mode 100644 index 000000000..2a5f81c77 --- /dev/null +++ b/Clear/IllegalEnumValueError.html @@ -0,0 +1,1625 @@ + + + + + + + + + + + + + + + + + Clear::IllegalEnumValueError - clear develop + + + + + + + + + + +
+

+ + class Clear::IllegalEnumValueError + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/extensions/enum/enum.cr + + +
+ + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + +
+ + + diff --git a/Clear/Interval.html b/Clear/Interval.html new file mode 100644 index 000000000..6cbffe8c6 --- /dev/null +++ b/Clear/Interval.html @@ -0,0 +1,2079 @@ + + + + + + + + + + + + + + + + + Clear::Interval - clear develop + + + + + + + + + + +
+

+ + struct Clear::Interval + +

+ + + + + + + +

+ + + + Overview +

+ +

It can be converted automatically from/to a interval column.

+

+ +Usage example

+
class MyModel
+  include Clear::Model
+
+  column interval : Clear::TimeInDay
+end
+
+interval = Clear::Interval.new(60.days)
+record = MyModel.create!(interval: interval)
+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/extensions/interval/interval.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + +

+ + + + Class Method Summary +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(months : Int32 = 0, days : Int32 = 0, hours : Int32 = 0, minutes : Int32 = 0, seconds : Int32 = 0, milliseconds : Int32 = 0, microseconds : Int64 = 0) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.new(months : Int32, days : Int32, microseconds : Number) + + # +
+ +
+ +

For PG::Interval

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.new(span : Time::Span) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.new(span : Time::MonthSpan) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.new(io : IO) + + # +
+ +
+
+ + [View source] + +
+
+ + + + +

+ + + + Class Method Detail +

+ +
+
+ + def self.decode(x : Slice(UInt8)) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def +(interval : self) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def days : Int32 + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def hours : Int32 + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def microseconds : Int64 + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def milliseconds : Int32 + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def minutes : Int32 + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def months : Int32 + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def seconds : Int32 + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def to_json(json : JSON::Builder) : Nil + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def to_s(io) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def to_sql + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/Interval/Converter.html b/Clear/Interval/Converter.html new file mode 100644 index 000000000..d3a0eeab4 --- /dev/null +++ b/Clear/Interval/Converter.html @@ -0,0 +1,1676 @@ + + + + + + + + + + + + + + + + + Clear::Interval::Converter - clear develop + + + + + + + + + + +
+

+ + class Clear::Interval::Converter + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/extensions/interval/interval_converter.cr + + +
+ + + + + + + + +

+ + + + Class Method Summary +

+ + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +

+ + + + Class Method Detail +

+ +
+
+ + def self.to_column(x) : Clear::Interval | Nil + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.to_db(x : Clear::Interval | Nil) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + +
+ + + diff --git a/Clear/Migration.html b/Clear/Migration.html new file mode 100644 index 000000000..db3ff5cc5 --- /dev/null +++ b/Clear/Migration.html @@ -0,0 +1,2002 @@ + + + + + + + + + + + + + + + + + Clear::Migration - clear develop + + + + + + + + + + +
+

+ + module Clear::Migration + +

+ + + + + +

+ + + + Overview +

+ +

+Clear's migration system

+

Migrations in Clear are very similar to active record's migrations. +Migrations are two-way modification of the database.

+

It helps to keep a consistent database state during development lifecycle +of your application.

+

To create a migration, two ways:

+

+ +Clear command

+

+ +TL;DR

+

You can create a new file which will be present in src/db/migrate using:

+

clear-cli migration:g migration_name

+

Thus will create a migration in src/db/migration/[:uid]_migration_name.cr +(with uid number) and a class MigrationName

+

+ +Advanced options

+

You can use clear-cli migration help to get advanced options.

+

+ +Manually

+

You can create a class following this naming convention: +Anything + Number. +The number is then used to order the migration between each others and must be unique.

+

Following the rule than inclusion is often better than inheritance, just +include the module Clear::Migration to your class.

+

+ +Methods of migration

+

+ +Migration direction

+

Only one method must be overrided: change. In comparison to ActiveRecord, there's no +up and down methods, instead you can put specific up/down code like this:

+
def change(dir)
+  dir.down { irreversible! }
+end
+
def change(dir)
+  add_column :users, :full_name, :string
+
+  dir.up do
+    execute("UPDATE users SET full_name = (SELECT first_name || ' '  || last_name) from users")
+  end
+end
+ + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/extensions/enum/migration.cr + + +
+ + + + clear/migration/direction.cr + + +
+ + + + clear/migration/migration.cr + + +
+ + + + clear/migration/operation/columns.cr + + +
+ + + + clear/migration/operation/execute.cr + + +
+ + + + clear/migration/operation/indexes.cr + + +
+ + + + clear/migration/operation/operation.cr + + +
+ + + + clear/migration/operation/table.cr + + +
+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ Log = ::Log.for("clear.migration") +
+ + +
+ + + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + +

Instance methods inherited from module Clear::Migration::Helper

+ + + + add_column(table, column, datatype, nullable = false, constraint = nil, default = nil, with_values = false) + add_column, + + + + add_operation(op : Operation) + add_operation, + + + + apply(dir : Direction = Clear::Migration::Direction::Up) + apply, + + + + change(dir) + change, + + + + change_column_type(table, column, from, to) + change_column_type, + + + + create_enum(name, arr : Enumerable(T)) forall T
create_enum(name, e)
+ create_enum
, + + + + create_index(table, columns : Array(String), name = nil, using = nil, unique = false)
create_index(table, column, name = nil, using = nil, unique = false)
+ create_index
, + + + + create_table(name, id : Symbol | Bool = true, schema = "public", &) + create_table, + + + + drop_column(table, column, type) + drop_column, + + + + drop_enum(name, arr : Enumerable(T) | Nil = nil) forall T + drop_enum, + + + + execute(sql : String) + execute, + + + + irreversible! + irreversible!, + + + + rename_column(table, from, to) + rename_column + + + + + + + + + +

Class methods inherited from module Clear::Migration::Helper

+ + + + datatype(type : String) + datatype + + + + + + + + + + +

Instance methods inherited from module Clear::Migration::FullTextSearchableHelpers

+ + + + add_full_text_searchable(table, on : Array(Tuple(String, Char)), column_name = "full_text_vector", catalog = "pg_catalog.english", trigger_name = nil, function_name = nil) + add_full_text_searchable + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::ErrorMessages

+ + + + build_error_message(message : String, ways_to_resolve : Tuple | Array = Tuple.new, manual_pages : Tuple | Array = Tuple.new) + build_error_message, + + + + converter_error(from, to) + converter_error, + + + + format_width(x, w = 80) + format_width, + + + + illegal_setter_access_to_undefined_column(name) + illegal_setter_access_to_undefined_column, + + + + lack_of_primary_key(model_name) + lack_of_primary_key, + + + + migration_already_down(number) + migration_already_down, + + + + migration_already_up(number) + migration_already_up, + + + + migration_irreversible(name = nil, operation = nil) + migration_irreversible, + + + + migration_not_found(number) + migration_not_found, + + + + migration_not_unique(numbers) + migration_not_unique, + + + + no_migration_yet(version) + no_migration_yet, + + + + null_column_mapping_error(name, type) + null_column_mapping_error, + + + + order_by_error_invalid_order(current_order) + order_by_error_invalid_order, + + + + polymorphic_nil(through) + polymorphic_nil, + + + + polymorphic_unknown_class(class_name) + polymorphic_unknown_class, + + + + query_building_error(message) + query_building_error, + + + + uid_not_found(class_name) + uid_not_found, + + + + uninitialized_db_connection(connection) + uninitialized_db_connection + + + + + + + + + + + + + + +
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ abstract + def uid : Int64 + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/Migration/AddColumn.html b/Clear/Migration/AddColumn.html new file mode 100644 index 000000000..94b0b376e --- /dev/null +++ b/Clear/Migration/AddColumn.html @@ -0,0 +1,1868 @@ + + + + + + + + + + + + + + + + + Clear::Migration::AddColumn - clear develop + + + + + + + + + + +
+

+ + class Clear::Migration::AddColumn + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/migration/operation/columns.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + +

Instance methods inherited from class Clear::Migration::Operation

+ + + + down : Array(String) + down, + + + + irreversible!(operation_name : String | Nil = nil) + irreversible!, + + + + migration : Clear::Migration | Nil + migration, + + + + migration=(migration : Clear::Migration | Nil) + migration=, + + + + up : Array(String) + up + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::ErrorMessages

+ + + + build_error_message(message : String, ways_to_resolve : Tuple | Array = Tuple.new, manual_pages : Tuple | Array = Tuple.new) + build_error_message, + + + + converter_error(from, to) + converter_error, + + + + format_width(x, w = 80) + format_width, + + + + illegal_setter_access_to_undefined_column(name) + illegal_setter_access_to_undefined_column, + + + + lack_of_primary_key(model_name) + lack_of_primary_key, + + + + migration_already_down(number) + migration_already_down, + + + + migration_already_up(number) + migration_already_up, + + + + migration_irreversible(name = nil, operation = nil) + migration_irreversible, + + + + migration_not_found(number) + migration_not_found, + + + + migration_not_unique(numbers) + migration_not_unique, + + + + no_migration_yet(version) + no_migration_yet, + + + + null_column_mapping_error(name, type) + null_column_mapping_error, + + + + order_by_error_invalid_order(current_order) + order_by_error_invalid_order, + + + + polymorphic_nil(through) + polymorphic_nil, + + + + polymorphic_unknown_class(class_name) + polymorphic_unknown_class, + + + + query_building_error(message) + query_building_error, + + + + uid_not_found(class_name) + uid_not_found, + + + + uninitialized_db_connection(connection) + uninitialized_db_connection + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(table : String, column : String, datatype, nullable : Bool = false, constraint : Nil | String = nil, default : Nil | String = nil, with_values : Bool = false) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def down : Array(String) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def up : Array(String) + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/Migration/AddTable.html b/Clear/Migration/AddTable.html new file mode 100644 index 000000000..b67777053 --- /dev/null +++ b/Clear/Migration/AddTable.html @@ -0,0 +1,1931 @@ + + + + + + + + + + + + + + + + + Clear::Migration::AddTable - clear develop + + + + + + + + + + +
+

+ + class Clear::Migration::AddTable + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/migration/operation/table.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + +

Instance methods inherited from class Clear::Migration::Operation

+ + + + down : Array(String) + down, + + + + irreversible!(operation_name : String | Nil = nil) + irreversible!, + + + + migration : Clear::Migration | Nil + migration, + + + + migration=(migration : Clear::Migration | Nil) + migration=, + + + + up : Array(String) + up + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::ErrorMessages

+ + + + build_error_message(message : String, ways_to_resolve : Tuple | Array = Tuple.new, manual_pages : Tuple | Array = Tuple.new) + build_error_message, + + + + converter_error(from, to) + converter_error, + + + + format_width(x, w = 80) + format_width, + + + + illegal_setter_access_to_undefined_column(name) + illegal_setter_access_to_undefined_column, + + + + lack_of_primary_key(model_name) + lack_of_primary_key, + + + + migration_already_down(number) + migration_already_down, + + + + migration_already_up(number) + migration_already_up, + + + + migration_irreversible(name = nil, operation = nil) + migration_irreversible, + + + + migration_not_found(number) + migration_not_found, + + + + migration_not_unique(numbers) + migration_not_unique, + + + + no_migration_yet(version) + no_migration_yet, + + + + null_column_mapping_error(name, type) + null_column_mapping_error, + + + + order_by_error_invalid_order(current_order) + order_by_error_invalid_order, + + + + polymorphic_nil(through) + polymorphic_nil, + + + + polymorphic_unknown_class(class_name) + polymorphic_unknown_class, + + + + query_building_error(message) + query_building_error, + + + + uid_not_found(class_name) + uid_not_found, + + + + uninitialized_db_connection(connection) + uninitialized_db_connection + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(table : String, schema : String) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def down : Array(String) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def full_name + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def schema : String + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def table : String + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def up : Array(String) + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/Migration/ChangeColumnType.html b/Clear/Migration/ChangeColumnType.html new file mode 100644 index 000000000..3d1de2c73 --- /dev/null +++ b/Clear/Migration/ChangeColumnType.html @@ -0,0 +1,1868 @@ + + + + + + + + + + + + + + + + + Clear::Migration::ChangeColumnType - clear develop + + + + + + + + + + +
+

+ + class Clear::Migration::ChangeColumnType + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/migration/operation/columns.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + +

Instance methods inherited from class Clear::Migration::Operation

+ + + + down : Array(String) + down, + + + + irreversible!(operation_name : String | Nil = nil) + irreversible!, + + + + migration : Clear::Migration | Nil + migration, + + + + migration=(migration : Clear::Migration | Nil) + migration=, + + + + up : Array(String) + up + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::ErrorMessages

+ + + + build_error_message(message : String, ways_to_resolve : Tuple | Array = Tuple.new, manual_pages : Tuple | Array = Tuple.new) + build_error_message, + + + + converter_error(from, to) + converter_error, + + + + format_width(x, w = 80) + format_width, + + + + illegal_setter_access_to_undefined_column(name) + illegal_setter_access_to_undefined_column, + + + + lack_of_primary_key(model_name) + lack_of_primary_key, + + + + migration_already_down(number) + migration_already_down, + + + + migration_already_up(number) + migration_already_up, + + + + migration_irreversible(name = nil, operation = nil) + migration_irreversible, + + + + migration_not_found(number) + migration_not_found, + + + + migration_not_unique(numbers) + migration_not_unique, + + + + no_migration_yet(version) + no_migration_yet, + + + + null_column_mapping_error(name, type) + null_column_mapping_error, + + + + order_by_error_invalid_order(current_order) + order_by_error_invalid_order, + + + + polymorphic_nil(through) + polymorphic_nil, + + + + polymorphic_unknown_class(class_name) + polymorphic_unknown_class, + + + + query_building_error(message) + query_building_error, + + + + uid_not_found(class_name) + uid_not_found, + + + + uninitialized_db_connection(connection) + uninitialized_db_connection + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(table : String, column_name : String, old_column_type, new_column_type) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def down : Array(String) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def up : Array(String) + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/Migration/CreateEnum.html b/Clear/Migration/CreateEnum.html new file mode 100644 index 000000000..a49e4b68f --- /dev/null +++ b/Clear/Migration/CreateEnum.html @@ -0,0 +1,1868 @@ + + + + + + + + + + + + + + + + + Clear::Migration::CreateEnum - clear develop + + + + + + + + + + +
+

+ + class Clear::Migration::CreateEnum + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/extensions/enum/migration.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + +

Instance methods inherited from class Clear::Migration::Operation

+ + + + down : Array(String) + down, + + + + irreversible!(operation_name : String | Nil = nil) + irreversible!, + + + + migration : Clear::Migration | Nil + migration, + + + + migration=(migration : Clear::Migration | Nil) + migration=, + + + + up : Array(String) + up + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::ErrorMessages

+ + + + build_error_message(message : String, ways_to_resolve : Tuple | Array = Tuple.new, manual_pages : Tuple | Array = Tuple.new) + build_error_message, + + + + converter_error(from, to) + converter_error, + + + + format_width(x, w = 80) + format_width, + + + + illegal_setter_access_to_undefined_column(name) + illegal_setter_access_to_undefined_column, + + + + lack_of_primary_key(model_name) + lack_of_primary_key, + + + + migration_already_down(number) + migration_already_down, + + + + migration_already_up(number) + migration_already_up, + + + + migration_irreversible(name = nil, operation = nil) + migration_irreversible, + + + + migration_not_found(number) + migration_not_found, + + + + migration_not_unique(numbers) + migration_not_unique, + + + + no_migration_yet(version) + no_migration_yet, + + + + null_column_mapping_error(name, type) + null_column_mapping_error, + + + + order_by_error_invalid_order(current_order) + order_by_error_invalid_order, + + + + polymorphic_nil(through) + polymorphic_nil, + + + + polymorphic_unknown_class(class_name) + polymorphic_unknown_class, + + + + query_building_error(message) + query_building_error, + + + + uid_not_found(class_name) + uid_not_found, + + + + uninitialized_db_connection(connection) + uninitialized_db_connection + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(name : String, values : Array(String)) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def down : Array(String) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def up : Array(String) + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/Migration/CreateIndex.html b/Clear/Migration/CreateIndex.html new file mode 100644 index 000000000..784d477b4 --- /dev/null +++ b/Clear/Migration/CreateIndex.html @@ -0,0 +1,1910 @@ + + + + + + + + + + + + + + + + + Clear::Migration::CreateIndex - clear develop + + + + + + + + + + +
+

+ + class Clear::Migration::CreateIndex + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/migration/operation/indexes.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + +

Instance methods inherited from class Clear::Migration::Operation

+ + + + down : Array(String) + down, + + + + irreversible!(operation_name : String | Nil = nil) + irreversible!, + + + + migration : Clear::Migration | Nil + migration, + + + + migration=(migration : Clear::Migration | Nil) + migration=, + + + + up : Array(String) + up + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::ErrorMessages

+ + + + build_error_message(message : String, ways_to_resolve : Tuple | Array = Tuple.new, manual_pages : Tuple | Array = Tuple.new) + build_error_message, + + + + converter_error(from, to) + converter_error, + + + + format_width(x, w = 80) + format_width, + + + + illegal_setter_access_to_undefined_column(name) + illegal_setter_access_to_undefined_column, + + + + lack_of_primary_key(model_name) + lack_of_primary_key, + + + + migration_already_down(number) + migration_already_down, + + + + migration_already_up(number) + migration_already_up, + + + + migration_irreversible(name = nil, operation = nil) + migration_irreversible, + + + + migration_not_found(number) + migration_not_found, + + + + migration_not_unique(numbers) + migration_not_unique, + + + + no_migration_yet(version) + no_migration_yet, + + + + null_column_mapping_error(name, type) + null_column_mapping_error, + + + + order_by_error_invalid_order(current_order) + order_by_error_invalid_order, + + + + polymorphic_nil(through) + polymorphic_nil, + + + + polymorphic_unknown_class(class_name) + polymorphic_unknown_class, + + + + query_building_error(message) + query_building_error, + + + + uid_not_found(class_name) + uid_not_found, + + + + uninitialized_db_connection(connection) + uninitialized_db_connection + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(table : String, fields : Array(String), name = nil, using : Nil | String = nil, unique : Bool = false) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.new(table : String, field : String | Symbol, name = nil, using : Nil | String = nil, unique : Bool = false) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def down : Array(String) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def safe_name(x) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def up : Array(String) + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/Migration/Direction.html b/Clear/Migration/Direction.html new file mode 100644 index 000000000..fc26a4c99 --- /dev/null +++ b/Clear/Migration/Direction.html @@ -0,0 +1,1794 @@ + + + + + + + + + + + + + + + + + Clear::Migration::Direction - clear develop + + + + + + + + + + +
+

+ + enum Clear::Migration::Direction + +

+ + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/migration/direction.cr + + +
+ + + + + +

+ + + + Enum Members +

+ +
+ +
+ Up = 0 +
+ + +
+ Down = 1 +
+ + +
+ + + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def down(&) + + # +
+ +
+ +

Run the block given in parameter if the direction is a rollback

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def down? + + # +
+ +
+ +

Return true whether the migration is a rollback

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def up(&) + + # +
+ +
+ +

Run the block given in parameter if the direction is a upstream

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def up? + + # +
+ +
+ +

Return true whether the migration is a upstream

+
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/Migration/DropEnum.html b/Clear/Migration/DropEnum.html new file mode 100644 index 000000000..2db088a7c --- /dev/null +++ b/Clear/Migration/DropEnum.html @@ -0,0 +1,1868 @@ + + + + + + + + + + + + + + + + + Clear::Migration::DropEnum - clear develop + + + + + + + + + + +
+

+ + class Clear::Migration::DropEnum + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/extensions/enum/migration.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + +

Instance methods inherited from class Clear::Migration::Operation

+ + + + down : Array(String) + down, + + + + irreversible!(operation_name : String | Nil = nil) + irreversible!, + + + + migration : Clear::Migration | Nil + migration, + + + + migration=(migration : Clear::Migration | Nil) + migration=, + + + + up : Array(String) + up + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::ErrorMessages

+ + + + build_error_message(message : String, ways_to_resolve : Tuple | Array = Tuple.new, manual_pages : Tuple | Array = Tuple.new) + build_error_message, + + + + converter_error(from, to) + converter_error, + + + + format_width(x, w = 80) + format_width, + + + + illegal_setter_access_to_undefined_column(name) + illegal_setter_access_to_undefined_column, + + + + lack_of_primary_key(model_name) + lack_of_primary_key, + + + + migration_already_down(number) + migration_already_down, + + + + migration_already_up(number) + migration_already_up, + + + + migration_irreversible(name = nil, operation = nil) + migration_irreversible, + + + + migration_not_found(number) + migration_not_found, + + + + migration_not_unique(numbers) + migration_not_unique, + + + + no_migration_yet(version) + no_migration_yet, + + + + null_column_mapping_error(name, type) + null_column_mapping_error, + + + + order_by_error_invalid_order(current_order) + order_by_error_invalid_order, + + + + polymorphic_nil(through) + polymorphic_nil, + + + + polymorphic_unknown_class(class_name) + polymorphic_unknown_class, + + + + query_building_error(message) + query_building_error, + + + + uid_not_found(class_name) + uid_not_found, + + + + uninitialized_db_connection(connection) + uninitialized_db_connection + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(name : String, values : Nil | Array(String)) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def down : Array(String) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def up : Array(String) + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/Migration/DropTable.html b/Clear/Migration/DropTable.html new file mode 100644 index 000000000..01dfb76fd --- /dev/null +++ b/Clear/Migration/DropTable.html @@ -0,0 +1,1931 @@ + + + + + + + + + + + + + + + + + Clear::Migration::DropTable - clear develop + + + + + + + + + + +
+

+ + class Clear::Migration::DropTable + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/migration/operation/table.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + +

Instance methods inherited from class Clear::Migration::Operation

+ + + + down : Array(String) + down, + + + + irreversible!(operation_name : String | Nil = nil) + irreversible!, + + + + migration : Clear::Migration | Nil + migration, + + + + migration=(migration : Clear::Migration | Nil) + migration=, + + + + up : Array(String) + up + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::ErrorMessages

+ + + + build_error_message(message : String, ways_to_resolve : Tuple | Array = Tuple.new, manual_pages : Tuple | Array = Tuple.new) + build_error_message, + + + + converter_error(from, to) + converter_error, + + + + format_width(x, w = 80) + format_width, + + + + illegal_setter_access_to_undefined_column(name) + illegal_setter_access_to_undefined_column, + + + + lack_of_primary_key(model_name) + lack_of_primary_key, + + + + migration_already_down(number) + migration_already_down, + + + + migration_already_up(number) + migration_already_up, + + + + migration_irreversible(name = nil, operation = nil) + migration_irreversible, + + + + migration_not_found(number) + migration_not_found, + + + + migration_not_unique(numbers) + migration_not_unique, + + + + no_migration_yet(version) + no_migration_yet, + + + + null_column_mapping_error(name, type) + null_column_mapping_error, + + + + order_by_error_invalid_order(current_order) + order_by_error_invalid_order, + + + + polymorphic_nil(through) + polymorphic_nil, + + + + polymorphic_unknown_class(class_name) + polymorphic_unknown_class, + + + + query_building_error(message) + query_building_error, + + + + uid_not_found(class_name) + uid_not_found, + + + + uninitialized_db_connection(connection) + uninitialized_db_connection + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(table : String, schema : String) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def down : Array(String) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def full_name + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def schema : String + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def table : String + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def up : Array(String) + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/Migration/Execute.html b/Clear/Migration/Execute.html new file mode 100644 index 000000000..8c3409788 --- /dev/null +++ b/Clear/Migration/Execute.html @@ -0,0 +1,1868 @@ + + + + + + + + + + + + + + + + + Clear::Migration::Execute - clear develop + + + + + + + + + + +
+

+ + class Clear::Migration::Execute + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/migration/operation/execute.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + +

Instance methods inherited from class Clear::Migration::Operation

+ + + + down : Array(String) + down, + + + + irreversible!(operation_name : String | Nil = nil) + irreversible!, + + + + migration : Clear::Migration | Nil + migration, + + + + migration=(migration : Clear::Migration | Nil) + migration=, + + + + up : Array(String) + up + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::ErrorMessages

+ + + + build_error_message(message : String, ways_to_resolve : Tuple | Array = Tuple.new, manual_pages : Tuple | Array = Tuple.new) + build_error_message, + + + + converter_error(from, to) + converter_error, + + + + format_width(x, w = 80) + format_width, + + + + illegal_setter_access_to_undefined_column(name) + illegal_setter_access_to_undefined_column, + + + + lack_of_primary_key(model_name) + lack_of_primary_key, + + + + migration_already_down(number) + migration_already_down, + + + + migration_already_up(number) + migration_already_up, + + + + migration_irreversible(name = nil, operation = nil) + migration_irreversible, + + + + migration_not_found(number) + migration_not_found, + + + + migration_not_unique(numbers) + migration_not_unique, + + + + no_migration_yet(version) + no_migration_yet, + + + + null_column_mapping_error(name, type) + null_column_mapping_error, + + + + order_by_error_invalid_order(current_order) + order_by_error_invalid_order, + + + + polymorphic_nil(through) + polymorphic_nil, + + + + polymorphic_unknown_class(class_name) + polymorphic_unknown_class, + + + + query_building_error(message) + query_building_error, + + + + uid_not_found(class_name) + uid_not_found, + + + + uninitialized_db_connection(connection) + uninitialized_db_connection + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(sql : String, irreversible : Bool | Nil = false) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def down : Array(String) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def up : Array(String) + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/Migration/FullTextSearchableHelpers.html b/Clear/Migration/FullTextSearchableHelpers.html new file mode 100644 index 000000000..5cb0f421f --- /dev/null +++ b/Clear/Migration/FullTextSearchableHelpers.html @@ -0,0 +1,1649 @@ + + + + + + + + + + + + + + + + + Clear::Migration::FullTextSearchableHelpers - clear develop + + + + + + + + + + +
+

+ + module Clear::Migration::FullTextSearchableHelpers + +

+ + + + + + + + + + + + + + + +

+ + + + Direct including types +

+ + + + + +

+ + + + Defined in: +

+ + + + clear/extensions/full_text_searchable/migration.cr + + +
+ + + + + + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ +
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def add_full_text_searchable(table, on : Array(Tuple(String, Char)), column_name = "full_text_vector", catalog = "pg_catalog.english", trigger_name = nil, function_name = nil) + + # +
+ +
+ +

Add a tsvector field to a table. +Create column, index and trigger.

+
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/Migration/FullTextSearchableOperation.html b/Clear/Migration/FullTextSearchableOperation.html new file mode 100644 index 000000000..490cd3a26 --- /dev/null +++ b/Clear/Migration/FullTextSearchableOperation.html @@ -0,0 +1,1994 @@ + + + + + + + + + + + + + + + + + Clear::Migration::FullTextSearchableOperation - clear develop + + + + + + + + + + +
+

+ + class Clear::Migration::FullTextSearchableOperation + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/extensions/full_text_searchable/migration.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + +

Instance methods inherited from class Clear::Migration::Operation

+ + + + down : Array(String) + down, + + + + irreversible!(operation_name : String | Nil = nil) + irreversible!, + + + + migration : Clear::Migration | Nil + migration, + + + + migration=(migration : Clear::Migration | Nil) + migration=, + + + + up : Array(String) + up + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::ErrorMessages

+ + + + build_error_message(message : String, ways_to_resolve : Tuple | Array = Tuple.new, manual_pages : Tuple | Array = Tuple.new) + build_error_message, + + + + converter_error(from, to) + converter_error, + + + + format_width(x, w = 80) + format_width, + + + + illegal_setter_access_to_undefined_column(name) + illegal_setter_access_to_undefined_column, + + + + lack_of_primary_key(model_name) + lack_of_primary_key, + + + + migration_already_down(number) + migration_already_down, + + + + migration_already_up(number) + migration_already_up, + + + + migration_irreversible(name = nil, operation = nil) + migration_irreversible, + + + + migration_not_found(number) + migration_not_found, + + + + migration_not_unique(numbers) + migration_not_unique, + + + + no_migration_yet(version) + no_migration_yet, + + + + null_column_mapping_error(name, type) + null_column_mapping_error, + + + + order_by_error_invalid_order(current_order) + order_by_error_invalid_order, + + + + polymorphic_nil(through) + polymorphic_nil, + + + + polymorphic_unknown_class(class_name) + polymorphic_unknown_class, + + + + query_building_error(message) + query_building_error, + + + + uid_not_found(class_name) + uid_not_found, + + + + uninitialized_db_connection(connection) + uninitialized_db_connection + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(table : String, src_fields : Array(Tuple(String, Char)), catalog : String = "pg_catalog.english", trigger_name = nil, function_name = nil, dest_field : String = "full_text_vector") + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def catalog : String + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def dest_field : String + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def down : Array(String) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def function_name : String + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def src_fields : Array(Tuple(String, Char)) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def table : String + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def trigger_name : String + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def up : Array(String) + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/Migration/FullTextSearchableOperation/Priority.html b/Clear/Migration/FullTextSearchableOperation/Priority.html new file mode 100644 index 000000000..75ddddfb1 --- /dev/null +++ b/Clear/Migration/FullTextSearchableOperation/Priority.html @@ -0,0 +1,1618 @@ + + + + + + + + + + + + + + + + + Clear::Migration::FullTextSearchableOperation::Priority - clear develop + + + + + + + + + + +
+

+ + module Clear::Migration::FullTextSearchableOperation::Priority + +

+ + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/extensions/full_text_searchable/migration.cr + + +
+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ IMPORTANT = 'B' +
+ + +
+ LOW = 'D' +
+ + +
+ NORMAL = 'C' +
+ + +
+ VERY_IMPORTANT = 'A' +
+ + +
+ + + + + + + + + + + +
+ +
+ + + + + + + + + +
+ + + diff --git a/Clear/Migration/FullTextSearchableTableHelpers.html b/Clear/Migration/FullTextSearchableTableHelpers.html new file mode 100644 index 000000000..3f68b97fe --- /dev/null +++ b/Clear/Migration/FullTextSearchableTableHelpers.html @@ -0,0 +1,1683 @@ + + + + + + + + + + + + + + + + + Clear::Migration::FullTextSearchableTableHelpers - clear develop + + + + + + + + + + +
+

+ + module Clear::Migration::FullTextSearchableTableHelpers + +

+ + + + + + + + + + + + + + + +

+ + + + Direct including types +

+ + + + + +

+ + + + Defined in: +

+ + + + clear/extensions/full_text_searchable/migration.cr + + +
+ + + + + + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ +
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def full_text_searchable(on : Array(Tuple(String, Char)), column_name = "full_text_vector", catalog = "pg_catalog.english", trigger_name = nil, function_name = nil) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def full_text_searchable(on : String, column_name = "full_text_vector", catalog = "pg_catalog.english", trigger_name = nil, function_name = nil) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def full_text_searchable(on : Array(String), column_name = "full_text_vector", catalog = "pg_catalog.english", trigger_name = nil, function_name = nil) + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/Migration/Helper.html b/Clear/Migration/Helper.html new file mode 100644 index 000000000..d09dd2465 --- /dev/null +++ b/Clear/Migration/Helper.html @@ -0,0 +1,2121 @@ + + + + + + + + + + + + + + + + + Clear::Migration::Helper - clear develop + + + + + + + + + + +
+

+ + module Clear::Migration::Helper + +

+ + + + + + + + + +

+ + + + Included Modules +

+ + + + + + + + +

+ + + + Direct including types +

+ + + + + +

+ + + + Defined in: +

+ + + + clear/extensions/enum/migration.cr + + +
+ + + + clear/extensions/full_text_searchable/full_text_searchable.cr + + +
+ + + + clear/migration/migration.cr + + +
+ + + + clear/migration/operation/columns.cr + + +
+ + + + clear/migration/operation/indexes.cr + + +
+ + + + clear/migration/operation/table.cr + + +
+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ TYPE_MAPPING = {"string" => "text", "int32" => "int", "int64" => "bigint", "long" => "bigint", "bigdecimal" => "numeric", "datetime" => "timestamp without time zone"} +
+ + +
+ + + + + +

+ + + + Class Method Summary +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + +

Instance methods inherited from module Clear::Migration::FullTextSearchableHelpers

+ + + + add_full_text_searchable(table, on : Array(Tuple(String, Char)), column_name = "full_text_vector", catalog = "pg_catalog.english", trigger_name = nil, function_name = nil) + add_full_text_searchable + + + + + + + + + + + + + + +
+ + + + +

+ + + + Class Method Detail +

+ +
+
+ + def self.datatype(type : String) + + # +
+ +
+ +

Replace some common type to their equivalent in postgresql +if the type is not found in the correspondance table, then return +itself

+
+ +
+
+ + [View source] + +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def add_column(table, column, datatype, nullable = false, constraint = nil, default = nil, with_values = false) + + # +
+ +
+ +

Add a column to a specific table

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def add_operation(op : Operation) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def apply(dir : Direction = Clear::Migration::Direction::Up) + + # +
+ +
+ +

This will apply the migration in a given direction (up or down)

+
+ +
+
+ + [View source] + +
+
+ +
+
+ abstract + def change(dir) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def change_column_type(table, column, from, to) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def create_enum(name, arr : Enumerable(T)) forall T + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def create_enum(name, e) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def create_index(table, columns : Array(String), name = nil, using = nil, unique = false) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def create_index(table, column, name = nil, using = nil, unique = false) + + # +
+ +
+ +

Add a column to a specific table

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def create_table(name, id : Symbol | Bool = true, schema = "public", &) + + # +
+ +
+ +

Helper used in migration to create a new table.

+

Usage:

+
create_table(:users) do |t|
+  t.column :first_name, :string
+  t.column :last_name, :string
+  t.column :email, :string, unique: true
+  t.timestamps
+end
+

By default, a column id of type integer will be created as primary key of the table. +This can be prevented using primary: false

+
create_table(:users, id: false) do |t|
+  t.column :user_id, :integer, primary: true # Use custom name for the primary key
+  t.column :first_name, :string
+  t.column :last_name, :string
+  t.column :email, :string, unique: true
+  t.timestamps
+end
+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def drop_column(table, column, type) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def drop_enum(name, arr : Enumerable(T) | Nil = nil) forall T + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def execute(sql : String) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def irreversible! + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def rename_column(table, from, to) + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/Migration/IrreversibleMigration.html b/Clear/Migration/IrreversibleMigration.html new file mode 100644 index 000000000..e2c0cd72c --- /dev/null +++ b/Clear/Migration/IrreversibleMigration.html @@ -0,0 +1,1636 @@ + + + + + + + + + + + + + + + + + Clear::Migration::IrreversibleMigration - clear develop + + + + + + + + + + +
+

+ + class Clear::Migration::IrreversibleMigration + +

+ + + + + + + +

+ + + + Overview +

+ +

This error is throw when you try to revert a migration which is irreversible.

+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/migration/migration.cr + + +
+ + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + +
+ + + diff --git a/Clear/Migration/Manager.html b/Clear/Migration/Manager.html new file mode 100644 index 000000000..989311d91 --- /dev/null +++ b/Clear/Migration/Manager.html @@ -0,0 +1,2208 @@ + + + + + + + + + + + + + + + + + Clear::Migration::Manager - clear develop + + + + + + + + + + +
+

+ + class Clear::Migration::Manager + +

+ + + + + + + +

+ + + + Overview +

+ +

The migration manager is a singleton, it load all the migrations, +check which one are #up and #down, and can trigger one or multiple +downgrade / upgrade of the database.

+

The migration system needs the creation of a table named __clear_metadatas +in your database. This table will be created automatically on the first +initialization of the Migration Manager.

+ + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/migration/manager.cr + + +
+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ METADATA_VERSION = "1" +
+ +
+

Used to migrate between metadata version, in case we need it in the future.

+
+ + +
+ + + + + +

+ + + + Class Method Summary +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + +

Instance methods inherited from module Clear::ErrorMessages

+ + + + build_error_message(message : String, ways_to_resolve : Tuple | Array = Tuple.new, manual_pages : Tuple | Array = Tuple.new) + build_error_message, + + + + converter_error(from, to) + converter_error, + + + + format_width(x, w = 80) + format_width, + + + + illegal_setter_access_to_undefined_column(name) + illegal_setter_access_to_undefined_column, + + + + lack_of_primary_key(model_name) + lack_of_primary_key, + + + + migration_already_down(number) + migration_already_down, + + + + migration_already_up(number) + migration_already_up, + + + + migration_irreversible(name = nil, operation = nil) + migration_irreversible, + + + + migration_not_found(number) + migration_not_found, + + + + migration_not_unique(numbers) + migration_not_unique, + + + + no_migration_yet(version) + no_migration_yet, + + + + null_column_mapping_error(name, type) + null_column_mapping_error, + + + + order_by_error_invalid_order(current_order) + order_by_error_invalid_order, + + + + polymorphic_nil(through) + polymorphic_nil, + + + + polymorphic_unknown_class(class_name) + polymorphic_unknown_class, + + + + query_building_error(message) + query_building_error, + + + + uid_not_found(class_name) + uid_not_found, + + + + uninitialized_db_connection(connection) + uninitialized_db_connection + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +

+ + + + Class Method Detail +

+ +
+
+ + def self.instance + + # +
+ +
+ +

To access to the manager

+
Clear::Migration::Manager.instance
+
+ +
+
+ + [View source] + +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def apply_all + + # +
+ +
+ +

Apply all the migrations not yet applied.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def apply_to(version, direction = :both) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def commited?(m : Clear::Migration) + + # +
+ +
+ +

Return true if the migration has been commited (already applied into the database) +or false otherwise

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def current_version + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def down(number : Int64) : Nil + + # +
+ +
+ +

Force down a migration; throw error if the mgiration is already down

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def ensure_ready + + # +
+ +
+ +

Create if needed the metadata table +to save the migrations.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def find(number) + + # +
+ +
+ +

Fetch the migration instance with the selected number

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def load_existing_migrations + + # +
+ +
+ +

Fetch all the migrations already activated on the database.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def max_version + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def migrations_up + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def print_status : String + + # +
+ +
+ +

Print out the status ( up | down ) of all migrations found by the manager.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def refresh + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def reinit! + + # +
+ +
+ +

Force reloading the migration system +Recheck all the current up migrations +and the metadata table. +This is useful if you access to the migration process +through another program, or during specs

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def up(number : Int64) : Nil + + # +
+ +
+ +

Force up a migration; throw error if the migration is already up

+
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/Migration/Operation.html b/Clear/Migration/Operation.html new file mode 100644 index 000000000..4d7c412a8 --- /dev/null +++ b/Clear/Migration/Operation.html @@ -0,0 +1,1896 @@ + + + + + + + + + + + + + + + + + Clear::Migration::Operation - clear develop + + + + + + + + + + +
+

+ + abstract class Clear::Migration::Operation + +

+ + + + + + + + + + + +

+ + + + Included Modules +

+ + + + + + +

+ + + + Direct Known Subclasses +

+ + + + + + + +

+ + + + Defined in: +

+ + + + clear/migration/operation/operation.cr + + +
+ + + + + + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + +

Instance methods inherited from module Clear::ErrorMessages

+ + + + build_error_message(message : String, ways_to_resolve : Tuple | Array = Tuple.new, manual_pages : Tuple | Array = Tuple.new) + build_error_message, + + + + converter_error(from, to) + converter_error, + + + + format_width(x, w = 80) + format_width, + + + + illegal_setter_access_to_undefined_column(name) + illegal_setter_access_to_undefined_column, + + + + lack_of_primary_key(model_name) + lack_of_primary_key, + + + + migration_already_down(number) + migration_already_down, + + + + migration_already_up(number) + migration_already_up, + + + + migration_irreversible(name = nil, operation = nil) + migration_irreversible, + + + + migration_not_found(number) + migration_not_found, + + + + migration_not_unique(numbers) + migration_not_unique, + + + + no_migration_yet(version) + no_migration_yet, + + + + null_column_mapping_error(name, type) + null_column_mapping_error, + + + + order_by_error_invalid_order(current_order) + order_by_error_invalid_order, + + + + polymorphic_nil(through) + polymorphic_nil, + + + + polymorphic_unknown_class(class_name) + polymorphic_unknown_class, + + + + query_building_error(message) + query_building_error, + + + + uid_not_found(class_name) + uid_not_found, + + + + uninitialized_db_connection(connection) + uninitialized_db_connection + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ abstract + def down : Array(String) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def irreversible!(operation_name : String | Nil = nil) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def migration : Clear::Migration | Nil + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def migration=(migration : Clear::Migration | Nil) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ abstract + def up : Array(String) + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/Migration/RemoveColumn.html b/Clear/Migration/RemoveColumn.html new file mode 100644 index 000000000..a8d54a015 --- /dev/null +++ b/Clear/Migration/RemoveColumn.html @@ -0,0 +1,1868 @@ + + + + + + + + + + + + + + + + + Clear::Migration::RemoveColumn - clear develop + + + + + + + + + + +
+

+ + class Clear::Migration::RemoveColumn + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/migration/operation/columns.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + +

Instance methods inherited from class Clear::Migration::Operation

+ + + + down : Array(String) + down, + + + + irreversible!(operation_name : String | Nil = nil) + irreversible!, + + + + migration : Clear::Migration | Nil + migration, + + + + migration=(migration : Clear::Migration | Nil) + migration=, + + + + up : Array(String) + up + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::ErrorMessages

+ + + + build_error_message(message : String, ways_to_resolve : Tuple | Array = Tuple.new, manual_pages : Tuple | Array = Tuple.new) + build_error_message, + + + + converter_error(from, to) + converter_error, + + + + format_width(x, w = 80) + format_width, + + + + illegal_setter_access_to_undefined_column(name) + illegal_setter_access_to_undefined_column, + + + + lack_of_primary_key(model_name) + lack_of_primary_key, + + + + migration_already_down(number) + migration_already_down, + + + + migration_already_up(number) + migration_already_up, + + + + migration_irreversible(name = nil, operation = nil) + migration_irreversible, + + + + migration_not_found(number) + migration_not_found, + + + + migration_not_unique(numbers) + migration_not_unique, + + + + no_migration_yet(version) + no_migration_yet, + + + + null_column_mapping_error(name, type) + null_column_mapping_error, + + + + order_by_error_invalid_order(current_order) + order_by_error_invalid_order, + + + + polymorphic_nil(through) + polymorphic_nil, + + + + polymorphic_unknown_class(class_name) + polymorphic_unknown_class, + + + + query_building_error(message) + query_building_error, + + + + uid_not_found(class_name) + uid_not_found, + + + + uninitialized_db_connection(connection) + uninitialized_db_connection + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(table : String, column : String, datatype) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def down : Array(String) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def up : Array(String) + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/Migration/RenameColumn.html b/Clear/Migration/RenameColumn.html new file mode 100644 index 000000000..20839a2b9 --- /dev/null +++ b/Clear/Migration/RenameColumn.html @@ -0,0 +1,1868 @@ + + + + + + + + + + + + + + + + + Clear::Migration::RenameColumn - clear develop + + + + + + + + + + +
+

+ + class Clear::Migration::RenameColumn + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/migration/operation/columns.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + +

Instance methods inherited from class Clear::Migration::Operation

+ + + + down : Array(String) + down, + + + + irreversible!(operation_name : String | Nil = nil) + irreversible!, + + + + migration : Clear::Migration | Nil + migration, + + + + migration=(migration : Clear::Migration | Nil) + migration=, + + + + up : Array(String) + up + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::ErrorMessages

+ + + + build_error_message(message : String, ways_to_resolve : Tuple | Array = Tuple.new, manual_pages : Tuple | Array = Tuple.new) + build_error_message, + + + + converter_error(from, to) + converter_error, + + + + format_width(x, w = 80) + format_width, + + + + illegal_setter_access_to_undefined_column(name) + illegal_setter_access_to_undefined_column, + + + + lack_of_primary_key(model_name) + lack_of_primary_key, + + + + migration_already_down(number) + migration_already_down, + + + + migration_already_up(number) + migration_already_up, + + + + migration_irreversible(name = nil, operation = nil) + migration_irreversible, + + + + migration_not_found(number) + migration_not_found, + + + + migration_not_unique(numbers) + migration_not_unique, + + + + no_migration_yet(version) + no_migration_yet, + + + + null_column_mapping_error(name, type) + null_column_mapping_error, + + + + order_by_error_invalid_order(current_order) + order_by_error_invalid_order, + + + + polymorphic_nil(through) + polymorphic_nil, + + + + polymorphic_unknown_class(class_name) + polymorphic_unknown_class, + + + + query_building_error(message) + query_building_error, + + + + uid_not_found(class_name) + uid_not_found, + + + + uninitialized_db_connection(connection) + uninitialized_db_connection + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(table : String, old_column_name : String, new_column_name : String) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def down : Array(String) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def up : Array(String) + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/Migration/Table.html b/Clear/Migration/Table.html new file mode 100644 index 000000000..6941f56b7 --- /dev/null +++ b/Clear/Migration/Table.html @@ -0,0 +1,2290 @@ + + + + + + + + + + + + + + + + + Clear::Migration::Table - clear develop + + + + + + + + + + +
+

+ + class Clear::Migration::Table + +

+ + + + + + + +

+ + + + Overview +

+ +

Reopen Table to add the helpers

+ + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/extensions/full_text_searchable/full_text_searchable.cr + + +
+ + + + clear/migration/operation/table.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Macro Summary +

+ + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + +

Instance methods inherited from module Clear::Migration::FullTextSearchableTableHelpers

+ + + + full_text_searchable(on : Array(Tuple(String, Char)), column_name = "full_text_vector", catalog = "pg_catalog.english", trigger_name = nil, function_name = nil)
full_text_searchable(on : String, column_name = "full_text_vector", catalog = "pg_catalog.english", trigger_name = nil, function_name = nil)
full_text_searchable(on : Array(String), column_name = "full_text_vector", catalog = "pg_catalog.english", trigger_name = nil, function_name = nil)
+ full_text_searchable
+ + + + + + + + + + + + + + + + +

Instance methods inherited from class Clear::Migration::Operation

+ + + + down : Array(String) + down, + + + + irreversible!(operation_name : String | Nil = nil) + irreversible!, + + + + migration : Clear::Migration | Nil + migration, + + + + migration=(migration : Clear::Migration | Nil) + migration=, + + + + up : Array(String) + up + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::ErrorMessages

+ + + + build_error_message(message : String, ways_to_resolve : Tuple | Array = Tuple.new, manual_pages : Tuple | Array = Tuple.new) + build_error_message, + + + + converter_error(from, to) + converter_error, + + + + format_width(x, w = 80) + format_width, + + + + illegal_setter_access_to_undefined_column(name) + illegal_setter_access_to_undefined_column, + + + + lack_of_primary_key(model_name) + lack_of_primary_key, + + + + migration_already_down(number) + migration_already_down, + + + + migration_already_up(number) + migration_already_up, + + + + migration_irreversible(name = nil, operation = nil) + migration_irreversible, + + + + migration_not_found(number) + migration_not_found, + + + + migration_not_unique(numbers) + migration_not_unique, + + + + no_migration_yet(version) + no_migration_yet, + + + + null_column_mapping_error(name, type) + null_column_mapping_error, + + + + order_by_error_invalid_order(current_order) + order_by_error_invalid_order, + + + + polymorphic_nil(through) + polymorphic_nil, + + + + polymorphic_unknown_class(class_name) + polymorphic_unknown_class, + + + + query_building_error(message) + query_building_error, + + + + uid_not_found(class_name) + uid_not_found, + + + + uninitialized_db_connection(connection) + uninitialized_db_connection + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(name : String, schema : String, is_create : Bool) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + +

+ + + + Macro Detail +

+ +
+
+ + macro method_missing(caller) + + # +
+ +
+ +

DEPRECATED +Method missing is used to generate add_column using the method name as +column type (ActiveRecord's style)

+
+ +
+
+ + [View source] + +
+
+ + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def add_column(column, type, default = nil, null = true, primary = false, index = false, unique = false, array = false) + + # +
+ +
+ +

Add/alter a column for this table.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def add_fkey(fields : Array(String), table : String, foreign_fields : Array(String), on_delete : String, primary : Bool) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def column(name, type, default = nil, null = true, primary = false, index = false, unique = false, array = false) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def column_operations : Array(ColumnOperation) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def down : Array(String) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def fkey_operations : Array(FkeyOperation) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def full_name + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def index(field : String | Symbol, name = nil, using = nil, unique = false) + + # +
+ +
+ +

Add or replace an index for this table. +Alias for add_index

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def index(fields : Array, name = nil, using = nil, unique = false) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def index_operations : Array(IndexOperation) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def is_create? : Bool + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def name : String + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def references(to, name : String | Nil = nil, on_delete = "restrict", type = "bigint", null = false, foreign_key = "id", primary = false) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def schema : String + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def timestamps(null = false) + + # +
+ +
+ +

Add the timestamps to the field.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def up : Array(String) + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/Migration/Table/ColumnOperation.html b/Clear/Migration/Table/ColumnOperation.html new file mode 100644 index 000000000..02184f321 --- /dev/null +++ b/Clear/Migration/Table/ColumnOperation.html @@ -0,0 +1,1846 @@ + + + + + + + + + + + + + + + + + Clear::Migration::Table::ColumnOperation - clear develop + + + + + + + + + + +
+

+ + struct Clear::Migration::Table::ColumnOperation + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/migration/operation/table.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(column : String, type : String, null : Bool = false, default : SQL::Any = nil, primary : Bool = false, array : Bool = false) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def array : Bool + + # +
+ +
+
+ +
+
+ +
+
+ + def clone + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def column : String + + # +
+ +
+
+ +
+
+ +
+
+ + def copy_with(column _column = @column, type _type = @type, null _null = @null, default _default = @default, primary _primary = @primary, array _array = @array) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def default : SQL::Any + + # +
+ +
+
+ +
+
+ +
+
+ + def null : Bool + + # +
+ +
+
+ +
+
+ +
+
+ + def primary : Bool + + # +
+ +
+
+ +
+
+ +
+
+ + def type : String + + # +
+ +
+
+ +
+
+ + + +
+ + + diff --git a/Clear/Migration/Table/FkeyOperation.html b/Clear/Migration/Table/FkeyOperation.html new file mode 100644 index 000000000..d5c277f07 --- /dev/null +++ b/Clear/Migration/Table/FkeyOperation.html @@ -0,0 +1,1827 @@ + + + + + + + + + + + + + + + + + Clear::Migration::Table::FkeyOperation - clear develop + + + + + + + + + + +
+

+ + struct Clear::Migration::Table::FkeyOperation + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/migration/operation/table.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(fields : Array(String), table : String, foreign_fields : Array(String), on_delete : String, primary : Bool) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def clone + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def copy_with(fields _fields = @fields, table _table = @table, foreign_fields _foreign_fields = @foreign_fields, on_delete _on_delete = @on_delete, primary _primary = @primary) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def fields : Array(String) + + # +
+ +
+
+ +
+
+ +
+
+ + def foreign_fields : Array(String) + + # +
+ +
+
+ +
+
+ +
+
+ + def on_delete : String + + # +
+ +
+
+ +
+
+ +
+
+ + def primary : Bool + + # +
+ +
+
+ +
+
+ +
+
+ + def table : String + + # +
+ +
+
+ +
+
+ + + +
+ + + diff --git a/Clear/Migration/Table/IndexOperation.html b/Clear/Migration/Table/IndexOperation.html new file mode 100644 index 000000000..1afd9469f --- /dev/null +++ b/Clear/Migration/Table/IndexOperation.html @@ -0,0 +1,1808 @@ + + + + + + + + + + + + + + + + + Clear::Migration::Table::IndexOperation - clear develop + + + + + + + + + + +
+

+ + struct Clear::Migration::Table::IndexOperation + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/migration/operation/table.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(fields : Array(String), name : String, using : String | Nil = nil, unique : Bool = false) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def clone + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def copy_with(fields _fields = @fields, name _name = @name, using _using = @using, unique _unique = @unique) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def fields : Array(String) + + # +
+ +
+
+ +
+
+ +
+
+ + def name : String + + # +
+ +
+
+ +
+
+ +
+
+ + def unique : Bool + + # +
+ +
+
+ +
+
+ +
+
+ + def using : String | Nil + + # +
+ +
+
+ +
+
+ + + +
+ + + diff --git a/Clear/Model.html b/Clear/Model.html new file mode 100644 index 000000000..4d61e4b6f --- /dev/null +++ b/Clear/Model.html @@ -0,0 +1,2479 @@ + + + + + + + + + + + + + + + + + Clear::Model - clear develop + + + + + + + + + + +
+

+ + module Clear::Model + +

+ + + + + +

+ + + + Overview +

+ +

Model definition is made by adding the Clear::Model mixin in your class.

+

+ +Simple Model

+
class MyModel
+  include Clear::Model
+
+  column my_column : String
+end
+

We just created a new model, linked to your database, mapping the column my_column of type String (text in postgres).

+

Now, you can play with your model:

+
row = MyModel.new # create an empty row
+row.my_column = "This is a content"
+row.save! # insert the new row in the database !
+

By convention, the table name will follow an underscore, plural version of your model: my_models. +A model into a module will prepend the module name before, so Logistic::MyModel will check for logistic_my_models in your database. +You can force a specific table name using:

+
class MyModel
+  include Clear::Model
+  self.table = "another_table_name"
+end
+

+ +Presence validation

+

Unlike many ORM around, Clear carry about non-nullable pattern in crystal. Meaning column my_column : String assume than a call to row.my_column will return a String.

+

But it exists cases where the column is not yet initialized:

+ +

For example, this code will compile:

+
row = MyModel.new # create an empty row
+puts row.my_column
+

However, it will throw a runtime exception You cannot access to the field 'my_column' because it never has been initialized

+

Same way, trying to save the object will raise an error:

+
row.save      # Will return false
+pp row.errors # Will tell you than `my_column` presence is mandatory.
+

Thanks to expressiveness of the Crystal language, we can handle presence validation by simply using the Nilable type in crystal:

+
class MyModel
+  include Clear::Model
+
+  column my_column : String? # Now, the column can be NULL or text in postgres.
+end
+

This time, the code above will works; in case of no value, my_column will be nil by default.

+

+ +Querying your code

+

Whenever you want to fetch data from your database, you must create a new collection query:

+

MyModel.query #Will setup a vanilla 'SELECT * FROM my_models'

+

Queries are fetchable using each:

+
MyModel.query.each do |model|
+  # Do something with your model here.
+end
+

+ +Refining your query

+

A collection query offers a lot of functionalities. You can read the API for more informations.

+

+ +Column type

+

By default, Clear map theses columns types:

+ +

NOTE: The crystal-pg gems map also some structures like GIS coordinates, but their implementation is not tested in Clear. Use them at your own risk. Tell me if it's working 😉

+

If you need to map special structure, see Mapping Your Data guides for more informations.

+

+ +Primary key

+

Primary key is essential for relational mapping. Currently Clear support only one column primary key.

+

A model without primary key can work in sort of degraded mode, throwing error in case of using some methods on them:

+ +

To setup a primary key, you can add the modifier primary: true to the column:

+
class MyModel
+  include Clear::Model
+
+  column id : Int32, primary: true, presence: false
+  column my_column : String?
+end
+

Note the flag presence: false added to the column. This tells Clear than presence checking on save is not mandatory. Usually this happens if you setup a default value in postgres. In the case of our primary key id, we use a serial auto-increment default value. +Therefore, saving the model without primary key will works. The id will be fetched after insertion:

+
m = MyModel
+m.save!
+m.id # Now the id value is setup.
+

+ +Helpers

+

Clear provides various built-in helpers to facilitate your life:

+

+ +Timestamps

+
class MyModel
+  include Clear::Model
+  timestamps # Will map the two columns 'created_at' and 'updated_at', and map some hooks to update their values.
+end
+

Theses fields are automatically updated whenever you call save methods, and works as Rails ActiveRecord.

+

+ +With Serial Pkey

+
class MyModel
+  include Clear::Model
+  primary_key "my_primary_key"
+end
+

Basically rewrite column id : UInt64, primary: true, presence: false

+

Argument is optional (default = id)

+ + + + + +

+ + + + Included Modules +

+ + + + + + + + +

+ + + + Direct including types +

+ + + + + +

+ + + + Defined in: +

+ + + + clear/extensions/full_text_searchable/full_text_searchable.cr + + +
+ + + + clear/model/collection.cr + + +
+ + + + clear/model/errors.cr + + +
+ + + + clear/model/model.cr + + +
+ + + + + + + + + + +

+ + + + Macro Summary +

+ + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + + + + + + + +

Class methods inherited from module Clear::Model::FullTextSearchable

+ + + + to_tsq(text) + to_tsq + + + + + + +

Macros inherited from module Clear::Model::FullTextSearchable

+ + + + full_text_searchable(through = "full_text_vector", catalog = "pg_catalog.english", scope_name = "search") + full_text_searchable + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Macros inherited from module Clear::Model::HasFactory

+ + + + polymorphic(through = "type") + polymorphic + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Macros inherited from module Clear::Model::HasRelations

+ + + + belongs_to(name, foreign_key = nil, no_cache = false, primary = false, foreign_key_type = Int64) + belongs_to, + + + + has_many(name, through = nil, foreign_key = nil, own_key = nil, primary_key = nil, no_cache = false, polymorphic = false, foreign_key_type = nil) + has_many, + + + + has_one(name, foreign_key = nil, primary_key = nil, no_cache = false, polymorphic = false, foreign_key_type = nil) + has_one + + + + + + + +

Instance methods inherited from module Clear::Model::HasValidation

+ + + + add_error(column, reason)
add_error(reason)
+ add_error
, + + + + clear_errors + clear_errors, + + + + error? + error?, + + + + errors : Array(Error) + errors, + + + + print_errors + print_errors, + + + + valid! + valid!, + + + + valid? + valid?, + + + + validate + validate + + + + + + + + + + + + + + + + + + + + + + + + + +

Macros inherited from module Clear::Validation::Helper

+ + + + ensure_than(field, message, &block) + ensure_than, + + + + on_presence(*fields, &block) + on_presence + + + + + + + +

Instance methods inherited from module Clear::Model::HasSaving

+ + + + delete + delete, + + + + persisted? : Bool + persisted?, + + + + reload : self + reload, + + + + save(on_conflict : Clear::SQL::InsertQuery -> | Nil = nil)
save(&block)
+ save
, + + + + save!(on_conflict : Clear::SQL::InsertQuery -> | Nil = nil)
save!(&block : Clear::SQL::InsertQuery -> )
+ save!
, + + + + update(**args) + update, + + + + update!(**args) + update! + + + + + + + + + + + + + + + + + + + + + + + + + +

Macros inherited from module Clear::Model::HasSerialPkey

+ + + + add_pkey_type(type, &block) + add_pkey_type, + + + + primary_key(name = "id", type = :bigserial) + primary_key + + + + + + + + + + + + + + + + +

Macros inherited from module Clear::Model::HasTimestamps

+ + + + timestamps + timestamps + + + + + + + +

Instance methods inherited from module Clear::Model::HasColumns

+ + + + [](x) : Clear::SQL::Any + [], + + + + []?(x) : Clear::SQL::Any + []?, + + + + reset(h : Hash(String, _))
reset(h : Hash(Symbol, _))
reset(**t : **T) forall T
+ reset
, + + + + set(h : Hash(String, _))
set(h : Hash(Symbol, _))
set(**t : **T) forall T
+ set
, + + + + to_h(full = false) + to_h, + + + + update_h + update_h + + + + + + + + + + + + +

Macros inherited from module Clear::Model::HasColumns

+ + + + column(name, primary = false, converter = nil, column_name = nil, presence = true, mass_assign = true) + column + + + + + + + +

Instance methods inherited from module Clear::Model::HasHooks

+ + + + trigger_after_events(event_name) + trigger_after_events, + + + + trigger_before_events(event_name) + trigger_before_events, + + + + with_triggers(event_name, &) + with_triggers + + + + + + + + + + + + +

Macros inherited from module Clear::Model::HasHooks

+ + + + after(event_name, method_name) + after, + + + + before(event_name, method_name) + before + + + + + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::ErrorMessages

+ + + + build_error_message(message : String, ways_to_resolve : Tuple | Array = Tuple.new, manual_pages : Tuple | Array = Tuple.new) + build_error_message, + + + + converter_error(from, to) + converter_error, + + + + format_width(x, w = 80) + format_width, + + + + illegal_setter_access_to_undefined_column(name) + illegal_setter_access_to_undefined_column, + + + + lack_of_primary_key(model_name) + lack_of_primary_key, + + + + migration_already_down(number) + migration_already_down, + + + + migration_already_up(number) + migration_already_up, + + + + migration_irreversible(name = nil, operation = nil) + migration_irreversible, + + + + migration_not_found(number) + migration_not_found, + + + + migration_not_unique(numbers) + migration_not_unique, + + + + no_migration_yet(version) + no_migration_yet, + + + + null_column_mapping_error(name, type) + null_column_mapping_error, + + + + order_by_error_invalid_order(current_order) + order_by_error_invalid_order, + + + + polymorphic_nil(through) + polymorphic_nil, + + + + polymorphic_unknown_class(class_name) + polymorphic_unknown_class, + + + + query_building_error(message) + query_building_error, + + + + uid_not_found(class_name) + uid_not_found, + + + + uninitialized_db_connection(connection) + uninitialized_db_connection + + + + + + + + + + + + + + +
+ + + + + + +

+ + + + Macro Detail +

+ +
+
+ + macro scope(name, &block) + + # +
+ +
+ +

A scope allow you to filter in a very human way a set of data.

+

Usage:

+
scope("admin") { where({role: "admin"}) }
+

for example, instead of writing:

+
User.query.where { (role == "admin") & (active == true) }
+

You can write:

+
User.admin.active
+

Scope can be used for other purpose than just filter (e.g. ordering), +but I would not recommend it.

+
+ +
+
+ + [View source] + +
+
+ + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def __pkey__ + + # +
+ +
+ +

Alias method for primary key.

+

If Model#id IS the primary key, then calling Model#__pkey__ is exactly the same as Model#id.

+

This method exists to tremendously simplify the meta-programming code. +If no primary key has been setup to this model, raise an exception.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def cache : Clear::Model::QueryCache | Nil + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/Model/ClassMethods.html b/Clear/Model/ClassMethods.html new file mode 100644 index 000000000..81e934990 --- /dev/null +++ b/Clear/Model/ClassMethods.html @@ -0,0 +1,1598 @@ + + + + + + + + + + + + + + + + + Clear::Model::ClassMethods - clear develop + + + + + + + + + + +
+

+ + module Clear::Model::ClassMethods + +

+ + + + + + + + + + + + + + + +

+ + + + Direct including types +

+ + + + + +

+ + + + Defined in: +

+ + + + clear/model/modules/class_methods.cr + + +
+ + + + + + + + + + + + + + +
+ +
+ + + + + + + + + +
+ + + diff --git a/Clear/Model/CollectionBase.html b/Clear/Model/CollectionBase.html new file mode 100644 index 000000000..f3430962c --- /dev/null +++ b/Clear/Model/CollectionBase.html @@ -0,0 +1,3822 @@ + + + + + + + + + + + + + + + + + Clear::Model::CollectionBase(T) - clear develop + + + + + + + + + + +
+

+ + class Clear::Model::CollectionBase(T) + +

+ + + + + + + +

+ + + + Overview +

+ +

CollectionBase(T) is the base class for collection of model. +Collection of model are a SQL SELECT query mapping & building system. They are Enumerable and are +`Clear::SQL::SelectBuilder` behavior; therefore, they can be used array-like and are working with low-level SQL +Building.

+

The CollectionBase(T) is extended by each model. For example, generating the model MyModel will generate the +class MyModel::Collection which inherits from CollectionBase(MyModel)

+

Collection are instantiated using Model.query method.

+ + + + + +

+ + + + Included Modules +

+ + + + + + +

+ + + + Direct Known Subclasses +

+ + + + + + + +

+ + + + Defined in: +

+ + + + clear/model/collection.cr + + +
+ + + + + + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + +

Instance methods inherited from module Clear::SQL::SelectBuilder

+ + + + before_query(&block : -> Nil) + before_query, + + + + columns : Array(SQL::Column) + columns, + + + + default_wildcard_table + default_wildcard_table, + + + + dup : self + dup, + + + + havings : Array(Clear::Expression::Node) + havings, + + + + is_distinct? + is_distinct?, + + + + joins : Array(SQL::Join) + joins, + + + + limit : Int64 | Nil + limit, + + + + lock : String | Nil + lock, + + + + offset : Int64 | Nil + offset, + + + + order_bys : Array(Clear::SQL::Query::OrderBy::Record) + order_bys, + + + + to_delete + to_delete, + + + + to_sql : String + to_sql, + + + + to_update + to_update, + + + + total_entries : Int64 | Nil + total_entries, + + + + total_entries=(total_entries : Int64 | Nil) + total_entries=, + + + + wheres : Array(Clear::Expression::Node) + wheres + + + + + + +

Constructor methods inherited from module Clear::SQL::SelectBuilder

+ + + + new(distinct_value = nil, cte = {} of String => Clear::SQL::SelectBuilder | String, columns = [] of SQL::Column, froms = [] of SQL::From, joins = [] of SQL::Join, wheres = [] of Clear::Expression::Node, havings = [] of Clear::Expression::Node, windows = [] of ::Tuple(String, String), group_bys = [] of Symbolic, order_bys = [] of Clear::SQL::Query::OrderBy::Record, limit = nil, offset = nil, lock = nil, before_query_triggers = [] of (-> Nil)) + new + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::WithPagination

+ + + + current_page + current_page, + + + + first_page? + first_page?, + + + + last_page? + last_page?, + + + + next_page + next_page, + + + + out_of_bounds? + out_of_bounds?, + + + + paginate(page : Int32 = DEFAULT_PAGE, per_page : Int32 = DEFAULT_LIMIT) + paginate, + + + + per_page + per_page, + + + + previous_page + previous_page, + + + + total_pages + total_pages + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::Change

+ + + + change! : self + change! + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::Connection

+ + + + connection_name : String + connection_name, + + + + use_connection(connection_name : String) + use_connection + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::Pluck

+ + + + pluck(fields : Tuple(*T)) forall T
pluck(*fields)
pluck(**fields : **T) forall T
+ pluck
, + + + + pluck_col(field : Clear::SQL::Symbolic, type : T.class) forall T
pluck_col(field : Clear::SQL::Symbolic)
+ pluck_col
+ + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::Fetch

+ + + + fetch(fetch_all = false, & : Hash(String, Clear::SQL::Any) -> Nil) + fetch, + + + + fetch_first + fetch_first, + + + + fetch_first! + fetch_first!, + + + + fetch_with_cursor(count = 1000, & : Hash(String, Clear::SQL::Any) -> Nil) + fetch_with_cursor, + + + + first + first, + + + + first! + first!, + + + + scalar(type : T.class) forall T + scalar, + + + + to_a : Array(Hash(String, Clear::SQL::Any)) + to_a + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::Execute

+ + + + execute(connection_name : String | Nil = nil) + execute + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::Lock

+ + + + with_lock(str : String = "FOR UPDATE") + with_lock + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::Window

+ + + + clear_windows + clear_windows, + + + + print_windows + print_windows, + + + + window(name, value)
window(windows : NamedTuple)
+ window
, + + + + windows : Array(WindowDeclaration) + windows + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::CTE

+ + + + cte : Hash(String, CTEAuthorized) + cte, + + + + with_cte(name, request : CTEAuthorized)
with_cte(tuple : NamedTuple)
+ with_cte
+ + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::Aggregate

+ + + + agg(field, x : X.class) forall X + agg, + + + + avg(field, x : X.class) forall X + avg, + + + + count(type : X.class = Int64) forall X + count, + + + + max(field, x : X.class) forall X + max, + + + + min(field, x : X.class) forall X + min, + + + + sum(field) : Float64 + sum + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::OffsetLimit

+ + + + clear_limit + clear_limit, + + + + clear_offset + clear_offset, + + + + limit(x : Int | Nil) + limit, + + + + offset(x : Int | Nil) + offset + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::GroupBy

+ + + + clear_group_bys + clear_group_bys, + + + + group_by(column : Symbolic) + group_by, + + + + group_bys : Array(Symbolic) + group_bys + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::OrderBy

+ + + + clear_order_bys + clear_order_bys, + + + + order_by(tuple : NamedTuple)
order_by(expression : Symbol, direction : Symbol = :asc, nulls : Symbol | Nil = nil)
order_by(expression : String, direction : Symbol = :asc, nulls : Symbol | Nil = nil)
order_by(**tuple)
+ order_by
, + + + + reverse_order_by + reverse_order_by + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::Having

+ + + + clear_havings + clear_havings, + + + + having(node : Clear::Expression::Node)
having(&)
having(conditions : NamedTuple | Hash(String, Clear::SQL::Any))
having(template : String, *args)
having(template : String, **tuple)
having(**tuple)
+ having
, + + + + or_having(node : Clear::Expression::Node)
or_having(template : String, *args)
or_having(template : String, **named_tuple)
or_having(&)
+ or_having
+ + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::Where

+ + + + clear_wheres + clear_wheres, + + + + or_where(node : Clear::Expression::Node)
or_where(template : String, *args)
or_where(template : String, **tuple)
or_where(&)
+ or_where
, + + + + where(node : Clear::Expression::Node)
where(&)
where(conditions : NamedTuple | Hash(String, Clear::SQL::Any))
where(template : String)
where(template : String, *args)
where(template : String, **tuple)
where(**tuple)
+ where
+ + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::Join

+ + + + cross_join(name : Selectable, lateral = false) + cross_join, + + + + full_outer_join(name : Selectable, lateral = false, &)
full_outer_join(name : Selectable, condition : String = "true", lateral = false)
+ full_outer_join
, + + + + inner_join(name : Selectable, lateral = false, &)
inner_join(name : Selectable, condition : String = "true", lateral = false)
+ inner_join
, + + + + join(name : Selectable, type = :inner, lateral = false, &)
join(name : Selectable, type = :inner, condition : String = "true", lateral = false)
join(name : Selectable, type = :inner, lateral = false)
+ join
, + + + + left_join(name : Selectable, lateral = false, &)
left_join(name : Selectable, condition : String = "true", lateral = false)
+ left_join
, + + + + right_join(name : Selectable, lateral = false, &)
right_join(name : Selectable, condition : String = "true", lateral = false)
+ right_join
+ + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::From

+ + + + clear_from + clear_from, + + + + from(*args)
from(**tuple)
+ from
, + + + + froms : Array(SQL::From) + froms + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::Select

+ + + + clear_distinct + clear_distinct, + + + + clear_select + clear_select, + + + + default_wildcard_table=(table : String | Nil = nil) + default_wildcard_table=, + + + + distinct(on : String | Nil = "") + distinct, + + + + distinct_value : String | Nil + distinct_value, + + + + select(c : Column)
select(*args)
+ select
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def <<(item : T) + + # +
+ +
+ +

Add an item to the current collection.

+

If the current collection is not originated from a has_many or has_many through: relation, calling << over +the collection will raise a Clear::SQL::OperationNotPermittedError

+

Returns self and therefore can be chained

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def [](range : Range(Number, Number), fetch_columns = false) : Array(T) + + # +
+ +
+ +

Get a range of models

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def [](off, fetch_columns = false) : T + + # +
+ +
+ +

Basically a fancy way to write OFFSET x LIMIT 1

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def []?(off, fetch_columns = false) : T | Nil + + # +
+ +
+ +

Basically a fancy way to write OFFSET x LIMIT 1

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def add(item : T) + + # +
+ +
+ +

Alias for Collection#<<

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def any? + + # +
+ +
+ +

Check whether the query return any row.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def build(x : NamedTuple, &block : T -> Nil) : T + + # +
+ +
+ +

Build a new collection; if the collection comes from a has_many relation +(e.g. my_model.associations.build), the foreign column which store +the primary key of my_model will be setup by default, preventing you +to forget it. +You can pass extra parameters using a named tuple: +my_model.associations.build({a_column: "value"})

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def build(**tuple, & : T -> Nil) : T + + # +
+ +
+ +

Build a new collection; if the collection comes from a has_many relation +(e.g. my_model.associations.build), the foreign column which store +the primary key of my_model will be setup by default, preventing you +to forget it. +You can pass extra parameters using a named tuple: +my_model.associations.build({a_column: "value"})

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def build(x : NamedTuple) : T + + # +
+ +
+ +

Build a new collection; if the collection comes from a has_many relation +(e.g. my_model.associations.build), the foreign column which store +the primary key of my_model will be setup by default, preventing you +to forget it. +You can pass extra parameters using a named tuple: +my_model.associations.build({a_column: "value"})

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def build(**tuple) : T + + # +
+ +
+ +

Build a new collection; if the collection comes from a has_many relation +(e.g. my_model.associations.build), the foreign column which store +the primary key of my_model will be setup by default, preventing you +to forget it. +You can pass extra parameters using a named tuple: +my_model.associations.build({a_column: "value"})

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def count(type : X.class = Int64) forall X + + # +
+ +
+ +

Use SQL COUNT over your query, and return this number as a Int64

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def create(x : NamedTuple, &block : T -> Nil) : T + + # +
+ +
+ +

Build a new object and setup +the fields like setup in the condition tuple. +Just after building, save the object.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def create(**tuple, & : T -> Nil) : T + + # +
+ +
+ +

Build a new object and setup +the fields like setup in the condition tuple. +Just after building, save the object.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def create(x : NamedTuple) : T + + # +
+ +
+ +

Build a new object and setup +the fields like setup in the condition tuple. +Just after building, save the object.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def create(**tuple) : T + + # +
+ +
+ +

Build a new object and setup +the fields like setup in the condition tuple. +Just after building, save the object.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def create!(x : NamedTuple, &block : T -> Nil) : T + + # +
+ +
+ +

Build a new object and setup +the fields like setup in the condition tuple. +Just after building, save the object. +But instead of returning self if validation failed, +raise Clear::Model::InvalidError exception

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def create!(**tuple, & : T -> Nil) : T + + # +
+ +
+ +

Build a new object and setup +the fields like setup in the condition tuple. +Just after building, save the object. +But instead of returning self if validation failed, +raise Clear::Model::InvalidError exception

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def create!(x : NamedTuple) : T + + # +
+ +
+ +

Build a new object and setup +the fields like setup in the condition tuple. +Just after building, save the object. +But instead of returning self if validation failed, +raise Clear::Model::InvalidError exception

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def create!(**tuple) : T + + # +
+ +
+ +

Build a new object and setup +the fields like setup in the condition tuple. +Just after building, save the object. +But instead of returning self if validation failed, +raise Clear::Model::InvalidError exception

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def delete_all : self + + # +
+ +
+ +

Delete all the rows which would have been returned by this collection. +Is equivalent to collection.to_delete.execute

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def dup + + # +
+ +
+ +
+ Description copied from module Clear::SQL::SelectBuilder +
+ +

Duplicate the query

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def each(fetch_columns = false, & : T -> ) : Nil + + # +
+ +
+ +

Build the SQL, send the query then iterate through each models +gathered by the request.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def each_with_cursor(batch = 1000, fetch_columns = false, &block : T -> ) + + # +
+ +
+ +

Build the SQL, send the query then iterate through each models +gathered by the request. +Use a postgres cursor to avoid memory bloating. +Useful to fetch millions of rows at once.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def empty? + + # +
+ +
+ +

Inverse of #any?, return true if the request return no rows.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def find(fetch_columns = false, &) : T | Nil + + # +
+ +
+ +

A convenient way to write where { condition }.first(fetch_columns)

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def find(tuple : NamedTuple, fetch_columns = false) : T | Nil + + # +
+ +
+ +

A convenient way to write where({any_column: "any_value"}).first(fetch_columns)

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def find(**tuple) : T | Nil + + # +
+ +
+ +

A convenient way to write where({any_column: "any_value"}).first

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def find!(fetch_columns = false, &) : T + + # +
+ +
+ +

A convenient way to write where { condition }.first!(fetch_columns)

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def find!(tuple : NamedTuple, fetch_columns = false) : T + + # +
+ +
+ +

A convenient way to write where({any_column: "any_value"}).first!(fetch_columns)

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def find!(**tuple) : T + + # +
+ +
+ +

A convenient way to write where({any_column: "any_value"}).first!

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def find_or_build(x : NamedTuple, &block : T -> Nil) : T + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def find_or_build(**tuple, & : T -> Nil) : T + + # +
+ +
+ +

Try to fetch a row. If not found, build a new object and setup +the fields like setup in the condition tuple.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def find_or_build(x : NamedTuple) : T + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def find_or_build(**tuple) : T + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def find_or_create(x : NamedTuple, &block : T -> Nil) : T + + # +
+ +
+ +

Try to fetch a row. If not found, build a new object and setup +the fields like setup in the condition tuple. +Just after building, save the object.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def find_or_create(**tuple, & : T -> Nil) : T + + # +
+ +
+ +

Try to fetch a row. If not found, build a new object and setup +the fields like setup in the condition tuple. +Just after building, save the object.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def find_or_create(x : NamedTuple) : T + + # +
+ +
+ +

Try to fetch a row. If not found, build a new object and setup +the fields like setup in the condition tuple. +Just after building, save the object.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def find_or_create(**tuple) : T + + # +
+ +
+ +

Try to fetch a row. If not found, build a new object and setup +the fields like setup in the condition tuple. +Just after building, save the object.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def first(fetch_columns = false) : T | Nil + + # +
+ +
+ +

Get the first row from the collection query. +if not found, return nil

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def first!(fetch_columns = false) : T + + # +
+ +
+ +

Get the first row from the collection query. +if not found, throw an error

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def item_class + + # +
+ +
+ +

Return the model class for this collection

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def last(fetch_columns = false) : T | Nil + + # +
+ +
+ +

Get the last row from the collection query. +if not found, return nil

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def last!(fetch_columns = false) : T + + # +
+ +
+ +

Get the last row from the collection query. +if not found, throw an error

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def map(fetch_columns = false, &block : T -> X) : Array(X) forall X + + # +
+ +
+ +

Build the SQL, send the query then build and array by applying the +block transformation over it.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def tags + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def to_a(fetch_columns = false) : Array(T) + + # +
+ +
+ +

Create an array from the query.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def unlink(item : T) + + # +
+ +
+ +

Unlink the model currently referenced through a relation has_many through

+

If the current colleciton doesn't come from a has_many through relation, +this method will throw Clear::SQL::OperationNotPermittedError

+

Returns true if unlinking is successful (e.g. one or more rows have been updated), or false otherwise

+
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/Model/Column.html b/Clear/Model/Column.html new file mode 100644 index 000000000..3a4ca3a0f --- /dev/null +++ b/Clear/Model/Column.html @@ -0,0 +1,2324 @@ + + + + + + + + + + + + + + + + + Clear::Model::Column(T, C) - clear develop + + + + + + + + + + +
+

+ + class Clear::Model::Column(T, C) + +

+ + + + + + + +

+ + + + Overview +

+ +

A column of a Model +Provide some methods like:

+ + + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/model/column.cr + + +
+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ UNKNOWN = UnknownClass.new +
+ + +
+ + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + +

Instance methods inherited from module Clear::ErrorMessages

+ + + + build_error_message(message : String, ways_to_resolve : Tuple | Array = Tuple.new, manual_pages : Tuple | Array = Tuple.new) + build_error_message, + + + + converter_error(from, to) + converter_error, + + + + format_width(x, w = 80) + format_width, + + + + illegal_setter_access_to_undefined_column(name) + illegal_setter_access_to_undefined_column, + + + + lack_of_primary_key(model_name) + lack_of_primary_key, + + + + migration_already_down(number) + migration_already_down, + + + + migration_already_up(number) + migration_already_up, + + + + migration_irreversible(name = nil, operation = nil) + migration_irreversible, + + + + migration_not_found(number) + migration_not_found, + + + + migration_not_unique(numbers) + migration_not_unique, + + + + no_migration_yet(version) + no_migration_yet, + + + + null_column_mapping_error(name, type) + null_column_mapping_error, + + + + order_by_error_invalid_order(current_order) + order_by_error_invalid_order, + + + + polymorphic_nil(through) + polymorphic_nil, + + + + polymorphic_unknown_class(class_name) + polymorphic_unknown_class, + + + + query_building_error(message) + query_building_error, + + + + uid_not_found(class_name) + uid_not_found, + + + + uninitialized_db_connection(connection) + uninitialized_db_connection + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(name : String, value : T | UnknownClass = UNKNOWN, has_db_default : Bool = false) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def changed? : Bool + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def clear + + # +
+ +
+ +

Completely clear the column, remove both #value and #old_value and turning the column in a non-defined state.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def clear_change_flag + + # +
+ +
+ +

Reset #changed? flag to false. See Column(T)#dirty! for the counter part.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def defined? + + # +
+ +
+ +

Check whether the column is defined or not.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def dirty! + + # +
+ +
+ +

Reset #changed? flag to true. See Column(T)#clear_change_flag for the counter part.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def has_db_default? : Bool + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def inspect + + # +
+ +
+ +

Inspect this column. +If a column is not loaded (e.g. not defined once), it will show "#undef". +If a column is dirty (e.g. change hasn't be saved), it will show a "*" after the value.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def name : String + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def nilable? + + # +
+ +
+ +

Return true if the value is an union of a Type with Nilable, false otherwise.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def old_value : T | UnknownClass + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def reset(x : T | Nil) + + # +
+ +
+ +

Reset the current field. +Restore the #old_value state to current value. +Reset the flag changed to false.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def reset_convert(x) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def revert + + # +
+ +
+ +

If the column is dirty (e.g the value has been changed), return to the previous state.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def set(x : T | Nil) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def set_convert(x) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def to_sql_value(default = nil) : Clear::SQL::Any + + # +
+ +
+ +

Return the database converted value using the converter

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def value(default : X) : T | X forall X + + # +
+ +
+ +

Returns the current value of this column or default if the value is undefined.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def value : T + + # +
+ +
+ +

Returns the current value of this column. +If the value has never been initialized, throw an exception

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def value=(x : T) + + # +
+ +
+ +

Set the value of the column to the value x. If x is not equal to the old value, then the column #changed? +flag is set to true.

+
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/Model/Column/UnknownClass.html b/Clear/Model/Column/UnknownClass.html new file mode 100644 index 000000000..8314205d6 --- /dev/null +++ b/Clear/Model/Column/UnknownClass.html @@ -0,0 +1,1711 @@ + + + + + + + + + + + + + + + + + Clear::Model::Column::UnknownClass - clear develop + + + + + + + + + + +
+

+ + struct Clear::Model::Column::UnknownClass + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/model/column.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def initialize + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/Model/Connection.html b/Clear/Model/Connection.html new file mode 100644 index 000000000..1f428d8a5 --- /dev/null +++ b/Clear/Model/Connection.html @@ -0,0 +1,1598 @@ + + + + + + + + + + + + + + + + + Clear::Model::Connection - clear develop + + + + + + + + + + +
+

+ + module Clear::Model::Connection + +

+ + + + + + + + + + + + + + + +

+ + + + Direct including types +

+ + + + + +

+ + + + Defined in: +

+ + + + clear/model/modules/connection.cr + + +
+ + + + + + + + + + + + + + +
+ +
+ + + + + + + + + +
+ + + diff --git a/Clear/Model/Converter.html b/Clear/Model/Converter.html new file mode 100644 index 000000000..fd9d929dd --- /dev/null +++ b/Clear/Model/Converter.html @@ -0,0 +1,1695 @@ + + + + + + + + + + + + + + + + + Clear::Model::Converter - clear develop + + + + + + + + + + +
+

+ + module Clear::Model::Converter + +

+ + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/model/converters/base.cr + + +
+ + + + clear/model/converters/number_converters.cr + + +
+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ CONVERTERS = {"Array(Bool)" => Clear::Model::Converter::ArrayConverterBool, "Array(Bool | Nil)" => Clear::Model::Converter::ArrayConverterBool, "Array(String)" => Clear::Model::Converter::ArrayConverterString, "Array(String | Nil)" => Clear::Model::Converter::ArrayConverterString, "Array(Float32)" => Clear::Model::Converter::ArrayConverterFloat32, "Array(Float32 | Nil)" => Clear::Model::Converter::ArrayConverterFloat32, "Array(Float64)" => Clear::Model::Converter::ArrayConverterFloat64, "Array(Float64 | Nil)" => Clear::Model::Converter::ArrayConverterFloat64, "Array(Int32)" => Clear::Model::Converter::ArrayConverterInt32, "Array(Int32 | Nil)" => Clear::Model::Converter::ArrayConverterInt32, "Array(Int64)" => Clear::Model::Converter::ArrayConverterInt64, "Array(Int64 | Nil)" => Clear::Model::Converter::ArrayConverterInt64, "Bool" => Clear::Model::Converter::BoolConverter, "JSON::Any" => Clear::Model::Converter::JSON::AnyConverter, "Int8" => ::Clear::Model::Converter::Int8Converter, "Int16" => ::Clear::Model::Converter::Int16Converter, "Int32" => ::Clear::Model::Converter::Int32Converter, "Int64" => ::Clear::Model::Converter::Int64Converter, "UInt8" => ::Clear::Model::Converter::UInt8Converter, "UInt16" => ::Clear::Model::Converter::UInt16Converter, "UInt32" => ::Clear::Model::Converter::UInt32Converter, "UInt64" => ::Clear::Model::Converter::UInt64Converter, "Float32" => ::Clear::Model::Converter::Float32Converter, "Float64" => ::Clear::Model::Converter::Float64Converter, "BigInt" => ::Clear::Model::Converter::BigIntConverter, "BigFloat" => ::Clear::Model::Converter::BigFloatConverter, "BigDecimal" => ::Clear::Model::Converter::BigDecimalConverter, "String" => Clear::Model::Converter::StringConverter, "Time" => Clear::Model::Converter::TimeConverter, "Crypto::Bcrypt::Password" => Clear::Model::Converter::BcryptPasswordConverter, "Clear::TSVector" => Clear::TSVector::Converter, "Clear::Interval" => Clear::Interval::Converter, "Clear::TimeInDay" => Clear::TimeInDay::Converter, "UUID" => Clear::Model::Converter::UUIDConverter} of String => Base.class +
+ + +
+ + + + + + + +

+ + + + Macro Summary +

+ + + + + + +
+ +
+ + + + + + +

+ + + + Macro Detail +

+ +
+
+ + macro add_converter(name, klazz) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + macro to_column(name, value) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + macro to_db(name, value) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + +
+ + + diff --git a/Clear/Model/Converter/ArrayConverterBool.html b/Clear/Model/Converter/ArrayConverterBool.html new file mode 100644 index 000000000..fc2bc2ff6 --- /dev/null +++ b/Clear/Model/Converter/ArrayConverterBool.html @@ -0,0 +1,1669 @@ + + + + + + + + + + + + + + + + + Clear::Model::Converter::ArrayConverterBool - clear develop + + + + + + + + + + +
+

+ + module Clear::Model::Converter::ArrayConverterBool + +

+ + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/model/converters/array_converter.cr + + +
+ + + + + + + + +

+ + + + Class Method Summary +

+ + + + + + + + +
+ +
+ + + + +

+ + + + Class Method Detail +

+ +
+
+ + def self.to_column(x) : Array(Bool) | Nil + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.to_db(x : Array(Bool) | Nil) : Clear::SQL::Any + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.to_string(x) : String + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + +
+ + + diff --git a/Clear/Model/Converter/ArrayConverterFloat32.html b/Clear/Model/Converter/ArrayConverterFloat32.html new file mode 100644 index 000000000..7d8961986 --- /dev/null +++ b/Clear/Model/Converter/ArrayConverterFloat32.html @@ -0,0 +1,1669 @@ + + + + + + + + + + + + + + + + + Clear::Model::Converter::ArrayConverterFloat32 - clear develop + + + + + + + + + + +
+

+ + module Clear::Model::Converter::ArrayConverterFloat32 + +

+ + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/model/converters/array_converter.cr + + +
+ + + + + + + + +

+ + + + Class Method Summary +

+ + + + + + + + +
+ +
+ + + + +

+ + + + Class Method Detail +

+ +
+
+ + def self.to_column(x) : Array(Float32) | Nil + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.to_db(x : Array(Float32) | Nil) : Clear::SQL::Any + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.to_string(x) : String + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + +
+ + + diff --git a/Clear/Model/Converter/ArrayConverterFloat64.html b/Clear/Model/Converter/ArrayConverterFloat64.html new file mode 100644 index 000000000..8ebcfc966 --- /dev/null +++ b/Clear/Model/Converter/ArrayConverterFloat64.html @@ -0,0 +1,1669 @@ + + + + + + + + + + + + + + + + + Clear::Model::Converter::ArrayConverterFloat64 - clear develop + + + + + + + + + + +
+

+ + module Clear::Model::Converter::ArrayConverterFloat64 + +

+ + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/model/converters/array_converter.cr + + +
+ + + + + + + + +

+ + + + Class Method Summary +

+ + + + + + + + +
+ +
+ + + + +

+ + + + Class Method Detail +

+ +
+
+ + def self.to_column(x) : Array(Float64) | Nil + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.to_db(x : Array(Float64) | Nil) : Clear::SQL::Any + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.to_string(x) : String + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + +
+ + + diff --git a/Clear/Model/Converter/ArrayConverterInt32.html b/Clear/Model/Converter/ArrayConverterInt32.html new file mode 100644 index 000000000..5cec47330 --- /dev/null +++ b/Clear/Model/Converter/ArrayConverterInt32.html @@ -0,0 +1,1669 @@ + + + + + + + + + + + + + + + + + Clear::Model::Converter::ArrayConverterInt32 - clear develop + + + + + + + + + + +
+

+ + module Clear::Model::Converter::ArrayConverterInt32 + +

+ + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/model/converters/array_converter.cr + + +
+ + + + + + + + +

+ + + + Class Method Summary +

+ + + + + + + + +
+ +
+ + + + +

+ + + + Class Method Detail +

+ +
+
+ + def self.to_column(x) : Array(Int32) | Nil + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.to_db(x : Array(Int32) | Nil) : Clear::SQL::Any + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.to_string(x) : String + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + +
+ + + diff --git a/Clear/Model/Converter/ArrayConverterInt64.html b/Clear/Model/Converter/ArrayConverterInt64.html new file mode 100644 index 000000000..f0b57af9f --- /dev/null +++ b/Clear/Model/Converter/ArrayConverterInt64.html @@ -0,0 +1,1669 @@ + + + + + + + + + + + + + + + + + Clear::Model::Converter::ArrayConverterInt64 - clear develop + + + + + + + + + + +
+

+ + module Clear::Model::Converter::ArrayConverterInt64 + +

+ + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/model/converters/array_converter.cr + + +
+ + + + + + + + +

+ + + + Class Method Summary +

+ + + + + + + + +
+ +
+ + + + +

+ + + + Class Method Detail +

+ +
+
+ + def self.to_column(x) : Array(Int64) | Nil + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.to_db(x : Array(Int64) | Nil) : Clear::SQL::Any + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.to_string(x) : String + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + +
+ + + diff --git a/Clear/Model/Converter/ArrayConverterString.html b/Clear/Model/Converter/ArrayConverterString.html new file mode 100644 index 000000000..05bef737a --- /dev/null +++ b/Clear/Model/Converter/ArrayConverterString.html @@ -0,0 +1,1669 @@ + + + + + + + + + + + + + + + + + Clear::Model::Converter::ArrayConverterString - clear develop + + + + + + + + + + +
+

+ + module Clear::Model::Converter::ArrayConverterString + +

+ + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/model/converters/array_converter.cr + + +
+ + + + + + + + +

+ + + + Class Method Summary +

+ + + + + + + + +
+ +
+ + + + +

+ + + + Class Method Detail +

+ +
+
+ + def self.to_column(x) : Array(String) | Nil + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.to_db(x : Array(String) | Nil) : Clear::SQL::Any + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.to_string(x) : String + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + +
+ + + diff --git a/Clear/Model/Converter/Base.html b/Clear/Model/Converter/Base.html new file mode 100644 index 000000000..286daf9ec --- /dev/null +++ b/Clear/Model/Converter/Base.html @@ -0,0 +1,1612 @@ + + + + + + + + + + + + + + + + + Clear::Model::Converter::Base - clear develop + + + + + + + + + + +
+

+ + abstract class Clear::Model::Converter::Base + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/model/converters/base.cr + + +
+ + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + +
+ + + diff --git a/Clear/Model/Converter/BcryptPasswordConverter.html b/Clear/Model/Converter/BcryptPasswordConverter.html new file mode 100644 index 000000000..faf81c5a0 --- /dev/null +++ b/Clear/Model/Converter/BcryptPasswordConverter.html @@ -0,0 +1,1648 @@ + + + + + + + + + + + + + + + + + Clear::Model::Converter::BcryptPasswordConverter - clear develop + + + + + + + + + + +
+

+ + module Clear::Model::Converter::BcryptPasswordConverter + +

+ + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/extensions/bcrypt/bcrypt.cr + + +
+ + + + + + + + +

+ + + + Class Method Summary +

+ + + + + + + + +
+ +
+ + + + +

+ + + + Class Method Detail +

+ +
+
+ + def self.to_column(x) : Crypto::Bcrypt::Password | Nil + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.to_db(x : Crypto::Bcrypt::Password | Nil) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + +
+ + + diff --git a/Clear/Model/Converter/BigDecimalConverter.html b/Clear/Model/Converter/BigDecimalConverter.html new file mode 100644 index 000000000..6ebd5fcf1 --- /dev/null +++ b/Clear/Model/Converter/BigDecimalConverter.html @@ -0,0 +1,1687 @@ + + + + + + + + + + + + + + + + + Clear::Model::Converter::BigDecimalConverter - clear develop + + + + + + + + + + +
+

+ + class Clear::Model::Converter::BigDecimalConverter + +

+ + + + + + + +

+ + + + Overview +

+ +

Convert from and to BigDecimal

+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/model/converters/number_converters.cr + + +
+ + + + + + + + +

+ + + + Class Method Summary +

+ + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +

+ + + + Class Method Detail +

+ +
+
+ + def self.to_column(x) : BigDecimal | Nil + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.to_db(x : BigDecimal | Nil) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + +
+ + + diff --git a/Clear/Model/Converter/BigFloatConverter.html b/Clear/Model/Converter/BigFloatConverter.html new file mode 100644 index 000000000..328d6c860 --- /dev/null +++ b/Clear/Model/Converter/BigFloatConverter.html @@ -0,0 +1,1687 @@ + + + + + + + + + + + + + + + + + Clear::Model::Converter::BigFloatConverter - clear develop + + + + + + + + + + +
+

+ + class Clear::Model::Converter::BigFloatConverter + +

+ + + + + + + +

+ + + + Overview +

+ +

Convert from and to BigFloat

+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/model/converters/number_converters.cr + + +
+ + + + + + + + +

+ + + + Class Method Summary +

+ + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +

+ + + + Class Method Detail +

+ +
+
+ + def self.to_column(x) : BigFloat | Nil + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.to_db(x : BigFloat | Nil) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + +
+ + + diff --git a/Clear/Model/Converter/BigIntConverter.html b/Clear/Model/Converter/BigIntConverter.html new file mode 100644 index 000000000..aa7b8a022 --- /dev/null +++ b/Clear/Model/Converter/BigIntConverter.html @@ -0,0 +1,1687 @@ + + + + + + + + + + + + + + + + + Clear::Model::Converter::BigIntConverter - clear develop + + + + + + + + + + +
+

+ + class Clear::Model::Converter::BigIntConverter + +

+ + + + + + + +

+ + + + Overview +

+ +

Convert from and to BigInt

+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/model/converters/number_converters.cr + + +
+ + + + + + + + +

+ + + + Class Method Summary +

+ + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +

+ + + + Class Method Detail +

+ +
+
+ + def self.to_column(x) : BigInt | Nil + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.to_db(x : BigInt | Nil) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + +
+ + + diff --git a/Clear/Model/Converter/BoolConverter.html b/Clear/Model/Converter/BoolConverter.html new file mode 100644 index 000000000..6aac54c3a --- /dev/null +++ b/Clear/Model/Converter/BoolConverter.html @@ -0,0 +1,1664 @@ + + + + + + + + + + + + + + + + + Clear::Model::Converter::BoolConverter - clear develop + + + + + + + + + + +
+

+ + module Clear::Model::Converter::BoolConverter + +

+ + + + + +

+ + + + Overview +

+ +

Convert the column to a boolean +If value is not boolean (e.g. string or number), rules of falsey +value is used:

+

falsey's values are: +false, nil, 0, "0", "" (empty string), "false", "f"

+

Anything else is considered true

+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/model/converters/bool_converter.cr + + +
+ + + + + + + + +

+ + + + Class Method Summary +

+ + + + + + + + +
+ +
+ + + + +

+ + + + Class Method Detail +

+ +
+
+ + def self.to_column(x) : Bool | Nil + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.to_db(x : Bool | Nil) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + +
+ + + diff --git a/Clear/Model/Converter/Float32Converter.html b/Clear/Model/Converter/Float32Converter.html new file mode 100644 index 000000000..0cc452a7a --- /dev/null +++ b/Clear/Model/Converter/Float32Converter.html @@ -0,0 +1,1687 @@ + + + + + + + + + + + + + + + + + Clear::Model::Converter::Float32Converter - clear develop + + + + + + + + + + +
+

+ + class Clear::Model::Converter::Float32Converter + +

+ + + + + + + +

+ + + + Overview +

+ +

Convert from and to Float32

+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/model/converters/number_converters.cr + + +
+ + + + + + + + +

+ + + + Class Method Summary +

+ + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +

+ + + + Class Method Detail +

+ +
+
+ + def self.to_column(x) : Float32 | Nil + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.to_db(x : Float32 | Nil) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + +
+ + + diff --git a/Clear/Model/Converter/Float64Converter.html b/Clear/Model/Converter/Float64Converter.html new file mode 100644 index 000000000..9a1f6dcf8 --- /dev/null +++ b/Clear/Model/Converter/Float64Converter.html @@ -0,0 +1,1687 @@ + + + + + + + + + + + + + + + + + Clear::Model::Converter::Float64Converter - clear develop + + + + + + + + + + +
+

+ + class Clear::Model::Converter::Float64Converter + +

+ + + + + + + +

+ + + + Overview +

+ +

Convert from and to Float64

+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/model/converters/number_converters.cr + + +
+ + + + + + + + +

+ + + + Class Method Summary +

+ + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +

+ + + + Class Method Detail +

+ +
+
+ + def self.to_column(x) : Float64 | Nil + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.to_db(x : Float64 | Nil) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + +
+ + + diff --git a/Clear/Model/Converter/Int16Converter.html b/Clear/Model/Converter/Int16Converter.html new file mode 100644 index 000000000..fe5fa31f8 --- /dev/null +++ b/Clear/Model/Converter/Int16Converter.html @@ -0,0 +1,1687 @@ + + + + + + + + + + + + + + + + + Clear::Model::Converter::Int16Converter - clear develop + + + + + + + + + + +
+

+ + class Clear::Model::Converter::Int16Converter + +

+ + + + + + + +

+ + + + Overview +

+ +

Convert from and to Int16

+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/model/converters/number_converters.cr + + +
+ + + + + + + + +

+ + + + Class Method Summary +

+ + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +

+ + + + Class Method Detail +

+ +
+
+ + def self.to_column(x) : Int16 | Nil + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.to_db(x : Int16 | Nil) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + +
+ + + diff --git a/Clear/Model/Converter/Int32Converter.html b/Clear/Model/Converter/Int32Converter.html new file mode 100644 index 000000000..57d2f98de --- /dev/null +++ b/Clear/Model/Converter/Int32Converter.html @@ -0,0 +1,1687 @@ + + + + + + + + + + + + + + + + + Clear::Model::Converter::Int32Converter - clear develop + + + + + + + + + + +
+

+ + class Clear::Model::Converter::Int32Converter + +

+ + + + + + + +

+ + + + Overview +

+ +

Convert from and to Int32

+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/model/converters/number_converters.cr + + +
+ + + + + + + + +

+ + + + Class Method Summary +

+ + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +

+ + + + Class Method Detail +

+ +
+
+ + def self.to_column(x) : Int32 | Nil + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.to_db(x : Int32 | Nil) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + +
+ + + diff --git a/Clear/Model/Converter/Int64Converter.html b/Clear/Model/Converter/Int64Converter.html new file mode 100644 index 000000000..f233742b3 --- /dev/null +++ b/Clear/Model/Converter/Int64Converter.html @@ -0,0 +1,1687 @@ + + + + + + + + + + + + + + + + + Clear::Model::Converter::Int64Converter - clear develop + + + + + + + + + + +
+

+ + class Clear::Model::Converter::Int64Converter + +

+ + + + + + + +

+ + + + Overview +

+ +

Convert from and to Int64

+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/model/converters/number_converters.cr + + +
+ + + + + + + + +

+ + + + Class Method Summary +

+ + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +

+ + + + Class Method Detail +

+ +
+
+ + def self.to_column(x) : Int64 | Nil + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.to_db(x : Int64 | Nil) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + +
+ + + diff --git a/Clear/Model/Converter/Int8Converter.html b/Clear/Model/Converter/Int8Converter.html new file mode 100644 index 000000000..7b07aee70 --- /dev/null +++ b/Clear/Model/Converter/Int8Converter.html @@ -0,0 +1,1687 @@ + + + + + + + + + + + + + + + + + Clear::Model::Converter::Int8Converter - clear develop + + + + + + + + + + +
+

+ + class Clear::Model::Converter::Int8Converter + +

+ + + + + + + +

+ + + + Overview +

+ +

Convert from and to Int8

+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/model/converters/number_converters.cr + + +
+ + + + + + + + +

+ + + + Class Method Summary +

+ + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +

+ + + + Class Method Detail +

+ +
+
+ + def self.to_column(x) : Int8 | Nil + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.to_db(x : Int8 | Nil) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + +
+ + + diff --git a/Clear/Model/Converter/JSON.html b/Clear/Model/Converter/JSON.html new file mode 100644 index 000000000..77e7fec4f --- /dev/null +++ b/Clear/Model/Converter/JSON.html @@ -0,0 +1,1584 @@ + + + + + + + + + + + + + + + + + Clear::Model::Converter::JSON - clear develop + + + + + + + + + + +
+

+ + module Clear::Model::Converter::JSON + +

+ + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/model/converters/json_any_converter.cr + + +
+ + + + + + + + + + + + + + +
+ +
+ + + + + + + + + +
+ + + diff --git a/Clear/Model/Converter/JSON/AnyConverter.html b/Clear/Model/Converter/JSON/AnyConverter.html new file mode 100644 index 000000000..39563a9b9 --- /dev/null +++ b/Clear/Model/Converter/JSON/AnyConverter.html @@ -0,0 +1,1648 @@ + + + + + + + + + + + + + + + + + Clear::Model::Converter::JSON::AnyConverter - clear develop + + + + + + + + + + +
+

+ + module Clear::Model::Converter::JSON::AnyConverter + +

+ + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/model/converters/json_any_converter.cr + + +
+ + + + + + + + +

+ + + + Class Method Summary +

+ + + + + + + + +
+ +
+ + + + +

+ + + + Class Method Detail +

+ +
+
+ + def self.to_column(x) : ::JSON::Any | Nil + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.to_db(x : ::JSON::Any | Nil) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + +
+ + + diff --git a/Clear/Model/Converter/StringConverter.html b/Clear/Model/Converter/StringConverter.html new file mode 100644 index 000000000..0a09d1243 --- /dev/null +++ b/Clear/Model/Converter/StringConverter.html @@ -0,0 +1,1676 @@ + + + + + + + + + + + + + + + + + Clear::Model::Converter::StringConverter - clear develop + + + + + + + + + + +
+

+ + class Clear::Model::Converter::StringConverter + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/model/converters/string_converter.cr + + +
+ + + + + + + + +

+ + + + Class Method Summary +

+ + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +

+ + + + Class Method Detail +

+ +
+
+ + def self.to_column(x) : String | Nil + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.to_db(x : String | Nil) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + +
+ + + diff --git a/Clear/Model/Converter/TimeConverter.html b/Clear/Model/Converter/TimeConverter.html new file mode 100644 index 000000000..a6abb0c68 --- /dev/null +++ b/Clear/Model/Converter/TimeConverter.html @@ -0,0 +1,1676 @@ + + + + + + + + + + + + + + + + + Clear::Model::Converter::TimeConverter - clear develop + + + + + + + + + + +
+

+ + class Clear::Model::Converter::TimeConverter + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/model/converters/time_converter.cr + + +
+ + + + + + + + +

+ + + + Class Method Summary +

+ + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +

+ + + + Class Method Detail +

+ +
+
+ + def self.to_column(x) : Time | Nil + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.to_db(x : Time | Nil) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + +
+ + + diff --git a/Clear/Model/Converter/UInt16Converter.html b/Clear/Model/Converter/UInt16Converter.html new file mode 100644 index 000000000..9392037b3 --- /dev/null +++ b/Clear/Model/Converter/UInt16Converter.html @@ -0,0 +1,1687 @@ + + + + + + + + + + + + + + + + + Clear::Model::Converter::UInt16Converter - clear develop + + + + + + + + + + +
+

+ + class Clear::Model::Converter::UInt16Converter + +

+ + + + + + + +

+ + + + Overview +

+ +

Convert from and to UInt16

+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/model/converters/number_converters.cr + + +
+ + + + + + + + +

+ + + + Class Method Summary +

+ + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +

+ + + + Class Method Detail +

+ +
+
+ + def self.to_column(x) : UInt16 | Nil + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.to_db(x : UInt16 | Nil) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + +
+ + + diff --git a/Clear/Model/Converter/UInt32Converter.html b/Clear/Model/Converter/UInt32Converter.html new file mode 100644 index 000000000..c8727d43d --- /dev/null +++ b/Clear/Model/Converter/UInt32Converter.html @@ -0,0 +1,1687 @@ + + + + + + + + + + + + + + + + + Clear::Model::Converter::UInt32Converter - clear develop + + + + + + + + + + +
+

+ + class Clear::Model::Converter::UInt32Converter + +

+ + + + + + + +

+ + + + Overview +

+ +

Convert from and to UInt32

+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/model/converters/number_converters.cr + + +
+ + + + + + + + +

+ + + + Class Method Summary +

+ + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +

+ + + + Class Method Detail +

+ +
+
+ + def self.to_column(x) : UInt32 | Nil + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.to_db(x : UInt32 | Nil) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + +
+ + + diff --git a/Clear/Model/Converter/UInt64Converter.html b/Clear/Model/Converter/UInt64Converter.html new file mode 100644 index 000000000..8ef68ddd7 --- /dev/null +++ b/Clear/Model/Converter/UInt64Converter.html @@ -0,0 +1,1687 @@ + + + + + + + + + + + + + + + + + Clear::Model::Converter::UInt64Converter - clear develop + + + + + + + + + + +
+

+ + class Clear::Model::Converter::UInt64Converter + +

+ + + + + + + +

+ + + + Overview +

+ +

Convert from and to UInt64

+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/model/converters/number_converters.cr + + +
+ + + + + + + + +

+ + + + Class Method Summary +

+ + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +

+ + + + Class Method Detail +

+ +
+
+ + def self.to_column(x) : UInt64 | Nil + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.to_db(x : UInt64 | Nil) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + +
+ + + diff --git a/Clear/Model/Converter/UInt8Converter.html b/Clear/Model/Converter/UInt8Converter.html new file mode 100644 index 000000000..653caeaa0 --- /dev/null +++ b/Clear/Model/Converter/UInt8Converter.html @@ -0,0 +1,1687 @@ + + + + + + + + + + + + + + + + + Clear::Model::Converter::UInt8Converter - clear develop + + + + + + + + + + +
+

+ + class Clear::Model::Converter::UInt8Converter + +

+ + + + + + + +

+ + + + Overview +

+ +

Convert from and to UInt8

+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/model/converters/number_converters.cr + + +
+ + + + + + + + +

+ + + + Class Method Summary +

+ + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +

+ + + + Class Method Detail +

+ +
+
+ + def self.to_column(x) : UInt8 | Nil + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.to_db(x : UInt8 | Nil) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + +
+ + + diff --git a/Clear/Model/Converter/UUIDConverter.html b/Clear/Model/Converter/UUIDConverter.html new file mode 100644 index 000000000..91b375b29 --- /dev/null +++ b/Clear/Model/Converter/UUIDConverter.html @@ -0,0 +1,1687 @@ + + + + + + + + + + + + + + + + + Clear::Model::Converter::UUIDConverter - clear develop + + + + + + + + + + +
+

+ + class Clear::Model::Converter::UUIDConverter + +

+ + + + + + + +

+ + + + Overview +

+ +

Convert from UUID column to Crystal's UUID

+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/extensions/uuid/uuid.cr + + +
+ + + + + + + + +

+ + + + Class Method Summary +

+ + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +

+ + + + Class Method Detail +

+ +
+
+ + def self.to_column(x) : UUID | Nil + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.to_db(x : UUID | Nil) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + +
+ + + diff --git a/Clear/Model/Error.html b/Clear/Model/Error.html new file mode 100644 index 000000000..7baf5ba52 --- /dev/null +++ b/Clear/Model/Error.html @@ -0,0 +1,1641 @@ + + + + + + + + + + + + + + + + + Clear::Model::Error - clear develop + + + + + + + + + + +
+

+ + class Clear::Model::Error + +

+ + + + + + + + + + + + + + + +

+ + + + Direct Known Subclasses +

+ + + + + + + +

+ + + + Defined in: +

+ + + + clear/model/errors.cr + + +
+ + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + +
+ + + diff --git a/Clear/Model/EventManager.html b/Clear/Model/EventManager.html new file mode 100644 index 000000000..483e10de1 --- /dev/null +++ b/Clear/Model/EventManager.html @@ -0,0 +1,1765 @@ + + + + + + + + + + + + + + + + + Clear::Model::EventManager - clear develop + + + + + + + + + + +
+

+ + class Clear::Model::EventManager + +

+ + + + + + + +

+ + + + Overview +

+ +

Global storage for model lifecycle event management

+

This class acts as a storage and can trigger events +This class a singleton.

+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/model/event_manager.cr + + +
+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ EVENT_CALLBACKS = {} of EventKey => Array(HookFunction) +
+ + +
+ INHERITANCE_MAP = {} of String => String +
+ + +
+ + + + + +

+ + + + Class Method Summary +

+ + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +

+ + + + Class Method Detail +

+ +
+
+ + def self.add_inheritance(parent, child) + + # +
+ +
+ +

Map the inheritance between models. Events which belongs to parent model are triggered when child model lifecycle +actions occurs

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.attach(klazz, direction : Symbol, event : Symbol, block : HookFunction) + + # +
+ +
+ +

Add an event for a specific class, to a specific direction (after or before), a specific event Symbol (validate, save, commit...)

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.trigger(klazz, direction : Symbol, event : Symbol, mdl : Clear::Model) + + # +
+ +
+ +

Trigger events callback for a specific model. +Direction can be :before and :after +In case of :before direction, the events are called in reverse order:

+
before:
+- Last defined event
+- First defined event
+action
+after:
+- First defined events
+- Last defined events
+
+ +
+
+ + [View source] + +
+
+ + + + + + + +
+ + + diff --git a/Clear/Model/EventManager/EventKey.html b/Clear/Model/EventManager/EventKey.html new file mode 100644 index 000000000..663652387 --- /dev/null +++ b/Clear/Model/EventManager/EventKey.html @@ -0,0 +1,1594 @@ + + + + + + + + + + + + + + + + + Clear::Model::EventManager::EventKey - clear develop + + + + + + + + + + +
+

+ + alias Clear::Model::EventManager::EventKey + +

+ + + + + + + +

+ + + + Alias Definition +

+ {String, Symbol, Symbol} + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/model/event_manager.cr + + +
+ + + + + + + + + + + + + + +
+ +
+ + + + + + + + + +
+ + + diff --git a/Clear/Model/EventManager/HookFunction.html b/Clear/Model/EventManager/HookFunction.html new file mode 100644 index 000000000..ad9781edf --- /dev/null +++ b/Clear/Model/EventManager/HookFunction.html @@ -0,0 +1,1594 @@ + + + + + + + + + + + + + + + + + Clear::Model::EventManager::HookFunction - clear develop + + + + + + + + + + +
+

+ + alias Clear::Model::EventManager::HookFunction + +

+ + + + + + + +

+ + + + Alias Definition +

+ Clear::Model -> Nil + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/model/event_manager.cr + + +
+ + + + + + + + + + + + + + +
+ +
+ + + + + + + + + +
+ + + diff --git a/Clear/Model/Factory.html b/Clear/Model/Factory.html new file mode 100644 index 000000000..d6fc247a3 --- /dev/null +++ b/Clear/Model/Factory.html @@ -0,0 +1,1731 @@ + + + + + + + + + + + + + + + + + Clear::Model::Factory - clear develop + + + + + + + + + + +
+

+ + module Clear::Model::Factory + +

+ + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/model/factories/base.cr + + +
+ + + + clear/model/factories/polymorphic_factory.cr + + +
+ + + + clear/model/factories/simple_factory.cr + + +
+ + + + clear/model/factory.cr + + +
+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ FACTORIES = {"Clear::Reflection::Column" => ::Clear::Model::Factory::SimpleFactory(Clear::Reflection::Column).new, "Clear::Reflection::Table" => ::Clear::Model::Factory::SimpleFactory(Clear::Reflection::Table).new} of String => Clear::Model::Factory::Base +
+ + +
+ + + + + +

+ + + + Class Method Summary +

+ + + + +

+ + + + Macro Summary +

+ + + + + + +
+ +
+ + + + +

+ + + + Class Method Detail +

+ +
+
+ + def self.build(type : String, h : Hash, cache : Clear::Model::QueryCache | Nil = nil, persisted = false, fetch_columns = false) : Clear::Model + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.build(type : T.class, h : Hash, cache : Clear::Model::QueryCache | Nil = nil, persisted = false, fetch_columns = false) : T forall T + + # +
+ +
+
+ + [View source] + +
+
+ + + + +

+ + + + Macro Detail +

+ +
+
+ + macro add(type, factory) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + +
+ + + diff --git a/Clear/Model/Factory/Base.html b/Clear/Model/Factory/Base.html new file mode 100644 index 000000000..ea5fa9d5e --- /dev/null +++ b/Clear/Model/Factory/Base.html @@ -0,0 +1,1643 @@ + + + + + + + + + + + + + + + + + Clear::Model::Factory::Base - clear develop + + + + + + + + + + +
+

+ + module Clear::Model::Factory::Base + +

+ + + + + + + + + + + + + + + +

+ + + + Direct including types +

+ + + + + +

+ + + + Defined in: +

+ + + + clear/model/factories/base.cr + + +
+ + + + + + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ +
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ abstract + def build(h : Hash(String, Clear::SQL::Any), cache : Clear::Model::QueryCache | Nil = nil, persisted : Bool = false, fetch_columns : Bool = false) : Clear::Model + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/Model/Factory/PolymorphicFactory.html b/Clear/Model/Factory/PolymorphicFactory.html new file mode 100644 index 000000000..60dbdbbcb --- /dev/null +++ b/Clear/Model/Factory/PolymorphicFactory.html @@ -0,0 +1,1818 @@ + + + + + + + + + + + + + + + + + Clear::Model::Factory::PolymorphicFactory(T) - clear develop + + + + + + + + + + +
+

+ + class Clear::Model::Factory::PolymorphicFactory(T) + +

+ + + + + + + + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/model/factories/polymorphic_factory.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + +

Instance methods inherited from module Clear::Model::Factory::Base

+ + + + build(h : Hash(String, Clear::SQL::Any), cache : Clear::Model::QueryCache | Nil = nil, persisted : Bool = false, fetch_columns : Bool = false) : Clear::Model + build + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(type_field : String, self_class : String) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def build(h : Hash(String, Clear::SQL::Any), cache : Clear::Model::QueryCache | Nil = nil, persisted : Bool = false, fetch_columns : Bool = false) : Clear::Model + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self_class : String + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self_class=(self_class : String) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def type_field : String + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def type_field=(type_field : String) + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/Model/Factory/SimpleFactory.html b/Clear/Model/Factory/SimpleFactory.html new file mode 100644 index 000000000..95918fa8b --- /dev/null +++ b/Clear/Model/Factory/SimpleFactory.html @@ -0,0 +1,1691 @@ + + + + + + + + + + + + + + + + + Clear::Model::Factory::SimpleFactory(T) - clear develop + + + + + + + + + + +
+

+ + class Clear::Model::Factory::SimpleFactory(T) + +

+ + + + + + + + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/model/factories/simple_factory.cr + + +
+ + + + + + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + +

Instance methods inherited from module Clear::Model::Factory::Base

+ + + + build(h : Hash(String, Clear::SQL::Any), cache : Clear::Model::QueryCache | Nil = nil, persisted : Bool = false, fetch_columns : Bool = false) : Clear::Model + build + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def build(h : Hash(String, Clear::SQL::Any), cache : Clear::Model::QueryCache | Nil = nil, persisted : Bool = false, fetch_columns : Bool = false) : Clear::Model + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/Model/FullTextSearchable.html b/Clear/Model/FullTextSearchable.html new file mode 100644 index 000000000..f7510347a --- /dev/null +++ b/Clear/Model/FullTextSearchable.html @@ -0,0 +1,1784 @@ + + + + + + + + + + + + + + + + + Clear::Model::FullTextSearchable - clear develop + + + + + + + + + + +
+

+ + module Clear::Model::FullTextSearchable + +

+ + + + + +

+ + + + Overview +

+ +

Full text search plugin offers full integration with tsvector capabilities of +Postgresql.

+

It allows you to query models through the text content of one or multiple fields.

+

+ +The blog example

+

Let's assume we have a blog and want to implement full text search over title and content:

+
create_table "posts" do |t|
+  t.column :title, :string, null: false
+  t.column :content, :string, null: false
+
+  t.full_text_searchable on: [{"title", 'A'}, {"content", 'C'}]
+end
+

This migration will create a 3rd column named full_text_vector of type tsvector, +a gin index, a trigger and a function to update automatically this column.

+

Over the on keyword, '{"title", 'A'}' means it allows search of the content of "title", with level of priority (weight) "A", which tells postgres than title content is more meaningful than the article content itself.

+

Now, let's build some models:

+

+  model Post
+    include Clear::Model
+    #...
+
+    full_text_searchable
+  end
+
+  Post.create!({title: "About poney", content: "Poney are cool"})
+  Post.create!({title: "About dog and cat", content: "Cat and dog are cool. But not as much as poney"})
+  Post.create!({title: "You won't believe: She raises her poney like as star!", content: "She's cool because poney are cool"})
+

Search is now easily done

+
Post.query.search("poney") # Return all the articles !
+

Obviously, search call can be chained:

+
user = User.find! { email == "some_email@example.com" }
+Post.query.from_user(user).search("orm")
+

+ +Additional parameters

+

+ +catalog

+

Select the catalog to use to build the tsquery. By default, pg_catalog.english is used.

+
# in your migration:
+t.full_text_searchable on: [{"title", 'A'}, {"content", 'C'}], catalog: "pg_catalog.french"
+
+# in your model
+full_text_searchable catalog: "pg_catalog.french"
+

Note: For now, Clear doesn't offers dynamic selection of catalog (for let's say multi-lang service). +If your app need this feature, do not hesitate to open an issue.

+

+ +trigger_name, function_name

+

In migration, you can change the name generated for the trigger and the function, using theses two keys.

+

+ +dest_field

+

The field created in the database, which will contains your ts vector. Default is full_text_vector.

+
# in your migration
+t.full_text_searchable on: [{"title", 'A'}, {"content", 'C'}], dest_field: "tsv"
+
+# in your model
+full_text_searchable "tsv"
+ + + + + + + + + + + +

+ + + + Direct including types +

+ + + + + +

+ + + + Defined in: +

+ + + + clear/extensions/full_text_searchable/model.cr + + +
+ + + + + + + + +

+ + + + Class Method Summary +

+ + + + +

+ + + + Macro Summary +

+ + + + + + +
+ +
+ + + + +

+ + + + Class Method Detail +

+ +
+
+ + def self.to_tsq(text) + + # +
+ +
+ +

Parse client side text and generate string ready to be ingested by PG's to_tsquery.

+

Author note: pg to_tsquery is awesome but can easily fail to parse. +search method use then a wrapper text_to_search used to ensure than +request is understood and produce ALWAYS legal string for to_tsquery +This is a good helper then to use with the input of your end-users !

+

However, this helper can be improved, as it doesn't use all the features +of tsvector (parentesis, OR operator etc...)

+
+ +
+
+ + [View source] + +
+
+ + + + +

+ + + + Macro Detail +

+ +
+
+ + macro full_text_searchable(through = "full_text_vector", catalog = "pg_catalog.english", scope_name = "search") + + # +
+ +
+ +

Set this model as searchable using tsvector

+
+ +
+
+ + [View source] + +
+
+ + + + + +
+ + + diff --git a/Clear/Model/HasColumns.html b/Clear/Model/HasColumns.html new file mode 100644 index 000000000..c6486843c --- /dev/null +++ b/Clear/Model/HasColumns.html @@ -0,0 +1,2023 @@ + + + + + + + + + + + + + + + + + Clear::Model::HasColumns - clear develop + + + + + + + + + + +
+

+ + module Clear::Model::HasColumns + +

+ + + + + +

+ + + + Overview +

+ +

This module declare all the methods and macro related to columns in Clear::Model

+ + + + + + + + + + + +

+ + + + Direct including types +

+ + + + + +

+ + + + Defined in: +

+ + + + clear/model/modules/has_columns.cr + + +
+ + + + + + + + + + +

+ + + + Macro Summary +

+ + + + +

+ + + + Instance Method Summary +

+ + + + +
+ +
+ + + + + + +

+ + + + Macro Detail +

+ +
+
+ + macro column(name, primary = false, converter = nil, column_name = nil, presence = true, mass_assign = true) + + # +
+ +
+ +

Bind a column to the model.

+

Simple example:

+
class MyModel
+  include Clear::Model
+
+  column some_id : Int32, primary: true
+  column nullable_column : String?
+end
+

options:

+
    +
  • +

    primary : Bool: Let Clear ORM know which column is the primary key. +Currently compound primary key are not compatible with Clear ORM.

    +
  • +
  • +

    converter : Class | Module: Use this class to convert the data from the +SQL. This class must possess the class methods +to_column(::Clear::SQL::Any) : T and to_db(T) : ::Clear::SQL::Any +with T the type of the column.

    +
  • +
  • +

    column_name : String: If the name of the column in the model doesn't fit the name of the +column in the SQL, you can use the parameter column_name to tell Clear about +which db column is linked to current field.

    +
  • +
  • +

    presence : Bool (default = true): Use this option to let know Clear that +your column is not nullable but with default value generated by the database +on insert (e.g. serial) +During validation before saving, the presence will not be checked on this field +and Clear will try to insert without the field value.

    +
  • +
  • +

    mass_assign : Bool (default = true): Use this option to turn on/ off mass assignment +when instantiating or updating a new model from json through .from_json methods from +the Clear::Model::JSONDeserialize module.

    +
  • +
+
+ +
+
+ + [View source] + +
+
+ + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def [](x) : Clear::SQL::Any + + # +
+ +
+ +

Access to direct SQL attributes given by the request used to build the model. +Access is read only and updating the model columns will not apply change to theses columns.

+
model = Model.query.select("MIN(id) as min_id").first(fetch_columns: true)
+id = model["min_id"].to_i32
+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def []?(x) : Clear::SQL::Any + + # +
+ +
+ +

Access to direct SQL attributes given by the request and used to build the model +or Nil if not found.

+

Access is read only and updating the model columns will not apply change to theses columns. +You must set fetch_column: true in your model to access the attributes.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def reset(h : Hash(String, _)) + + # +
+ +
+ +

See #reset(**t : **T)

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def reset(h : Hash(Symbol, _)) + + # +
+ +
+ +

See #reset(**t : **T)

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def reset(**t : **T) forall T + + # +
+ +
+ +

Reset one or multiple columns; Reseting set the current value of the column +to the given value, while the changed? flag remains false. +If you call save on a persisted model, the reset columns won't be +commited in the UPDATE query.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def set(h : Hash(String, _)) + + # +
+ +
+ +

See #set(**t : **T)

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def set(h : Hash(Symbol, _)) + + # +
+ +
+ +

See #set(**t : **T)

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def set(**t : **T) forall T + + # +
+ +
+ +

Set one or multiple columns to a specific value +This two are equivalents:

+
model.set(a: 1)
+model.a = 1
+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def to_h(full = false) + + # +
+ +
+ +

Returns the model columns as Hash. +Calling #to_h will returns only the defined columns, while settings the optional parameter full to true +will return all the column and fill the undefined columns by nil values. +Example:

+
# Assuming our model has a primary key, a first name and last name and two timestamp columns:
+model = Model.query.select("first_name, last_name").first!
+model.to_h             # => { "first_name" => "Johnny", "last_name" => "Walker" }
+model.to_h(full: true) # => {"id" => nil, "first_name" => "Johnny", "last_name" => "Walker", "created_at" => nil, "updated_at" => nil}
+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def update_h + + # +
+ +
+ +

Returns the current hash of the modified values:

+
model = Model.query.first!
+model.update_h # => {}
+model.first_name = "hello"
+model.update_h # => { "first_name" => "hello" }
+model.save!
+model.update_h # => {}
+
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/Model/HasFactory.html b/Clear/Model/HasFactory.html new file mode 100644 index 000000000..e6d7a76ef --- /dev/null +++ b/Clear/Model/HasFactory.html @@ -0,0 +1,1648 @@ + + + + + + + + + + + + + + + + + Clear::Model::HasFactory - clear develop + + + + + + + + + + +
+

+ + module Clear::Model::HasFactory + +

+ + + + + + + + + + + + + + + +

+ + + + Direct including types +

+ + + + + +

+ + + + Defined in: +

+ + + + clear/model/modules/has_factory.cr + + +
+ + + + + + + + + + +

+ + + + Macro Summary +

+ + + + + + +
+ +
+ + + + + + +

+ + + + Macro Detail +

+ +
+
+ + macro polymorphic(through = "type") + + # +
+ +
+ +

Define a polymorphic factory, if the model is tagged as polymorphic

+
+ +
+
+ + [View source] + +
+
+ + + + + +
+ + + diff --git a/Clear/Model/HasHooks.html b/Clear/Model/HasHooks.html new file mode 100644 index 000000000..587a8dd49 --- /dev/null +++ b/Clear/Model/HasHooks.html @@ -0,0 +1,1777 @@ + + + + + + + + + + + + + + + + + Clear::Model::HasHooks - clear develop + + + + + + + + + + +
+

+ + module Clear::Model::HasHooks + +

+ + + + + + + + + + + + + + + +

+ + + + Direct including types +

+ + + + + +

+ + + + Defined in: +

+ + + + clear/model/modules/has_hooks.cr + + +
+ + + + + + + + + + +

+ + + + Macro Summary +

+ + + + +

+ + + + Instance Method Summary +

+ + + + +
+ +
+ + + + + + +

+ + + + Macro Detail +

+ +
+
+ + macro after(event_name, method_name) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + macro before(event_name, method_name) + + # +
+ +
+
+ + [View source] + +
+
+ + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def trigger_after_events(event_name) + + # +
+ +
+ +

Triggers the events hooked after event_name

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def trigger_before_events(event_name) + + # +
+ +
+ +

Triggers the events hooked before event_name

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def with_triggers(event_name, &) + + # +
+ +
+ +

This performs theses operations:

+
    +
  • Call triggers before the event
  • +
  • Yield the given block
  • +
  • Call triggers after the event
  • +
+
model.with_triggers("email_sent") do |m|
+  model.send_email
+end
+

Returns self

+
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/Model/HasHooks/ClassMethods.html b/Clear/Model/HasHooks/ClassMethods.html new file mode 100644 index 000000000..8773e99d7 --- /dev/null +++ b/Clear/Model/HasHooks/ClassMethods.html @@ -0,0 +1,1648 @@ + + + + + + + + + + + + + + + + + Clear::Model::HasHooks::ClassMethods - clear develop + + + + + + + + + + +
+

+ + module Clear::Model::HasHooks::ClassMethods + +

+ + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/model/modules/has_hooks.cr + + +
+ + + + + + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ +
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def after(event_name : Symbol, &block : Clear::Model -> Nil) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def before(event_name : Symbol, &block : Clear::Model -> Nil) + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/Model/HasRelations.html b/Clear/Model/HasRelations.html new file mode 100644 index 000000000..2378be284 --- /dev/null +++ b/Clear/Model/HasRelations.html @@ -0,0 +1,1748 @@ + + + + + + + + + + + + + + + + + Clear::Model::HasRelations - clear develop + + + + + + + + + + +
+

+ + module Clear::Model::HasRelations + +

+ + + + + +

+ + + + Overview +

+ +
class Model
+  include Clear::Model
+
+  has_many posts : Post, foreign_key: Model.underscore_name + "_id", no_cache : false
+
+  has_one passport : Passport
+  has_many posts
+end
+ + + + + + + + + + + +

+ + + + Direct including types +

+ + + + + +

+ + + + Defined in: +

+ + + + clear/model/modules/has_relations.cr + + +
+ + + + + + + + + + +

+ + + + Macro Summary +

+ + + + + + +
+ +
+ + + + + + +

+ + + + Macro Detail +

+ +
+
+ + macro belongs_to(name, foreign_key = nil, no_cache = false, primary = false, foreign_key_type = Int64) + + # +
+ +
+ +
class Model
+  include Clear::Model
+
+  belongs_to user : User, foreign_key: "the_user_id"
+end
+
+ +
+
+ + [View source] + +
+
+ +
+
+ + macro has_many(name, through = nil, foreign_key = nil, own_key = nil, primary_key = nil, no_cache = false, polymorphic = false, foreign_key_type = nil) + + # +
+ +
+ +

Has Many and Has One are the relations where the model share its primary key into a foreign table. In our example above, we can assume than a User has many Post as author.

+

Basically, for each belongs_to declaration, you must have a has_many or has_one declaration on the other model.

+

While has_many relation returns a list of models, has_one returns only one model when called.

+

Example:

+
class User
+  include Clear::Model
+
+  has_many posts : Post, foreign_key: "author_id"
+end
+
+ +
+
+ + [View source] + +
+
+ +
+
+ + macro has_one(name, foreign_key = nil, primary_key = nil, no_cache = false, polymorphic = false, foreign_key_type = nil) + + # +
+ +
+ +

The method has_one declare a relation 1 to [0,1] +where the current model primary key is stored in the foreign table. +primary_key method (default: self#__pkey__) and foreign_key method +(default: table_name in singular, plus "_id" appended) +can be redefined

+

Example:

+
model Passport
+  column id : Int32, primary : true
+  has_one user : User It assumes the table `users` have a column `passport_id`
+end
+
+model Passport
+  column id : Int32, primary : true
+  has_one owner : User # It assumes the table `users` have a column `passport_id`
+end
+
+ +
+
+ + [View source] + +
+
+ + + + + +
+ + + diff --git a/Clear/Model/HasSaving.html b/Clear/Model/HasSaving.html new file mode 100644 index 000000000..c1f5be5c8 --- /dev/null +++ b/Clear/Model/HasSaving.html @@ -0,0 +1,1882 @@ + + + + + + + + + + + + + + + + + Clear::Model::HasSaving - clear develop + + + + + + + + + + +
+

+ + module Clear::Model::HasSaving + +

+ + + + + + + + + + + + + + + +

+ + + + Direct including types +

+ + + + + +

+ + + + Defined in: +

+ + + + clear/model/modules/has_saving.cr + + +
+ + + + + + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ +
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def delete + + # +
+ +
+ +

Delete the model by building and executing a DELETE query. +A deleted model is not persisted anymore, and can be saved again. +Clear will do INSERT instead of UPDATE then +Return true if the model has been successfully deleted, and false otherwise.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def persisted? : Bool + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def reload : self + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def save(on_conflict : Clear::SQL::InsertQuery -> | Nil = nil) + + # +
+ +
+ +

Save the model. If the model is already persisted, will call UPDATE query. +If the model is not persisted, will call INSERT

+

Optionally, you can pass a Proc to refine the INSERT with on conflict +resolution functions.

+

Return false if the model cannot be saved (validation issue) +Return true if the model has been correctly saved.

+

Example:

+
u = User.new
+if u.save
+  puts "User correctly saved !"
+else
+  puts "There was a problem during save: "
+  # do something with `u.errors`
+end
+

+ +on_conflict optional parameter

+

Example:

+
u = User.new id: 123, email: "email@example.com"
+u.save(-> (qry) { qry.on_conflict.do_update { |u| u.set(email: "email@example.com") } #update
+# IMPORTANT NOTICE: user may not be saved, but will be still detected as persisted !
+

You may want to use a block for on_conflict optional parameter:

+
u = User.new id: 123, email: "email@example.com"
+u.save do |qry|
+   qry.on_conflict.do_update { |u| u.set(email: "email@example.com")
+end
+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def save(&block) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def save!(on_conflict : Clear::SQL::InsertQuery -> | Nil = nil) + + # +
+ +
+ +

Performs #save call, but instead of returning false if validation failed, +raise Clear::Model::InvalidError exception

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def save!(&block : Clear::SQL::InsertQuery -> ) + + # +
+ +
+ +

Pass the on_conflict optional parameter via block.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def update(**args) + + # +
+ +
+ +

Set the fields passed as argument and call #save on the object

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def update!(**args) + + # +
+ +
+ +

Set the fields passed as argument and call #save! on the object

+
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/Model/HasScope.html b/Clear/Model/HasScope.html new file mode 100644 index 000000000..cbfc9000e --- /dev/null +++ b/Clear/Model/HasScope.html @@ -0,0 +1,1598 @@ + + + + + + + + + + + + + + + + + Clear::Model::HasScope - clear develop + + + + + + + + + + +
+

+ + module Clear::Model::HasScope + +

+ + + + + + + + + + + + + + + +

+ + + + Direct including types +

+ + + + + +

+ + + + Defined in: +

+ + + + clear/model/modules/has_scope.cr + + +
+ + + + + + + + + + + + + + +
+ +
+ + + + + + + + + +
+ + + diff --git a/Clear/Model/HasSerialPkey.html b/Clear/Model/HasSerialPkey.html new file mode 100644 index 000000000..a4685602e --- /dev/null +++ b/Clear/Model/HasSerialPkey.html @@ -0,0 +1,1711 @@ + + + + + + + + + + + + + + + + + Clear::Model::HasSerialPkey - clear develop + + + + + + + + + + +
+

+ + module Clear::Model::HasSerialPkey + +

+ + + + + + + + + + + + + + + +

+ + + + Direct including types +

+ + + + + +

+ + + + Defined in: +

+ + + + clear/model/modules/has_serial_pkey.cr + + +
+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ PKEY_TYPE = {"bigserial" => "column(__name__ : Int64, primary: true, presence: false)", "serial" => "column(__name__ : Int32, primary: true, presence: false)", "text" => "column(__name__ : String, primary: true, presence: true)", "int" => "column(__name__ : Int32, primary: true, presence: true)", "bigint" => "column(__name__ : Int64, primary: true, presence: true)", "uuid" => "column(__name__ : UUID, primary: true, presence: true)\nbefore(:validate) do |m|\n if !m.persisted? && (m.as(self)).__name___column.value(nil).nil?\n (m.as(self)).__name__ = UUID.random\n end\nend\n"} of Nil => Nil +
+ + +
+ + + + + + + +

+ + + + Macro Summary +

+ + + + + + +
+ +
+ + + + + + +

+ + + + Macro Detail +

+ +
+
+ + macro add_pkey_type(type, &block) + + # +
+ +
+ +

Add a hook for the primary_key +In the hook, name will be replaced by the column name required by calling primary_key

+

+ +Example

+
Clear::Model::HasSerialPkey.add_pkey_type("awesomepkeysystem") do
+  column __name__ : AwesomePkey, primary: true, presence: false
+
+  before_validate do
+    # ...
+  end
+end
+
+ +
+
+ + [View source] + +
+
+ +
+
+ + macro primary_key(name = "id", type = :bigserial) + + # +
+ +
+ +

Macro used to define serializable primary keys. +Currently support bigserial, serial and uuid.

+

For bigserial and serial, let to PostgreSQL the handling of sequence numbers. +For uuid, will generate a new UUID number on creation.

+
+ +
+
+ + [View source] + +
+
+ + + + + +
+ + + diff --git a/Clear/Model/HasTimestamps.html b/Clear/Model/HasTimestamps.html new file mode 100644 index 000000000..e16a314d7 --- /dev/null +++ b/Clear/Model/HasTimestamps.html @@ -0,0 +1,1650 @@ + + + + + + + + + + + + + + + + + Clear::Model::HasTimestamps - clear develop + + + + + + + + + + +
+

+ + module Clear::Model::HasTimestamps + +

+ + + + + + + + + + + + + + + +

+ + + + Direct including types +

+ + + + + +

+ + + + Defined in: +

+ + + + clear/model/modules/has_timestamps.cr + + +
+ + + + + + + + + + +

+ + + + Macro Summary +

+ + + + + + +
+ +
+ + + + + + +

+ + + + Macro Detail +

+ +
+
+ + macro timestamps + + # +
+ +
+ +

Generate the columns updated_at and created_at +The two column values are automatically set during insertion +or update of the model.

+
+ +
+
+ + [View source] + +
+
+ + + + + +
+ + + diff --git a/Clear/Model/HasValidation.html b/Clear/Model/HasValidation.html new file mode 100644 index 000000000..7b7246069 --- /dev/null +++ b/Clear/Model/HasValidation.html @@ -0,0 +1,1916 @@ + + + + + + + + + + + + + + + + + Clear::Model::HasValidation - clear develop + + + + + + + + + + +
+

+ + module Clear::Model::HasValidation + +

+ + + + + + + + + +

+ + + + Included Modules +

+ + + + + + + + +

+ + + + Direct including types +

+ + + + + +

+ + + + Defined in: +

+ + + + clear/model/modules/has_validation.cr + + +
+ + + + + + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + + + + + + + + + + +

Macros inherited from module Clear::Validation::Helper

+ + + + ensure_than(field, message, &block) + ensure_than, + + + + on_presence(*fields, &block) + on_presence + + + + + +
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def add_error(column, reason) + + # +
+ +
+ +

Add validation error related to a specific column

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def add_error(reason) + + # +
+ +
+ +

Add validation error not related to a specific column

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def clear_errors + + # +
+ +
+ +

Clear the errors log (if any) of the model and return itself

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def error? + + # +
+ +
+ +

Return true if saving has been declined because of validation issues. +The error list can be found by calling Clear::Model#errors

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def errors : Array(Error) + + # +
+ +
+ +

List of errors raised during validation, in case the model hasn't been saved properly.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def print_errors + + # +
+ +
+ +

Print the errors in string. Useful for debugging or simple error handling.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def valid! + + # +
+ +
+ +

Check whether the model is valid. If not, raise InvalidModelError. +Return the model itself

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def valid? + + # +
+ +
+ +

Return true if the model

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def validate + + # +
+ +
+ +

This method is called whenever #valid? or save is called. +By default, #validate is empty and must be overriden by your own validation code.

+
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/Model/HasValidation/Error.html b/Clear/Model/HasValidation/Error.html new file mode 100644 index 000000000..140df4d70 --- /dev/null +++ b/Clear/Model/HasValidation/Error.html @@ -0,0 +1,1770 @@ + + + + + + + + + + + + + + + + + Clear::Model::HasValidation::Error - clear develop + + + + + + + + + + +
+

+ + struct Clear::Model::HasValidation::Error + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/model/modules/has_validation.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(reason : String, column : String | Nil) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def clone + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def column : String | Nil + + # +
+ +
+
+ +
+
+ +
+
+ + def copy_with(reason _reason = @reason, column _column = @column) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def reason : String + + # +
+ +
+
+ +
+
+ + + +
+ + + diff --git a/Clear/Model/InvalidError.html b/Clear/Model/InvalidError.html new file mode 100644 index 000000000..e0bf779f9 --- /dev/null +++ b/Clear/Model/InvalidError.html @@ -0,0 +1,1724 @@ + + + + + + + + + + + + + + + + + Clear::Model::InvalidError - clear develop + + + + + + + + + + +
+

+ + class Clear::Model::InvalidError + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/model/errors.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(model : Clear::Model) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def model : Clear::Model + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/Model/JSONDeserialize.html b/Clear/Model/JSONDeserialize.html new file mode 100644 index 000000000..04a13f70e --- /dev/null +++ b/Clear/Model/JSONDeserialize.html @@ -0,0 +1,1609 @@ + + + + + + + + + + + + + + + + + Clear::Model::JSONDeserialize - clear develop + + + + + + + + + + +
+

+ + module Clear::Model::JSONDeserialize + +

+ + + + + +

+ + + + Overview +

+ +

This module declare all the methods and macro related to deserializing json in Clear::Model

+ + + + + + + + + + + +

+ + + + Direct including types +

+ + + + + +

+ + + + Defined in: +

+ + + + clear/model/json_deserialize.cr + + +
+ + + + + + + + + + + + + + +
+ +
+ + + + + + + + + +
+ + + diff --git a/Clear/Model/QueryCache.html b/Clear/Model/QueryCache.html new file mode 100644 index 000000000..8ece2e69b --- /dev/null +++ b/Clear/Model/QueryCache.html @@ -0,0 +1,1844 @@ + + + + + + + + + + + + + + + + + Clear::Model::QueryCache - clear develop + + + + + + + + + + +
+

+ + class Clear::Model::QueryCache + +

+ + + + + + + +

+ + + + Overview +

+ +

The Clear::Model::QueryCache +is a fire-and-forget cache used when caching associations and preventing N+1 queries anti-pattern.

+

This is not a global cache: One cache instance exists per collection, and the cache +disappear at the same time the Collection is unreferenced.

+

Each cache can references multiples relations at the same time. +This cache use an underlying hash to access to the references keys.

+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/model/query_cache.cr + + +
+ + + + + + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def active(relation_name) + + # +
+ +
+ +

Tell this cache than we active the cache over a specific relation name. +Returns self

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def active?(relation_name) + + # +
+ +
+ +

Check whether the cache is active on a certain association. +Returns true if relation_name is flagged as encached, or false otherwise.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def clear + + # +
+ +
+ +

Empty the cache and flag all relations has unactive

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def fetch + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def hit(relation_name, relation_value, klass : T.class) : Array(T) forall T + + # +
+ +
+ +

Try to hit the cache. If an array is found, it will be returned. +Otherwise, empty array is returned.

+

This methods do not check if a relation flagged as is actively cached or not. Therefore, hitting a non-cached +relation will return always an empty-array.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def set(relation_name, relation_value, arr : Array(T)) forall T + + # +
+ +
+ +

Set the cached array for a specific key {relation_name,relation_value}

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def with_cache(&) + + # +
+ +
+ +

Perform some operations with the cache then eventually clear the cache.

+
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/Model/ReadOnlyError.html b/Clear/Model/ReadOnlyError.html new file mode 100644 index 000000000..e008644b6 --- /dev/null +++ b/Clear/Model/ReadOnlyError.html @@ -0,0 +1,1724 @@ + + + + + + + + + + + + + + + + + Clear::Model::ReadOnlyError - clear develop + + + + + + + + + + +
+

+ + class Clear::Model::ReadOnlyError + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/model/errors.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(model : Clear::Model) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def model : Clear::Model + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/Model/Relations.html b/Clear/Model/Relations.html new file mode 100644 index 000000000..20942140c --- /dev/null +++ b/Clear/Model/Relations.html @@ -0,0 +1,1584 @@ + + + + + + + + + + + + + + + + + Clear::Model::Relations - clear develop + + + + + + + + + + +
+

+ + module Clear::Model::Relations + +

+ + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/model/modules/relations/belongs_to_macro.cr + + +
+ + + + + + + + + + + + + + +
+ +
+ + + + + + + + + +
+ + + diff --git a/Clear/Reflection.html b/Clear/Reflection.html new file mode 100644 index 000000000..e88da3494 --- /dev/null +++ b/Clear/Reflection.html @@ -0,0 +1,1584 @@ + + + + + + + + + + + + + + + + + Clear::Reflection - clear develop + + + + + + + + + + +
+

+ + module Clear::Reflection + +

+ + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/model/reflection/column.cr + + +
+ + + + + + + + + + + + + + +
+ +
+ + + + + + + + + +
+ + + diff --git a/Clear/Reflection/Column.html b/Clear/Reflection/Column.html new file mode 100644 index 000000000..1c17f1e7b --- /dev/null +++ b/Clear/Reflection/Column.html @@ -0,0 +1,4271 @@ + + + + + + + + + + + + + + + + + Clear::Reflection::Column - clear develop + + + + + + + + + + +
+

+ + class Clear::Reflection::Column + +

+ + + + + + + +

+ + + + Overview +

+ +

Reflection of the columns using information_schema in postgreSQL.

+

TODO Usage of view instead of model

+ + + + + +

+ + + + Included Modules +

+ + + + +

+ + + + Extended Modules +

+ + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/model/reflection/column.cr + + +
+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ COLUMNS = {"table_catalog" => {type: String, primary: false, converter: "String", db_column_name: "table_catalog", crystal_variable_name: table_catalog, presence: true, mass_assign: true}, "table_schema" => {type: String, primary: false, converter: "String", db_column_name: "table_schema", crystal_variable_name: table_schema, presence: true, mass_assign: true}, "table_name" => {type: String, primary: false, converter: "String", db_column_name: "table_name", crystal_variable_name: table_name, presence: false, mass_assign: true}, "column_name" => {type: String, primary: true, converter: "String", db_column_name: "column_name", crystal_variable_name: column_name, presence: true, mass_assign: true}} of Nil => Nil +
+ + +
+ POLYMORPHISM_SETTINGS = {} of Nil => Nil +
+ + +
+ + + +

+ + + + Constructors +

+ + + + +

+ + + + Class Method Summary +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + +

Instance methods inherited from module Clear::Model

+ + + + __pkey__ + __pkey__, + + + + cache : Clear::Model::QueryCache | Nil + cache + + + + + + + + + + + + +

Macros inherited from module Clear::Model

+ + + + scope(name, &block) + scope + + + + + + + + + + + + + +

Class methods inherited from module Clear::Model::FullTextSearchable

+ + + + to_tsq(text) + to_tsq + + + + + + +

Macros inherited from module Clear::Model::FullTextSearchable

+ + + + full_text_searchable(through = "full_text_vector", catalog = "pg_catalog.english", scope_name = "search") + full_text_searchable + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Macros inherited from module Clear::Model::HasFactory

+ + + + polymorphic(through = "type") + polymorphic + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Macros inherited from module Clear::Model::HasRelations

+ + + + belongs_to(name, foreign_key = nil, no_cache = false, primary = false, foreign_key_type = Int64) + belongs_to, + + + + has_many(name, through = nil, foreign_key = nil, own_key = nil, primary_key = nil, no_cache = false, polymorphic = false, foreign_key_type = nil) + has_many, + + + + has_one(name, foreign_key = nil, primary_key = nil, no_cache = false, polymorphic = false, foreign_key_type = nil) + has_one + + + + + + + +

Instance methods inherited from module Clear::Model::HasValidation

+ + + + add_error(column, reason)
add_error(reason)
+ add_error
, + + + + clear_errors + clear_errors, + + + + error? + error?, + + + + errors : Array(Error) + errors, + + + + print_errors + print_errors, + + + + valid! + valid!, + + + + valid? + valid?, + + + + validate + validate + + + + + + + + + + + + + + + + + + + + + + + + + +

Macros inherited from module Clear::Validation::Helper

+ + + + ensure_than(field, message, &block) + ensure_than, + + + + on_presence(*fields, &block) + on_presence + + + + + + + +

Instance methods inherited from module Clear::Model::HasSaving

+ + + + delete + delete, + + + + persisted? : Bool + persisted?, + + + + reload : self + reload, + + + + save(on_conflict : Clear::SQL::InsertQuery -> | Nil = nil)
save(&block)
+ save
, + + + + save!(on_conflict : Clear::SQL::InsertQuery -> | Nil = nil)
save!(&block : Clear::SQL::InsertQuery -> )
+ save!
, + + + + update(**args) + update, + + + + update!(**args) + update! + + + + + + + + + + + + + + + + + + + + + + + + + +

Macros inherited from module Clear::Model::HasSerialPkey

+ + + + add_pkey_type(type, &block) + add_pkey_type, + + + + primary_key(name = "id", type = :bigserial) + primary_key + + + + + + + + + + + + + + + + +

Macros inherited from module Clear::Model::HasTimestamps

+ + + + timestamps + timestamps + + + + + + + +

Instance methods inherited from module Clear::Model::HasColumns

+ + + + [](x) : Clear::SQL::Any + [], + + + + []?(x) : Clear::SQL::Any + []?, + + + + reset(h : Hash(String, _))
reset(h : Hash(Symbol, _))
reset(**t : **T) forall T
+ reset
, + + + + set(h : Hash(String, _))
set(h : Hash(Symbol, _))
set(**t : **T) forall T
+ set
, + + + + to_h(full = false) + to_h, + + + + update_h + update_h + + + + + + + + + + + + +

Macros inherited from module Clear::Model::HasColumns

+ + + + column(name, primary = false, converter = nil, column_name = nil, presence = true, mass_assign = true) + column + + + + + + + +

Instance methods inherited from module Clear::Model::HasHooks

+ + + + trigger_after_events(event_name) + trigger_after_events, + + + + trigger_before_events(event_name) + trigger_before_events, + + + + with_triggers(event_name, &) + with_triggers + + + + + + + + + + + + +

Macros inherited from module Clear::Model::HasHooks

+ + + + after(event_name, method_name) + after, + + + + before(event_name, method_name) + before + + + + + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::ErrorMessages

+ + + + build_error_message(message : String, ways_to_resolve : Tuple | Array = Tuple.new, manual_pages : Tuple | Array = Tuple.new) + build_error_message, + + + + converter_error(from, to) + converter_error, + + + + format_width(x, w = 80) + format_width, + + + + illegal_setter_access_to_undefined_column(name) + illegal_setter_access_to_undefined_column, + + + + lack_of_primary_key(model_name) + lack_of_primary_key, + + + + migration_already_down(number) + migration_already_down, + + + + migration_already_up(number) + migration_already_up, + + + + migration_irreversible(name = nil, operation = nil) + migration_irreversible, + + + + migration_not_found(number) + migration_not_found, + + + + migration_not_unique(numbers) + migration_not_unique, + + + + no_migration_yet(version) + no_migration_yet, + + + + null_column_mapping_error(name, type) + null_column_mapping_error, + + + + order_by_error_invalid_order(current_order) + order_by_error_invalid_order, + + + + polymorphic_nil(through) + polymorphic_nil, + + + + polymorphic_unknown_class(class_name) + polymorphic_unknown_class, + + + + query_building_error(message) + query_building_error, + + + + uid_not_found(class_name) + uid_not_found, + + + + uninitialized_db_connection(connection) + uninitialized_db_connection + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.build(x : NamedTuple) : self + + # +
+ +
+ +

Build a new empty model and fill the columns using the NamedTuple in argument.

+

Returns the new model

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.build(x : NamedTuple, &block : self -> Nil) : self + + # +
+ +
+ +

Build a new empty model and fill the columns using the NamedTuple in argument.

+

Returns the new model

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.create(x : NamedTuple, &block : self -> Nil) : self + + # +
+ +
+ +

Build and new model and save it. Returns the model.

+

The model may not be saved due to validation failure; +check the returned model errors? and persisted? flags.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.create(**tuple, &block : self -> Nil) : self + + # +
+ +
+ +

Build and new model and save it. Returns the model.

+

The model may not be saved due to validation failure; +check the returned model errors? and persisted? flags.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.create(x : NamedTuple) : self + + # +
+ +
+ +

Build and new model and save it. Returns the model.

+

The model may not be saved due to validation failure; +check the returned model errors? and persisted? flags.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.create(**tuple) : self + + # +
+ +
+ +

Build and new model and save it. Returns the model.

+

The model may not be saved due to validation failure; +check the returned model errors? and persisted? flags.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.create!(x : NamedTuple, &block : self -> Nil) : self + + # +
+ +
+ +

Build and new model and save it. Returns the model.

+

Returns the newly inserted model +Raises an exception if validation failed during the saving process.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.create!(**tuple, &block : self -> Nil) : self + + # +
+ +
+ +

Build and new model and save it. Returns the model.

+

Returns the newly inserted model +Raises an exception if validation failed during the saving process.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.create!(x : NamedTuple) : self + + # +
+ +
+ +

Build and new model and save it. Returns the model.

+

Returns the newly inserted model +Raises an exception if validation failed during the saving process.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.create!(**tuple) : self + + # +
+ +
+ +

Build and new model and save it. Returns the model.

+

Returns the newly inserted model +Raises an exception if validation failed during the saving process.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.new(h : Hash(String, _), cache : Clear::Model::QueryCache | Nil = nil, persisted = false, fetch_columns = false) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.new(json : JSON::Any, cache : Clear::Model::QueryCache | Nil = nil, persisted = false) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.new(t : NamedTuple, persisted = false) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.new + + # +
+ +
+
+ + [View source] + +
+
+ + + + +

+ + + + Class Method Detail +

+ +
+
+ + def self.build(**tuple : **T) forall T + + # +
+ +
+ +

Build a new empty model and fill the columns using the NamedTuple in argument.

+

Returns the new model

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.build(**tuple) + + # +
+ +
+ +

Build a new empty model and fill the columns using the NamedTuple in argument.

+

Returns the new model

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.build(**tuple, &) + + # +
+ +
+ +

Build a new empty model and fill the columns using the NamedTuple in argument.

+

Returns the new model

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.columns + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.connection : String + + # +
+ +
+ +

Define on which connection the model is living. Useful in case of models living in different databases.

+

Is set to "default" by default.

+

See Clear::SQL#init(URI, *opts) for more information about multi-connections.

+

Example:

+
Clear::SQL.init("postgres://postgres@localhost/database_1")
+Clear::SQL.init("secondary", "postgres://postgres@localhost/database_2")
+
+class ModelA
+  include Clear::Model
+
+  # Performs all the queries on `database_1`
+  # self.connection = "default"
+  column id : Int32, primary: true, presence: false
+  column title : String
+end
+
+class ModelB
+  include Clear::Model
+
+  # Performs all the queries on `database_2`
+  self.connection = "secondary"
+
+  column id : Int32, primary: true, presence: false
+end
+
+ +
+
+ +
+
+ +
+
+ + def self.connection=(connection : String) + + # +
+ +
+ +

Define on which connection the model is living. Useful in case of models living in different databases.

+

Is set to "default" by default.

+

See Clear::SQL#init(URI, *opts) for more information about multi-connections.

+

Example:

+
Clear::SQL.init("postgres://postgres@localhost/database_1")
+Clear::SQL.init("secondary", "postgres://postgres@localhost/database_2")
+
+class ModelA
+  include Clear::Model
+
+  # Performs all the queries on `database_1`
+  # self.connection = "default"
+  column id : Int32, primary: true, presence: false
+  column title : String
+end
+
+class ModelB
+  include Clear::Model
+
+  # Performs all the queries on `database_2`
+  self.connection = "secondary"
+
+  column id : Int32, primary: true, presence: false
+end
+
+ +
+
+ +
+
+ +
+
+ + def self.create_from_json(string_or_io : String | IO, trusted : Bool = false) + + # +
+ +
+ +

Create a new model from json and save it. Returns the model.

+

The model may not be saved due to validation failure; +check the returned model errors? and persisted? flags. +Trusted flag set to true will allow mass assignment without protection, FALSE by default

+
+ +
+
+ +
+
+ +
+
+ + def self.create_from_json!(string_or_io : String | IO, trusted : Bool = false) + + # +
+ +
+ +

Create a new model from json and save it. Returns the model.

+

Returns the newly inserted model +Raises an exception if validation failed during the saving process. +Trusted flag set to true will allow mass assignment without protection, FALSE by default

+
+ +
+
+ +
+
+ +
+
+ + def self.find(x) + + # +
+ +
+ +

Returns a model using primary key equality +Returns nil if not found.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.find!(x) + + # +
+ +
+ +

Returns a model using primary key equality. +Raises error if the model is not found.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.from_json(string_or_io : String | IO, trusted : Bool = false) + + # +
+ +
+ +

Create a new empty model and fill the columns from json. Returns the new model

+

Trusted flag set to true will allow mass assignment without protection, FALSE by default

+
+ +
+
+ +
+
+ +
+
+ + def self.full_table_name + + # +
+ +
+ +

returns the fully qualified and escaped name for this table. +add schema if schema is different from 'public' (default schema)

+

ex: "schema"."table"

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.import(array : Enumerable(self), on_conflict : Clear::SQL::InsertQuery -> | Nil = nil) + + # +
+ +
+ +

Import a bulk of models in one SQL insert query. +Each model must be non-persisted.

+

on_conflict callback can be optionnaly turned on +to manage constraints of the database.

+

Note: Old models are not modified. This method return a copy of the +models as saved in the database.

+

+ +Example:

+
users = [User.new(id: 1), User.new(id: 2), User.new(id: 3)]
+users = User.import(users)
+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.polymorphic? : Bool + + # +
+ +
+
+ +
+
+ +
+
+ + def self.query + + # +
+ +
+ +

Return a new empty query SELECT * FROM [my_model_table]. Can be refined after that.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.read_only=(read_only : Bool) + + # +
+ +
+
+ +
+
+ +
+
+ + def self.read_only? : Bool + + # +
+ +
+
+ +
+
+ +
+
+ + def self.schema : Clear::SQL::Symbolic | Nil + + # +
+ +
+ +

Define the current schema used in PostgreSQL. The value is nil by default, which lead to non-specified +schema during the querying, and usage of "public" by PostgreSQL.

+

This property can be redefined on initialization. Example:

+
class MyModel
+  include Clear::Model
+
+  self.schema = "my_schema"
+end
+MyModel.query.to_sql # SELECT * FROM "my_schema"."my_models"
+
+ +
+
+ +
+
+ +
+
+ + def self.schema=(schema : Clear::SQL::Symbolic | Nil) + + # +
+ +
+ +

Define the current schema used in PostgreSQL. The value is nil by default, which lead to non-specified +schema during the querying, and usage of "public" by PostgreSQL.

+

This property can be redefined on initialization. Example:

+
class MyModel
+  include Clear::Model
+
+  self.schema = "my_schema"
+end
+MyModel.query.to_sql # SELECT * FROM "my_schema"."my_models"
+
+ +
+
+ +
+
+ +
+
+ + def self.table : Clear::SQL::Symbolic + + # +
+ +
+ +

Return the table name setup for this model. +By convention, the class name is by default equals to the pluralized underscored string form of the model name. +Example:

+
MyModel => "my_models"
+Person => "people"
+Project::Info => "project_infos"
+

The property can be updated at initialization to a custom table name:

+
class MyModel
+  include Clear::Model
+
+  self.table = "another_table_name"
+end
+MyModel.query.to_sql # SELECT * FROM "another_table_name"
+
+ +
+
+ +
+
+ +
+
+ + def self.table=(table : Clear::SQL::Symbolic) + + # +
+ +
+ +

Return the table name setup for this model. +By convention, the class name is by default equals to the pluralized underscored string form of the model name. +Example:

+
MyModel => "my_models"
+Person => "people"
+Project::Info => "project_infos"
+

The property can be updated at initialization to a custom table name:

+
class MyModel
+  include Clear::Model
+
+  self.table = "another_table_name"
+end
+MyModel.query.to_sql # SELECT * FROM "another_table_name"
+
+ +
+
+ +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def _cached_table : Clear::Reflection::Table | Nil + + # +
+ +
+
+ +
+
+ +
+
+ + def attributes : Hash(String, Clear::SQL::Any) + + # +
+ +
+ +

Attributes, used when fetch_columns is true

+
+ +
+
+ +
+
+ +
+
+ + def cache : Clear::Model::QueryCache | Nil + + # +
+ +
+
+ +
+
+ +
+
+ + def changed? + + # +
+ +
+ +

Return true if the model is dirty (e.g. one or more fields +have been changed.). Return false otherwise.

+
+ +
+
+ +
+
+ +
+
+ + def clear_change_flags + + # +
+ +
+ +

Reset the #changed? flag on all columns

+

The model behave like its not dirty anymore +and call to save would apply no changes.

+

Returns self

+
+ +
+
+ +
+
+ +
+
+ + def column_name : String + + # +
+ +
+ +

Returns the value of #column_name column or throw an exception if the column is not defined.

+
+ +
+
+ +
+
+ +
+
+ + def column_name=(x : String) + + # +
+ +
+ +

Setter for #column_name column.

+
+ +
+
+ +
+
+ +
+
+ + def column_name_column : Clear::Model::Column(String, Clear::Model::Converter::StringConverter) + + # +
+ +
+ +

Returns the column object used to manage #column_name field

+

See Clear::Model::Column

+
+ +
+
+ +
+
+ +
+
+ + def reset(h : Hash(Symbol, _)) + + # +
+ +
+ +

Set the columns from hash

+
+ +
+
+ +
+
+ +
+
+ + def reset(h : Hash(String, _)) + + # +
+ +
+ +

Set the model fields from hash

+
+ +
+
+ +
+
+ +
+
+ + def reset(t : NamedTuple) + + # +
+ +
+
+ +
+
+ +
+
+ + def reset(from_json : JSON::Any) + + # +
+ +
+
+ +
+
+ +
+
+ + def reset(**t : **T) forall T + + # +
+ +
+ +

reset flavors

+
+ +
+
+ +
+
+ +
+
+ + def set(h : Hash(Symbol, _)) + + # +
+ +
+ +

Set the columns from hash

+
+ +
+
+ +
+
+ +
+
+ + def set(h : Hash(String, _)) + + # +
+ +
+ +

Set the model fields from hash

+
+ +
+
+ +
+
+ +
+
+ + def set(t : NamedTuple) + + # +
+ +
+
+ +
+
+ +
+
+ + def set(from_json : JSON::Any) + + # +
+ +
+
+ +
+
+ +
+
+ + def set(**t : **T) forall T + + # +
+ +
+ +
+ Description copied from module Clear::Model::HasColumns +
+ +

Set one or multiple columns to a specific value +This two are equivalents:

+
model.set(a: 1)
+model.a = 1
+
+ +
+
+ +
+
+ +
+
+ + def set_from_json(string_or_io : String | IO, trusted : Bool = false) + + # +
+ +
+ +

Set the fields from json passed as argument +Trusted flag set to true will allow mass assignment without protection, FALSE by default

+
+ +
+
+ +
+
+ +
+
+ + def table : Clear::Reflection::Table + + # +
+ +
+ +

The method table is a belongs_to relation to Clear::Reflection::Table

+
+ +
+
+ +
+
+ +
+
+ + def table=(model : Clear::Reflection::Table) + + # +
+ +
+
+ +
+
+ +
+
+ + def table_catalog : String + + # +
+ +
+ +

Returns the value of #table_catalog column or throw an exception if the column is not defined.

+
+ +
+
+ +
+
+ +
+
+ + def table_catalog=(x : String) + + # +
+ +
+ +

Setter for #table_catalog column.

+
+ +
+
+ +
+
+ +
+
+ + def table_catalog_column : Clear::Model::Column(String, Clear::Model::Converter::StringConverter) + + # +
+ +
+ +

Returns the column object used to manage #table_catalog field

+

See Clear::Model::Column

+
+ +
+
+ +
+
+ +
+
+ + def table_name : String + + # +
+ +
+ +

Returns the value of #table_name column or throw an exception if the column is not defined.

+
+ +
+
+ +
+
+ +
+
+ + def table_name=(x : String) + + # +
+ +
+ +

Setter for #table_name column.

+
+ +
+
+ +
+
+ +
+
+ + def table_name_column : Clear::Model::Column(String, Clear::Model::Converter::StringConverter) + + # +
+ +
+ +

Returns the column object used to manage #table_name field

+

See Clear::Model::Column

+
+ +
+
+ +
+
+ +
+
+ + def table_schema : String + + # +
+ +
+ +

Returns the value of #table_schema column or throw an exception if the column is not defined.

+
+ +
+
+ +
+
+ +
+
+ + def table_schema=(x : String) + + # +
+ +
+ +

Setter for #table_schema column.

+
+ +
+
+ +
+
+ +
+
+ + def table_schema_column : Clear::Model::Column(String, Clear::Model::Converter::StringConverter) + + # +
+ +
+ +

Returns the column object used to manage #table_schema field

+

See Clear::Model::Column

+
+ +
+
+ +
+
+ +
+
+ + def to_h(full = false) : Hash(String, Clear::SQL::Any) + + # +
+ +
+ +

Return a hash version of the columns of this model.

+
+ +
+
+ +
+
+ +
+
+ + def to_json(emit_nulls : Bool = false) + + # +
+ +
+
+ +
+
+ +
+
+ + def to_json(json, emit_nulls = false) + + # +
+ +
+
+ +
+
+ +
+
+ + def update_from_json(string_or_io : String | IO, trusted : Bool = false) + + # +
+ +
+ +

Set the fields from json passed as argument and call save on the object +Trusted flag set to true will allow mass assignment without protection, FALSE by default

+
+ +
+
+ +
+
+ +
+
+ + def update_from_json!(string_or_io : String | IO, trusted : Bool = false) + + # +
+ +
+ +

Set the fields from json passed as argument and call save! on the object +Trusted flag set to true will allow mass assignment without protection, FALSE by default

+
+ +
+
+ +
+
+ +
+
+ + def update_h : Hash(String, Clear::SQL::Any) + + # +
+ +
+ +

Generate the hash for update request (like during save)

+
+ +
+
+ +
+
+ +
+
+ + def validate_fields_presence + + # +
+ +
+ +

For each column, ensure than when needed the column has present +information into it.

+

This method is called on validation.

+
+ +
+
+ +
+
+ + + +
+ + + diff --git a/Clear/Reflection/Column/Collection.html b/Clear/Reflection/Column/Collection.html new file mode 100644 index 000000000..db5484ffa --- /dev/null +++ b/Clear/Reflection/Column/Collection.html @@ -0,0 +1,2619 @@ + + + + + + + + + + + + + + + + + Clear::Reflection::Column::Collection - clear develop + + + + + + + + + + +
+

+ + class Clear::Reflection::Column::Collection + +

+ + + + + + + +

+ + + + Overview +

+ +

:doc: +Clear::Model::Collection

+

This is the object managing a SELECT request. +A new collection is created by calling Clear::Model.query

+

Collection are mutable and refining the SQL will mutate the collection. +You may want to copy the collection by calling dup

+

See Clear::Model::CollectionBase

+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/model/reflection/column.cr + + +
+ + + + + + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + +

Instance methods inherited from class Clear::Model::CollectionBase(Clear::Reflection::Column)

+ + + + <<(item : T) + <<, + + + + [](range : Range(Number, Number), fetch_columns = false) : Array(T)
[](off, fetch_columns = false) : T
+ []
, + + + + []?(off, fetch_columns = false) : T | Nil + []?, + + + + add(item : T) + add, + + + + any? + any?, + + + + build(x : NamedTuple, &block : T -> Nil) : T
build(**tuple, & : T -> Nil) : T
build(x : NamedTuple) : T
build(**tuple) : T
+ build
, + + + + count(type : X.class = Int64) forall X + count, + + + + create(x : NamedTuple, &block : T -> Nil) : T
create(**tuple, & : T -> Nil) : T
create(x : NamedTuple) : T
create(**tuple) : T
+ create
, + + + + create!(x : NamedTuple, &block : T -> Nil) : T
create!(**tuple, & : T -> Nil) : T
create!(x : NamedTuple) : T
create!(**tuple) : T
+ create!
, + + + + delete_all : self + delete_all, + + + + dup + dup, + + + + each(fetch_columns = false, & : T -> ) : Nil + each, + + + + each_with_cursor(batch = 1000, fetch_columns = false, &block : T -> ) + each_with_cursor, + + + + empty? + empty?, + + + + find(fetch_columns = false, &) : T | Nil
find(tuple : NamedTuple, fetch_columns = false) : T | Nil
find(**tuple) : T | Nil
+ find
, + + + + find!(fetch_columns = false, &) : T
find!(tuple : NamedTuple, fetch_columns = false) : T
find!(**tuple) : T
+ find!
, + + + + find_or_build(x : NamedTuple, &block : T -> Nil) : T
find_or_build(**tuple, & : T -> Nil) : T
find_or_build(x : NamedTuple) : T
find_or_build(**tuple) : T
+ find_or_build
, + + + + find_or_create(x : NamedTuple, &block : T -> Nil) : T
find_or_create(**tuple, & : T -> Nil) : T
find_or_create(x : NamedTuple) : T
find_or_create(**tuple) : T
+ find_or_create
, + + + + first(fetch_columns = false) : T | Nil + first, + + + + first!(fetch_columns = false) : T + first!, + + + + item_class + item_class, + + + + last(fetch_columns = false) : T | Nil + last, + + + + last!(fetch_columns = false) : T + last!, + + + + map(fetch_columns = false, &block : T -> X) : Array(X) forall X + map, + + + + tags + tags, + + + + to_a(fetch_columns = false) : Array(T) + to_a, + + + + unlink(item : T) + unlink + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::SelectBuilder

+ + + + before_query(&block : -> Nil) + before_query, + + + + columns : Array(SQL::Column) + columns, + + + + default_wildcard_table + default_wildcard_table, + + + + dup : self + dup, + + + + havings : Array(Clear::Expression::Node) + havings, + + + + is_distinct? + is_distinct?, + + + + joins : Array(SQL::Join) + joins, + + + + limit : Int64 | Nil + limit, + + + + lock : String | Nil + lock, + + + + offset : Int64 | Nil + offset, + + + + order_bys : Array(Clear::SQL::Query::OrderBy::Record) + order_bys, + + + + to_delete + to_delete, + + + + to_sql : String + to_sql, + + + + to_update + to_update, + + + + total_entries : Int64 | Nil + total_entries, + + + + total_entries=(total_entries : Int64 | Nil) + total_entries=, + + + + wheres : Array(Clear::Expression::Node) + wheres + + + + + + +

Constructor methods inherited from module Clear::SQL::SelectBuilder

+ + + + new(distinct_value = nil, cte = {} of String => Clear::SQL::SelectBuilder | String, columns = [] of SQL::Column, froms = [] of SQL::From, joins = [] of SQL::Join, wheres = [] of Clear::Expression::Node, havings = [] of Clear::Expression::Node, windows = [] of ::Tuple(String, String), group_bys = [] of Symbolic, order_bys = [] of Clear::SQL::Query::OrderBy::Record, limit = nil, offset = nil, lock = nil, before_query_triggers = [] of (-> Nil)) + new + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::WithPagination

+ + + + current_page + current_page, + + + + first_page? + first_page?, + + + + last_page? + last_page?, + + + + next_page + next_page, + + + + out_of_bounds? + out_of_bounds?, + + + + paginate(page : Int32 = DEFAULT_PAGE, per_page : Int32 = DEFAULT_LIMIT) + paginate, + + + + per_page + per_page, + + + + previous_page + previous_page, + + + + total_pages + total_pages + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::Change

+ + + + change! : self + change! + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::Connection

+ + + + connection_name : String + connection_name, + + + + use_connection(connection_name : String) + use_connection + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::Pluck

+ + + + pluck(fields : Tuple(*T)) forall T
pluck(*fields)
pluck(**fields : **T) forall T
+ pluck
, + + + + pluck_col(field : Clear::SQL::Symbolic, type : T.class) forall T
pluck_col(field : Clear::SQL::Symbolic)
+ pluck_col
+ + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::Fetch

+ + + + fetch(fetch_all = false, & : Hash(String, Clear::SQL::Any) -> Nil) + fetch, + + + + fetch_first + fetch_first, + + + + fetch_first! + fetch_first!, + + + + fetch_with_cursor(count = 1000, & : Hash(String, Clear::SQL::Any) -> Nil) + fetch_with_cursor, + + + + first + first, + + + + first! + first!, + + + + scalar(type : T.class) forall T + scalar, + + + + to_a : Array(Hash(String, Clear::SQL::Any)) + to_a + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::Execute

+ + + + execute(connection_name : String | Nil = nil) + execute + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::Lock

+ + + + with_lock(str : String = "FOR UPDATE") + with_lock + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::Window

+ + + + clear_windows + clear_windows, + + + + print_windows + print_windows, + + + + window(name, value)
window(windows : NamedTuple)
+ window
, + + + + windows : Array(WindowDeclaration) + windows + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::CTE

+ + + + cte : Hash(String, CTEAuthorized) + cte, + + + + with_cte(name, request : CTEAuthorized)
with_cte(tuple : NamedTuple)
+ with_cte
+ + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::Aggregate

+ + + + agg(field, x : X.class) forall X + agg, + + + + avg(field, x : X.class) forall X + avg, + + + + count(type : X.class = Int64) forall X + count, + + + + max(field, x : X.class) forall X + max, + + + + min(field, x : X.class) forall X + min, + + + + sum(field) : Float64 + sum + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::OffsetLimit

+ + + + clear_limit + clear_limit, + + + + clear_offset + clear_offset, + + + + limit(x : Int | Nil) + limit, + + + + offset(x : Int | Nil) + offset + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::GroupBy

+ + + + clear_group_bys + clear_group_bys, + + + + group_by(column : Symbolic) + group_by, + + + + group_bys : Array(Symbolic) + group_bys + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::OrderBy

+ + + + clear_order_bys + clear_order_bys, + + + + order_by(tuple : NamedTuple)
order_by(expression : Symbol, direction : Symbol = :asc, nulls : Symbol | Nil = nil)
order_by(expression : String, direction : Symbol = :asc, nulls : Symbol | Nil = nil)
order_by(**tuple)
+ order_by
, + + + + reverse_order_by + reverse_order_by + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::Having

+ + + + clear_havings + clear_havings, + + + + having(node : Clear::Expression::Node)
having(&)
having(conditions : NamedTuple | Hash(String, Clear::SQL::Any))
having(template : String, *args)
having(template : String, **tuple)
having(**tuple)
+ having
, + + + + or_having(node : Clear::Expression::Node)
or_having(template : String, *args)
or_having(template : String, **named_tuple)
or_having(&)
+ or_having
+ + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::Where

+ + + + clear_wheres + clear_wheres, + + + + or_where(node : Clear::Expression::Node)
or_where(template : String, *args)
or_where(template : String, **tuple)
or_where(&)
+ or_where
, + + + + where(node : Clear::Expression::Node)
where(&)
where(conditions : NamedTuple | Hash(String, Clear::SQL::Any))
where(template : String)
where(template : String, *args)
where(template : String, **tuple)
where(**tuple)
+ where
+ + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::Join

+ + + + cross_join(name : Selectable, lateral = false) + cross_join, + + + + full_outer_join(name : Selectable, lateral = false, &)
full_outer_join(name : Selectable, condition : String = "true", lateral = false)
+ full_outer_join
, + + + + inner_join(name : Selectable, lateral = false, &)
inner_join(name : Selectable, condition : String = "true", lateral = false)
+ inner_join
, + + + + join(name : Selectable, type = :inner, lateral = false, &)
join(name : Selectable, type = :inner, condition : String = "true", lateral = false)
join(name : Selectable, type = :inner, lateral = false)
+ join
, + + + + left_join(name : Selectable, lateral = false, &)
left_join(name : Selectable, condition : String = "true", lateral = false)
+ left_join
, + + + + right_join(name : Selectable, lateral = false, &)
right_join(name : Selectable, condition : String = "true", lateral = false)
+ right_join
+ + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::From

+ + + + clear_from + clear_from, + + + + from(*args)
from(**tuple)
+ from
, + + + + froms : Array(SQL::From) + froms + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::Select

+ + + + clear_distinct + clear_distinct, + + + + clear_select + clear_select, + + + + default_wildcard_table=(table : String | Nil = nil) + default_wildcard_table=, + + + + distinct(on : String | Nil = "") + distinct, + + + + distinct_value : String | Nil + distinct_value, + + + + select(c : Column)
select(*args)
+ select
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def with_table(fetch_columns = false, &block : Clear::Reflection::Table::Collection -> ) : self + + # +
+ +
+
+ +
+
+ +
+
+ + def with_table(fetch_columns = false) : self + + # +
+ +
+
+ +
+
+ + + +
+ + + diff --git a/Clear/Reflection/Table.html b/Clear/Reflection/Table.html new file mode 100644 index 000000000..4193e29bb --- /dev/null +++ b/Clear/Reflection/Table.html @@ -0,0 +1,4356 @@ + + + + + + + + + + + + + + + + + Clear::Reflection::Table - clear develop + + + + + + + + + + +
+

+ + class Clear::Reflection::Table + +

+ + + + + + + +

+ + + + Overview +

+ +

Reflection of the tables using information_schema in postgreSQL.

+

TODO Usage of view instead of model

+ + + + + +

+ + + + Included Modules +

+ + + + +

+ + + + Extended Modules +

+ + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/model/reflection/table.cr + + +
+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ COLUMNS = {"table_catalog" => {type: String, primary: false, converter: "String", db_column_name: "table_catalog", crystal_variable_name: table_catalog, presence: true, mass_assign: true}, "table_schema" => {type: String, primary: false, converter: "String", db_column_name: "table_schema", crystal_variable_name: table_schema, presence: true, mass_assign: true}, "table_name" => {type: String, primary: true, converter: "String", db_column_name: "table_name", crystal_variable_name: table_name, presence: true, mass_assign: true}, "table_type" => {type: String, primary: false, converter: "String", db_column_name: "table_type", crystal_variable_name: table_type, presence: true, mass_assign: true}} of Nil => Nil +
+ + +
+ POLYMORPHISM_SETTINGS = {} of Nil => Nil +
+ + +
+ + + +

+ + + + Constructors +

+ + + + +

+ + + + Class Method Summary +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + +

Instance methods inherited from module Clear::Model

+ + + + __pkey__ + __pkey__, + + + + cache : Clear::Model::QueryCache | Nil + cache + + + + + + + + + + + + +

Macros inherited from module Clear::Model

+ + + + scope(name, &block) + scope + + + + + + + + + + + + + +

Class methods inherited from module Clear::Model::FullTextSearchable

+ + + + to_tsq(text) + to_tsq + + + + + + +

Macros inherited from module Clear::Model::FullTextSearchable

+ + + + full_text_searchable(through = "full_text_vector", catalog = "pg_catalog.english", scope_name = "search") + full_text_searchable + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Macros inherited from module Clear::Model::HasFactory

+ + + + polymorphic(through = "type") + polymorphic + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Macros inherited from module Clear::Model::HasRelations

+ + + + belongs_to(name, foreign_key = nil, no_cache = false, primary = false, foreign_key_type = Int64) + belongs_to, + + + + has_many(name, through = nil, foreign_key = nil, own_key = nil, primary_key = nil, no_cache = false, polymorphic = false, foreign_key_type = nil) + has_many, + + + + has_one(name, foreign_key = nil, primary_key = nil, no_cache = false, polymorphic = false, foreign_key_type = nil) + has_one + + + + + + + +

Instance methods inherited from module Clear::Model::HasValidation

+ + + + add_error(column, reason)
add_error(reason)
+ add_error
, + + + + clear_errors + clear_errors, + + + + error? + error?, + + + + errors : Array(Error) + errors, + + + + print_errors + print_errors, + + + + valid! + valid!, + + + + valid? + valid?, + + + + validate + validate + + + + + + + + + + + + + + + + + + + + + + + + + +

Macros inherited from module Clear::Validation::Helper

+ + + + ensure_than(field, message, &block) + ensure_than, + + + + on_presence(*fields, &block) + on_presence + + + + + + + +

Instance methods inherited from module Clear::Model::HasSaving

+ + + + delete + delete, + + + + persisted? : Bool + persisted?, + + + + reload : self + reload, + + + + save(on_conflict : Clear::SQL::InsertQuery -> | Nil = nil)
save(&block)
+ save
, + + + + save!(on_conflict : Clear::SQL::InsertQuery -> | Nil = nil)
save!(&block : Clear::SQL::InsertQuery -> )
+ save!
, + + + + update(**args) + update, + + + + update!(**args) + update! + + + + + + + + + + + + + + + + + + + + + + + + + +

Macros inherited from module Clear::Model::HasSerialPkey

+ + + + add_pkey_type(type, &block) + add_pkey_type, + + + + primary_key(name = "id", type = :bigserial) + primary_key + + + + + + + + + + + + + + + + +

Macros inherited from module Clear::Model::HasTimestamps

+ + + + timestamps + timestamps + + + + + + + +

Instance methods inherited from module Clear::Model::HasColumns

+ + + + [](x) : Clear::SQL::Any + [], + + + + []?(x) : Clear::SQL::Any + []?, + + + + reset(h : Hash(String, _))
reset(h : Hash(Symbol, _))
reset(**t : **T) forall T
+ reset
, + + + + set(h : Hash(String, _))
set(h : Hash(Symbol, _))
set(**t : **T) forall T
+ set
, + + + + to_h(full = false) + to_h, + + + + update_h + update_h + + + + + + + + + + + + +

Macros inherited from module Clear::Model::HasColumns

+ + + + column(name, primary = false, converter = nil, column_name = nil, presence = true, mass_assign = true) + column + + + + + + + +

Instance methods inherited from module Clear::Model::HasHooks

+ + + + trigger_after_events(event_name) + trigger_after_events, + + + + trigger_before_events(event_name) + trigger_before_events, + + + + with_triggers(event_name, &) + with_triggers + + + + + + + + + + + + +

Macros inherited from module Clear::Model::HasHooks

+ + + + after(event_name, method_name) + after, + + + + before(event_name, method_name) + before + + + + + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::ErrorMessages

+ + + + build_error_message(message : String, ways_to_resolve : Tuple | Array = Tuple.new, manual_pages : Tuple | Array = Tuple.new) + build_error_message, + + + + converter_error(from, to) + converter_error, + + + + format_width(x, w = 80) + format_width, + + + + illegal_setter_access_to_undefined_column(name) + illegal_setter_access_to_undefined_column, + + + + lack_of_primary_key(model_name) + lack_of_primary_key, + + + + migration_already_down(number) + migration_already_down, + + + + migration_already_up(number) + migration_already_up, + + + + migration_irreversible(name = nil, operation = nil) + migration_irreversible, + + + + migration_not_found(number) + migration_not_found, + + + + migration_not_unique(numbers) + migration_not_unique, + + + + no_migration_yet(version) + no_migration_yet, + + + + null_column_mapping_error(name, type) + null_column_mapping_error, + + + + order_by_error_invalid_order(current_order) + order_by_error_invalid_order, + + + + polymorphic_nil(through) + polymorphic_nil, + + + + polymorphic_unknown_class(class_name) + polymorphic_unknown_class, + + + + query_building_error(message) + query_building_error, + + + + uid_not_found(class_name) + uid_not_found, + + + + uninitialized_db_connection(connection) + uninitialized_db_connection + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.build(x : NamedTuple) : self + + # +
+ +
+ +

Build a new empty model and fill the columns using the NamedTuple in argument.

+

Returns the new model

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.build(x : NamedTuple, &block : self -> Nil) : self + + # +
+ +
+ +

Build a new empty model and fill the columns using the NamedTuple in argument.

+

Returns the new model

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.create(x : NamedTuple, &block : self -> Nil) : self + + # +
+ +
+ +

Build and new model and save it. Returns the model.

+

The model may not be saved due to validation failure; +check the returned model errors? and persisted? flags.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.create(**tuple, &block : self -> Nil) : self + + # +
+ +
+ +

Build and new model and save it. Returns the model.

+

The model may not be saved due to validation failure; +check the returned model errors? and persisted? flags.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.create(x : NamedTuple) : self + + # +
+ +
+ +

Build and new model and save it. Returns the model.

+

The model may not be saved due to validation failure; +check the returned model errors? and persisted? flags.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.create(**tuple) : self + + # +
+ +
+ +

Build and new model and save it. Returns the model.

+

The model may not be saved due to validation failure; +check the returned model errors? and persisted? flags.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.create!(x : NamedTuple, &block : self -> Nil) : self + + # +
+ +
+ +

Build and new model and save it. Returns the model.

+

Returns the newly inserted model +Raises an exception if validation failed during the saving process.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.create!(**tuple, &block : self -> Nil) : self + + # +
+ +
+ +

Build and new model and save it. Returns the model.

+

Returns the newly inserted model +Raises an exception if validation failed during the saving process.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.create!(x : NamedTuple) : self + + # +
+ +
+ +

Build and new model and save it. Returns the model.

+

Returns the newly inserted model +Raises an exception if validation failed during the saving process.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.create!(**tuple) : self + + # +
+ +
+ +

Build and new model and save it. Returns the model.

+

Returns the newly inserted model +Raises an exception if validation failed during the saving process.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.new(h : Hash(String, _), cache : Clear::Model::QueryCache | Nil = nil, persisted = false, fetch_columns = false) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.new(json : JSON::Any, cache : Clear::Model::QueryCache | Nil = nil, persisted = false) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.new(t : NamedTuple, persisted = false) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.new + + # +
+ +
+
+ + [View source] + +
+
+ + + + +

+ + + + Class Method Detail +

+ +
+
+ + def self.build(**tuple : **T) forall T + + # +
+ +
+ +

Build a new empty model and fill the columns using the NamedTuple in argument.

+

Returns the new model

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.build(**tuple) + + # +
+ +
+ +

Build a new empty model and fill the columns using the NamedTuple in argument.

+

Returns the new model

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.build(**tuple, &) + + # +
+ +
+ +

Build a new empty model and fill the columns using the NamedTuple in argument.

+

Returns the new model

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.columns + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.connection : String + + # +
+ +
+ +

Define on which connection the model is living. Useful in case of models living in different databases.

+

Is set to "default" by default.

+

See Clear::SQL#init(URI, *opts) for more information about multi-connections.

+

Example:

+
Clear::SQL.init("postgres://postgres@localhost/database_1")
+Clear::SQL.init("secondary", "postgres://postgres@localhost/database_2")
+
+class ModelA
+  include Clear::Model
+
+  # Performs all the queries on `database_1`
+  # self.connection = "default"
+  column id : Int32, primary: true, presence: false
+  column title : String
+end
+
+class ModelB
+  include Clear::Model
+
+  # Performs all the queries on `database_2`
+  self.connection = "secondary"
+
+  column id : Int32, primary: true, presence: false
+end
+
+ +
+
+ +
+
+ +
+
+ + def self.connection=(connection : String) + + # +
+ +
+ +

Define on which connection the model is living. Useful in case of models living in different databases.

+

Is set to "default" by default.

+

See Clear::SQL#init(URI, *opts) for more information about multi-connections.

+

Example:

+
Clear::SQL.init("postgres://postgres@localhost/database_1")
+Clear::SQL.init("secondary", "postgres://postgres@localhost/database_2")
+
+class ModelA
+  include Clear::Model
+
+  # Performs all the queries on `database_1`
+  # self.connection = "default"
+  column id : Int32, primary: true, presence: false
+  column title : String
+end
+
+class ModelB
+  include Clear::Model
+
+  # Performs all the queries on `database_2`
+  self.connection = "secondary"
+
+  column id : Int32, primary: true, presence: false
+end
+
+ +
+
+ +
+
+ +
+
+ + def self.create_from_json(string_or_io : String | IO, trusted : Bool = false) + + # +
+ +
+ +

Create a new model from json and save it. Returns the model.

+

The model may not be saved due to validation failure; +check the returned model errors? and persisted? flags. +Trusted flag set to true will allow mass assignment without protection, FALSE by default

+
+ +
+
+ +
+
+ +
+
+ + def self.create_from_json!(string_or_io : String | IO, trusted : Bool = false) + + # +
+ +
+ +

Create a new model from json and save it. Returns the model.

+

Returns the newly inserted model +Raises an exception if validation failed during the saving process. +Trusted flag set to true will allow mass assignment without protection, FALSE by default

+
+ +
+
+ +
+
+ +
+
+ + def self.find(x) + + # +
+ +
+ +

Returns a model using primary key equality +Returns nil if not found.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.find!(x) + + # +
+ +
+ +

Returns a model using primary key equality. +Raises error if the model is not found.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.from_json(string_or_io : String | IO, trusted : Bool = false) + + # +
+ +
+ +

Create a new empty model and fill the columns from json. Returns the new model

+

Trusted flag set to true will allow mass assignment without protection, FALSE by default

+
+ +
+
+ +
+
+ +
+
+ + def self.full_table_name + + # +
+ +
+ +

returns the fully qualified and escaped name for this table. +add schema if schema is different from 'public' (default schema)

+

ex: "schema"."table"

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.import(array : Enumerable(self), on_conflict : Clear::SQL::InsertQuery -> | Nil = nil) + + # +
+ +
+ +

Import a bulk of models in one SQL insert query. +Each model must be non-persisted.

+

on_conflict callback can be optionnaly turned on +to manage constraints of the database.

+

Note: Old models are not modified. This method return a copy of the +models as saved in the database.

+

+ +Example:

+
users = [User.new(id: 1), User.new(id: 2), User.new(id: 3)]
+users = User.import(users)
+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.polymorphic? : Bool + + # +
+ +
+
+ +
+
+ +
+
+ + def self.public + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.query + + # +
+ +
+ +

Return a new empty query SELECT * FROM [my_model_table]. Can be refined after that.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.read_only=(read_only : Bool) + + # +
+ +
+
+ +
+
+ +
+
+ + def self.read_only? : Bool + + # +
+ +
+
+ +
+
+ +
+
+ + def self.schema : Clear::SQL::Symbolic | Nil + + # +
+ +
+ +

Define the current schema used in PostgreSQL. The value is nil by default, which lead to non-specified +schema during the querying, and usage of "public" by PostgreSQL.

+

This property can be redefined on initialization. Example:

+
class MyModel
+  include Clear::Model
+
+  self.schema = "my_schema"
+end
+MyModel.query.to_sql # SELECT * FROM "my_schema"."my_models"
+
+ +
+
+ +
+
+ +
+
+ + def self.schema=(schema : Clear::SQL::Symbolic | Nil) + + # +
+ +
+ +

Define the current schema used in PostgreSQL. The value is nil by default, which lead to non-specified +schema during the querying, and usage of "public" by PostgreSQL.

+

This property can be redefined on initialization. Example:

+
class MyModel
+  include Clear::Model
+
+  self.schema = "my_schema"
+end
+MyModel.query.to_sql # SELECT * FROM "my_schema"."my_models"
+
+ +
+
+ +
+
+ +
+
+ + def self.table : Clear::SQL::Symbolic + + # +
+ +
+ +

Return the table name setup for this model. +By convention, the class name is by default equals to the pluralized underscored string form of the model name. +Example:

+
MyModel => "my_models"
+Person => "people"
+Project::Info => "project_infos"
+

The property can be updated at initialization to a custom table name:

+
class MyModel
+  include Clear::Model
+
+  self.table = "another_table_name"
+end
+MyModel.query.to_sql # SELECT * FROM "another_table_name"
+
+ +
+
+ +
+
+ +
+
+ + def self.table=(table : Clear::SQL::Symbolic) + + # +
+ +
+ +

Return the table name setup for this model. +By convention, the class name is by default equals to the pluralized underscored string form of the model name. +Example:

+
MyModel => "my_models"
+Person => "people"
+Project::Info => "project_infos"
+

The property can be updated at initialization to a custom table name:

+
class MyModel
+  include Clear::Model
+
+  self.table = "another_table_name"
+end
+MyModel.query.to_sql # SELECT * FROM "another_table_name"
+
+ +
+
+ +
+
+ +
+
+ + def self.tables_only + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.views_only + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def attributes : Hash(String, Clear::SQL::Any) + + # +
+ +
+ +

Attributes, used when fetch_columns is true

+
+ +
+
+ +
+
+ +
+
+ + def cache : Clear::Model::QueryCache | Nil + + # +
+ +
+
+ +
+
+ +
+
+ + def changed? + + # +
+ +
+ +

Return true if the model is dirty (e.g. one or more fields +have been changed.). Return false otherwise.

+
+ +
+
+ +
+
+ +
+
+ + def clear_change_flags + + # +
+ +
+ +

Reset the #changed? flag on all columns

+

The model behave like its not dirty anymore +and call to save would apply no changes.

+

Returns self

+
+ +
+
+ +
+
+ +
+
+ + def columns : Clear::Reflection::Column::Collection + + # +
+ +
+ +

The method columns is a has_many relation to Clear::Reflection::Column

+
+ +
+
+ +
+
+ +
+
+ + def indexes : Hash(String, Array(String)) + + # +
+ +
+ +

List all the indexes related to the current table. +return an hash where the key is the name of the column +and the value is an array containing all the indexes related to this specific +field.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def invalidate_caching : self + + # +
+ +
+ +

Force to clean-up the caches for the relations +connected to this model.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def reset(h : Hash(Symbol, _)) + + # +
+ +
+ +

Set the columns from hash

+
+ +
+
+ +
+
+ +
+
+ + def reset(h : Hash(String, _)) + + # +
+ +
+ +

Set the model fields from hash

+
+ +
+
+ +
+
+ +
+
+ + def reset(t : NamedTuple) + + # +
+ +
+
+ +
+
+ +
+
+ + def reset(from_json : JSON::Any) + + # +
+ +
+
+ +
+
+ +
+
+ + def reset(**t : **T) forall T + + # +
+ +
+ +

reset flavors

+
+ +
+
+ +
+
+ +
+
+ + def set(h : Hash(Symbol, _)) + + # +
+ +
+ +

Set the columns from hash

+
+ +
+
+ +
+
+ +
+
+ + def set(h : Hash(String, _)) + + # +
+ +
+ +

Set the model fields from hash

+
+ +
+
+ +
+
+ +
+
+ + def set(t : NamedTuple) + + # +
+ +
+
+ +
+
+ +
+
+ + def set(from_json : JSON::Any) + + # +
+ +
+
+ +
+
+ +
+
+ + def set(**t : **T) forall T + + # +
+ +
+ +
+ Description copied from module Clear::Model::HasColumns +
+ +

Set one or multiple columns to a specific value +This two are equivalents:

+
model.set(a: 1)
+model.a = 1
+
+ +
+
+ +
+
+ +
+
+ + def set_from_json(string_or_io : String | IO, trusted : Bool = false) + + # +
+ +
+ +

Set the fields from json passed as argument +Trusted flag set to true will allow mass assignment without protection, FALSE by default

+
+ +
+
+ +
+
+ +
+
+ + def table_catalog : String + + # +
+ +
+ +

Returns the value of #table_catalog column or throw an exception if the column is not defined.

+
+ +
+
+ +
+
+ +
+
+ + def table_catalog=(x : String) + + # +
+ +
+ +

Setter for #table_catalog column.

+
+ +
+
+ +
+
+ +
+
+ + def table_catalog_column : Clear::Model::Column(String, Clear::Model::Converter::StringConverter) + + # +
+ +
+ +

Returns the column object used to manage #table_catalog field

+

See Clear::Model::Column

+
+ +
+
+ +
+
+ +
+
+ + def table_name : String + + # +
+ +
+ +

Returns the value of #table_name column or throw an exception if the column is not defined.

+
+ +
+
+ +
+
+ +
+
+ + def table_name=(x : String) + + # +
+ +
+ +

Setter for #table_name column.

+
+ +
+
+ +
+
+ +
+
+ + def table_name_column : Clear::Model::Column(String, Clear::Model::Converter::StringConverter) + + # +
+ +
+ +

Returns the column object used to manage #table_name field

+

See Clear::Model::Column

+
+ +
+
+ +
+
+ +
+
+ + def table_schema : String + + # +
+ +
+ +

Returns the value of #table_schema column or throw an exception if the column is not defined.

+
+ +
+
+ +
+
+ +
+
+ + def table_schema=(x : String) + + # +
+ +
+ +

Setter for #table_schema column.

+
+ +
+
+ +
+
+ +
+
+ + def table_schema_column : Clear::Model::Column(String, Clear::Model::Converter::StringConverter) + + # +
+ +
+ +

Returns the column object used to manage #table_schema field

+

See Clear::Model::Column

+
+ +
+
+ +
+
+ +
+
+ + def table_type : String + + # +
+ +
+ +

Returns the value of #table_type column or throw an exception if the column is not defined.

+
+ +
+
+ +
+
+ +
+
+ + def table_type=(x : String) + + # +
+ +
+ +

Setter for #table_type column.

+
+ +
+
+ +
+
+ +
+
+ + def table_type_column : Clear::Model::Column(String, Clear::Model::Converter::StringConverter) + + # +
+ +
+ +

Returns the column object used to manage #table_type field

+

See Clear::Model::Column

+
+ +
+
+ +
+
+ +
+
+ + def to_h(full = false) : Hash(String, Clear::SQL::Any) + + # +
+ +
+ +

Return a hash version of the columns of this model.

+
+ +
+
+ +
+
+ +
+
+ + def to_json(emit_nulls : Bool = false) + + # +
+ +
+
+ +
+
+ +
+
+ + def to_json(json, emit_nulls = false) + + # +
+ +
+
+ +
+
+ +
+
+ + def update_from_json(string_or_io : String | IO, trusted : Bool = false) + + # +
+ +
+ +

Set the fields from json passed as argument and call save on the object +Trusted flag set to true will allow mass assignment without protection, FALSE by default

+
+ +
+
+ +
+
+ +
+
+ + def update_from_json!(string_or_io : String | IO, trusted : Bool = false) + + # +
+ +
+ +

Set the fields from json passed as argument and call save! on the object +Trusted flag set to true will allow mass assignment without protection, FALSE by default

+
+ +
+
+ +
+
+ +
+
+ + def update_h : Hash(String, Clear::SQL::Any) + + # +
+ +
+ +

Generate the hash for update request (like during save)

+
+ +
+
+ +
+
+ +
+
+ + def validate_fields_presence + + # +
+ +
+ +

For each column, ensure than when needed the column has present +information into it.

+

This method is called on validation.

+
+ +
+
+ +
+
+ + + +
+ + + diff --git a/Clear/Reflection/Table/Collection.html b/Clear/Reflection/Table/Collection.html new file mode 100644 index 000000000..32ef91db6 --- /dev/null +++ b/Clear/Reflection/Table/Collection.html @@ -0,0 +1,2705 @@ + + + + + + + + + + + + + + + + + Clear::Reflection::Table::Collection - clear develop + + + + + + + + + + +
+

+ + class Clear::Reflection::Table::Collection + +

+ + + + + + + +

+ + + + Overview +

+ +

Addition of the method for eager loading and N+1 avoidance.

+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/model/reflection/table.cr:4 + + +
+ + + + clear/model/reflection/table.cr:16 + + +
+ + + + clear/model/reflection/table.cr:18 + + +
+ + + + clear/model/reflection/table.cr:19 + + +
+ + + + + + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + +

Instance methods inherited from class Clear::Model::CollectionBase(Clear::Reflection::Table)

+ + + + <<(item : T) + <<, + + + + [](range : Range(Number, Number), fetch_columns = false) : Array(T)
[](off, fetch_columns = false) : T
+ []
, + + + + []?(off, fetch_columns = false) : T | Nil + []?, + + + + add(item : T) + add, + + + + any? + any?, + + + + build(x : NamedTuple, &block : T -> Nil) : T
build(**tuple, & : T -> Nil) : T
build(x : NamedTuple) : T
build(**tuple) : T
+ build
, + + + + count(type : X.class = Int64) forall X + count, + + + + create(x : NamedTuple, &block : T -> Nil) : T
create(**tuple, & : T -> Nil) : T
create(x : NamedTuple) : T
create(**tuple) : T
+ create
, + + + + create!(x : NamedTuple, &block : T -> Nil) : T
create!(**tuple, & : T -> Nil) : T
create!(x : NamedTuple) : T
create!(**tuple) : T
+ create!
, + + + + delete_all : self + delete_all, + + + + dup + dup, + + + + each(fetch_columns = false, & : T -> ) : Nil + each, + + + + each_with_cursor(batch = 1000, fetch_columns = false, &block : T -> ) + each_with_cursor, + + + + empty? + empty?, + + + + find(fetch_columns = false, &) : T | Nil
find(tuple : NamedTuple, fetch_columns = false) : T | Nil
find(**tuple) : T | Nil
+ find
, + + + + find!(fetch_columns = false, &) : T
find!(tuple : NamedTuple, fetch_columns = false) : T
find!(**tuple) : T
+ find!
, + + + + find_or_build(x : NamedTuple, &block : T -> Nil) : T
find_or_build(**tuple, & : T -> Nil) : T
find_or_build(x : NamedTuple) : T
find_or_build(**tuple) : T
+ find_or_build
, + + + + find_or_create(x : NamedTuple, &block : T -> Nil) : T
find_or_create(**tuple, & : T -> Nil) : T
find_or_create(x : NamedTuple) : T
find_or_create(**tuple) : T
+ find_or_create
, + + + + first(fetch_columns = false) : T | Nil + first, + + + + first!(fetch_columns = false) : T + first!, + + + + item_class + item_class, + + + + last(fetch_columns = false) : T | Nil + last, + + + + last!(fetch_columns = false) : T + last!, + + + + map(fetch_columns = false, &block : T -> X) : Array(X) forall X + map, + + + + tags + tags, + + + + to_a(fetch_columns = false) : Array(T) + to_a, + + + + unlink(item : T) + unlink + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::SelectBuilder

+ + + + before_query(&block : -> Nil) + before_query, + + + + columns : Array(SQL::Column) + columns, + + + + default_wildcard_table + default_wildcard_table, + + + + dup : self + dup, + + + + havings : Array(Clear::Expression::Node) + havings, + + + + is_distinct? + is_distinct?, + + + + joins : Array(SQL::Join) + joins, + + + + limit : Int64 | Nil + limit, + + + + lock : String | Nil + lock, + + + + offset : Int64 | Nil + offset, + + + + order_bys : Array(Clear::SQL::Query::OrderBy::Record) + order_bys, + + + + to_delete + to_delete, + + + + to_sql : String + to_sql, + + + + to_update + to_update, + + + + total_entries : Int64 | Nil + total_entries, + + + + total_entries=(total_entries : Int64 | Nil) + total_entries=, + + + + wheres : Array(Clear::Expression::Node) + wheres + + + + + + +

Constructor methods inherited from module Clear::SQL::SelectBuilder

+ + + + new(distinct_value = nil, cte = {} of String => Clear::SQL::SelectBuilder | String, columns = [] of SQL::Column, froms = [] of SQL::From, joins = [] of SQL::Join, wheres = [] of Clear::Expression::Node, havings = [] of Clear::Expression::Node, windows = [] of ::Tuple(String, String), group_bys = [] of Symbolic, order_bys = [] of Clear::SQL::Query::OrderBy::Record, limit = nil, offset = nil, lock = nil, before_query_triggers = [] of (-> Nil)) + new + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::WithPagination

+ + + + current_page + current_page, + + + + first_page? + first_page?, + + + + last_page? + last_page?, + + + + next_page + next_page, + + + + out_of_bounds? + out_of_bounds?, + + + + paginate(page : Int32 = DEFAULT_PAGE, per_page : Int32 = DEFAULT_LIMIT) + paginate, + + + + per_page + per_page, + + + + previous_page + previous_page, + + + + total_pages + total_pages + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::Change

+ + + + change! : self + change! + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::Connection

+ + + + connection_name : String + connection_name, + + + + use_connection(connection_name : String) + use_connection + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::Pluck

+ + + + pluck(fields : Tuple(*T)) forall T
pluck(*fields)
pluck(**fields : **T) forall T
+ pluck
, + + + + pluck_col(field : Clear::SQL::Symbolic, type : T.class) forall T
pluck_col(field : Clear::SQL::Symbolic)
+ pluck_col
+ + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::Fetch

+ + + + fetch(fetch_all = false, & : Hash(String, Clear::SQL::Any) -> Nil) + fetch, + + + + fetch_first + fetch_first, + + + + fetch_first! + fetch_first!, + + + + fetch_with_cursor(count = 1000, & : Hash(String, Clear::SQL::Any) -> Nil) + fetch_with_cursor, + + + + first + first, + + + + first! + first!, + + + + scalar(type : T.class) forall T + scalar, + + + + to_a : Array(Hash(String, Clear::SQL::Any)) + to_a + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::Execute

+ + + + execute(connection_name : String | Nil = nil) + execute + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::Lock

+ + + + with_lock(str : String = "FOR UPDATE") + with_lock + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::Window

+ + + + clear_windows + clear_windows, + + + + print_windows + print_windows, + + + + window(name, value)
window(windows : NamedTuple)
+ window
, + + + + windows : Array(WindowDeclaration) + windows + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::CTE

+ + + + cte : Hash(String, CTEAuthorized) + cte, + + + + with_cte(name, request : CTEAuthorized)
with_cte(tuple : NamedTuple)
+ with_cte
+ + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::Aggregate

+ + + + agg(field, x : X.class) forall X + agg, + + + + avg(field, x : X.class) forall X + avg, + + + + count(type : X.class = Int64) forall X + count, + + + + max(field, x : X.class) forall X + max, + + + + min(field, x : X.class) forall X + min, + + + + sum(field) : Float64 + sum + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::OffsetLimit

+ + + + clear_limit + clear_limit, + + + + clear_offset + clear_offset, + + + + limit(x : Int | Nil) + limit, + + + + offset(x : Int | Nil) + offset + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::GroupBy

+ + + + clear_group_bys + clear_group_bys, + + + + group_by(column : Symbolic) + group_by, + + + + group_bys : Array(Symbolic) + group_bys + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::OrderBy

+ + + + clear_order_bys + clear_order_bys, + + + + order_by(tuple : NamedTuple)
order_by(expression : Symbol, direction : Symbol = :asc, nulls : Symbol | Nil = nil)
order_by(expression : String, direction : Symbol = :asc, nulls : Symbol | Nil = nil)
order_by(**tuple)
+ order_by
, + + + + reverse_order_by + reverse_order_by + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::Having

+ + + + clear_havings + clear_havings, + + + + having(node : Clear::Expression::Node)
having(&)
having(conditions : NamedTuple | Hash(String, Clear::SQL::Any))
having(template : String, *args)
having(template : String, **tuple)
having(**tuple)
+ having
, + + + + or_having(node : Clear::Expression::Node)
or_having(template : String, *args)
or_having(template : String, **named_tuple)
or_having(&)
+ or_having
+ + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::Where

+ + + + clear_wheres + clear_wheres, + + + + or_where(node : Clear::Expression::Node)
or_where(template : String, *args)
or_where(template : String, **tuple)
or_where(&)
+ or_where
, + + + + where(node : Clear::Expression::Node)
where(&)
where(conditions : NamedTuple | Hash(String, Clear::SQL::Any))
where(template : String)
where(template : String, *args)
where(template : String, **tuple)
where(**tuple)
+ where
+ + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::Join

+ + + + cross_join(name : Selectable, lateral = false) + cross_join, + + + + full_outer_join(name : Selectable, lateral = false, &)
full_outer_join(name : Selectable, condition : String = "true", lateral = false)
+ full_outer_join
, + + + + inner_join(name : Selectable, lateral = false, &)
inner_join(name : Selectable, condition : String = "true", lateral = false)
+ inner_join
, + + + + join(name : Selectable, type = :inner, lateral = false, &)
join(name : Selectable, type = :inner, condition : String = "true", lateral = false)
join(name : Selectable, type = :inner, lateral = false)
+ join
, + + + + left_join(name : Selectable, lateral = false, &)
left_join(name : Selectable, condition : String = "true", lateral = false)
+ left_join
, + + + + right_join(name : Selectable, lateral = false, &)
right_join(name : Selectable, condition : String = "true", lateral = false)
+ right_join
+ + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::From

+ + + + clear_from + clear_from, + + + + from(*args)
from(**tuple)
+ from
, + + + + froms : Array(SQL::From) + froms + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::Select

+ + + + clear_distinct + clear_distinct, + + + + clear_select + clear_select, + + + + default_wildcard_table=(table : String | Nil = nil) + default_wildcard_table=, + + + + distinct(on : String | Nil = "") + distinct, + + + + distinct_value : String | Nil + distinct_value, + + + + select(c : Column)
select(*args)
+ select
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def public + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def tables_only + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def views_only + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def with_columns(fetch_columns = false, &block : Clear::Reflection::Column::Collection -> ) : self + + # +
+ +
+ +

Eager load the has many relation columns. +Use it to avoid N+1 queries.

+
+ +
+
+ +
+
+ +
+
+ + def with_columns(fetch_columns = false) + + # +
+ +
+
+ +
+
+ + + +
+ + + diff --git a/Clear/SQL.html b/Clear/SQL.html new file mode 100644 index 000000000..cd0e195f9 --- /dev/null +++ b/Clear/SQL.html @@ -0,0 +1,2530 @@ + + + + + + + + + + + + + + + + + Clear::SQL - clear develop + + + + + + + + + + +
+

+ + module Clear::SQL + +

+ + + + + +

+ + + + Overview +

+ +

+Clear::SQL

+

Clear is made like an onion:

+
+------------------------------------+
+|           THE ORM STACK            +
++------------------------------------+
+|  Model | DB Views | Migrations     | < High Level Tools
++---------------+--------------------+
+|  Columns | Validation | Converters | < Mapping system
++---------------+--------------------+
+|  Clear::SQL   | Clear::Expression  | < Low Level SQL Builder
++------------------------------------+
+|  Crystal DB   | Crystal PG         | < Low Level connection
++------------------------------------+
+

On the bottom stack, Clear offer SQL query building. +Theses features are then used by top level parts of the engine.

+

The SQL module provide a simple API to generate #delete, #insert, #select +and #update methods.

+

Each requests can be duplicated then modified and executed.

+

Note: Each request object is mutable. Therefore, to update and store a request, +you must use manually the dup method.

+ + + + + +

+ + + + Included Modules +

+ + + + +

+ + + + Extended Modules +

+ + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/sql/connection_pool.cr + + +
+ + + + clear/sql/errors.cr + + +
+ + + + clear/sql/fragment/column.cr + + +
+ + + + clear/sql/fragment/fragment.cr + + +
+ + + + clear/sql/fragment/from.cr + + +
+ + + + clear/sql/fragment/join.cr + + +
+ + + + clear/sql/lock.cr + + +
+ + + + clear/sql/query/connection.cr + + +
+ + + + clear/sql/query/from.cr + + +
+ + + + clear/sql/sql.cr + + +
+ + + + clear/sql/truncate.cr + + +
+ + + + + + + + +

+ + + + Class Method Summary +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + +

Instance methods inherited from module Clear::SQL::Transaction

+ + + + after_commit(connection : String = "default", &block : DB::Connection -> Nil) + after_commit, + + + + in_transaction?(connection : String = "default") + in_transaction?, + + + + rollback(to = nil) + rollback, + + + + rollback_transaction + rollback_transaction, + + + + transaction(connection : String = "default", level : Level = Level::Serializable, &) + transaction, + + + + with_savepoint(sp_name : Symbolic | Nil = nil, connection_name : String = "default", &) + with_savepoint + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Logger

+ + + + log_query(sql, &) + log_query + + + + + + + + + +

Class methods inherited from module Clear::SQL::Logger

+ + + + colorize=(colorize : Bool) + colorize=, + + + + colorize? : Bool + colorize?, + + + + colorize_query(qry : String) + colorize_query, + + + + display_mn_sec(x) : String + display_mn_sec, + + + + display_time(x) : String + display_time + + + + + + + + +
+ + + + +

+ + + + Class Method Detail +

+ +
+
+ + def self.lock(table : String | Symbol, mode = "ACCESS EXCLUSIVE", connection = "default", &) + + # +
+ +
+ +

Lock completetly a table.

+
Clear::SQL.lock("my_table") do
+end
+

Optional parameter mode allow you to decide over the lock level +Modes are:

+
    +
  • ACCESS EXCLUSIVE (default)
  • +
  • ACCESS SHARE
  • +
  • ROW SHARE
  • +
  • ROW EXCLUSIVE
  • +
  • SHARE UPDATE EXCLUSIVE
  • +
  • SHARE
  • +
  • SHARE ROW EXCLUSIVE
  • +
  • EXCLUSIVE
  • +
+

See Official PG documentation for more informations

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.truncate(tablename : Clear::Model.class | String | Symbol, restart_sequence : Bool = false, cascade : Bool = false, truncate_inherited : Bool = true, connection_name : String = "default") forall T + + # +
+ +
+ +

Truncate a table or a model

+
User.query.count          # => 200
+Clear::SQL.truncate(User) # equivalent to Clear::SQL.truncate(User.table, connection_name: User.connection)
+User.query.count          # => 0
+

SEE https://www.postgresql.org/docs/current/sql-truncate.html +for more information.

+
    +
  • restart_sequence set to true will append RESTART IDENTITY to the query
  • +
  • cascade set to true will append CASCADE to the query
  • +
  • truncate_inherited set to false will append ONLY to the query
  • +
  • connection_name will be: Model.connection or default unless optionally defined.
  • +
+
+ +
+
+ + [View source] + +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def add_connection(name : String, url : String) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def delete(table : Symbolic) + + # +
+ +
+ +

Start a DELETE table query

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def escape(x : String | Symbol) + + # +
+ +
+ +

Escape the expression, double quoting it.

+

It allows use of reserved keywords as table or column name

+

NOTE Escape is used for escaping postgresql keyword. For example +if you have a column named order (which is a reserved word), you want +to escape it by double-quoting it.

+

For escaping STRING value, please use Clear::SQL.sanitize

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def execute(connection_name : String, sql) + + # +
+ +
+ +

Execute a SQL statement on a specific connection.

+

Usage: +Clear::SQL.execute("seconddatabase", "SELECT 1 FROM users")

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def execute(sql) + + # +
+ +
+ +

Execute a SQL statement.

+

Usage: +Clear::SQL.execute("SELECT 1 FROM users")

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def init(name : String, url : String) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def init(url : String) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def init(connections : Hash(Symbolic, String)) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def insert(table, args : NamedTuple) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def insert(table, *args) + + # +
+ +
+ +

Alias of #insert_into, for hurry developers

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def insert + + # +
+ +
+ +

Create a new INSERT query

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def insert_into(table : Symbolic) + + # +
+ +
+ +

Prepare a new INSERT INTO table query +:ditto:

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def insert_into(table : Symbolic, *args) + + # +
+ +
+ +

Start an INSERT INTO table query

+
Clear::SQL.insert_into("table", {id: 1, name: "hello"}, {id: 2, name: "World"})
+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def raw(x, *params) + + # +
+ +
+ +

This provide a fast way to create SQL fragment while escaping items, both with ? and :key system:

+
query = Mode.query.select(Clear::SQL.raw("CASE WHEN x=:x THEN 1 ELSE 0 END as check", x: "blabla"))
+query = Mode.query.select(Clear::SQL.raw("CASE WHEN x=? THEN 1 ELSE 0 END as check", "blabla"))
+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def raw(__template, **params) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def raw_enum(x, params : Enumerable(T)) forall T + + # +
+ +
+ +

See self.raw +Can pass an array to this version

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def rollback + + # +
+ +
+ +

Raise a rollback, in case of transaction

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def sanitize(x) + + # +
+ +
+ +

Sanitize string and convert some literals (e.g. Time)

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def select(*args) + + # +
+ +
+ +

Start a SELECT FROM table query

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def unsafe(x) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def update(table) + + # +
+ +
+ +

Start a UPDATE table query

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def with_savepoint(connection_name = "default", &) + + # +
+ +
+ +

Create a transaction, but this one is stackable +using savepoints.

+

Example:

+
Clear::SQL.with_savepoint do
+  # do something
+  Clear::SQL.with_savepoint do
+    rollback # < Rollback only the last `with_savepoint` block
+  end
+end
+
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/SQL/Any.html b/Clear/SQL/Any.html new file mode 100644 index 000000000..a5e389d5d --- /dev/null +++ b/Clear/SQL/Any.html @@ -0,0 +1,1594 @@ + + + + + + + + + + + + + + + + + Clear::SQL::Any - clear develop + + + + + + + + + + +
+

+ + alias Clear::SQL::Any + +

+ + + + + + + +

+ + + + Alias Definition +

+ Array(PG::BoolArray) | Array(PG::CharArray) | Array(PG::Float32Array) | Array(PG::Float64Array) | Array(PG::Int16Array) | Array(PG::Int32Array) | Array(PG::Int64Array) | Array(PG::NumericArray) | Array(PG::StringArray) | Array(PG::TimeArray) | Array(PG::UUIDArray) | BigDecimal | Bool | Char | Clear::Expression::Literal | Crypto::Bcrypt::Password | Float32 | Float64 | Int16 | Int32 | Int64 | Int8 | JSON::Any | JSON::PullParser | PG::Geo::Box | PG::Geo::Circle | PG::Geo::Line | PG::Geo::LineSegment | PG::Geo::Path | PG::Geo::Point | PG::Geo::Polygon | PG::Interval | PG::Numeric | Slice(UInt8) | String | Time | UInt16 | UInt32 | UInt64 | UInt8 | UUID | Nil + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/sql/sql.cr + + +
+ + + + + + + + + + + + + + +
+ +
+ + + + + + + + + +
+ + + diff --git a/Clear/SQL/CancelTransactionError.html b/Clear/SQL/CancelTransactionError.html new file mode 100644 index 000000000..703593ffa --- /dev/null +++ b/Clear/SQL/CancelTransactionError.html @@ -0,0 +1,1649 @@ + + + + + + + + + + + + + + + + + Clear::SQL::CancelTransactionError - clear develop + + + + + + + + + + +
+

+ + class Clear::SQL::CancelTransactionError + +

+ + + + + + + +

+ + + + Overview +

+ +

Like rollback, but used into savepoint, it will revert completely the transaction

+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/sql/errors.cr + + +
+ + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + +
+ + + diff --git a/Clear/SQL/Column.html b/Clear/SQL/Column.html new file mode 100644 index 000000000..34a2f7b1d --- /dev/null +++ b/Clear/SQL/Column.html @@ -0,0 +1,1831 @@ + + + + + + + + + + + + + + + + + Clear::SQL::Column - clear develop + + + + + + + + + + +
+

+ + struct Clear::SQL::Column + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/sql/fragment/column.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + +

Instance methods inherited from struct Clear::SQL::Fragment

+ + + + initialize + initialize, + + + + to_sql + to_sql + + + + + + +

Constructor methods inherited from struct Clear::SQL::Fragment

+ + + + new + new + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(value : Clear::SQL::SelectBuilder | String | Symbol, var : String | Symbol | Nil = nil) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def to_sql + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def value : Selectable + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def value=(value : Selectable) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def var : Symbolic | Nil + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def var=(var : Symbolic | Nil) + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/SQL/ConnectionPool.html b/Clear/SQL/ConnectionPool.html new file mode 100644 index 000000000..7245dd96e --- /dev/null +++ b/Clear/SQL/ConnectionPool.html @@ -0,0 +1,1685 @@ + + + + + + + + + + + + + + + + + Clear::SQL::ConnectionPool - clear develop + + + + + + + + + + +
+

+ + class Clear::SQL::ConnectionPool + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/sql/connection_pool.cr + + +
+ + + + + + + + +

+ + + + Class Method Summary +

+ + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +

+ + + + Class Method Detail +

+ +
+
+ + def self.init(uri, name) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.with_connection(target : String, &) + + # +
+ +
+ +

Retrieve a connection from the connection pool, or wait for it. +If the current Fiber already has a connection, the connection is returned; +this strategy provides easy usage of multiple statement connection (like BEGIN/ROLLBACK features).

+
+ +
+
+ + [View source] + +
+
+ + + + + + + +
+ + + diff --git a/Clear/SQL/DeleteQuery.html b/Clear/SQL/DeleteQuery.html new file mode 100644 index 000000000..4c420c45e --- /dev/null +++ b/Clear/SQL/DeleteQuery.html @@ -0,0 +1,1890 @@ + + + + + + + + + + + + + + + + + Clear::SQL::DeleteQuery - clear develop + + + + + + + + + + +
+

+ + class Clear::SQL::DeleteQuery + +

+ + + + + + + + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/sql/delete_query.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + +

Instance methods inherited from module Clear::SQL::Query::Change

+ + + + change! : self + change! + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::Execute

+ + + + execute(connection_name : String | Nil = nil) + execute + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::Where

+ + + + clear_wheres + clear_wheres, + + + + or_where(node : Clear::Expression::Node)
or_where(template : String, *args)
or_where(template : String, **tuple)
or_where(&)
+ or_where
, + + + + where(node : Clear::Expression::Node)
where(&)
where(conditions : NamedTuple | Hash(String, Clear::SQL::Any))
where(template : String)
where(template : String, *args)
where(template : String, **tuple)
where(**tuple)
+ where
+ + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::Connection

+ + + + connection_name : String + connection_name, + + + + use_connection(connection_name : String) + use_connection + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(table : String | Symbol | Nil = nil, wheres : Array(Clear::Expression::Node) = [] of Clear::Expression::Node) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def from(table : String | Symbol | Nil) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def table : Symbolic | Nil + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def to_sql + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def wheres : Array(Clear::Expression::Node) + + # +
+ +
+ +

Return the list of where clause; each where clause are transformed into +Clear::Expression::Node

+
+ +
+
+ +
+
+ + + +
+ + + diff --git a/Clear/SQL/Error.html b/Clear/SQL/Error.html new file mode 100644 index 000000000..ec1b4518e --- /dev/null +++ b/Clear/SQL/Error.html @@ -0,0 +1,1649 @@ + + + + + + + + + + + + + + + + + Clear::SQL::Error - clear develop + + + + + + + + + + +
+

+ + class Clear::SQL::Error + +

+ + + + + + + + + + + + + + + +

+ + + + Direct Known Subclasses +

+ + + + + + + +

+ + + + Defined in: +

+ + + + clear/sql/errors.cr + + +
+ + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + +
+ + + diff --git a/Clear/SQL/ExecutionError.html b/Clear/SQL/ExecutionError.html new file mode 100644 index 000000000..b8e0cd959 --- /dev/null +++ b/Clear/SQL/ExecutionError.html @@ -0,0 +1,1638 @@ + + + + + + + + + + + + + + + + + Clear::SQL::ExecutionError - clear develop + + + + + + + + + + +
+

+ + class Clear::SQL::ExecutionError + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/sql/errors.cr + + +
+ + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + +
+ + + diff --git a/Clear/SQL/Fragment.html b/Clear/SQL/Fragment.html new file mode 100644 index 000000000..862c23f49 --- /dev/null +++ b/Clear/SQL/Fragment.html @@ -0,0 +1,1750 @@ + + + + + + + + + + + + + + + + + Clear::SQL::Fragment - clear develop + + + + + + + + + + +
+

+ + abstract struct Clear::SQL::Fragment + +

+ + + + + + + + + + + + + + + +

+ + + + Direct Known Subclasses +

+ + + + + + + +

+ + + + Defined in: +

+ + + + clear/sql/fragment/fragment.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def initialize + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ abstract + def to_sql + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/SQL/From.html b/Clear/SQL/From.html new file mode 100644 index 000000000..fa0501bc2 --- /dev/null +++ b/Clear/SQL/From.html @@ -0,0 +1,1831 @@ + + + + + + + + + + + + + + + + + Clear::SQL::From - clear develop + + + + + + + + + + +
+

+ + struct Clear::SQL::From + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/sql/fragment/from.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + +

Instance methods inherited from struct Clear::SQL::Fragment

+ + + + initialize + initialize, + + + + to_sql + to_sql + + + + + + +

Constructor methods inherited from struct Clear::SQL::Fragment

+ + + + new + new + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(value : Clear::SQL::SelectBuilder | String | Symbol, var : String | Symbol | Nil = nil) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def to_sql + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def value : Selectable + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def value=(value : Selectable) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def var : Symbolic | Nil + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def var=(var : Symbolic | Nil) + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/SQL/InsertQuery.html b/Clear/SQL/InsertQuery.html new file mode 100644 index 000000000..83fc6f814 --- /dev/null +++ b/Clear/SQL/InsertQuery.html @@ -0,0 +1,2296 @@ + + + + + + + + + + + + + + + + + Clear::SQL::InsertQuery - clear develop + + + + + + + + + + +
+

+ + class Clear::SQL::InsertQuery + +

+ + + + + + + +

+ + + + Overview +

+ +

An insert query

+

cf. postgres documentation

+
[ WITH [ RECURSIVE ] with_query [, ...] ]
+INSERT INTO table_name [ AS alias ] [ ( column_name [, ...] ) ]
+   { DEFAULT VALUES | VALUES ( { expression | DEFAULT } [, ...] ) [, ...] | query }
+   [ ON CONFLICT [ conflict_target ] conflict_action ]
+   [ RETURNING * | output_expression [ [ AS ] output_name ] [, ...] ]
+ + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/sql/insert_query.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + +

Instance methods inherited from module Clear::SQL::Query::OnConflict

+ + + + clear_conflict + clear_conflict, + + + + conflict? + conflict?, + + + + do_conflict_action(str) + do_conflict_action, + + + + do_nothing + do_nothing, + + + + do_update(&) + do_update, + + + + on_conflict(constraint : String | Bool | OnConflictWhereClause = true)
on_conflict(&)
+ on_conflict
, + + + + on_conflict_action : String | Clear::SQL::UpdateQuery + on_conflict_action, + + + + on_conflict_condition : String | OnConflictWhereClause | Bool + on_conflict_condition + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::Connection

+ + + + connection_name : String + connection_name, + + + + use_connection(connection_name : String) + use_connection + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::Change

+ + + + change! : self + change! + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::CTE

+ + + + cte : Hash(String, CTEAuthorized) + cte, + + + + with_cte(name, request : CTEAuthorized)
with_cte(tuple : NamedTuple)
+ with_cte
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(table : Symbol | String, values) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.new(table : Symbol | String) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def clear_values + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def columns(*args : Array(String | Symbol)) + + # +
+ +
+ +

Used with values

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def execute(connection_name : String = "default") : Hash(String, Clear::SQL::Any) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def fetch(connection_name : String = "default", & : Hash(String, Clear::SQL::Any) -> Nil) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def into(table : Symbol | String) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def keys : Array(Symbolic) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def returning(str : String) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def returning : String | Nil + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def size : Int32 + + # +
+ +
+ +

Number of rows of this insertion request

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def table : Symbol | String + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def table? : Symbol | String | Nil + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def to_sql + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def values(row : Hash(Symbolic, Inserable)) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def values(rows : Array(Hash(Symbolic, Inserable))) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def values(row : NamedTuple) + + # +
+ +
+ +

Fast insert system

+

insert({field: "value"}).into(:table)

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def values(rows : Array(NamedTuple)) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def values(select_query : SelectBuilder) + + # +
+ +
+ +

Insert into ... (...) SELECT

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def values : SelectBuilder | Array(Array(Inserable)) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def values(*args) + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/SQL/InsertQuery/Inserable.html b/Clear/SQL/InsertQuery/Inserable.html new file mode 100644 index 000000000..28ecc96cd --- /dev/null +++ b/Clear/SQL/InsertQuery/Inserable.html @@ -0,0 +1,1594 @@ + + + + + + + + + + + + + + + + + Clear::SQL::InsertQuery::Inserable - clear develop + + + + + + + + + + +
+

+ + alias Clear::SQL::InsertQuery::Inserable + +

+ + + + + + + +

+ + + + Alias Definition +

+ Array(PG::BoolArray) | Array(PG::CharArray) | Array(PG::Float32Array) | Array(PG::Float64Array) | Array(PG::Int16Array) | Array(PG::Int32Array) | Array(PG::Int64Array) | Array(PG::NumericArray) | Array(PG::StringArray) | Array(PG::TimeArray) | Array(PG::UUIDArray) | BigDecimal | BigFloat | BigInt | Bool | Char | Clear::Expression::Literal | Crypto::Bcrypt::Password | Float32 | Float64 | Int16 | Int32 | Int64 | Int8 | JSON::Any | JSON::PullParser | PG::Geo::Box | PG::Geo::Circle | PG::Geo::Line | PG::Geo::LineSegment | PG::Geo::Path | PG::Geo::Point | PG::Geo::Polygon | PG::Interval | PG::Numeric | Slice(UInt8) | String | Time | UInt16 | UInt32 | UInt64 | UInt8 | UUID | Nil + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/sql/insert_query.cr + + +
+ + + + + + + + + + + + + + +
+ +
+ + + + + + + + + +
+ + + diff --git a/Clear/SQL/JSONB.html b/Clear/SQL/JSONB.html new file mode 100644 index 000000000..16ee44b65 --- /dev/null +++ b/Clear/SQL/JSONB.html @@ -0,0 +1,1831 @@ + + + + + + + + + + + + + + + + + Clear::SQL::JSONB - clear develop + + + + + + + + + + +
+

+ + module Clear::SQL::JSONB + +

+ + + + + + + + + + + +

+ + + + Extended Modules +

+ + + + + + +

+ + + + Direct including types +

+ + + + + +

+ + + + Defined in: +

+ + + + clear/extensions/jsonb/jsonb.cr + + +
+ + + + + + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ +
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def jsonb_all_exists?(field, keys : Array(String)) + + # +
+ +
+ +

jsonb ?& operator +Do all of these array strings exist as top-level keys?

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def jsonb_any_exists?(field, keys : Array(String)) + + # +
+ +
+ +

jsonb ?| operator +Do any of these array strings exist as top-level keys?

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def jsonb_eq(field, key, value) + + # +
+ +
+ +

Test equality using the @> operator

+
jsonb_eq("data.sub.key", "value")
+

=> data @> '{"sub": {"key": "value"}}'

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def jsonb_exists?(field, value) + + # +
+ +
+ +

Does the string exist as a top-level key within the JSON value?

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def jsonb_k2h(key : String, value : JSONBKey) : JSONBHash + + # +
+ +
+ +

Transform a key to a hash

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def jsonb_resolve(field, arr : Array(String), cast = nil) : String + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def jsonb_resolve(field, key : String, cast = nil) + + # +
+ +
+ +

Return text selector for the field/key :

+
jsonb_text("data", "sub.key").like("user%")
+# => "data->'sub'->>'key' LIKE 'user%'"
+
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/SQL/JSONB/JSONBHash.html b/Clear/SQL/JSONB/JSONBHash.html new file mode 100644 index 000000000..f8d840538 --- /dev/null +++ b/Clear/SQL/JSONB/JSONBHash.html @@ -0,0 +1,1594 @@ + + + + + + + + + + + + + + + + + Clear::SQL::JSONB::JSONBHash - clear develop + + + + + + + + + + +
+

+ + alias Clear::SQL::JSONB::JSONBHash + +

+ + + + + + + +

+ + + + Alias Definition +

+ Hash(String, Clear::SQL::JSONB::JSONBKey) + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/extensions/jsonb/jsonb.cr + + +
+ + + + + + + + + + + + + + +
+ +
+ + + + + + + + + +
+ + + diff --git a/Clear/SQL/JSONB/JSONBKey.html b/Clear/SQL/JSONB/JSONBKey.html new file mode 100644 index 000000000..b75b00d8d --- /dev/null +++ b/Clear/SQL/JSONB/JSONBKey.html @@ -0,0 +1,1594 @@ + + + + + + + + + + + + + + + + + Clear::SQL::JSONB::JSONBKey - clear develop + + + + + + + + + + +
+

+ + alias Clear::SQL::JSONB::JSONBKey + +

+ + + + + + + +

+ + + + Alias Definition +

+ Bool | Clear::Expression::Literal | Float32 | Float64 | Hash(String, Clear::SQL::JSONB::JSONBKey) | Int16 | Int32 | Int64 | Int8 | String | Symbol | Time | UInt16 | UInt32 | UInt64 | UInt8 | Nil + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/extensions/jsonb/jsonb.cr + + +
+ + + + + + + + + + + + + + +
+ +
+ + + + + + + + + +
+ + + diff --git a/Clear/SQL/Join.html b/Clear/SQL/Join.html new file mode 100644 index 000000000..0339ca766 --- /dev/null +++ b/Clear/SQL/Join.html @@ -0,0 +1,1850 @@ + + + + + + + + + + + + + + + + + Clear::SQL::Join - clear develop + + + + + + + + + + +
+

+ + struct Clear::SQL::Join + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/sql/fragment/join.cr + + +
+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ TYPE = {left: "LEFT JOIN", inner: "INNER JOIN", right: "RIGHT JOIN", full_outer: "FULL OUTER JOIN", cross: "CROSS JOIN"} +
+ + +
+ + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + +

Instance methods inherited from struct Clear::SQL::Fragment

+ + + + initialize + initialize, + + + + to_sql + to_sql + + + + + + +

Constructor methods inherited from struct Clear::SQL::Fragment

+ + + + new + new + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(from : Clear::SQL::SelectBuilder | String | Symbol, condition : Clear::Expression::Node | Nil = nil, lateral : Bool = false, type : Symbol = :inner) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def condition : Clear::Expression::Node | Nil + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def from : Selectable + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def lateral? : Bool + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def to_sql + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def type : String + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/SQL/Logger.html b/Clear/SQL/Logger.html new file mode 100644 index 000000000..8e3cd1d55 --- /dev/null +++ b/Clear/SQL/Logger.html @@ -0,0 +1,1768 @@ + + + + + + + + + + + + + + + + + Clear::SQL::Logger - clear develop + + + + + + + + + + +
+

+ + module Clear::SQL::Logger + +

+ + + + + + + + + + + + + + + +

+ + + + Direct including types +

+ + + + + +

+ + + + Defined in: +

+ + + + clear/sql/logger.cr + + +
+ + + + + + + + +

+ + + + Class Method Summary +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ +
+ + + + +

+ + + + Class Method Detail +

+ +
+
+ + def self.colorize=(colorize : Bool) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.colorize? : Bool + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.colorize_query(qry : String) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.display_mn_sec(x) : String + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.display_time(x) : String + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def log_query(sql, &) + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/SQL/OperationNotPermittedError.html b/Clear/SQL/OperationNotPermittedError.html new file mode 100644 index 000000000..b0cc427b2 --- /dev/null +++ b/Clear/SQL/OperationNotPermittedError.html @@ -0,0 +1,1638 @@ + + + + + + + + + + + + + + + + + Clear::SQL::OperationNotPermittedError - clear develop + + + + + + + + + + +
+

+ + class Clear::SQL::OperationNotPermittedError + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/sql/errors.cr + + +
+ + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + +
+ + + diff --git a/Clear/SQL/Query.html b/Clear/SQL/Query.html new file mode 100644 index 000000000..c5fd6a948 --- /dev/null +++ b/Clear/SQL/Query.html @@ -0,0 +1,1584 @@ + + + + + + + + + + + + + + + + + Clear::SQL::Query - clear develop + + + + + + + + + + +
+

+ + module Clear::SQL::Query + +

+ + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/sql/query/aggregate.cr + + +
+ + + + + + + + + + + + + + +
+ +
+ + + + + + + + + +
+ + + diff --git a/Clear/SQL/Query/Aggregate.html b/Clear/SQL/Query/Aggregate.html new file mode 100644 index 000000000..45b836105 --- /dev/null +++ b/Clear/SQL/Query/Aggregate.html @@ -0,0 +1,1797 @@ + + + + + + + + + + + + + + + + + Clear::SQL::Query::Aggregate - clear develop + + + + + + + + + + +
+

+ + module Clear::SQL::Query::Aggregate + +

+ + + + + + + + + + + + + + + +

+ + + + Direct including types +

+ + + + + +

+ + + + Defined in: +

+ + + + clear/sql/query/aggregate.cr + + +
+ + + + + + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ +
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def agg(field, x : X.class) forall X + + # +
+ +
+ +

Call an custom aggregation function, like MEDIAN or other:

+
query.agg("MEDIAN(age)", Int64)
+

Note than COUNT, MIN, MAX, SUM and AVG are already conveniently mapped.

+

This return only one row, and should not be used with group_by (prefer pluck or fetch)

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def avg(field, x : X.class) forall X + + # +
+ +
+ +

SQL aggregation function "AVG":

+
query.avg("field", Int64)
+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def count(type : X.class = Int64) forall X + + # +
+ +
+ +

Use SQL COUNT over your query, and return this number as a Int64

+

as count return always a scalar, the usage of COUNT(*) OVER GROUP BY can be done by +using pluck or select

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def max(field, x : X.class) forall X + + # +
+ +
+ +

SQL aggregation function "MAX":

+
query.max("field", Int64)
+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def min(field, x : X.class) forall X + + # +
+ +
+ +

SQL aggregation function "MIN":

+
query.min("field", Int64)
+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def sum(field) : Float64 + + # +
+ +
+ +

SUM through a field and return a Float64 +Note: This function is not safe injection-wise, so beware !.

+
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/SQL/Query/BeforeQuery.html b/Clear/SQL/Query/BeforeQuery.html new file mode 100644 index 000000000..2dd7c07ac --- /dev/null +++ b/Clear/SQL/Query/BeforeQuery.html @@ -0,0 +1,1598 @@ + + + + + + + + + + + + + + + + + Clear::SQL::Query::BeforeQuery - clear develop + + + + + + + + + + +
+

+ + module Clear::SQL::Query::BeforeQuery + +

+ + + + + + + + + + + + + + + +

+ + + + Direct including types +

+ + + + + +

+ + + + Defined in: +

+ + + + clear/sql/query/before_query.cr + + +
+ + + + + + + + + + + + + + +
+ +
+ + + + + + + + + +
+ + + diff --git a/Clear/SQL/Query/CTE.html b/Clear/SQL/Query/CTE.html new file mode 100644 index 000000000..ec442524b --- /dev/null +++ b/Clear/SQL/Query/CTE.html @@ -0,0 +1,1727 @@ + + + + + + + + + + + + + + + + + Clear::SQL::Query::CTE - clear develop + + + + + + + + + + +
+

+ + module Clear::SQL::Query::CTE + +

+ + + + + +

+ + + + Overview +

+ +

Allow usage of Common Table Expressions (CTE) in the query building

+ + + + + + + + + + + +

+ + + + Direct including types +

+ + + + + +

+ + + + Defined in: +

+ + + + clear/sql/query/cte.cr + + +
+ + + + + + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ +
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def cte : Hash(String, CTEAuthorized) + + # +
+ +
+ +

List the current CTE of the query. The key is the name of the CTE, +while the value is the fragment (string or Sub-select)

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def with_cte(name, request : CTEAuthorized) + + # +
+ +
+ +

Add a CTE to the query.

+
Clear::SQL.select.with_cte("full_year",
+  "SELECT DATE(date)"
+  "FROM generate_series(NOW() - INTERVAL '1 year', NOW(), '1 day'::interval) date")
+  .select("*").from("full_year")
+# WITH full_year AS ( SELECT DATE(date) ... ) SELECT * FROM full_year;
+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def with_cte(tuple : NamedTuple) + + # +
+ +
+ +

Add a CTE to the query. Use NamedTuple convention:

+
Clear::SQL.select.with_cte(cte: "xxx")
+# WITH cte AS xxx SELECT...
+
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/SQL/Query/Change.html b/Clear/SQL/Query/Change.html new file mode 100644 index 000000000..f34f1eb8d --- /dev/null +++ b/Clear/SQL/Query/Change.html @@ -0,0 +1,1657 @@ + + + + + + + + + + + + + + + + + Clear::SQL::Query::Change - clear develop + + + + + + + + + + +
+

+ + module Clear::SQL::Query::Change + +

+ + + + + + + + + + + + + + + +

+ + + + Direct including types +

+ + + + + +

+ + + + Defined in: +

+ + + + clear/sql/query/change.cr + + +
+ + + + + + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ +
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def change! : self + + # +
+ +
+ +

This method is called everytime the request has been changed +By default, this do nothing and return self. However, it can be +reimplemented to change some behavior when the query is changed

+

(eg. it is by Clear::Model::Collection, to discard cache over collection)

+
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/SQL/Query/Connection.html b/Clear/SQL/Query/Connection.html new file mode 100644 index 000000000..7b7e4d85f --- /dev/null +++ b/Clear/SQL/Query/Connection.html @@ -0,0 +1,1683 @@ + + + + + + + + + + + + + + + + + Clear::SQL::Query::Connection - clear develop + + + + + + + + + + +
+

+ + module Clear::SQL::Query::Connection + +

+ + + + + + + + + + + + + + + +

+ + + + Direct including types +

+ + + + + +

+ + + + Defined in: +

+ + + + clear/sql/query/connection.cr + + +
+ + + + + + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ +
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def connection_name : String + + # +
+ +
+ +

Connection used by the query. +Change it using #use_connection method

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def use_connection(connection_name : String) + + # +
+ +
+ +

Change the connection used by the query on execution

+
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/SQL/Query/Execute.html b/Clear/SQL/Query/Execute.html new file mode 100644 index 000000000..74070e05a --- /dev/null +++ b/Clear/SQL/Query/Execute.html @@ -0,0 +1,1657 @@ + + + + + + + + + + + + + + + + + Clear::SQL::Query::Execute - clear develop + + + + + + + + + + +
+

+ + module Clear::SQL::Query::Execute + +

+ + + + + + + + + + + + + + + +

+ + + + Direct including types +

+ + + + + +

+ + + + Defined in: +

+ + + + clear/sql/query/execute.cr + + +
+ + + + + + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ +
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def execute(connection_name : String | Nil = nil) + + # +
+ +
+ +

Execute an SQL statement which does not return anything.

+

If an optional connection_name parameter is given, this will +override the connection used by the query.

+
%(default secondary).each do |cnx|
+  Clear::SQL.select("pg_shards('xxx')").execute(cnx)
+end
+
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/SQL/Query/Fetch.html b/Clear/SQL/Query/Fetch.html new file mode 100644 index 000000000..d99a0d5cb --- /dev/null +++ b/Clear/SQL/Query/Fetch.html @@ -0,0 +1,1850 @@ + + + + + + + + + + + + + + + + + Clear::SQL::Query::Fetch - clear develop + + + + + + + + + + +
+

+ + module Clear::SQL::Query::Fetch + +

+ + + + + + + + + + + + + + + +

+ + + + Direct including types +

+ + + + + +

+ + + + Defined in: +

+ + + + clear/sql/query/fetch.cr + + +
+ + + + + + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ +
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def fetch(fetch_all = false, & : Hash(String, Clear::SQL::Any) -> Nil) + + # +
+ +
+ +

Fetch the result set row per row +fetch_all optional parameter is helpful in transactional environment, so it stores +the result and close the resultset before starting to call yield over the data +preventing creation of a new connection if you need to call SQL into the +yielded block.

+
# This is wrong: The connection is still busy retrieving the users:
+Clear::SQL.select.from("users").fetch do |u|
+  Clear::SQL.select.from("posts").where { u["id"] == posts.id }
+end
+
+# Instead, use `fetch_all`
+# Clear will store the value of the result set in memory
+# before calling the block, and the connection is now ready to handle
+# another query.
+Clear::SQL.select.from("users").fetch(fetch_all: true) do |u|
+  Clear::SQL.select.from("posts").where { u["id"] == posts.id }
+end
+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def fetch_first + + # +
+ +
+ +

Alias for #first because first is redefined in Collection::Base +object to return a model instead.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def fetch_first! + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def fetch_with_cursor(count = 1000, & : Hash(String, Clear::SQL::Any) -> Nil) + + # +
+ +
+ +

Fetch the data using CURSOR. +This will prevent Clear to load all the data from the database into memory. +This is useful if you need to retrieve and update a large dataset.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def first + + # +
+ +
+ +

Return the first line of the query as Hash(String, ::Clear::SQL::Any), or nil +if not found

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def first! + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def scalar(type : T.class) forall T + + # +
+ +
+ +

Helpers to fetch a SELECT with only one row and one column return.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def to_a : Array(Hash(String, Clear::SQL::Any)) + + # +
+ +
+ +

Return an array with all the rows fetched.

+
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/SQL/Query/From.html b/Clear/SQL/Query/From.html new file mode 100644 index 000000000..c46869ac2 --- /dev/null +++ b/Clear/SQL/Query/From.html @@ -0,0 +1,1719 @@ + + + + + + + + + + + + + + + + + Clear::SQL::Query::From - clear develop + + + + + + + + + + +
+

+ + module Clear::SQL::Query::From + +

+ + + + + + + + + + + + + + + +

+ + + + Direct including types +

+ + + + + +

+ + + + Defined in: +

+ + + + clear/sql/query/from.cr + + +
+ + + + + + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ +
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def clear_from + + # +
+ +
+ +

Clear the FROM clause and return self

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def from(*args) + + # +
+ +
+ +

FROM fragment of the SQL query

+
Clear::SQL.select.from("airplanes").to_sql # < SELECT * FROM airplanes
+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def from(**tuple) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def froms : Array(SQL::From) + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/SQL/Query/GroupBy.html b/Clear/SQL/Query/GroupBy.html new file mode 100644 index 000000000..385fa54c0 --- /dev/null +++ b/Clear/SQL/Query/GroupBy.html @@ -0,0 +1,1683 @@ + + + + + + + + + + + + + + + + + Clear::SQL::Query::GroupBy - clear develop + + + + + + + + + + +
+

+ + module Clear::SQL::Query::GroupBy + +

+ + + + + + + + + + + + + + + +

+ + + + Direct including types +

+ + + + + +

+ + + + Defined in: +

+ + + + clear/sql/query/group_by.cr + + +
+ + + + + + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ +
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def clear_group_bys + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def group_by(column : Symbolic) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def group_bys : Array(Symbolic) + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/SQL/Query/Having.html b/Clear/SQL/Query/Having.html new file mode 100644 index 000000000..18e3a0143 --- /dev/null +++ b/Clear/SQL/Query/Having.html @@ -0,0 +1,1942 @@ + + + + + + + + + + + + + + + + + Clear::SQL::Query::Having - clear develop + + + + + + + + + + +
+

+ + module Clear::SQL::Query::Having + +

+ + + + + + + + + + + + + + + +

+ + + + Direct including types +

+ + + + + +

+ + + + Defined in: +

+ + + + clear/sql/query/having.cr + + +
+ + + + + + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ +
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def clear_havings + + # +
+ +
+ +

Clear all the having clauses and return self

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def having(node : Clear::Expression::Node) + + # +
+ +
+ +

Build SQL #having condition using a Clear::Expression::Node

+
query.having(Clear::Expression::Node::InArray.new("id", ['1', '2', '3', '4']))
+# Note: in this example, InArray node use unsafe strings
+

If useful for moving a having clause from a request to another one:

+
query1.having { a == b } # having a = b
+
query2.having(query1.havings[0]) # HAVING a = b
+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def having(&) + + # +
+ +
+ +

Build SQL #having condition using the Expression engine.

+
query.having { id == 1 }
+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def having(conditions : NamedTuple | Hash(String, Clear::SQL::Any)) + + # +
+ +
+ +

Build SQL #having condition using a NamedTuple. +this will use:

+
    +
  • the = operator if compared with a literal
  • +
+
query.having({keyword: "hello"}) # having keyword = 'hello'
+
    +
  • the IN operator if compared with an array:
  • +
+
query.having({x: [1, 2]}) # having x in (1, 2)
+
    +
  • the >= and <= | < if compared with a range:
  • +
+
query.having({x: (1..4)})  # having x >= 1 AND x <= 4
+query.having({x: (1...4)}) # having x >= 1 AND x < 4
+
    +
  • You also can put another select query as argument:
  • +
+
query.having({x: another_select}) # having x IN (SELECT ... )
+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def having(template : String, *args) + + # +
+ +
+ +

Build SQL #having condition using a template string and +interpolating ? characters with parameters given in a tuple or array.

+
having("x = ? OR y = ?", 1, "l'eau") # having x = 1 OR y = 'l''eau'
+

Raise error if there's not enough parameters to cover all the ? placeholders

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def having(template : String, **tuple) + + # +
+ +
+ +

Build SQL #having interpolating :keyword with the NamedTuple passed in argument.

+
having("id = :id OR date >= :start", id: 1, start: 1.day.ago)
+# having id = 1 AND date >= '201x-xx-xx ...'
+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def having(**tuple) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def or_having(node : Clear::Expression::Node) + + # +
+ +
+ +

Build SQL #or_having condition using a Clear::Expression::Node

+
query.or_having(Clear::Expression::Node::InArray.new("id", ['1', '2', '3', '4']))
+# Note: in this example, InArray node use unsafe strings
+

If useful for moving a having clause from a request to another one:

+
query1.or_having { a == b } # having a = b
+
query2.or_having(query1.havings[0]) # having a = b
+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def or_having(template : String, *args) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def or_having(template : String, **named_tuple) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def or_having(&) + + # +
+ +
+ +

Build SQL #having condition using the Expression engine.

+
query.or_having { id == 1 }
+
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/SQL/Query/Join.html b/Clear/SQL/Query/Join.html new file mode 100644 index 000000000..c5318594a --- /dev/null +++ b/Clear/SQL/Query/Join.html @@ -0,0 +1,1928 @@ + + + + + + + + + + + + + + + + + Clear::SQL::Query::Join - clear develop + + + + + + + + + + +
+

+ + module Clear::SQL::Query::Join + +

+ + + + + + + + + + + + + + + +

+ + + + Direct including types +

+ + + + + +

+ + + + Defined in: +

+ + + + clear/sql/query/join.cr + + +
+ + + + + + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ +
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def cross_join(name : Selectable, lateral = false) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def full_outer_join(name : Selectable, lateral = false, &) + + # +
+ +
+ +

Add a "FULL_OUTER" JOIN directive to the query

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def full_outer_join(name : Selectable, condition : String = "true", lateral = false) + + # +
+ +
+ +

Add a "FULL_OUTER" JOIN directive to the query

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def inner_join(name : Selectable, lateral = false, &) + + # +
+ +
+ +

Add a "INNER" JOIN directive to the query

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def inner_join(name : Selectable, condition : String = "true", lateral = false) + + # +
+ +
+ +

Add a "INNER" JOIN directive to the query

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def join(name : Selectable, type = :inner, lateral = false, &) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def join(name : Selectable, type = :inner, condition : String = "true", lateral = false) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def join(name : Selectable, type = :inner, lateral = false) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def left_join(name : Selectable, lateral = false, &) + + # +
+ +
+ +

Add a "LEFT" JOIN directive to the query

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def left_join(name : Selectable, condition : String = "true", lateral = false) + + # +
+ +
+ +

Add a "LEFT" JOIN directive to the query

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def right_join(name : Selectable, lateral = false, &) + + # +
+ +
+ +

Add a "RIGHT" JOIN directive to the query

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def right_join(name : Selectable, condition : String = "true", lateral = false) + + # +
+ +
+ +

Add a "RIGHT" JOIN directive to the query

+
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/SQL/Query/Lock.html b/Clear/SQL/Query/Lock.html new file mode 100644 index 000000000..762c8297d --- /dev/null +++ b/Clear/SQL/Query/Lock.html @@ -0,0 +1,1641 @@ + + + + + + + + + + + + + + + + + Clear::SQL::Query::Lock - clear develop + + + + + + + + + + +
+

+ + module Clear::SQL::Query::Lock + +

+ + + + + + + + + + + + + + + +

+ + + + Direct including types +

+ + + + + +

+ + + + Defined in: +

+ + + + clear/sql/query/lock.cr + + +
+ + + + + + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ +
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def with_lock(str : String = "FOR UPDATE") + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/SQL/Query/OffsetLimit.html b/Clear/SQL/Query/OffsetLimit.html new file mode 100644 index 000000000..d71a5d13e --- /dev/null +++ b/Clear/SQL/Query/OffsetLimit.html @@ -0,0 +1,1704 @@ + + + + + + + + + + + + + + + + + Clear::SQL::Query::OffsetLimit - clear develop + + + + + + + + + + +
+

+ + module Clear::SQL::Query::OffsetLimit + +

+ + + + + + + + + + + + + + + +

+ + + + Direct including types +

+ + + + + +

+ + + + Defined in: +

+ + + + clear/sql/query/offset_limit.cr + + +
+ + + + + + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ +
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def clear_limit + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def clear_offset + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def limit(x : Int | Nil) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def offset(x : Int | Nil) + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/SQL/Query/OnConflict.html b/Clear/SQL/Query/OnConflict.html new file mode 100644 index 000000000..7b63a07fd --- /dev/null +++ b/Clear/SQL/Query/OnConflict.html @@ -0,0 +1,1809 @@ + + + + + + + + + + + + + + + + + Clear::SQL::Query::OnConflict - clear develop + + + + + + + + + + +
+

+ + module Clear::SQL::Query::OnConflict + +

+ + + + + + + + + + + + + + + +

+ + + + Direct including types +

+ + + + + +

+ + + + Defined in: +

+ + + + clear/sql/query/on_conflict.cr + + +
+ + + + + + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ +
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def clear_conflict + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def conflict? + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def do_conflict_action(str) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def do_nothing + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def do_update(&) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def on_conflict(constraint : String | Bool | OnConflictWhereClause = true) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def on_conflict(&) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def on_conflict_action : String | Clear::SQL::UpdateQuery + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def on_conflict_condition : String | OnConflictWhereClause | Bool + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/SQL/Query/OnConflict/OnConflictWhereClause.html b/Clear/SQL/Query/OnConflict/OnConflictWhereClause.html new file mode 100644 index 000000000..2828005bc --- /dev/null +++ b/Clear/SQL/Query/OnConflict/OnConflictWhereClause.html @@ -0,0 +1,1818 @@ + + + + + + + + + + + + + + + + + Clear::SQL::Query::OnConflict::OnConflictWhereClause - clear develop + + + + + + + + + + +
+

+ + class Clear::SQL::Query::OnConflict::OnConflictWhereClause + +

+ + + + + + + +

+ + + + Overview +

+ +

Fragment used when ON CONFLICT WHERE ...

+ + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/sql/query/on_conflict.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + +

Instance methods inherited from module Clear::SQL::Query::Where

+ + + + clear_wheres + clear_wheres, + + + + or_where(node : Clear::Expression::Node)
or_where(template : String, *args)
or_where(template : String, **tuple)
or_where(&)
+ or_where
, + + + + where(node : Clear::Expression::Node)
where(&)
where(conditions : NamedTuple | Hash(String, Clear::SQL::Any))
where(template : String)
where(template : String, *args)
where(template : String, **tuple)
where(**tuple)
+ where
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def change! + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def to_s + + # +
+ +
+ +
+ Description copied from class Object +
+ +

Returns a nicely readable and concise string representation of this object, +typically intended for users.

+

This method should usually not be overridden. It delegates to +#to_s(IO) which can be overridden for custom implementations.

+

Also see #inspect.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def wheres : Array(Clear::Expression::Node) + + # +
+ +
+ +

Return the list of where clause; each where clause are transformed into +Clear::Expression::Node

+
+ +
+
+ +
+
+ + + +
+ + + diff --git a/Clear/SQL/Query/OrderBy.html b/Clear/SQL/Query/OrderBy.html new file mode 100644 index 000000000..23c217884 --- /dev/null +++ b/Clear/SQL/Query/OrderBy.html @@ -0,0 +1,1817 @@ + + + + + + + + + + + + + + + + + Clear::SQL::Query::OrderBy - clear develop + + + + + + + + + + +
+

+ + module Clear::SQL::Query::OrderBy + +

+ + + + + +

+ + + + Overview +

+ +

Encode for:

+

ORDER BY expression [ASC | DESC | USING operator] [NULLS FIRST | NULLS LAST];

+

Current implementation:

+

[x] Multiple Order by clauses +[x] ASC/DESC +[x] NULLS FIRST / NULLS LAST +[ ] NOT IMPLEMENTED: USING OPERATOR

+ + + + + + + + + + + +

+ + + + Direct including types +

+ + + + + +

+ + + + Defined in: +

+ + + + clear/sql/query/order_by.cr + + +
+ + + + + + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ +
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def clear_order_bys + + # +
+ +
+ +

Remove all order by clauses

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def order_by(tuple : NamedTuple) + + # +
+ +
+ +

Add multiple ORDER BY clause using a tuple:

+
query = Clear::SQL.select.from("users").order_by(id: :desc, name: {:asc, :nulls_last})
+query.to_sql # > SELECT * FROM users ORDER BY "id" DESC, "name" ASC NULLS LAST
+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def order_by(expression : Symbol, direction : Symbol = :asc, nulls : Symbol | Nil = nil) + + # +
+ +
+ +

Add one ORDER BY clause

+
query = Clear::SQL.select.from("users").order_by(:id, :desc, nulls_last)
+query.to_sql # > SELECT * FROM users ORDER BY "id" DESC NULLS LAST
+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def order_by(expression : String, direction : Symbol = :asc, nulls : Symbol | Nil = nil) + + # +
+ +
+ +

Add one ORDER BY clause

+
query = Clear::SQL.select.from("users").order_by(:id, :desc, nulls_last)
+query.to_sql # > SELECT * FROM users ORDER BY "id" DESC NULLS LAST
+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def order_by(**tuple) + + # +
+ +
+ +

Add multiple ORDER BY clause using a tuple:

+
query = Clear::SQL.select.from("users").order_by(id: :desc, name: {:asc, :nulls_last})
+query.to_sql # > SELECT * FROM users ORDER BY "id" DESC, "name" ASC NULLS LAST
+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def reverse_order_by + + # +
+ +
+ +

Flip over all order bys by switching the ASC direction to DESC and the NULLS FIRST to NULLS LAST

+
query = Clear::SQL.select.from("users").order_by(id: :desc, name: :asc, company: {:asc, :nulls_last})
+query.reverse_order_by
+query.to_sql # SELECT * FROM users ORDER BY "id" ASC, "name" DESC, "company" DESC NULLS FIRST
+

return self

+
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/SQL/Query/OrderBy/Record.html b/Clear/SQL/Query/OrderBy/Record.html new file mode 100644 index 000000000..66ac5e59c --- /dev/null +++ b/Clear/SQL/Query/OrderBy/Record.html @@ -0,0 +1,1789 @@ + + + + + + + + + + + + + + + + + Clear::SQL::Query::OrderBy::Record - clear develop + + + + + + + + + + +
+

+ + struct Clear::SQL::Query::OrderBy::Record + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/sql/query/order_by.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(op : String, dir : Symbol, nulls : Symbol | Nil) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def clone + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def copy_with(op _op = @op, dir _dir = @dir, nulls _nulls = @nulls) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def dir : Symbol + + # +
+ +
+
+ +
+
+ +
+
+ + def nulls : Symbol | Nil + + # +
+ +
+
+ +
+
+ +
+
+ + def op : String + + # +
+ +
+
+ +
+
+ + + +
+ + + diff --git a/Clear/SQL/Query/Pluck.html b/Clear/SQL/Query/Pluck.html new file mode 100644 index 000000000..0330102d9 --- /dev/null +++ b/Clear/SQL/Query/Pluck.html @@ -0,0 +1,1789 @@ + + + + + + + + + + + + + + + + + Clear::SQL::Query::Pluck - clear develop + + + + + + + + + + +
+

+ + module Clear::SQL::Query::Pluck + +

+ + + + + + + + + + + + + + + +

+ + + + Direct including types +

+ + + + + +

+ + + + Defined in: +

+ + + + clear/sql/query/pluck.cr + + +
+ + + + + + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ +
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def pluck(fields : Tuple(*T)) forall T + + # +
+ +
+ +

Select specifics columns and return an array of Tuple(*Clear::SQL::Any) containing the columns in the order of the selected +arguments:

+
User.query.pluck("first_name", "last_name").each do |(first_name, last_name)|
+  # ...
+end
+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def pluck(*fields) + + # +
+ +
+ +

Select specifics columns and return an array of Tuple(*Clear::SQL::Any) containing the columns in the order of the selected +arguments:

+
User.query.pluck("first_name", "last_name").each do |(first_name, last_name)|
+  # ...
+end
+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def pluck(**fields : **T) forall T + + # +
+ +
+ +

Select specifics columns and returns on array of tuple of type of the named tuple passed as parameter:

+
User.query.pluck(id: Int64, "UPPER(last_name)": String).each do #...
+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def pluck_col(field : Clear::SQL::Symbolic, type : T.class) forall T + + # +
+ +
+ +

Select a specific column of your SQL query, execute the query +and return an array containing this field.

+
User.query.pluck_col("id") # [1,2,3,4...]
+

Note: It returns an array of Clear::SQL::Any. Therefore, you may want to use #pluck_col(str, Type) to return +an array of Type:

+
User.query.pluck_col("id", Int64)
+

The field argument is a SQL fragment; it's not escaped (beware SQL injection) and allow call to functions +and aggregate methods:

+
# ...
+User.query.pluck_col("CASE WHEN id % 2 = 0 THEN id ELSE NULL END AS id").each do
+# ...
+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def pluck_col(field : Clear::SQL::Symbolic) + + # +
+ +
+ +

Select a specific column of your SQL query, execute the query +and return an array containing this field.

+
User.query.pluck_col("id") # [1,2,3,4...]
+

Note: It returns an array of Clear::SQL::Any. Therefore, you may want to use #pluck_col(str, Type) to return +an array of Type:

+
User.query.pluck_col("id", Int64)
+

The field argument is a SQL fragment; it's not escaped (beware SQL injection) and allow call to functions +and aggregate methods:

+
# ...
+User.query.pluck_col("CASE WHEN id % 2 = 0 THEN id ELSE NULL END AS id").each do
+# ...
+
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/SQL/Query/Select.html b/Clear/SQL/Query/Select.html new file mode 100644 index 000000000..fe80e671e --- /dev/null +++ b/Clear/SQL/Query/Select.html @@ -0,0 +1,1814 @@ + + + + + + + + + + + + + + + + + Clear::SQL::Query::Select - clear develop + + + + + + + + + + +
+

+ + module Clear::SQL::Query::Select + +

+ + + + + + + + + + + + + + + +

+ + + + Direct including types +

+ + + + + +

+ + + + Defined in: +

+ + + + clear/sql/query/select.cr + + +
+ + + + + + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ +
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def clear_distinct + + # +
+ +
+ +

Remove distinct

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def clear_select + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def default_wildcard_table=(table : String | Nil = nil) + + # +
+ +
+ +

In some case you want you query to return table.* instead of * +if no select parameters has been set. This occurs in the case of joins +between models.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def distinct(on : String | Nil = "") + + # +
+ +
+ +

Add DISTINCT to the SELECT part of the query

+
    +
  • If on is blank (empty string, default), will call a simple SELECT DISTINCT ...
  • +
  • If on is nil, will remove the distinct (see #clear_distinct)
  • +
  • If on is a non empty string, will call SELECT DISTINCT ON (on) ...
  • +
+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def distinct_value : String | Nil + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def select(c : Column) + + # +
+ +
+ +

def select(name : Symbolic, var = nil) +@columns << Column.new(name, var) +self +end

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def select(*args) + + # +
+ +
+ +

Add field(s) to selection from tuple

+
select({user_id: "uid", updated_at: "updated_at"})
+# => Output "SELECT user_id as uid, updated_at as updated_at"
+
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/SQL/Query/Where.html b/Clear/SQL/Query/Where.html new file mode 100644 index 000000000..55b6a1fb9 --- /dev/null +++ b/Clear/SQL/Query/Where.html @@ -0,0 +1,1992 @@ + + + + + + + + + + + + + + + + + Clear::SQL::Query::Where - clear develop + + + + + + + + + + +
+

+ + module Clear::SQL::Query::Where + +

+ + + + + +

+ + + + Overview +

+ +

Feature WHERE clause building. +each call to where method stack where clause. +Theses clauses are then combined together using the AND operator. +Therefore, query.where("a").where("b") will return a AND b

+ + + + + + + + + + + +

+ + + + Direct including types +

+ + + + + +

+ + + + Defined in: +

+ + + + clear/sql/query/where.cr + + +
+ + + + + + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ +
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def clear_wheres + + # +
+ +
+ +

Clear all the where clauses and return self

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def or_where(node : Clear::Expression::Node) + + # +
+ +
+ +

Build SQL #or_where condition using a Clear::Expression::Node

+
query.or_where(Clear::Expression::Node::InArray.new("id", ['1', '2', '3', '4']))
+# Note: in this example, InArray node use unsafe strings
+

If useful for moving a where clause from a request to another one:

+
query1.or_where { a == b } # WHERE a = b
+
query2.or_where(query1.wheres[0]) # WHERE a = b
+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def or_where(template : String, *args) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def or_where(template : String, **tuple) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def or_where(&) + + # +
+ +
+ +

Build SQL #where condition using the Expression engine.

+
query.or_where { id == 1 }
+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def where(node : Clear::Expression::Node) + + # +
+ +
+ +

Build SQL #where condition using a Clear::Expression::Node

+
query.where(Clear::Expression::Node::InArray.new("id", ['1', '2', '3', '4']))
+# Note: in this example, InArray node use unsafe strings
+

If useful for moving a where clause from a request to another one:

+
query1.where { a == b } # WHERE a = b
+
query2.where(query1.wheres[0]) # WHERE a = b
+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def where(&) + + # +
+ +
+ +

Build SQL #where condition using the Expression engine.

+
query.where { id == 1 }
+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def where(conditions : NamedTuple | Hash(String, Clear::SQL::Any)) + + # +
+ +
+ +

Build SQL #where condition using a NamedTuple. +this will use:

+
    +
  • the = operator if compared with a literal
  • +
+
query.where({keyword: "hello"}) # WHERE keyword = 'hello'
+
    +
  • the IN operator if compared with an array:
  • +
+
query.where({x: [1, 2]}) # WHERE x in (1,2)
+
    +
  • the >= and <= | < if compared with a range:
  • +
+
query.where({x: (1..4)})  # WHERE x >= 1 AND x <= 4
+query.where({x: (1...4)}) # WHERE x >= 1 AND x < 4
+
    +
  • You also can put another select query as argument:
  • +
+
query.where({x: another_select}) # WHERE x IN (SELECT ... )
+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def where(template : String) + + # +
+ +
+ +

Build custom SQL #where +beware of SQL injections!

+
where("ADD_SOME_DANGEROUS_SQL_HERE") # WHERE ADD_SOME_DANGEROUS_SQL_HERE
+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def where(template : String, *args) + + # +
+ +
+ +

Build SQL #where condition using a template string and +interpolating ? characters with parameters given in a tuple or array.

+
where("x = ? OR y = ?", 1, "l'eau") # WHERE x = 1 OR y = 'l''eau'
+

Raise error if there's not enough parameters to cover all the ? placeholders

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def where(template : String, **tuple) + + # +
+ +
+ +

Build SQL #where interpolating :keyword with the NamedTuple passed in argument.

+
where("id = :id OR date >= :start", id: 1, start: 1.day.ago)
+# WHERE id = 1 AND date >= '201x-xx-xx ...'
+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def where(**tuple) + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/SQL/Query/Window.html b/Clear/SQL/Query/Window.html new file mode 100644 index 000000000..43be701ed --- /dev/null +++ b/Clear/SQL/Query/Window.html @@ -0,0 +1,1732 @@ + + + + + + + + + + + + + + + + + Clear::SQL::Query::Window - clear develop + + + + + + + + + + +
+

+ + module Clear::SQL::Query::Window + +

+ + + + + + + + + + + + + + + +

+ + + + Direct including types +

+ + + + + +

+ + + + Defined in: +

+ + + + clear/sql/query/window.cr + + +
+ + + + + + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ +
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def clear_windows + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def print_windows + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def window(name, value) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def window(windows : NamedTuple) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def windows : Array(WindowDeclaration) + + # +
+ +
+ +

eq. WINDOW window_name AS ( window_definition )

+
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/SQL/Query/Window/WindowDeclaration.html b/Clear/SQL/Query/Window/WindowDeclaration.html new file mode 100644 index 000000000..8ecb8d2d8 --- /dev/null +++ b/Clear/SQL/Query/Window/WindowDeclaration.html @@ -0,0 +1,1594 @@ + + + + + + + + + + + + + + + + + Clear::SQL::Query::Window::WindowDeclaration - clear develop + + + + + + + + + + +
+

+ + alias Clear::SQL::Query::Window::WindowDeclaration + +

+ + + + + + + +

+ + + + Alias Definition +

+ {String, String} + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/sql/query/window.cr + + +
+ + + + + + + + + + + + + + +
+ +
+ + + + + + + + + +
+ + + diff --git a/Clear/SQL/Query/WithPagination.html b/Clear/SQL/Query/WithPagination.html new file mode 100644 index 000000000..84c429917 --- /dev/null +++ b/Clear/SQL/Query/WithPagination.html @@ -0,0 +1,1888 @@ + + + + + + + + + + + + + + + + + Clear::SQL::Query::WithPagination - clear develop + + + + + + + + + + +
+

+ + module Clear::SQL::Query::WithPagination + +

+ + + + + + + + + + + + + + + +

+ + + + Direct including types +

+ + + + + +

+ + + + Defined in: +

+ + + + clear/sql/query/with_pagination.cr + + +
+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ DEFAULT_LIMIT = 50 +
+ + +
+ DEFAULT_PAGE = 1 +
+ + +
+ + + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ +
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def current_page + + # +
+ +
+ +

Return the current page

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def first_page? + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def last_page? + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def next_page + + # +
+ +
+ +

Return current_page + 1 or nil if there is no next page

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def out_of_bounds? + + # +
+ +
+ +

Helper method that is true when someone tries to fetch a page with a +larger number than the last page. Can be used in combination with flashes +and redirecting.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def paginate(page : Int32 = DEFAULT_PAGE, per_page : Int32 = DEFAULT_LIMIT) + + # +
+ +
+ +

Enter pagination mode. +This is helpful to manage paginated table. +Pagination will handle the page progression automatically and update +offset and limit parameters by his own.

+
page = query.paginate(2, 50)
+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def per_page + + # +
+ +
+ +

Return the number of items maximum per page.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def previous_page + + # +
+ +
+ +

Return current_page - 1 or nil if there is no previous page

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def total_pages + + # +
+ +
+ +

Return the total number of pages.

+
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/SQL/QueryBuildingError.html b/Clear/SQL/QueryBuildingError.html new file mode 100644 index 000000000..45a96d62d --- /dev/null +++ b/Clear/SQL/QueryBuildingError.html @@ -0,0 +1,1638 @@ + + + + + + + + + + + + + + + + + Clear::SQL::QueryBuildingError - clear develop + + + + + + + + + + +
+

+ + class Clear::SQL::QueryBuildingError + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/sql/errors.cr + + +
+ + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + +
+ + + diff --git a/Clear/SQL/RecordNotFoundError.html b/Clear/SQL/RecordNotFoundError.html new file mode 100644 index 000000000..df7cadbf3 --- /dev/null +++ b/Clear/SQL/RecordNotFoundError.html @@ -0,0 +1,1638 @@ + + + + + + + + + + + + + + + + + Clear::SQL::RecordNotFoundError - clear develop + + + + + + + + + + +
+

+ + class Clear::SQL::RecordNotFoundError + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/sql/errors.cr + + +
+ + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + +
+ + + diff --git a/Clear/SQL/RollbackError.html b/Clear/SQL/RollbackError.html new file mode 100644 index 000000000..e7b38fcc6 --- /dev/null +++ b/Clear/SQL/RollbackError.html @@ -0,0 +1,1649 @@ + + + + + + + + + + + + + + + + + Clear::SQL::RollbackError - clear develop + + + + + + + + + + +
+

+ + class Clear::SQL::RollbackError + +

+ + + + + + + +

+ + + + Overview +

+ +

Rollback the transaction or the last savepoint.

+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/sql/errors.cr + + +
+ + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + +
+ + + diff --git a/Clear/SQL/SelectBuilder.html b/Clear/SQL/SelectBuilder.html new file mode 100644 index 000000000..9076ca56e --- /dev/null +++ b/Clear/SQL/SelectBuilder.html @@ -0,0 +1,2740 @@ + + + + + + + + + + + + + + + + + Clear::SQL::SelectBuilder - clear develop + + + + + + + + + + +
+

+ + module Clear::SQL::SelectBuilder + +

+ + + + + + + + + +

+ + + + Included Modules +

+ + + + + + + + +

+ + + + Direct including types +

+ + + + + +

+ + + + Defined in: +

+ + + + clear/sql/select_builder.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + +

Instance methods inherited from module Clear::SQL::Query::WithPagination

+ + + + current_page + current_page, + + + + first_page? + first_page?, + + + + last_page? + last_page?, + + + + next_page + next_page, + + + + out_of_bounds? + out_of_bounds?, + + + + paginate(page : Int32 = DEFAULT_PAGE, per_page : Int32 = DEFAULT_LIMIT) + paginate, + + + + per_page + per_page, + + + + previous_page + previous_page, + + + + total_pages + total_pages + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::Change

+ + + + change! : self + change! + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::Connection

+ + + + connection_name : String + connection_name, + + + + use_connection(connection_name : String) + use_connection + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::Pluck

+ + + + pluck(fields : Tuple(*T)) forall T
pluck(*fields)
pluck(**fields : **T) forall T
+ pluck
, + + + + pluck_col(field : Clear::SQL::Symbolic, type : T.class) forall T
pluck_col(field : Clear::SQL::Symbolic)
+ pluck_col
+ + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::Fetch

+ + + + fetch(fetch_all = false, & : Hash(String, Clear::SQL::Any) -> Nil) + fetch, + + + + fetch_first + fetch_first, + + + + fetch_first! + fetch_first!, + + + + fetch_with_cursor(count = 1000, & : Hash(String, Clear::SQL::Any) -> Nil) + fetch_with_cursor, + + + + first + first, + + + + first! + first!, + + + + scalar(type : T.class) forall T + scalar, + + + + to_a : Array(Hash(String, Clear::SQL::Any)) + to_a + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::Execute

+ + + + execute(connection_name : String | Nil = nil) + execute + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::Lock

+ + + + with_lock(str : String = "FOR UPDATE") + with_lock + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::Window

+ + + + clear_windows + clear_windows, + + + + print_windows + print_windows, + + + + window(name, value)
window(windows : NamedTuple)
+ window
, + + + + windows : Array(WindowDeclaration) + windows + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::CTE

+ + + + cte : Hash(String, CTEAuthorized) + cte, + + + + with_cte(name, request : CTEAuthorized)
with_cte(tuple : NamedTuple)
+ with_cte
+ + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::Aggregate

+ + + + agg(field, x : X.class) forall X + agg, + + + + avg(field, x : X.class) forall X + avg, + + + + count(type : X.class = Int64) forall X + count, + + + + max(field, x : X.class) forall X + max, + + + + min(field, x : X.class) forall X + min, + + + + sum(field) : Float64 + sum + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::OffsetLimit

+ + + + clear_limit + clear_limit, + + + + clear_offset + clear_offset, + + + + limit(x : Int | Nil) + limit, + + + + offset(x : Int | Nil) + offset + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::GroupBy

+ + + + clear_group_bys + clear_group_bys, + + + + group_by(column : Symbolic) + group_by, + + + + group_bys : Array(Symbolic) + group_bys + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::OrderBy

+ + + + clear_order_bys + clear_order_bys, + + + + order_by(tuple : NamedTuple)
order_by(expression : Symbol, direction : Symbol = :asc, nulls : Symbol | Nil = nil)
order_by(expression : String, direction : Symbol = :asc, nulls : Symbol | Nil = nil)
order_by(**tuple)
+ order_by
, + + + + reverse_order_by + reverse_order_by + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::Having

+ + + + clear_havings + clear_havings, + + + + having(node : Clear::Expression::Node)
having(&)
having(conditions : NamedTuple | Hash(String, Clear::SQL::Any))
having(template : String, *args)
having(template : String, **tuple)
having(**tuple)
+ having
, + + + + or_having(node : Clear::Expression::Node)
or_having(template : String, *args)
or_having(template : String, **named_tuple)
or_having(&)
+ or_having
+ + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::Where

+ + + + clear_wheres + clear_wheres, + + + + or_where(node : Clear::Expression::Node)
or_where(template : String, *args)
or_where(template : String, **tuple)
or_where(&)
+ or_where
, + + + + where(node : Clear::Expression::Node)
where(&)
where(conditions : NamedTuple | Hash(String, Clear::SQL::Any))
where(template : String)
where(template : String, *args)
where(template : String, **tuple)
where(**tuple)
+ where
+ + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::Join

+ + + + cross_join(name : Selectable, lateral = false) + cross_join, + + + + full_outer_join(name : Selectable, lateral = false, &)
full_outer_join(name : Selectable, condition : String = "true", lateral = false)
+ full_outer_join
, + + + + inner_join(name : Selectable, lateral = false, &)
inner_join(name : Selectable, condition : String = "true", lateral = false)
+ inner_join
, + + + + join(name : Selectable, type = :inner, lateral = false, &)
join(name : Selectable, type = :inner, condition : String = "true", lateral = false)
join(name : Selectable, type = :inner, lateral = false)
+ join
, + + + + left_join(name : Selectable, lateral = false, &)
left_join(name : Selectable, condition : String = "true", lateral = false)
+ left_join
, + + + + right_join(name : Selectable, lateral = false, &)
right_join(name : Selectable, condition : String = "true", lateral = false)
+ right_join
+ + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::From

+ + + + clear_from + clear_from, + + + + from(*args)
from(**tuple)
+ from
, + + + + froms : Array(SQL::From) + froms + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::Select

+ + + + clear_distinct + clear_distinct, + + + + clear_select + clear_select, + + + + default_wildcard_table=(table : String | Nil = nil) + default_wildcard_table=, + + + + distinct(on : String | Nil = "") + distinct, + + + + distinct_value : String | Nil + distinct_value, + + + + select(c : Column)
select(*args)
+ select
+ + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(distinct_value = nil, cte = {} of String => Clear::SQL::SelectBuilder | String, columns = [] of SQL::Column, froms = [] of SQL::From, joins = [] of SQL::Join, wheres = [] of Clear::Expression::Node, havings = [] of Clear::Expression::Node, windows = [] of ::Tuple(String, String), group_bys = [] of Symbolic, order_bys = [] of Clear::SQL::Query::OrderBy::Record, limit = nil, offset = nil, lock = nil, before_query_triggers = [] of (-> Nil)) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def before_query(&block : -> Nil) + + # +
+ +
+ +

A hook to apply some operation just before the query is executed.

+
call = 0
+req = Clear::SQL.select("1").before_query { call += 1 }
+10.times { req.execute }
+pp call # 10
+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def columns : Array(SQL::Column) + + # +
+ +
+
+ +
+
+ +
+
+ + def default_wildcard_table + + # +
+ +
+
+ +
+
+ +
+
+ + def dup : self + + # +
+ +
+ +

Duplicate the query

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def havings : Array(Clear::Expression::Node) + + # +
+ +
+
+ +
+
+ +
+
+ + def is_distinct? + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def joins : Array(SQL::Join) + + # +
+ +
+
+ +
+
+ +
+
+ + def limit : Int64 | Nil + + # +
+ +
+
+ +
+
+ +
+
+ + def lock : String | Nil + + # +
+ +
+
+ +
+
+ +
+
+ + def offset : Int64 | Nil + + # +
+ +
+
+ +
+
+ +
+
+ + def order_bys : Array(Clear::SQL::Query::OrderBy::Record) + + # +
+ +
+
+ +
+
+ +
+
+ + def to_delete + + # +
+ +
+ +

Construct a delete query from this select query. +It uses only the from and the where clause fo the current select request. +Can be useful in some case, but +use at your own risk !

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def to_sql : String + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def to_update + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def total_entries : Int64 | Nil + + # +
+ +
+
+ +
+
+ +
+
+ + def total_entries=(total_entries : Int64 | Nil) + + # +
+ +
+
+ +
+
+ +
+
+ + def wheres : Array(Clear::Expression::Node) + + # +
+ +
+ +

Return the list of where clause; each where clause are transformed into +Clear::Expression::Node

+
+ +
+
+ +
+
+ + + +
+ + + diff --git a/Clear/SQL/SelectQuery.html b/Clear/SQL/SelectQuery.html new file mode 100644 index 000000000..2587bc7f7 --- /dev/null +++ b/Clear/SQL/SelectQuery.html @@ -0,0 +1,2486 @@ + + + + + + + + + + + + + + + + + Clear::SQL::SelectQuery - clear develop + + + + + + + + + + +
+

+ + class Clear::SQL::SelectQuery + +

+ + + + + + + +

+ + + + Overview +

+ +

A Select Query builder

+

Postgres documentation:

+
[ WITH [ RECURSIVE ] with_query [, ...] ]
+SELECT [ ALL | DISTINCT [ ON ( expression [, ...] ) ] ]
+    [ * | expression [ [ AS ] output_name ] [, ...] ]
+    [ FROM from_item [, ...] ]
+    [ WHERE condition ]
+    [ GROUP BY grouping_element [, ...] ]
+    [ HAVING condition [, ...] ]
+    [ WINDOW window_name AS ( window_definition ) [, ...] ]
+    [ { UNION | INTERSECT | EXCEPT } [ ALL | DISTINCT ] select ]
+    [ ORDER BY expression [ ASC | DESC | USING operator ] [ NULLS { FIRST | LAST } ] [, ...] ]
+    [ LIMIT { count | ALL } ]
+    [ OFFSET start [ ROW | ROWS ] ]
+    [ FETCH { FIRST | NEXT } [ count ] { ROW | ROWS } ONLY ]
+    [ FOR { UPDATE | NO KEY UPDATE | SHARE | KEY SHARE } [ OF table_name [, ...] ] [ NOWAIT | SKIP LOCKED ] [...] ]
+ + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/sql/select_query.cr + + +
+ + + + + + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + +

Instance methods inherited from module Clear::SQL::SelectBuilder

+ + + + before_query(&block : -> Nil) + before_query, + + + + columns : Array(SQL::Column) + columns, + + + + default_wildcard_table + default_wildcard_table, + + + + dup : self + dup, + + + + havings : Array(Clear::Expression::Node) + havings, + + + + is_distinct? + is_distinct?, + + + + joins : Array(SQL::Join) + joins, + + + + limit : Int64 | Nil + limit, + + + + lock : String | Nil + lock, + + + + offset : Int64 | Nil + offset, + + + + order_bys : Array(Clear::SQL::Query::OrderBy::Record) + order_bys, + + + + to_delete + to_delete, + + + + to_sql : String + to_sql, + + + + to_update + to_update, + + + + total_entries : Int64 | Nil + total_entries, + + + + total_entries=(total_entries : Int64 | Nil) + total_entries=, + + + + wheres : Array(Clear::Expression::Node) + wheres + + + + + + +

Constructor methods inherited from module Clear::SQL::SelectBuilder

+ + + + new(distinct_value = nil, cte = {} of String => Clear::SQL::SelectBuilder | String, columns = [] of SQL::Column, froms = [] of SQL::From, joins = [] of SQL::Join, wheres = [] of Clear::Expression::Node, havings = [] of Clear::Expression::Node, windows = [] of ::Tuple(String, String), group_bys = [] of Symbolic, order_bys = [] of Clear::SQL::Query::OrderBy::Record, limit = nil, offset = nil, lock = nil, before_query_triggers = [] of (-> Nil)) + new + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::WithPagination

+ + + + current_page + current_page, + + + + first_page? + first_page?, + + + + last_page? + last_page?, + + + + next_page + next_page, + + + + out_of_bounds? + out_of_bounds?, + + + + paginate(page : Int32 = DEFAULT_PAGE, per_page : Int32 = DEFAULT_LIMIT) + paginate, + + + + per_page + per_page, + + + + previous_page + previous_page, + + + + total_pages + total_pages + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::Change

+ + + + change! : self + change! + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::Connection

+ + + + connection_name : String + connection_name, + + + + use_connection(connection_name : String) + use_connection + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::Pluck

+ + + + pluck(fields : Tuple(*T)) forall T
pluck(*fields)
pluck(**fields : **T) forall T
+ pluck
, + + + + pluck_col(field : Clear::SQL::Symbolic, type : T.class) forall T
pluck_col(field : Clear::SQL::Symbolic)
+ pluck_col
+ + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::Fetch

+ + + + fetch(fetch_all = false, & : Hash(String, Clear::SQL::Any) -> Nil) + fetch, + + + + fetch_first + fetch_first, + + + + fetch_first! + fetch_first!, + + + + fetch_with_cursor(count = 1000, & : Hash(String, Clear::SQL::Any) -> Nil) + fetch_with_cursor, + + + + first + first, + + + + first! + first!, + + + + scalar(type : T.class) forall T + scalar, + + + + to_a : Array(Hash(String, Clear::SQL::Any)) + to_a + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::Execute

+ + + + execute(connection_name : String | Nil = nil) + execute + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::Lock

+ + + + with_lock(str : String = "FOR UPDATE") + with_lock + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::Window

+ + + + clear_windows + clear_windows, + + + + print_windows + print_windows, + + + + window(name, value)
window(windows : NamedTuple)
+ window
, + + + + windows : Array(WindowDeclaration) + windows + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::CTE

+ + + + cte : Hash(String, CTEAuthorized) + cte, + + + + with_cte(name, request : CTEAuthorized)
with_cte(tuple : NamedTuple)
+ with_cte
+ + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::Aggregate

+ + + + agg(field, x : X.class) forall X + agg, + + + + avg(field, x : X.class) forall X + avg, + + + + count(type : X.class = Int64) forall X + count, + + + + max(field, x : X.class) forall X + max, + + + + min(field, x : X.class) forall X + min, + + + + sum(field) : Float64 + sum + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::OffsetLimit

+ + + + clear_limit + clear_limit, + + + + clear_offset + clear_offset, + + + + limit(x : Int | Nil) + limit, + + + + offset(x : Int | Nil) + offset + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::GroupBy

+ + + + clear_group_bys + clear_group_bys, + + + + group_by(column : Symbolic) + group_by, + + + + group_bys : Array(Symbolic) + group_bys + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::OrderBy

+ + + + clear_order_bys + clear_order_bys, + + + + order_by(tuple : NamedTuple)
order_by(expression : Symbol, direction : Symbol = :asc, nulls : Symbol | Nil = nil)
order_by(expression : String, direction : Symbol = :asc, nulls : Symbol | Nil = nil)
order_by(**tuple)
+ order_by
, + + + + reverse_order_by + reverse_order_by + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::Having

+ + + + clear_havings + clear_havings, + + + + having(node : Clear::Expression::Node)
having(&)
having(conditions : NamedTuple | Hash(String, Clear::SQL::Any))
having(template : String, *args)
having(template : String, **tuple)
having(**tuple)
+ having
, + + + + or_having(node : Clear::Expression::Node)
or_having(template : String, *args)
or_having(template : String, **named_tuple)
or_having(&)
+ or_having
+ + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::Where

+ + + + clear_wheres + clear_wheres, + + + + or_where(node : Clear::Expression::Node)
or_where(template : String, *args)
or_where(template : String, **tuple)
or_where(&)
+ or_where
, + + + + where(node : Clear::Expression::Node)
where(&)
where(conditions : NamedTuple | Hash(String, Clear::SQL::Any))
where(template : String)
where(template : String, *args)
where(template : String, **tuple)
where(**tuple)
+ where
+ + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::Join

+ + + + cross_join(name : Selectable, lateral = false) + cross_join, + + + + full_outer_join(name : Selectable, lateral = false, &)
full_outer_join(name : Selectable, condition : String = "true", lateral = false)
+ full_outer_join
, + + + + inner_join(name : Selectable, lateral = false, &)
inner_join(name : Selectable, condition : String = "true", lateral = false)
+ inner_join
, + + + + join(name : Selectable, type = :inner, lateral = false, &)
join(name : Selectable, type = :inner, condition : String = "true", lateral = false)
join(name : Selectable, type = :inner, lateral = false)
+ join
, + + + + left_join(name : Selectable, lateral = false, &)
left_join(name : Selectable, condition : String = "true", lateral = false)
+ left_join
, + + + + right_join(name : Selectable, lateral = false, &)
right_join(name : Selectable, condition : String = "true", lateral = false)
+ right_join
+ + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::From

+ + + + clear_from + clear_from, + + + + from(*args)
from(**tuple)
+ from
, + + + + froms : Array(SQL::From) + froms + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::Select

+ + + + clear_distinct + clear_distinct, + + + + clear_select + clear_select, + + + + default_wildcard_table=(table : String | Nil = nil) + default_wildcard_table=, + + + + distinct(on : String | Nil = "") + distinct, + + + + distinct_value : String | Nil + distinct_value, + + + + select(c : Column)
select(*args)
+ select
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def each(&) : Nil + + # +
+ +
+ +
+ Description copied from module Enumerable(Hash(String, Array(PG::BoolArray) | Array(PG::CharArray) | Array(PG::Float32Array) | Array(PG::Float64Array) | Array(PG::Int16Array) | Array(PG::Int32Array) | Array(PG::Int64Array) | Array(PG::NumericArray) | Array(PG::StringArray) | Array(PG::TimeArray) | Array(PG::UUIDArray) | BigDecimal | Bool | Char | Clear::Expression::Literal | Crypto::Bcrypt::Password | Float32 | Float64 | Int16 | Int32 | Int64 | Int8 | JSON::Any | JSON::PullParser | PG::Geo::Box | PG::Geo::Circle | PG::Geo::Line | PG::Geo::LineSegment | PG::Geo::Path | PG::Geo::Point | PG::Geo::Polygon | PG::Interval | PG::Numeric | Slice(UInt8) | String | Time | UInt16 | UInt32 | UInt64 | UInt8 | UUID | Nil)) +
+ +

Must yield this collection's elements to the block.

+
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/SQL/Selectable.html b/Clear/SQL/Selectable.html new file mode 100644 index 000000000..5fe2f67b7 --- /dev/null +++ b/Clear/SQL/Selectable.html @@ -0,0 +1,1594 @@ + + + + + + + + + + + + + + + + + Clear::SQL::Selectable - clear develop + + + + + + + + + + +
+

+ + alias Clear::SQL::Selectable + +

+ + + + + + + +

+ + + + Alias Definition +

+ Clear::SQL::SelectBuilder | String | Symbol + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/sql/sql.cr + + +
+ + + + + + + + + + + + + + +
+ +
+ + + + + + + + + +
+ + + diff --git a/Clear/SQL/Symbolic.html b/Clear/SQL/Symbolic.html new file mode 100644 index 000000000..cf45b4893 --- /dev/null +++ b/Clear/SQL/Symbolic.html @@ -0,0 +1,1594 @@ + + + + + + + + + + + + + + + + + Clear::SQL::Symbolic - clear develop + + + + + + + + + + +
+

+ + alias Clear::SQL::Symbolic + +

+ + + + + + + +

+ + + + Alias Definition +

+ String | Symbol + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/sql/sql.cr + + +
+ + + + + + + + + + + + + + +
+ +
+ + + + + + + + + +
+ + + diff --git a/Clear/SQL/Transaction.html b/Clear/SQL/Transaction.html new file mode 100644 index 000000000..31c387e09 --- /dev/null +++ b/Clear/SQL/Transaction.html @@ -0,0 +1,1817 @@ + + + + + + + + + + + + + + + + + Clear::SQL::Transaction - clear develop + + + + + + + + + + +
+

+ + module Clear::SQL::Transaction + +

+ + + + + + + + + + + + + + + +

+ + + + Direct including types +

+ + + + + +

+ + + + Defined in: +

+ + + + clear/sql/transaction.cr + + +
+ + + + + + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ +
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def after_commit(connection : String = "default", &block : DB::Connection -> Nil) + + # +
+ +
+ +

Register a callback function which will be fired once when SQL COMMIT +operation is called

+

This can be used for example to send email, or perform others tasks +when you want to be sure the data is secured in the database.

+
transaction do
+  @user = User.find(1)
+  @user.subscribe!
+  Clear::SQL.after_commit { Email.deliver(ConfirmationMail.new(@user)) }
+end
+

In case the transaction fail and eventually rollback, the code won't be called.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def in_transaction?(connection : String = "default") + + # +
+ +
+ +

Check whether the current pair of fiber/connection is in transaction +block or not.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def rollback(to = nil) + + # +
+ +
+ +

Rollback a transaction or return to the previous savepoint in case of a +with_savepoint block. +The params to offer

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def rollback_transaction + + # +
+ +
+ +

Rollback the transaction. In case the call is made inside a savepoint block +rollback everything.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def transaction(connection : String = "default", level : Level = Level::Serializable, &) + + # +
+ +
+ +

Enter new transaction block for the current connection/fiber pair.

+

Example:

+
Clear::SQL.transaction do
+  # do something
+  Clear::SQL.transaction do # Technically, this block do nothing, since we already are in transaction
+    rollback                # < Rollback the up-most `transaction` block.
+  end
+end
+

see #with_savepoint to use a stackable version using savepoints.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def with_savepoint(sp_name : Symbolic | Nil = nil, connection_name : String = "default", &) + + # +
+ +
+ +

Create a transaction, but this one is stackable +using savepoints.

+

Example:

+
Clear::SQL.with_savepoint do
+  # do something
+  Clear::SQL.with_savepoint do
+    rollback # < Rollback only the last `with_savepoint` block
+  end
+end
+
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/SQL/Transaction/Level.html b/Clear/SQL/Transaction/Level.html new file mode 100644 index 000000000..f0cb6f812 --- /dev/null +++ b/Clear/SQL/Transaction/Level.html @@ -0,0 +1,1763 @@ + + + + + + + + + + + + + + + + + Clear::SQL::Transaction::Level - clear develop + + + + + + + + + + +
+

+ + enum Clear::SQL::Transaction::Level + +

+ + + + + +

+ + + + Overview +

+ +

Represents the differents levels of transactions +as described in https://www.postgresql.org/docs/9.5/transaction-iso.html

+

ReadUncommited is voluntarly ommited as it fallback to ReadCommited in PostgreSQL

+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/sql/transaction.cr + + +
+ + + + + +

+ + + + Enum Members +

+ +
+ +
+ ReadCommitted = 0 +
+ + +
+ RepeatableRead = 1 +
+ + +
+ Serializable = 2 +
+ + +
+ + + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def read_committed? + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def repeatable_read? + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def serializable? + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/SQL/UpdateQuery.html b/Clear/SQL/UpdateQuery.html new file mode 100644 index 000000000..03e64f476 --- /dev/null +++ b/Clear/SQL/UpdateQuery.html @@ -0,0 +1,1972 @@ + + + + + + + + + + + + + + + + + Clear::SQL::UpdateQuery - clear develop + + + + + + + + + + +
+

+ + class Clear::SQL::UpdateQuery + +

+ + + + + + + +

+ + + + Overview +

+ +

TODO Documentation

+ + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/sql/update_query.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + +

Instance methods inherited from module Clear::SQL::Query::Execute

+ + + + execute(connection_name : String | Nil = nil) + execute + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::Where

+ + + + clear_wheres + clear_wheres, + + + + or_where(node : Clear::Expression::Node)
or_where(template : String, *args)
or_where(template : String, **tuple)
or_where(&)
+ or_where
, + + + + where(node : Clear::Expression::Node)
where(&)
where(conditions : NamedTuple | Hash(String, Clear::SQL::Any))
where(template : String)
where(template : String, *args)
where(template : String, **tuple)
where(**tuple)
+ where
+ + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::Change

+ + + + change! : self + change! + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::Connection

+ + + + connection_name : String + connection_name, + + + + use_connection(connection_name : String) + use_connection + + + + + + + + + + + + + + + + +

Instance methods inherited from module Clear::SQL::Query::CTE

+ + + + cte : Hash(String, CTEAuthorized) + cte, + + + + with_cte(name, request : CTEAuthorized)
with_cte(tuple : NamedTuple)
+ with_cte
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(table : String | Symbol | Nil, wheres : Array(Clear::Expression::Node) = [] of Clear::Expression::Node) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def set(row : NamedTuple) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def set(row : String) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def set(row : Hash(String, Updatable)) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def set(**row) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def to_sql + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def wheres : Array(Clear::Expression::Node) + + # +
+ +
+ +

Return the list of where clause; each where clause are transformed into +Clear::Expression::Node

+
+ +
+
+ +
+
+ + + +
+ + + diff --git a/Clear/SQL/UpdateQuery/Updatable.html b/Clear/SQL/UpdateQuery/Updatable.html new file mode 100644 index 000000000..2f1299ff4 --- /dev/null +++ b/Clear/SQL/UpdateQuery/Updatable.html @@ -0,0 +1,1594 @@ + + + + + + + + + + + + + + + + + Clear::SQL::UpdateQuery::Updatable - clear develop + + + + + + + + + + +
+

+ + alias Clear::SQL::UpdateQuery::Updatable + +

+ + + + + + + +

+ + + + Alias Definition +

+ Array(PG::BoolArray) | Array(PG::CharArray) | Array(PG::Float32Array) | Array(PG::Float64Array) | Array(PG::Int16Array) | Array(PG::Int32Array) | Array(PG::Int64Array) | Array(PG::NumericArray) | Array(PG::StringArray) | Array(PG::TimeArray) | Array(PG::UUIDArray) | BigDecimal | BigFloat | BigInt | Bool | Char | Clear::Expression::Literal | Crypto::Bcrypt::Password | Float32 | Float64 | Int16 | Int32 | Int64 | Int8 | JSON::Any | JSON::PullParser | PG::Geo::Box | PG::Geo::Circle | PG::Geo::Line | PG::Geo::LineSegment | PG::Geo::Path | PG::Geo::Point | PG::Geo::Polygon | PG::Interval | PG::Numeric | Slice(UInt8) | String | Time | UInt16 | UInt32 | UInt64 | UInt8 | UUID | Nil + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/sql/update_query.cr + + +
+ + + + + + + + + + + + + + +
+ +
+ + + + + + + + + +
+ + + diff --git a/Clear/SQL/UpdateQuery/UpdateInstruction.html b/Clear/SQL/UpdateQuery/UpdateInstruction.html new file mode 100644 index 000000000..0860f8623 --- /dev/null +++ b/Clear/SQL/UpdateQuery/UpdateInstruction.html @@ -0,0 +1,1594 @@ + + + + + + + + + + + + + + + + + Clear::SQL::UpdateQuery::UpdateInstruction - clear develop + + + + + + + + + + +
+

+ + alias Clear::SQL::UpdateQuery::UpdateInstruction + +

+ + + + + + + +

+ + + + Alias Definition +

+ Hash(String, Array(PG::BoolArray) | Array(PG::CharArray) | Array(PG::Float32Array) | Array(PG::Float64Array) | Array(PG::Int16Array) | Array(PG::Int32Array) | Array(PG::Int64Array) | Array(PG::NumericArray) | Array(PG::StringArray) | Array(PG::TimeArray) | Array(PG::UUIDArray) | BigDecimal | BigFloat | BigInt | Bool | Char | Clear::Expression::Literal | Crypto::Bcrypt::Password | Float32 | Float64 | Int16 | Int32 | Int64 | Int8 | JSON::Any | JSON::PullParser | PG::Geo::Box | PG::Geo::Circle | PG::Geo::Line | PG::Geo::LineSegment | PG::Geo::Path | PG::Geo::Point | PG::Geo::Polygon | PG::Interval | PG::Numeric | Slice(UInt8) | String | Time | UInt16 | UInt32 | UInt64 | UInt8 | UUID | Nil) | String + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/sql/update_query.cr + + +
+ + + + + + + + + + + + + + +
+ +
+ + + + + + + + + +
+ + + diff --git a/Clear/TSVector.html b/Clear/TSVector.html new file mode 100644 index 000000000..9dde90ea2 --- /dev/null +++ b/Clear/TSVector.html @@ -0,0 +1,1804 @@ + + + + + + + + + + + + + + + + + Clear::TSVector - clear develop + + + + + + + + + + +
+

+ + class Clear::TSVector + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/extensions/full_text_searchable/tsvector.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + +

+ + + + Class Method Summary +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(io) + + # +
+ +
+
+ + [View source] + +
+
+ + + + +

+ + + + Class Method Detail +

+ +
+
+ + def self.decode(x : Slice(UInt8)) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def [](key : String) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def []?(key : String) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def lexems : Hash(String, Lexem) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def to_sql + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/TSVector/Converter.html b/Clear/TSVector/Converter.html new file mode 100644 index 000000000..ac9736469 --- /dev/null +++ b/Clear/TSVector/Converter.html @@ -0,0 +1,1648 @@ + + + + + + + + + + + + + + + + + Clear::TSVector::Converter - clear develop + + + + + + + + + + +
+

+ + module Clear::TSVector::Converter + +

+ + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/extensions/full_text_searchable/tsvector.cr + + +
+ + + + + + + + +

+ + + + Class Method Summary +

+ + + + + + + + +
+ +
+ + + + +

+ + + + Class Method Detail +

+ +
+
+ + def self.to_column(x) : Clear::TSVector | Nil + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.to_db(x : TSVector | Nil) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + +
+ + + diff --git a/Clear/TSVector/Lexem.html b/Clear/TSVector/Lexem.html new file mode 100644 index 000000000..6cccfd0de --- /dev/null +++ b/Clear/TSVector/Lexem.html @@ -0,0 +1,1751 @@ + + + + + + + + + + + + + + + + + Clear::TSVector::Lexem - clear develop + + + + + + + + + + +
+

+ + struct Clear::TSVector::Lexem + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/extensions/full_text_searchable/tsvector.cr + + +
+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ WEIGHTS = ['A', 'B', 'C', 'D'] +
+ + +
+ + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(io) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def positions : Array(Position) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def value : String + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/TSVector/Lexem/Position.html b/Clear/TSVector/Lexem/Position.html new file mode 100644 index 000000000..4a82abd66 --- /dev/null +++ b/Clear/TSVector/Lexem/Position.html @@ -0,0 +1,1770 @@ + + + + + + + + + + + + + + + + + Clear::TSVector::Lexem::Position - clear develop + + + + + + + + + + +
+

+ + struct Clear::TSVector::Lexem::Position + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/extensions/full_text_searchable/tsvector.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(weight : Char, position : UInt16) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def clone + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def copy_with(weight _weight = @weight, position _position = @position) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def position : UInt16 + + # +
+ +
+
+ +
+
+ +
+
+ + def weight : Char + + # +
+ +
+
+ +
+
+ + + +
+ + + diff --git a/Clear/TimeInDay.html b/Clear/TimeInDay.html new file mode 100644 index 000000000..6bcd3e15a --- /dev/null +++ b/Clear/TimeInDay.html @@ -0,0 +1,2104 @@ + + + + + + + + + + + + + + + + + Clear::TimeInDay - clear develop + + + + + + + + + + +
+

+ + struct Clear::TimeInDay + +

+ + + + + + + +

+ + + + Overview +

+ +

Clear::TimeInDay represents the "time" object of PostgreSQL

+

It can be converted automatically from/to a time column. +It offers helpers which makes it usable also as a stand alone.

+

+ +Usage example

+
time = Clear::TimeInDay.parse("12:33")
+puts time.hour    # 12
+puts time.minutes # 0
+
+Time.local.at(time) # Today at 12:33:00
+time.to_s           # 12:33:00
+time.to_s(false)    # don't show seconds => 12:33
+
+time = time + 2.minutes # 12:35
+

As with Interval, you might wanna use it as a column (use underlying time type in PostgreSQL):

+
class MyModel
+  include Clear::Model
+
+  column time_in_day : Clear::TimeInDay
+end
+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/extensions/time_in_days/time_in_day.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + +

+ + + + Class Method Summary +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(hours, minutes, seconds = 0) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.new(microseconds : UInt64 = 0) + + # +
+ +
+
+ + [View source] + +
+
+ + + + +

+ + + + Class Method Detail +

+ +
+
+ + def self.parse(str : String) + + # +
+ +
+ +

Parse a string, of format HH:MM or HH:MM:SS

+
+ +
+
+ + [View source] + +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def +(t : Time::Span) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def +(x : self) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def -(t : Time::Span) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def hour + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def inspect + + # +
+ +
+ +
+ Description copied from class Object +
+ +

Returns an unambiguous and information-rich string representation of this +object, typically intended for developers.

+

This method should usually not be overridden. It delegates to +#inspect(IO) which can be overridden for custom implementations.

+

Also see #to_s.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def microseconds : UInt64 + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def minutes + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def seconds + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def to_json(json : JSON::Builder) : Nil + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def to_s(show_seconds : Bool = true) + + # +
+ +
+ +
+ Description copied from class Object +
+ +

Returns a nicely readable and concise string representation of this object, +typically intended for users.

+

This method should usually not be overridden. It delegates to +#to_s(IO) which can be overridden for custom implementations.

+

Also see #inspect.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def to_s(io, show_seconds : Bool = true) + + # +
+ +
+ +

Return a string

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def to_tuple + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def total_seconds + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/TimeInDay/Converter.html b/Clear/TimeInDay/Converter.html new file mode 100644 index 000000000..aebc25771 --- /dev/null +++ b/Clear/TimeInDay/Converter.html @@ -0,0 +1,1648 @@ + + + + + + + + + + + + + + + + + Clear::TimeInDay::Converter - clear develop + + + + + + + + + + +
+

+ + module Clear::TimeInDay::Converter + +

+ + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/extensions/time_in_days/time_in_day_converter.cr + + +
+ + + + + + + + +

+ + + + Class Method Summary +

+ + + + + + + + +
+ +
+ + + + +

+ + + + Class Method Detail +

+ +
+
+ + def self.to_column(x) : TimeInDay | Nil + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.to_db(x : TimeInDay | Nil) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + +
+ + + diff --git a/Clear/Util.html b/Clear/Util.html new file mode 100644 index 000000000..46316ddcc --- /dev/null +++ b/Clear/Util.html @@ -0,0 +1,1688 @@ + + + + + + + + + + + + + + + + + Clear::Util - clear develop + + + + + + + + + + +
+

+ + module Clear::Util + +

+ + + + + +

+ + + + Overview +

+ +

A set of method(s) useful for building Clear ORM.

+ + + + + + + +

+ + + + Extended Modules +

+ + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/util.cr + + +
+ + + + + + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ +
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def hash_union(h1 : Hash(A, B), h2 : Hash(C, D)) forall A, B, C, D + + # +
+ +
+ +

Return a new hash which is union of two hash (some kind of deep merge)

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def lambda(u : U.class, v : V.class, &block : U -> V) forall U, V + + # +
+ +
+ +

Equivalent to ruby's lambda with one parameter. +This method is useful combined with the macro system of Crystal.

+
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Clear/Validation.html b/Clear/Validation.html new file mode 100644 index 000000000..36ec9967b --- /dev/null +++ b/Clear/Validation.html @@ -0,0 +1,1584 @@ + + + + + + + + + + + + + + + + + Clear::Validation - clear develop + + + + + + + + + + +
+

+ + module Clear::Validation + +

+ + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/model/validation/helper.cr + + +
+ + + + + + + + + + + + + + +
+ +
+ + + + + + + + + +
+ + + diff --git a/Clear/Validation/Helper.html b/Clear/Validation/Helper.html new file mode 100644 index 000000000..5de1544fa --- /dev/null +++ b/Clear/Validation/Helper.html @@ -0,0 +1,1672 @@ + + + + + + + + + + + + + + + + + Clear::Validation::Helper - clear develop + + + + + + + + + + +
+

+ + module Clear::Validation::Helper + +

+ + + + + + + + + + + + + + + +

+ + + + Direct including types +

+ + + + + +

+ + + + Defined in: +

+ + + + clear/model/validation/helper.cr + + +
+ + + + + + + + + + +

+ + + + Macro Summary +

+ + + + + + +
+ +
+ + + + + + +

+ + + + Macro Detail +

+ +
+
+ + macro ensure_than(field, message, &block) + + # +
+ +
+ +

Usage example:

+
ensure_than email, "must be an email" do |v|
+  EmailRegexp.valid?(v)
+end
+
+ +
+
+ + [View source] + +
+
+ +
+
+ + macro on_presence(*fields, &block) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + +
+ + + diff --git a/Clear/View.html b/Clear/View.html new file mode 100644 index 000000000..f7ff61242 --- /dev/null +++ b/Clear/View.html @@ -0,0 +1,2158 @@ + + + + + + + + + + + + + + + + + Clear::View - clear develop + + + + + + + + + + +
+

+ + class Clear::View + +

+ + + + + + + +

+ + + + Overview +

+ +

Create and maintain your database views directly in the code.

+

You could use the migration system to create and drop your views. However this +is proven to be difficult, even more if you want to update a view which depends on +another subviews.

+

+ +How it works ?

+

When you migrate using the migration system, all the views registered +are going to be destroyed and recreated again. +Order of creation depends of the requirement for each views

+

+ +Example

+
Clear::View.register :room_per_days do |view|
+  view.require(:rooms, :year_days)
+
+  view.query <<-SQL
+    SELECT room_id, day
+    FROM year_days
+    CROSS JOIN rooms
+  SQL
+end
+
+Clear::View.register :rooms do |view|
+  view.query <<-SQL
+  SELECT room.id as room_id
+  FROM generate_series(1, 4) AS room(id)
+  SQL
+end
+
+Clear::View.register :year_days do |view|
+  view.query <<-SQL
+  SELECT date.day::date as day
+  FROM   generate_series(
+    date_trunc('day', NOW()),
+    date_trunc('day', NOW() + INTERVAL '364 days'),
+    INTERVAL '1 day'
+  ) AS date(day)
+  SQL
+end
+

In the example above, room_per_days will be first dropped before a migration +start and last created after the migration finished, to prevent issue where some +views are linked to others

+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/view/base.cr + + +
+ + + + + + + + +

+ + + + Class Method Summary +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +

+ + + + Class Method Detail +

+ +
+
+ + def self.apply(direction : Symbol, view_name : String, apply_cache : Set(String)) + + # +
+ +
+ +

install the view into postgresql using CREATE VIEW

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.apply(direction : Symbol, apply_cache = Set(String).new) + + # +
+ +
+ +

install the view into postgresql using CREATE VIEW

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.register(name : Clear::SQL::Symbolic, &) + + # +
+ +
+ +

Call the DSL to register a new view

+
Clear::View.register(:name) do |view|
+  # describe the view here.
+end
+
+ +
+
+ + [View source] + +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def connection(connection : String) + + # +
+ +
+ +

database connection where is installed the view

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def connection : String + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def full_name + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def materialized(mat : Bool) + + # +
+ +
+ +

whether the view is materialized or not. I would recommend to use +migration execute create/drop whenever the view is a materialized view

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def materialized? : Bool + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def name(value : String | Symbol) + + # +
+ +
+ +

name of the view

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def name : String + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def query(query : String) + + # +
+ +
+ +

query body related to the view. Must be a SELECT clause

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def query : String + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def require(*req) + + # +
+ +
+ +

list of dependencies from the other view related to this view

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def requirement : Set(String) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def schema(value : String | Symbol) + + # +
+ +
+ +

schema to store the view (default public)

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def schema : String + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def to_create_sql + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def to_drop_sql + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Slice.html b/Slice.html new file mode 100644 index 000000000..651f08cc9 --- /dev/null +++ b/Slice.html @@ -0,0 +1,1766 @@ + + + + + + + + + + + + + + + + + Slice(T) - clear develop + + + + + + + + + + +
+

+ + struct Slice(T) + +

+ + + + + + + +

+ + + + Overview +

+ +

A Slice is a Pointer with an associated size.

+

While a pointer is unsafe because no bound checks are performed when reading from and writing to it, +reading from and writing to a slice involve bound checks. +In this way, a slice is a safe alternative to Pointer.

+

A Slice can be created as read-only: trying to write to it +will raise. For example the slice of bytes returned by +String#to_slice is read-only.

+ + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/extensions/core_ext.cr + + +
+ + + + + + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def to_json(json : JSON::Builder) + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Time.html b/Time.html new file mode 100644 index 000000000..315758af6 --- /dev/null +++ b/Time.html @@ -0,0 +1,1973 @@ + + + + + + + + + + + + + + + + + Time - clear develop + + + + + + + + + + +
+

+ + struct Time + +

+ + + + + + + +

+ + + + Overview +

+ +

Time represents a date-time instant in +incremental time +observed in a specific time zone.

+

The calendaric calculations are based on the rules of the proleptic Gregorian +calendar as specified in ISO 8601. +Leap seconds are ignored.

+

Internally, the time is stored as an Int64 representing seconds from epoch +(0001-01-01 00:00:00.0 UTC) and an Int32 representing +nanosecond-of-second with value range 0..999_999_999.

+

The supported date range is 0001-01-01 00:00:00.0 to +9999-12-31 23:59:59.999_999_999 in any local time zone.

+

+ +Telling the Time

+

There are several methods to retrieve a Time instance representing the +current time:

+
Time.utc                                        # returns the current time in UTC
+Time.local Time::Location.load("Europe/Berlin") # returns the current time in time zone Europe/Berlin
+Time.local                                      # returns the current time in current time zone
+

It is generally recommended to keep instances in UTC and only apply a +local time zone when formatting for user display, unless the domain logic +requires having a specific time zone (for example for calendaric operations).

+

+ +Creating a Specific Instant

+

Time instances representing a specific instant can be created by +.utc or .new with the date-time specified as individual arguments:

+
time = Time.utc(2016, 2, 15, 10, 20, 30)
+time.to_s # => "2016-02-15 10:20:30 UTC"
+time = Time.local(2016, 2, 15, 10, 20, 30, location: Time::Location.load("Europe/Berlin"))
+time.to_s # => "2016-02-15 10:20:30 +01:00"
+# The time-of-day can be omitted and defaults to midnight (start of day):
+time = Time.utc(2016, 2, 15)
+time.to_s # => "2016-02-15 00:00:00 UTC"
+

+ +Retrieving Time Information

+

Each Time instance allows querying calendar data:

+
time = Time.utc(2016, 2, 15, 10, 20, 30)
+time.year        # => 2016
+time.month       # => 2
+time.day         # => 15
+time.hour        # => 10
+time.minute      # => 20
+time.second      # => 30
+time.millisecond # => 0
+time.nanosecond  # => 0
+time.day_of_week # => Time::DayOfWeek::Monday
+time.day_of_year # => 46
+time.monday?     # => true
+time.time_of_day # => 10:20:30
+

For querying if a time is at a specific day of week, Time offers named +predicate methods, delegating to #day_of_week:

+
time.monday? # => true
+# ...
+time.sunday? # => false
+

+ +Time Zones

+

Each time is attached to a specific time zone, represented by a Location +(see #location). +#zone returns the time zone observed in this location at the current time +(i.e. the instant represented by this Time). +#offset returns the offset of the current zone in seconds.

+
time = Time.local(2018, 3, 8, 22, 5, 13, location: Time::Location.load("Europe/Berlin"))
+time          # => 2018-03-08 22:05:13 +01:00 Europe/Berlin
+time.location # => #<Time::Location Europe/Berlin>
+time.zone     # => #<Time::Location::Zone CET +01:00 (3600s) STD>
+time.offset   # => 3600
+

Using .utc, the location is Time::Location::UTC:

+
time = Time.utc(2018, 3, 8, 22, 5, 13)
+time          # => 2018-03-08 22:05:13.0 UTC
+time.location # => #<Time::Location UTC>
+time.zone     # => #<Time::Location::Zone UTC +00:00 (0s) STD>
+time.offset   # => 0
+

A Time instance can be transformed to a different time zone while retaining +the same instant using #in:

+
time_de = Time.local(2018, 3, 8, 22, 5, 13, location: Time::Location.load("Europe/Berlin"))
+time_ar = time_de.in Time::Location.load("America/Buenos_Aires")
+time_de # => 2018-03-08 22:05:13 +01:00 Europe/Berlin
+time_ar # => 2018-03-08 18:05:13 -03:00 America/Buenos_Aires
+

Both Time instances show a different local date-time, but they represent +the same date-time in the instant time-line, therefore they are considered +equal:

+
time_de.to_utc     # => 2018-03-08 21:05:13 UTC
+time_ar.to_utc     # => 2018-03-08 21:05:13 UTC
+time_de == time_ar # => true
+

There are also two special methods for converting to UTC and local time zone:

+
time.to_utc   # equals time.in(Location::UTC)
+time.to_local # equals time.in(Location.local)
+

#to_local_in allows changing the time zone while keeping +the same local date-time (wall clock) which results in a different instant +on the time line.

+

+ +Formatting and Parsing Time

+

To make date-time instances exchangeable between different computer systems +or readable to humans, they are usually converted to and from a string +representation.

+

The method #to_s formats the date-time according to a specified pattern.

+
time = Time.utc(2015, 10, 12, 10, 30, 0)
+time.to_s("%Y-%m-%d %H:%M:%S %:z") # => "2015-10-12 10:30:00 +00:00"
+

Similarly, Time.parse and Time.parse! are used to construct a Time instance from date-time +information in a string, according to a specified pattern:

+
Time.parse("2015-10-12 10:30:00 +00:00", "%Y-%m-%d %H:%M:%S %z", Time::Location::UTC)
+Time.parse!("2015-10-12 10:30:00 +00:00", "%Y-%m-%d %H:%M:%S %z")
+

See Time::Format for all directives.

+

+ +Calculations

+
Time.utc(2015, 10, 10) - 5.days # => 2015-10-05 00:00:00 +00:00
+
+span = Time.utc(2015, 10, 10) - Time.utc(2015, 9, 10)
+span.days          # => 30
+span.total_hours   # => 720
+span.total_minutes # => 43200
+

+ +Measuring Time

+

The typical time representation provided by the operating system is based on +a "wall clock" which is subject to changes for clock synchronization. +This can result in discontinuous jumps in the time-line making it not +suitable for accurately measuring elapsed time.

+

Instances of Time are focused on telling time – using a "wall clock". +When Time.local is called multiple times, the difference between the +returned instances is not guaranteed to equal to the time elapsed between +making the calls; even the order of the returned Time instances might +not reflect invocation order.

+
t1 = Time.utc
+# operation that takes 1 minute
+t2 = Time.utc
+t2 - t1 # => ?
+

The resulting Time::Span could be anything, even negative, if the +computer's wall clock has changed between both calls.

+

As an alternative, the operating system also provides a monotonic clock. +Its time-line has no specified starting point but is strictly linearly +increasing.

+

This monotonic clock should always be used for measuring elapsed time.

+

A reading from this clock can be taken using .monotonic:

+
t1 = Time.monotonic
+# operation that takes 1 minute
+t2 = Time.monotonic
+t2 - t1 # => 1.minute (approximately)
+

The execution time of a block can be measured using .measure:

+
elapsed_time = Time.measure do
+  # operation that takes 20 milliseconds
+end
+elapsed_time # => 20.milliseconds (approximately)
+ + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/extensions/interval/interval_converter.cr + + +
+ + + + clear/extensions/time_in_days/time_in_day_converter.cr + + +
+ + + + + + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def +(interval : Clear::Interval) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def +(time_in_day : Clear::TimeInDay) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def -(interval : Clear::Interval) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def -(time_in_day : Clear::TimeInDay) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def at(time_in_day : Clear::TimeInDay, timezone = nil) : Time + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/UUID.html b/UUID.html new file mode 100644 index 000000000..be8dabf9d --- /dev/null +++ b/UUID.html @@ -0,0 +1,1707 @@ + + + + + + + + + + + + + + + + + UUID - clear develop + + + + + + + + + + +
+

+ + struct UUID + +

+ + + + + + + +

+ + + + Overview +

+ +

Represents a UUID (Universally Unique IDentifier).

+

NOTE To use UUID, you must explicitly import it with require "uuid"

+ + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + clear/extensions/uuid/uuid.cr + + +
+ + + + + + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def to_json(json : JSON::Builder) + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/css/style.css b/css/style.css new file mode 100644 index 000000000..3d0a8a5f3 --- /dev/null +++ b/css/style.css @@ -0,0 +1,980 @@ +:root { + color-scheme: light dark; +} + +html, body { + background: #FFFFFF; + position: relative; + margin: 0; + padding: 0; + width: 100%; + height: 100%; + overflow: hidden; +} + +body { + font-family: "Avenir", "Tahoma", "Lucida Sans", "Lucida Grande", Verdana, Arial, sans-serif; + color: #333; + line-height: 1.5; +} + +a { + color: #263F6C; +} + +a:visited { + color: #112750; +} + +h1, h2, h3, h4, h5, h6 { + margin: 35px 0 25px; + color: #444444; +} + +h1.type-name { + color: #47266E; + margin: 20px 0 30px; + background-color: #F8F8F8; + padding: 10px 12px; + border: 1px solid #EBEBEB; + border-radius: 2px; +} + +h2 { + border-bottom: 1px solid #E6E6E6; + padding-bottom: 5px; +} + +body { + display: flex; +} + +.sidebar, .main-content { + overflow: auto; +} + +.sidebar { + width: 30em; + color: #F8F4FD; + background-color: #2E1052; + padding: 0 0 30px; + box-shadow: inset -3px 0 4px rgba(0,0,0,.35); + line-height: 1.2; + z-index: 0; +} + +.sidebar .search-box { + padding: 13px 9px; +} + +.sidebar input { + display: block; + box-sizing: border-box; + margin: 0; + padding: 5px; + font: inherit; + font-family: inherit; + line-height: 1.2; + width: 100%; + border: 0; + outline: 0; + border-radius: 2px; + box-shadow: 0px 3px 5px rgba(0,0,0,.25); + transition: box-shadow .12s; +} + +.sidebar input:focus { + box-shadow: 0px 5px 6px rgba(0,0,0,.5); +} + +.sidebar input::-webkit-input-placeholder { /* Chrome/Opera/Safari */ + color: #757575; + font-size: 14px; + text-indent: 2px; +} + +.sidebar input::-moz-placeholder { /* Firefox 19+ */ + color: #757575; + font-size: 14px; + text-indent: 2px; +} + +.sidebar input:-ms-input-placeholder { /* IE 10+ */ + color: #757575; + font-size: 14px; + text-indent: 2px; +} + +.sidebar input:-moz-placeholder { /* Firefox 18- */ + color: #757575; + font-size: 14px; + text-indent: 2px; +} + +.project-summary { + padding: 9px 15px 30px 30px; +} + +.project-name { + font-size: 1.4rem; + margin: 0; + color: #f4f4f4; + font-weight: 600; +} + +.project-version { + margin-top: 5px; + display: inline-block; + position: relative; +} + +.project-version > form::after { + position: absolute; + right: 0; + top: 0; + content: "\25BC"; + font-size: .6em; + line-height: 1.2rem; + z-index: -1; +} + +.project-versions-nav { + cursor: pointer; + margin: 0; + padding: 0 .9em 0 0; + border: none; + -moz-appearance: none; + -webkit-appearance: none; + appearance: none; + background-color: transparent; + color: inherit; + font-family: inherit; + font-size: inherit; + line-height: inherit; +} +.project-versions-nav:focus { + outline: none; +} + +.project-versions-nav > option { + color: initial; +} + +.sidebar ul { + margin: 0; + padding: 0; + list-style: none outside; +} + +.sidebar li { + display: block; + position: relative; +} + +.types-list li.hide { + display: none; +} + +.sidebar a { + text-decoration: none; + color: inherit; + transition: color .14s; +} +.types-list a { + display: block; + padding: 5px 15px 5px 30px; +} + +.types-list { + display: block; +} + +.sidebar a:focus { + outline: 1px solid #D1B7F1; +} + +.types-list a { + padding: 5px 15px 5px 30px; +} + +.sidebar .current > a, +.sidebar a:hover { + color: #866BA6; +} + +.types-list li ul { + overflow: hidden; + height: 0; + max-height: 0; + transition: 1s ease-in-out; +} + +.types-list li.parent { + padding-left: 30px; +} + +.types-list li.parent::before { + box-sizing: border-box; + content: "▼"; + display: block; + width: 30px; + height: 30px; + position: absolute; + top: 0; + left: 0; + text-align: center; + color: white; + font-size: 8px; + line-height: 30px; + transform: rotateZ(-90deg); + cursor: pointer; + transition: .2s linear; +} + + +.types-list li.parent > a { + padding-left: 0; +} + +.types-list li.parent.open::before { + transform: rotateZ(0); +} + +.types-list li.open > ul { + height: auto; + max-height: 1000em; +} + +.main-content { + padding: 0 30px 30px 30px; + width: 100%; +} + +.kind { + font-size: 60%; + color: #866BA6; +} + +.superclass-hierarchy { + margin: -15px 0 30px 0; + padding: 0; + list-style: none outside; + font-size: 80%; +} + +.superclass-hierarchy .superclass { + display: inline-block; + margin: 0 7px 0 0; + padding: 0; +} + +.superclass-hierarchy .superclass + .superclass::before { + content: "<"; + margin-right: 7px; +} + +.other-types-list li { + display: inline-block; +} + +.other-types-list, +.list-summary { + margin: 0 0 30px 0; + padding: 0; + list-style: none outside; +} + +.entry-const { + font-family: Menlo, Monaco, Consolas, 'Courier New', Courier, monospace; +} + +.entry-const code { + white-space: pre-wrap; +} + +.entry-summary { + padding-bottom: 4px; +} + +.superclass-hierarchy .superclass a, +.other-type a, +.entry-summary .signature { + padding: 4px 8px; + margin-bottom: 4px; + display: inline-block; + background-color: #f8f8f8; + color: #47266E; + border: 1px solid #f0f0f0; + text-decoration: none; + border-radius: 3px; + font-family: Menlo, Monaco, Consolas, 'Courier New', Courier, monospace; + transition: background .15s, border-color .15s; +} + +.superclass-hierarchy .superclass a:hover, +.other-type a:hover, +.entry-summary .signature:hover { + background: #D5CAE3; + border-color: #624288; +} + +.entry-summary .summary { + padding-left: 32px; +} + +.entry-summary .summary p { + margin: 12px 0 16px; +} + +.entry-summary a { + text-decoration: none; +} + +.entry-detail { + padding: 30px 0; +} + +.entry-detail .signature { + position: relative; + padding: 5px 15px; + margin-bottom: 10px; + display: block; + border-radius: 5px; + background-color: #f8f8f8; + color: #47266E; + border: 1px solid #f0f0f0; + font-family: Menlo, Monaco, Consolas, 'Courier New', Courier, monospace; + transition: .2s ease-in-out; +} + +.entry-detail:target .signature { + background-color: #D5CAE3; + border: 1px solid #624288; +} + +.entry-detail .signature .method-permalink { + position: absolute; + top: 0; + left: -35px; + padding: 5px 15px; + text-decoration: none; + font-weight: bold; + color: #624288; + opacity: .4; + transition: opacity .2s; +} + +.entry-detail .signature .method-permalink:hover { + opacity: 1; +} + +.entry-detail:target .signature .method-permalink { + opacity: 1; +} + +.methods-inherited { + padding-right: 10%; + line-height: 1.5em; +} + +.methods-inherited h3 { + margin-bottom: 4px; +} + +.methods-inherited a { + display: inline-block; + text-decoration: none; + color: #47266E; +} + +.methods-inherited a:hover { + text-decoration: underline; + color: #6C518B; +} + +.methods-inherited .tooltip>span { + background: #D5CAE3; + padding: 4px 8px; + border-radius: 3px; + margin: -4px -8px; +} + +.methods-inherited .tooltip * { + color: #47266E; +} + +pre { + padding: 10px 20px; + margin-top: 4px; + border-radius: 3px; + line-height: 1.45; + overflow: auto; + color: #333; + background: #fdfdfd; + font-size: 14px; + border: 1px solid #eee; +} + +code { + font-family: Menlo, Monaco, Consolas, 'Courier New', Courier, monospace; +} + +:not(pre) > code { + background-color: rgba(40,35,30,0.05); + padding: 0.2em 0.4em; + font-size: 85%; + border-radius: 3px; +} + +span.flag { + padding: 2px 4px 1px; + border-radius: 3px; + margin-right: 3px; + font-size: 11px; + border: 1px solid transparent; +} + +span.flag.orange { + background-color: #EE8737; + color: #FCEBDD; + border-color: #EB7317; +} + +span.flag.yellow { + background-color: #E4B91C; + color: #FCF8E8; + border-color: #B69115; +} + +span.flag.green { + background-color: #469C14; + color: #E2F9D3; + border-color: #34700E; +} + +span.flag.red { + background-color: #BF1919; + color: #F9ECEC; + border-color: #822C2C; +} + +span.flag.purple { + background-color: #2E1052; + color: #ECE1F9; + border-color: #1F0B37; +} + +span.flag.lime { + background-color: #a3ff00; + color: #222222; + border-color: #00ff1e; +} + +.tooltip>span { + position: absolute; + opacity: 0; + display: none; + pointer-events: none; +} + +.tooltip:hover>span { + display: inline-block; + opacity: 1; +} + +.c { + color: #969896; +} + +.n { + color: #0086b3; +} + +.t { + color: #0086b3; +} + +.s { + color: #183691; +} + +.i { + color: #7f5030; +} + +.k { + color: #a71d5d; +} + +.o { + color: #a71d5d; +} + +.m { + color: #795da3; +} + +.hidden { + display: none; +} +.search-results { + font-size: 90%; + line-height: 1.3; +} + +.search-results mark { + color: inherit; + background: transparent; + font-weight: bold; +} +.search-result { + padding: 5px 8px 5px 5px; + cursor: pointer; + border-left: 5px solid transparent; + transform: translateX(-3px); + transition: all .2s, background-color 0s, border .02s; + min-height: 3.2em; +} +.search-result.current { + border-left-color: #ddd; + background-color: rgba(200,200,200,0.4); + transform: translateX(0); + transition: all .2s, background-color .5s, border 0s; +} +.search-result.current:hover, +.search-result.current:focus { + border-left-color: #866BA6; +} +.search-result:not(.current):nth-child(2n) { + background-color: rgba(255,255,255,.06); +} +.search-result__title { + font-size: 105%; + word-break: break-all; + line-height: 1.1; + padding: 3px 0; +} +.search-result__title strong { + font-weight: normal; +} +.search-results .search-result__title > a { + padding: 0; + display: block; +} +.search-result__title > a > .args { + color: #dddddd; + font-weight: 300; + transition: inherit; + font-size: 88%; + line-height: 1.2; + letter-spacing: -.02em; +} +.search-result__title > a > .args * { + color: inherit; +} + +.search-result a, +.search-result a:hover { + color: inherit; +} +.search-result:not(.current):hover .search-result__title > a, +.search-result:not(.current):focus .search-result__title > a, +.search-result__title > a:focus { + color: #866BA6; +} +.search-result:not(.current):hover .args, +.search-result:not(.current):focus .args { + color: #6a5a7d; +} + +.search-result__type { + color: #e8e8e8; + font-weight: 300; +} +.search-result__doc { + color: #bbbbbb; + font-size: 90%; +} +.search-result__doc p { + margin: 0; + text-overflow: ellipsis; + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 2; + overflow: hidden; + line-height: 1.2em; + max-height: 2.4em; +} + +.js-modal-visible .modal-background { + display: flex; +} +.main-content { + position: relative; +} +.modal-background { + position: absolute; + display: none; + height: 100%; + width: 100%; + background: rgba(120,120,120,.4); + z-index: 100; + align-items: center; + justify-content: center; +} +.usage-modal { + max-width: 90%; + background: #fff; + border: 2px solid #ccc; + border-radius: 9px; + padding: 5px 15px 20px; + min-width: 50%; + color: #555; + position: relative; + transform: scale(.5); + transition: transform 200ms; +} +.js-modal-visible .usage-modal { + transform: scale(1); +} +.usage-modal > .close-button { + position: absolute; + right: 15px; + top: 8px; + color: #aaa; + font-size: 27px; + cursor: pointer; +} +.usage-modal > .close-button:hover { + text-shadow: 2px 2px 2px #ccc; + color: #999; +} +.modal-title { + margin: 0; + text-align: center; + font-weight: normal; + color: #666; + border-bottom: 2px solid #ddd; + padding: 10px; +} +.usage-list { + padding: 0; + margin: 13px; +} +.usage-list > li { + padding: 5px 2px; + overflow: auto; + padding-left: 100px; + min-width: 12em; +} +.usage-modal kbd { + background: #eee; + border: 1px solid #ccc; + border-bottom-width: 2px; + border-radius: 3px; + padding: 3px 8px; + font-family: monospace; + margin-right: 2px; + display: inline-block; +} +.usage-key { + float: left; + clear: left; + margin-left: -100px; + margin-right: 12px; +} +.doc-inherited { + font-weight: bold; +} + +.anchor { + float: left; + padding-right: 4px; + margin-left: -20px; +} + +.main-content .anchor .octicon-link { + width: 16px; + height: 16px; +} + +.main-content .anchor:focus { + outline: none +} + +.main-content h1:hover .anchor, +.main-content h2:hover .anchor, +.main-content h3:hover .anchor, +.main-content h4:hover .anchor, +.main-content h5:hover .anchor, +.main-content h6:hover .anchor { + text-decoration: none +} + +.main-content h1 .octicon-link, +.main-content h2 .octicon-link, +.main-content h3 .octicon-link, +.main-content h4 .octicon-link, +.main-content h5 .octicon-link, +.main-content h6 .octicon-link { + visibility: hidden +} + +.main-content h1:hover .anchor .octicon-link, +.main-content h2:hover .anchor .octicon-link, +.main-content h3:hover .anchor .octicon-link, +.main-content h4:hover .anchor .octicon-link, +.main-content h5:hover .anchor .octicon-link, +.main-content h6:hover .anchor .octicon-link { + visibility: visible +} + +img { + max-width: 100%; +} + +table { + font-size: 14px; + display: block; + max-width: -moz-fit-content; + max-width: fit-content; + overflow-x: auto; + white-space: nowrap; + background: #fdfdfd; + text-align: center; + border: 1px solid #eee; + border-collapse: collapse; + padding: 0px 5px 0px 5px; +} + +table th { + padding: 10px; + letter-spacing: 1px; + border-bottom: 1px solid #eee; +} + +table td { + padding: 10px; +} + +#sidebar-btn { + height: 32px; + width: 32px; +} + +#sidebar-btn-label { + height: 2em; + width: 2em; +} + +#sidebar-btn, #sidebar-btn-label { + display: none; + margin: .7rem; + appearance: none; + color: black; + cursor: pointer; +} + +@media only screen and (max-width: 635px) { + .sidebar, .main-content { + /* svg size + vertical margin - .search-box padding-top */ + padding-top: calc(2em + 2 * 0.7rem - 13px); + } + + #sidebar-btn, #sidebar-btn-label { + display: block; + position: absolute; + z-index: 50; + transition-duration: 200ms; + left: 0; + } + + #sidebar-btn:not(:checked) ~ #sidebar-btn-label > .close, + #sidebar-btn:checked ~ #sidebar-btn-label > .open, + #sidebar-btn:checked ~ .main-content { + display: none; + } + + #sidebar-btn:checked { + left: calc(100% - 32px - (2 * 0.7rem)); + } + + #sidebar-btn:checked ~ #sidebar-btn-label { + color: white; + /* 100% - svg size - horizontal margin */ + left: calc(100% - 2em - (2 * 0.7rem)); + } + + #sidebar-btn~.sidebar { + width: 0%; + } + + #sidebar-btn:checked~.sidebar { + visibility: visible; + width: 100%; + } + + .sidebar { + transition-duration: 200ms; + max-width: 100vw; + visibility: hidden; + } +} + +@media (prefers-color-scheme: dark) { + html, body { + background: #1b1b1b; + } + + body { + color: white; + } + + a { + color: #8cb4ff; + } + + .main-content a:visited { + color: #5f8de3; + } + + h1, h2, h3, h4, h5, h6 { + color: white; + } + + h1.type-name { + color: white; + background-color: #202020; + border: 1px solid #353535; + } + + .project-versions-nav > option { + background-color: #222; + } + + .superclass-hierarchy .superclass a, + .superclass-hierarchy .superclass a:visited, + .other-type a, + .other-type a:visited, + .entry-summary .signature, + .entry-summary a:visited { + background-color: #202020; + color: white; + border: 1px solid #353535; + } + + .superclass-hierarchy .superclass a:hover, + .other-type a:hover, + .entry-summary .signature:hover { + background: #443d4d; + border-color: #b092d4; + } + + .kind { + color: #b092d4; + } + + .n { + color: #00ade6; + } + + .t { + color: #00ade6; + } + + .k { + color: #ff66ae; + } + + .o { + color: #ff66ae; + } + + .s { + color: #7799ff; + } + + .i { + color: #b38668; + } + + .m { + color: #b9a5d6; + } + + .c { + color: #a1a1a1; + } + + .methods-inherited a, .methods-inherited a:visited { + color: #B290D9; + } + + .methods-inherited a:hover { + color: #D4B7F4; + } + + .methods-inherited .tooltip>span { + background: #443d4d; + } + + .methods-inherited .tooltip * { + color: white; + } + + .entry-detail:target .signature { + background-color: #443d4d; + border: 1px solid #b092d4; + } + + .entry-detail .signature { + background-color: #202020; + color: white; + border: 1px solid #353535; + } + + .entry-detail .signature .method-permalink { + color: #b092d4; + } + + :not(pre)>code { + background-color: #202020; + } + + span.flag.purple { + background-color: #443d4d; + color: #ECE1F9; + border-color: #b092d4; + } + + .sidebar input::-webkit-input-placeholder { /* Chrome/Opera/Safari */ + color: white; + } + + .sidebar input::-moz-placeholder { /* Firefox 19+ */ + color: white; + } + + .sidebar input:-ms-input-placeholder { /* IE 10+ */ + color: white; + } + + .sidebar input:-moz-placeholder { /* Firefox 18- */ + color: white; + } + + pre, + table { + color: white; + background: #202020; + border: 1px solid #353535; + } + + table th { + border-bottom: 1px solid #353535; + } + + #sidebar-btn, #sidebar-btn-label { + color: white; + } +} diff --git a/index.html b/index.html new file mode 100644 index 000000000..cc2f8e261 --- /dev/null +++ b/index.html @@ -0,0 +1,2137 @@ + + + + + + + + + + + + + + + + + clear develop + + + + + + + + + + +
+

clear

+

+ +Clear

+

Crystal CI +GitHub release

+

Clear is an ORM built specifically for PostgreSQL in Crystal.

+

It's probably the most advanced ORM for PG on Crystal in term of features offered. +It features Active Record pattern models, and low-level SQL builder.

+

You can deal out of the box with jsonb, tsvectors, cursors, CTE, bcrypt password, +array, uuid primary key, foreign constraints... and other things ! +It also has a powerful DSL to construct where and having clauses.

+

The philosophy beneath is to please me (and you !) with emphasis made on business +code readability and minimal setup.

+

The project is quite active and well maintened, too !

+

+ +Why to use Clear ?

+

In few seconds, you want to use Clear if:

+ +

You don't want to use Clear if:

+ +

+ +Features

+ +
  # Like ...
+  Product.query.where { ( type == "Book" ) & ( metadata.jsonb("author.full_name") == "Philip K. Dick" ) }
+  # ^--- will use @> operator, to relay on your gin index. For real.
+
+  Product.query.where { ( products.type == "Book" ) & ( products.metadata.jsonb("author.full_name") != "Philip K. Dick" ) }
+  # ^--- this time will use -> notation, because no optimizations possible :/
+
+  # Or...
+  User.query.where { created_at.in? 5.days.ago .. 1.day.ago }
+
+  # Or even...
+  ORM.query.where { ( description =~ /(^| )awesome($| )/i ) }.first!.name # Clear! :-)
+ +

+ +Installation

+

In shards.yml

+
dependencies:
+  clear:
+    github: crystal-garage/clear
+    branch: develop
+

Then:

+
  require "clear"
+

+ +Model definition

+

Clear offers some mixins, just include them in your classes to clear them:

+

+ +Column mapping

+

+class User
+  include Clear::Model
+
+  column id : Int64, primary: true
+
+  column email : String
+
+  column first_name : String?
+  column last_name : String?
+
+  column encrypted_password : Crypto::Bcrypt::Password
+
+  def password=(x)
+    self.encrypted_password = Crypto::Bcrypt::Password.create(password)
+  end
+end
+
+

+ +Column types

+ +
class Clear::Model::Converter::MyClassConversion
+  def self.to_column(x) : MyClass?
+    case x
+    when String
+      MyClass.from_string(x)
+    when Slice(UInt8)
+      MyClass.from_slice(x)
+    else
+      raise "Cannot convert from #{x.class} to MyClass"
+    end
+  end
+
+  def self.to_db(x : UUID?)
+    x.to_s
+  end
+end
+
+Clear::Model::Converter.add_converter("MyClass", Clear::Model::Converter::MyClassConversion)
+
+ +Column presence
+

Most of the ORM for Crystal are mapping column type as Type | Nil union. +It makes sens so we allow selection of some columns only of a model. +However, this have a caveats: columns are still accessible, and will return nil, +even if the real value of the column is not null !

+

Moreover, most of the developers will enforce nullity only on their programming +language level via validation, but not on the database, leading to inconsistency.

+

Therefore, we choose to throw exception whenever a column is accessed before +it has been initialized and to enforce presence through the union system of +Crystal.

+

Clear offers this through the use of column wrapper. +Wrapper can be of the type of the column as in postgres, or in UNKNOWN state. +This approach offers more flexibility:

+
User.query.select("last_name").each do |usr|
+  puts usr.first_name #Will raise an exception, as first_name hasn't been fetched.
+end
+
+u = User.new
+u.first_name_column.defined? #Return false
+u.first_name_column.value("") # Call the value or empty string if not defined :-)
+u.first_name = "bonjour"
+u.first_name_column.defined? #Return true now !
+

Wrapper give also some pretty useful features:

+
u = User.new
+u.email = "me@myaddress.com"
+u.email_column.changed? # TRUE
+u.email_column.revert
+u.email_column.defined? # No more
+

+ +Associations

+

Clear offers has_many, has_one, belongs_to and has_many through associations:

+
class Security::Action
+  belongs_to role : Role
+end
+
+class Security::Role
+  has_many user : User
+end
+
+class User
+  include Clear::Model
+
+  has_one user_info : UserInfo
+  has_many posts : Post
+
+  belongs_to role : Security::Role
+
+  # Use of the standard keys (users_id <=> security_role_id)
+  has_many actions : Security::Action, through: Security::Role
+end
+

+ +Querying

+

Clear offers a collection system for your models. The collection system +takes origin to the lower API Clear::SQL, used to build requests.

+

+ +Simple query

+
+ +Fetch a model
+

To fetch one model:

+
# 1. Get the first user
+User.query.first #Get the first user, ordered by primary key
+
+# Get a specific user
+User.find!(1) #Get the first user, or throw exception if not found.
+
+# Usage of query provides a `find_by` kind of method:
+u : User? = User.query.find { email =~ /yacine/i }
+
+ +Fetch multiple models
+

To prepare a collection, juste use Model#query. +Collections include SQL::Select object, so all the low level API +(where, join, group_by, lock...) can be used in this context.

+
# Get multiple users
+User.query.where { (id >= 100) & (id <= 200) }.each do |user|
+  # Do something with user !
+end
+
+#In case you know there's millions of row, use a cursor to avoid memory issues !
+User.query.where { (id >= 1) & (id <= 20_000_000) }.each_cursor(batch: 100) do |user|
+  # Do something with user; only 100 users will be stored in memory
+  # This method is using pg cursor, so it's 100% transaction-safe
+end
+
+ +Aggregate functions
+

Call aggregate functions from the query is possible. For complex aggregation, +I would recommend to use the SQL::View API (note: Not yet developed), +and keep the model query for fetching models only

+
# count
+user_on_gmail = User.query.where { email.ilike "@gmail.com%" }.count #Note: count return is Int64
+# min/max
+max_id = User.query.where { email.ilike "@gmail.com%" }.max("id", Int32)
+# your own aggregate
+weighted_avg = User.query.agg("SUM(performance_weight * performance_score) / SUM(performance_weight)", Float64)
+
+ +Fetching associations
+

Associations are basically getter which create predefined SQL. +To access to an association, just call it !

+
User.query.each do |user|
+  puts "User #{user.id} posts:"
+  user.posts.each do |post| #Works, but will trigger a request for each user.
+    puts "• #{post.id}"
+  end
+end
+
+ +Caching association for N+1 request
+

For every association, you can tell Clear to encache the results to avoid +N+1 queries, using with_XXX on the collection:

+
# Will call two requests only.
+User.query.with_posts.each do |user|
+  puts "User #{user.id} posts:"
+  user.posts.each do |post|
+    puts "• #{post.id}"
+  end
+end
+

Note than Clear doesn't perform a join method, and the SQL produced will use +the operator IN on the association.

+

In the case above:

+ +
  SELECT * FROM users;
+ +
  SELECT * FROM posts WHERE user_id IN ( SELECT id FROM users )
+

I have plan in a late future to offer different query strategies for the cache (e.g. joins, unions...)

+
+ +Associations caching examples
+

When you use the caching system of the association, using filters on association will +invalidate the cache, and N+1 query will happens.

+

For example:

+
User.query.with_posts.each do |user|
+  puts "User #{user.id} published posts:"
+  # Here: The cache system will not work. The cache on association
+  # is invalidated by the filter `where`.
+  user.posts.where({published: true}).each do |post|
+    puts "• #{post.id}"
+  end
+end
+

The way to fix it is to filter on the association itself:

+
User.query.with_posts(&.where({published: true})).each do |user|
+  puts "User #{user.id} published posts:"
+  # The posts collection of user is already encached with the published filter
+  user.posts.each do |post|
+    puts "• #{post.id}"
+  end
+end
+

Note than, of course in this example user.posts are not ALL the posts but only the +published posts

+

Thanks to this system, we can stack it to encache long distance relations:

+
# Will cache users<=>posts & posts<=>category
+# Total: 3 requests !
+User.query.with_posts(&.with_category).each do |user|
+  #...
+end
+
+ +Querying computed or foreign columns
+

In case you want columns computed by postgres, or stored in another table, you can use fetch_column. +By default, for performance reasons, fetch_columns option is set to false.

+
users = User.query.select(email: "users.email",
+  remark: "infos.remark").join("infos"){ infos.user_id == users.id }.to_a(fetch_columns: true)
+
+# Now the column "remark" will be fetched into each user object.
+# Access can be made using `[]` operator on the model.
+
+users.each do |u|
+  puts "email: `#{u.email}`, remark: `#{u["remark"]?}`"
+end
+

+ +Inspection & SQL logging

+

+ +Inspection

+

inspect over model offers debugging insights:

+
  p # => #<Post:0x10c5f6720
+          @attributes={},
+          @cache=
+           #<Clear::Model::QueryCache:0x10c6e8100
+            @cache={},
+            @cache_activation=Set{}>,
+          @content_column=
+           "...",
+          @errors=[],
+          @id_column=38,
+          @persisted=true,
+          @published_column=true,
+          @read_only=false,
+          @title_column="Lorem ipsum torquent inceptos"*,
+          @user_id_column=5>
+

In this case, the * means a column is changed and the object is dirty and diverge from the database.

+

+ +SQL Logging

+

One thing very important for a good ORM is to offer vision of the SQL +called under the hood. +Clear is offering SQL logging tools, with SQL syntax colorizing in your terminal.

+

For activation, simply setup the logger to DEBUG level !

+
Log.builder.bind "clear.*", :debug, Log::IOBackend.new(STDOUT)
+

+ +Save & validation

+

+ +Save

+

Object can be persisted, saved, updated:

+
u = User.new
+u.email = "test@example.com"
+u.save! #Save or throw if unsavable (validation failed).
+

Columns can be checked & reverted:

+
u = User.new
+u.email = "test@example.com"
+u.email_column.changed? # < Return "true"
+u.email_column.revert # Return to #undef.
+

+ +Validation

+
+ +Presence validator
+

Presence validator is done using the type of the column:

+
class User
+  include Clear::Model
+
+  column first_name : String # Must be present
+  column last_name : String? # Can be null
+end
+
+ +NOT NULL DEFAULT ... CASE
+

There's a case when a column CAN be null inside Crystal, if not persisted, +but CANNOT be null inside Postgres.

+

It's for example the case of the id column, which take value after saving !

+

In this case, you can write:

+
class User
+    column id : Int64, primary: true, presence: false #id will be set using pg serial !
+end
+

Thus, in all case this will fail:

+
u = User.new
+u.id # raise error
+
+ +Other validators
+

When you save your model, Clear will call first the presence validators, then +call your custom made validators. All you have to do is to reimplement +the validate method:

+
class MyModel
+#...
+  def validate
+    # Your code goes here
+  end
+end
+

Validation fails if model#errors is not empty:

+
  class MyModel
+    #...
+    def validate
+      if first_name_column.defined? && first_name != "ABCD" #< See below why `defined?` must be called.
+        add_error("first_name", "must be ABCD!")
+      end
+    end
+  end
+
+ +Unique validator
+

Please use unique feature of postgres. Unique validator at crystal level is a +non-go and lead to terrible race concurrency issues if your deploy on multiple nodes/pods. +It's an anti-pattern and must be avoided at any cost.

+
+ +The validation and the presence system
+

In the case you try validation on a column which has not been initialized, +Clear will complain, telling you you cannot access to the column. +Let's see an example here:

+
class MyModel
+  #...
+  def validate
+    add_error("first_name", "should not be empty") if first_name == ""
+  end
+end
+
+MyModel.new.save! #< Raise unexpected exception, not validation failure :(
+

This validator will raise an exception, because first_name has never been initialized. +To avoid this, we have many way:

+
# 1. Check presence:
+
+def validate
+  if first_name_column.defined? #Ensure we have a value here.
+    add_error("first_name", "should not be empty") if first_name == ""
+  end
+end
+
+# 2. Use column object + default value
+def validate
+  add_error("first_name", "should not be empty") if first_name_column.value("") == ""
+end
+
+# 3. Use the helper macro `on_presence`
+def validate
+  on_presence(first_name) do
+    add_error("first_name", "should not be empty") if first_name == ""
+  end
+end
+
+#4. Use the helper macro `ensure_than`
+def validate
+  ensure_than(first_name, "should not be empty", &.!=(""))
+end
+
+#5. Use the `ensure_than` helper (but with block notation) !
+def validate
+  ensure_than(first_name, "should not be empty") do |column|
+    column != ""
+  end
+end
+
+

I recommend the 4th method in most of the cases you will faces. +Simple to write and easy to read !

+

+ +Migration

+

Clear offers of course a migration system.

+

Migration should have an order column set. +This number can be wrote at the end of the class itself:

+
class Migration1
+  include Clear::Migration
+
+  def change(dir)
+    #...
+  end
+end
+

+ +Using filename

+

Another way is to write down all your migrations one file per migration, and +naming the file using the [number]_migration_description.cr pattern. +In this case, the migration class name doesn't need to have a number at the end of the class name.

+
# in src/db/migrations/1234_create_table.cr
+class CreateTable
+  include Clear::Migration
+
+  def change(dir)
+    #...
+  end
+end
+

+ +Migration examples

+

Migration must implement the method change(dir : Migration::Direction)

+

Direction is the current direction of the migration (up or down). +It provides few methods: up?, down?, up(&block), down(&block)

+

You can create a table:

+
  def change(dir)
+    create_table(:test) do |t|
+      t.column :first_name, :string, index: true
+      t.column :last_name, :string, unique: true
+
+      t.index "lower(first_name || ' ' || last_name)", using: :btree
+
+      t.timestamps
+    end
+  end
+

+ +Constraints

+

I strongly encourage to use the foreign key constraints of postgres for your references:

+
  t.references to: "users", on_delete: "cascade", null: false
+

There's no plan to offer on Crystal level the on_delete feature, like +dependent in ActiveRecord. That's a standard PG feature, just set it +up in migration

+

+ +Performances

+

Models add a layer of computation. Below is a sample with a very simple model +(two integer column), with fetching of 100k rows over 1M rows database, using --release flag:

+

| Method | | Total time | Speed | +| -------------------------: | ----: | -------------------- | -----------: | +| Simple load 100k | 12.04 | ( 83.03ms) (± 3.87%) | 2.28× slower | +| With cursor | 8.26 | ( 121.0ms) (± 1.25%) | 3.32× slower | +| With attributes | 10.30 | ( 97.12ms) (± 4.07%) | 2.67× slower | +| With attributes and cursor | 7.55 | (132.52ms) (± 2.39%) | 3.64× slower | +| SQL only | 27.46 | ( 36.42ms) (± 5.05%) | fastest |

+ +

As you can see, it takes around 100ms to fetch 100k rows for this simple model (SQL included). +If for more complex model, it would take a bit more of time, I think the performances +are quite reasonable, and tenfold or plus faster than Rails's ActiveRecord.

+

+ +Licensing

+

This shard is provided under the MIT license.

+

+ +Contribution

+

All contributions are welcome ! As a specialized ORM for PostgreSQL, +be sure a great contribution on a very specific PG feature will be incorporated +to this shard. +I hope one day we will cover all the features of PG here !

+

+ +Running Tests

+

In order to run the test suite, you will need to have the PostgresSQL service locally available via a socket for access with psql. psql will attempt to use the 'postgres' user to create the test database. If you are working with a newly installed database that may not have the postgres user, this can be created with createuser -s postgres.

+
+ + diff --git a/index.json b/index.json new file mode 100644 index 000000000..daddd36ff --- /dev/null +++ b/index.json @@ -0,0 +1 @@ +{"repository_name":"clear","body":"

\"clear\"

\n\n# Clear\n\n![Crystal CI](https://github.com/crystal-garage/clear/workflows/Crystal%20CI/badge.svg)\n[![GitHub release](https://img.shields.io/github/release/crystal-garage/clear.svg)](https://github.com/crystal-garage/clear/releases)\n\nClear is an ORM built specifically for PostgreSQL in Crystal.\n\nIt's probably the most advanced ORM for PG on Crystal in term of features offered.\nIt features Active Record pattern models, and low-level SQL builder.\n\nYou can deal out of the box with jsonb, tsvectors, cursors, CTE, bcrypt password,\narray, uuid primary key, foreign constraints... and other things !\nIt also has a powerful DSL to construct `where` and `having` clauses.\n\nThe philosophy beneath is to please me (and you !) with emphasis made on business\ncode readability and minimal setup.\n\nThe project is quite active and well maintened, too !\n\n## Why to use Clear ?\n\nIn few seconds, you want to use Clear if:\n\n- [x] You want an expressive ORM. Put straight your thought to your code !\n- [x] You'd like to use advanced Postgres features without hassle\n- [x] You are at aware of the pro and cons of Active Records pattern\n\nYou don't want to use Clear if:\n\n- [ ] You're not willing to use on PostgreSQL\n- [ ] You look for a minimalist ORM / Data Mapper\n- [ ] You need something which doesn't evolve, with breaking changes.\n Clear is still in alpha but starting to mature !\n\n## Features\n\n- Active Record pattern based ORM\n- Expressiveness as mantra - even with advanced features like jsonb, regexp... -\n\n```crystal\n # Like ...\n Product.query.where { ( type == \"Book\" ) & ( metadata.jsonb(\"author.full_name\") == \"Philip K. Dick\" ) }\n # ^--- will use @> operator, to relay on your gin index. For real.\n\n Product.query.where { ( products.type == \"Book\" ) & ( products.metadata.jsonb(\"author.full_name\") != \"Philip K. Dick\" ) }\n # ^--- this time will use -> notation, because no optimizations possible :/\n\n # Or...\n User.query.where { created_at.in? 5.days.ago .. 1.day.ago }\n\n # Or even...\n ORM.query.where { ( description =~ /(^| )awesome($| )/i ) }.first!.name # Clear! :-)\n```\n\n- Proper debug information\n - Log and colorize query. Show you the last query if your code crash !\n - If failing on compile for a good reason, give proper explaination (or at least try)\n- Migration system\n- Validation system\n- N+1 query avoidance strategy\n- Transaction, rollback & savepoint\n- Access to CTE, locks, cursors, scope, pagination, join, window, multi-connection and many others features\n- Model lifecycle/hooks\n- JSONB, UUID, FullTextSearch\n\n### Installation\n\nIn `shards.yml`\n\n```yml\ndependencies:\n clear:\n github: crystal-garage/clear\n branch: develop\n```\n\nThen:\n\n```crystal\n require \"clear\"\n```\n\n### Model definition\n\nClear offers some mixins, just include them in your classes to _clear_ them:\n\n#### Column mapping\n\n```crystal\n\nclass User\n include Clear::Model\n\n column id : Int64, primary: true\n\n column email : String\n\n column first_name : String?\n column last_name : String?\n\n column encrypted_password : Crypto::Bcrypt::Password\n\n def password=(x)\n self.encrypted_password = Crypto::Bcrypt::Password.create(password)\n end\nend\n\n```\n\n#### Column types\n\n- `Number`, `String`, `Time`, `Boolean` and `Jsonb` structures are already mapped.\n- `Array` of primitives too.\n For other type of data, just create your own converter !\n\n```crystal\nclass Clear::Model::Converter::MyClassConversion\n def self.to_column(x) : MyClass?\n case x\n when String\n MyClass.from_string(x)\n when Slice(UInt8)\n MyClass.from_slice(x)\n else\n raise \"Cannot convert from #{x.class} to MyClass\"\n end\n end\n\n def self.to_db(x : UUID?)\n x.to_s\n end\nend\n\nClear::Model::Converter.add_converter(\"MyClass\", Clear::Model::Converter::MyClassConversion)\n```\n\n##### Column presence\n\nMost of the ORM for Crystal are mapping column type as `Type | Nil` union.\nIt makes sens so we allow selection of some columns only of a model.\nHowever, this have a caveats: columns are still accessible, and will return nil,\neven if the real value of the column is not null !\n\nMoreover, most of the developers will enforce nullity only on their programming\nlanguage level via validation, but not on the database, leading to inconsistency.\n\nTherefore, we choose to throw exception whenever a column is accessed before\nit has been initialized and to enforce presence through the union system of\nCrystal.\n\nClear offers this through the use of column wrapper.\nWrapper can be of the type of the column as in postgres, or in `UNKNOWN` state.\nThis approach offers more flexibility:\n\n```crystal\nUser.query.select(\"last_name\").each do |usr|\n puts usr.first_name #Will raise an exception, as first_name hasn't been fetched.\nend\n\nu = User.new\nu.first_name_column.defined? #Return false\nu.first_name_column.value(\"\") # Call the value or empty string if not defined :-)\nu.first_name = \"bonjour\"\nu.first_name_column.defined? #Return true now !\n```\n\nWrapper give also some pretty useful features:\n\n```crystal\nu = User.new\nu.email = \"me@myaddress.com\"\nu.email_column.changed? # TRUE\nu.email_column.revert\nu.email_column.defined? # No more\n```\n\n#### Associations\n\nClear offers `has_many`, `has_one`, `belongs_to` and `has_many through` associations:\n\n```crystal\nclass Security::Action\n belongs_to role : Role\nend\n\nclass Security::Role\n has_many user : User\nend\n\nclass User\n include Clear::Model\n\n has_one user_info : UserInfo\n has_many posts : Post\n\n belongs_to role : Security::Role\n\n # Use of the standard keys (users_id <=> security_role_id)\n has_many actions : Security::Action, through: Security::Role\nend\n```\n\n### Querying\n\nClear offers a collection system for your models. The collection system\ntakes origin to the lower API `Clear::SQL`, used to build requests.\n\n#### Simple query\n\n##### Fetch a model\n\nTo fetch one model:\n\n```crystal\n# 1. Get the first user\nUser.query.first #Get the first user, ordered by primary key\n\n# Get a specific user\nUser.find!(1) #Get the first user, or throw exception if not found.\n\n# Usage of query provides a `find_by` kind of method:\nu : User? = User.query.find { email =~ /yacine/i }\n```\n\n##### Fetch multiple models\n\nTo prepare a collection, juste use `Model#query`.\nCollections include `SQL::Select` object, so all the low level API\n(`where`, `join`, `group_by`, `lock`...) can be used in this context.\n\n```crystal\n# Get multiple users\nUser.query.where { (id >= 100) & (id <= 200) }.each do |user|\n # Do something with user !\nend\n\n#In case you know there's millions of row, use a cursor to avoid memory issues !\nUser.query.where { (id >= 1) & (id <= 20_000_000) }.each_cursor(batch: 100) do |user|\n # Do something with user; only 100 users will be stored in memory\n # This method is using pg cursor, so it's 100% transaction-safe\nend\n```\n\n##### Aggregate functions\n\nCall aggregate functions from the query is possible. For complex aggregation,\nI would recommend to use the `SQL::View` API (note: Not yet developed),\nand keep the model query for _fetching_ models only\n\n```crystal\n# count\nuser_on_gmail = User.query.where { email.ilike \"@gmail.com%\" }.count #Note: count return is Int64\n# min/max\nmax_id = User.query.where { email.ilike \"@gmail.com%\" }.max(\"id\", Int32)\n# your own aggregate\nweighted_avg = User.query.agg(\"SUM(performance_weight * performance_score) / SUM(performance_weight)\", Float64)\n```\n\n##### Fetching associations\n\nAssociations are basically getter which create predefined SQL.\nTo access to an association, just call it !\n\n```crystal\nUser.query.each do |user|\n puts \"User #{user.id} posts:\"\n user.posts.each do |post| #Works, but will trigger a request for each user.\n puts \"• #{post.id}\"\n end\nend\n```\n\n###### Caching association for N+1 request\n\nFor every association, you can tell Clear to encache the results to avoid\nN+1 queries, using `with_XXX` on the collection:\n\n```crystal\n# Will call two requests only.\nUser.query.with_posts.each do |user|\n puts \"User #{user.id} posts:\"\n user.posts.each do |post|\n puts \"• #{post.id}\"\n end\nend\n```\n\nNote than Clear doesn't perform a join method, and the SQL produced will use\nthe operator `IN` on the association.\n\nIn the case above:\n\n- The first request will be\n\n```\n SELECT * FROM users;\n```\n\n- Thanks to the cache, a second request will be called before fetching the users:\n\n```\n SELECT * FROM posts WHERE user_id IN ( SELECT id FROM users )\n```\n\nI have plan in a late future to offer different query strategies for the cache (e.g. joins, unions...)\n\n###### Associations caching examples\n\nWhen you use the caching system of the association, using filters on association will\ninvalidate the cache, and N+1 query will happens.\n\nFor example:\n\n```crystal\nUser.query.with_posts.each do |user|\n puts \"User #{user.id} published posts:\"\n # Here: The cache system will not work. The cache on association\n # is invalidated by the filter `where`.\n user.posts.where({published: true}).each do |post|\n puts \"• #{post.id}\"\n end\nend\n```\n\nThe way to fix it is to filter on the association itself:\n\n```crystal\nUser.query.with_posts(&.where({published: true})).each do |user|\n puts \"User #{user.id} published posts:\"\n # The posts collection of user is already encached with the published filter\n user.posts.each do |post|\n puts \"• #{post.id}\"\n end\nend\n```\n\nNote than, of course in this example `user.posts` are not ALL the posts but only the\n`published` posts\n\nThanks to this system, we can stack it to encache long distance relations:\n\n```crystal\n# Will cache users<=>posts & posts<=>category\n# Total: 3 requests !\nUser.query.with_posts(&.with_category).each do |user|\n #...\nend\n```\n\n##### Querying computed or foreign columns\n\nIn case you want columns computed by postgres, or stored in another table, you can use `fetch_column`.\nBy default, for performance reasons, `fetch_columns` option is set to false.\n\n```crystal\nusers = User.query.select(email: \"users.email\",\n remark: \"infos.remark\").join(\"infos\"){ infos.user_id == users.id }.to_a(fetch_columns: true)\n\n# Now the column \"remark\" will be fetched into each user object.\n# Access can be made using `[]` operator on the model.\n\nusers.each do |u|\n puts \"email: `#{u.email}`, remark: `#{u[\"remark\"]?}`\"\nend\n```\n\n### Inspection & SQL logging\n\n#### Inspection\n\n`inspect` over model offers debugging insights:\n\n```text\n p # => #,\n @content_column=\n \"...\",\n @errors=[],\n @id_column=38,\n @persisted=true,\n @published_column=true,\n @read_only=false,\n @title_column=\"Lorem ipsum torquent inceptos\"*,\n @user_id_column=5>\n```\n\nIn this case, the `*` means a column is changed and the object is dirty and diverge from the database.\n\n#### SQL Logging\n\nOne thing very important for a good ORM is to offer vision of the SQL\ncalled under the hood.\nClear is offering SQL logging tools, with SQL syntax colorizing in your terminal.\n\nFor activation, simply setup the logger to `DEBUG` level !\n\n```\nLog.builder.bind \"clear.*\", :debug, Log::IOBackend.new(STDOUT)\n```\n\n### Save & validation\n\n#### Save\n\nObject can be persisted, saved, updated:\n\n```crystal\nu = User.new\nu.email = \"test@example.com\"\nu.save! #Save or throw if unsavable (validation failed).\n```\n\nColumns can be checked & reverted:\n\n```crystal\nu = User.new\nu.email = \"test@example.com\"\nu.email_column.changed? # < Return \"true\"\nu.email_column.revert # Return to #undef.\n```\n\n#### Validation\n\n##### Presence validator\n\nPresence validator is done using the type of the column:\n\n```crystal\nclass User\n include Clear::Model\n\n column first_name : String # Must be present\n column last_name : String? # Can be null\nend\n```\n\n###### `NOT NULL DEFAULT ...` CASE\n\nThere's a case when a column CAN be null inside Crystal, if not persisted,\nbut CANNOT be null inside Postgres.\n\nIt's for example the case of the `id` column, which take value after saving !\n\nIn this case, you can write:\n\n```crystal\nclass User\n column id : Int64, primary: true, presence: false #id will be set using pg serial !\nend\n```\n\nThus, in all case this will fail:\n\n```\nu = User.new\nu.id # raise error\n```\n\n##### Other validators\n\nWhen you save your model, Clear will call first the presence validators, then\ncall your custom made validators. All you have to do is to reimplement\nthe `validate` method:\n\n```crystal\nclass MyModel\n#...\n def validate\n # Your code goes here\n end\nend\n```\n\nValidation fails if `model#errors` is not empty:\n\n```crystal\n class MyModel\n #...\n def validate\n if first_name_column.defined? && first_name != \"ABCD\" #< See below why `defined?` must be called.\n add_error(\"first_name\", \"must be ABCD!\")\n end\n end\n end\n```\n\n##### Unique validator\n\nPlease use `unique` feature of postgres. Unique validator at crystal level is a\nnon-go and lead to terrible race concurrency issues if your deploy on multiple nodes/pods.\nIt's an anti-pattern and must be avoided at any cost.\n\n##### The validation and the presence system\n\nIn the case you try validation on a column which has not been initialized,\nClear will complain, telling you you cannot access to the column.\nLet's see an example here:\n\n```crystal\nclass MyModel\n #...\n def validate\n add_error(\"first_name\", \"should not be empty\") if first_name == \"\"\n end\nend\n\nMyModel.new.save! #< Raise unexpected exception, not validation failure :(\n```\n\nThis validator will raise an exception, because first_name has never been initialized.\nTo avoid this, we have many way:\n\n```crystal\n# 1. Check presence:\n\ndef validate\n if first_name_column.defined? #Ensure we have a value here.\n add_error(\"first_name\", \"should not be empty\") if first_name == \"\"\n end\nend\n\n# 2. Use column object + default value\ndef validate\n add_error(\"first_name\", \"should not be empty\") if first_name_column.value(\"\") == \"\"\nend\n\n# 3. Use the helper macro `on_presence`\ndef validate\n on_presence(first_name) do\n add_error(\"first_name\", \"should not be empty\") if first_name == \"\"\n end\nend\n\n#4. Use the helper macro `ensure_than`\ndef validate\n ensure_than(first_name, \"should not be empty\", &.!=(\"\"))\nend\n\n#5. Use the `ensure_than` helper (but with block notation) !\ndef validate\n ensure_than(first_name, \"should not be empty\") do |column|\n column != \"\"\n end\nend\n\n```\n\nI recommend the 4th method in most of the cases you will faces.\nSimple to write and easy to read !\n\n### Migration\n\nClear offers of course a migration system.\n\nMigration should have an `order` column set.\nThis number can be wrote at the end of the class itself:\n\n```crystal\nclass Migration1\n include Clear::Migration\n\n def change(dir)\n #...\n end\nend\n```\n\n#### Using filename\n\nAnother way is to write down all your migrations one file per migration, and\nnaming the file using the `[number]_migration_description.cr` pattern.\nIn this case, the migration class name doesn't need to have a number at the end of the class name.\n\n```crystal\n# in src/db/migrations/1234_create_table.cr\nclass CreateTable\n include Clear::Migration\n\n def change(dir)\n #...\n end\nend\n```\n\n#### Migration examples\n\nMigration must implement the method `change(dir : Migration::Direction)`\n\nDirection is the current direction of the migration (up or down).\nIt provides few methods: `up?`, `down?`, `up(&block)`, `down(&block)`\n\nYou can create a table:\n\n```crystal\n def change(dir)\n create_table(:test) do |t|\n t.column :first_name, :string, index: true\n t.column :last_name, :string, unique: true\n\n t.index \"lower(first_name || ' ' || last_name)\", using: :btree\n\n t.timestamps\n end\n end\n```\n\n#### Constraints\n\nI strongly encourage to use the foreign key constraints of postgres for your references:\n\n```crystal\n t.references to: \"users\", on_delete: \"cascade\", null: false\n```\n\nThere's no plan to offer on Crystal level the `on_delete` feature, like\n`dependent` in ActiveRecord. That's a standard PG feature, just set it\nup in migration\n\n## Performances\n\nModels add a layer of computation. Below is a sample with a very simple model\n(two integer column), with fetching of 100k rows over 1M rows database, using --release flag:\n\n| Method | | Total time | Speed |\n| -------------------------: | ----: | -------------------- | -----------: |\n| Simple load 100k | 12.04 | ( 83.03ms) (± 3.87%) | 2.28× slower |\n| With cursor | 8.26 | ( 121.0ms) (± 1.25%) | 3.32× slower |\n| With attributes | 10.30 | ( 97.12ms) (± 4.07%) | 2.67× slower |\n| With attributes and cursor | 7.55 | (132.52ms) (± 2.39%) | 3.64× slower |\n| SQL only | 27.46 | ( 36.42ms) (± 5.05%) | fastest |\n\n- `Simple load 100k` is using an array to fetch the 100k rows.\n- `With cursor` is querying 1000 rows at a time\n- `With attribute` setup a hash to deal with unknown attributes in the model (e.g. aggregates)\n- `With attribute and cursor` is doing cursored fetch with hash attributes created\n- `SQL only` build and execute SQL using SQL::Builder\n\nAs you can see, it takes around 100ms to fetch 100k rows for this simple model (SQL included).\nIf for more complex model, it would take a bit more of time, I think the performances\nare quite reasonable, and tenfold or plus faster than Rails's ActiveRecord.\n\n## Licensing\n\nThis shard is provided under the MIT license.\n\n## Contribution\n\nAll contributions are welcome ! As a specialized ORM for PostgreSQL,\nbe sure a great contribution on a very specific PG feature will be incorporated\nto this shard.\nI hope one day we will cover all the features of PG here !\n\n### Running Tests\n\nIn order to run the test suite, you will need to have the PostgresSQL service locally available via a socket for access with psql. psql will attempt to use the 'postgres' user to create the test database. If you are working with a newly installed database that may not have the postgres user, this can be created with `createuser -s postgres`.\n","program":{"html_id":"clear/toplevel","path":"toplevel.html","kind":"module","full_name":"Top Level Namespace","name":"Top Level Namespace","abstract":false,"locations":[],"repository_name":"clear","program":true,"enum":false,"alias":false,"const":false,"constants":[{"id":"ARRAY_TYPEMAP","name":"ARRAY_TYPEMAP","value":"{\"Bool\" => \"boolean[]\", \"String\" => \"text[]\", \"Float32\" => \"real[]\", \"Float64\" => \"double precision[]\", \"Int32\" => \"int[]\", \"Int64\" => \"bigint[]\"}"},{"id":"ARRAY_VALUES","name":"ARRAY_VALUES","value":"{bool: Bool, s: String, f32: Float32, f: Float64, i: Int32, i64: Int64}"}],"macros":[{"html_id":"columns_to_instance_vars-macro","name":"columns_to_instance_vars","doc":"Used internally to deserialise json","summary":"

Used internally to deserialise json

","abstract":false,"location":{"filename":"src/clear/model/json_deserialize.cr","line_number":19,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/json_deserialize.cr#L19"},"def":{"name":"columns_to_instance_vars","visibility":"Public","body":" \n# :nodoc:\n\n struct Assigner\n include JSON::Serializable\n\n \n{% for name, settings in COLUMNS %}\n @[JSON::Field(presence: true)]\n getter {{ name.id }} : {{ settings[:type] }} {% if settings[:type].resolve.nilable? %}{% else %} | Nil {% end %}\n @[JSON::Field(ignore: true)]\n getter? {{ name.id }}_present : Bool\n {% end %}\n\n\n \n# Create a new empty model and fill the columns with object's instance variables\n\n \n# Trusted flag set to true will allow mass assignment without protection\n\n def create(trusted : Bool)\n assign_columns(\n{{ @type }}\n.new, trusted)\n \nend\n\n \n# Update the inputted model and assign the columns with object's instance variables\n\n \n# Trusted flag set to true will allow mass assignment without protection\n\n def update(model, trusted : Bool)\n assign_columns(model, trusted)\n \nend\n\n macro finished\n \n# Assign properties to the model inputted with object's instance variables\n\n \n# Trusted flag set to true will allow mass assignment without protection\n\n protected def assign_columns(model, trusted : Bool)\n \n{% for name, settings in COLUMNS %}\n if ({{ settings[:mass_assign] }} || trusted) && self.{{ name.id }}_present?\n %value = self.{{ name.id }}\n {% if settings[:type].resolve.nilable? %}\n model.{{ name.id }} = %value\n {% else %}\n model.{{ name.id }} = %value unless %value.nil?\n {% end %}\n end\n {% end %}\n\n\n model\n \nend\n \nend\n \nend\n\n \n# Create a new empty model and fill the columns from json. Returns the new model\n\n \n#\n\n \n# Trusted flag set to true will allow mass assignment without protection, FALSE by default\n\n def self.from_json(string_or_io : String | IO, trusted : Bool = false)\n Assigner.from_json(string_or_io).create(trusted)\n \nend\n\n \n# Create a new model from json and save it. Returns the model.\n\n \n#\n\n \n# The model may not be saved due to validation failure;\n\n \n# check the returned model `errors?` and `persisted?` flags.\n\n \n# Trusted flag set to true will allow mass assignment without protection, FALSE by default\n\n def self.create_from_json(string_or_io : String | IO, trusted : Bool = false)\n mdl = self.from_json(string_or_io, trusted)\n mdl.save\n mdl\n \nend\n\n \n# Create a new model from json and save it. Returns the model.\n\n \n#\n\n \n# Returns the newly inserted model\n\n \n# Raises an exception if validation failed during the saving process.\n\n \n# Trusted flag set to true will allow mass assignment without protection, FALSE by default\n\n def self.create_from_json!(string_or_io : String | IO, trusted : Bool = false)\n self.from_json(string_or_io, trusted).save!\n \nend\n\n \n# Set the fields from json passed as argument\n\n \n# Trusted flag set to true will allow mass assignment without protection, FALSE by default\n\n def set_from_json(string_or_io : String | IO, trusted : Bool = false)\n Assigner.from_json(string_or_io).update(self, trusted)\n \nend\n\n \n# Set the fields from json passed as argument and call `save` on the object\n\n \n# Trusted flag set to true will allow mass assignment without protection, FALSE by default\n\n def update_from_json(string_or_io : String | IO, trusted : Bool = false)\n mdl = set_from_json(string_or_io, trusted)\n mdl.save\n mdl\n \nend\n\n \n# Set the fields from json passed as argument and call `save!` on the object\n\n \n# Trusted flag set to true will allow mass assignment without protection, FALSE by default\n\n def update_from_json!(string_or_io : String | IO, trusted : Bool = false)\n set_from_json(string_or_io, trusted).save!\n \nend\n\n"}}],"types":[{"html_id":"clear/BigDecimal","path":"BigDecimal.html","kind":"struct","full_name":"BigDecimal","name":"BigDecimal","abstract":false,"superclass":{"html_id":"clear/Number","kind":"struct","full_name":"Number","name":"Number"},"ancestors":[{"html_id":"clear/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"},{"html_id":"clear/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"},{"html_id":"clear/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"},{"html_id":"clear/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"},{"html_id":"clear/Number","kind":"struct","full_name":"Number","name":"Number"},{"html_id":"clear/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"},{"html_id":"clear/Steppable","kind":"module","full_name":"Steppable","name":"Steppable"},{"html_id":"clear/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/extensions/core_ext.cr","line_number":121,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/core_ext.cr#L121"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"clear/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"},{"html_id":"clear/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"},{"html_id":"clear/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"},{"html_id":"clear/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"}],"doc":"A `BigDecimal` can represent arbitrarily large precision decimals.\n\nIt is internally represented by a pair of `BigInt` and `UInt64`: value and scale.\nValue contains the actual value, and scale tells the decimal point place.\nE.g. when value is `1234` and scale `2`, the result is `12.34`.\n\nNOTE: To use `BigDecimal`, you must explicitly import it with `require \"big\"`\n\nThe general idea and some of the arithmetic algorithms were adapted from\nthe MIT/APACHE-licensed [bigdecimal-rs](https://github.com/akubera/bigdecimal-rs).","summary":"

A BigDecimal can represent arbitrarily large precision decimals.

","instance_methods":[{"html_id":"to_json(json:JSON::Builder)-instance-method","name":"to_json","abstract":false,"args":[{"name":"json","external_name":"json","restriction":"JSON::Builder"}],"args_string":"(json : JSON::Builder)","args_html":"(json : JSON::Builder)","location":{"filename":"src/clear/extensions/core_ext.cr","line_number":122,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/core_ext.cr#L122"},"def":{"name":"to_json","args":[{"name":"json","external_name":"json","restriction":"JSON::Builder"}],"visibility":"Public","body":"json.string(to_s)"}}]},{"html_id":"clear/Char","path":"Char.html","kind":"struct","full_name":"Char","name":"Char","abstract":false,"superclass":{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},"ancestors":[{"html_id":"clear/Steppable","kind":"module","full_name":"Steppable","name":"Steppable"},{"html_id":"clear/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"lib/inflector/src/inflector/string.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/lib/inflector/src/inflector/string.cr#L4"},{"filename":"src/clear/extensions/core_ext.cr","line_number":5,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/core_ext.cr#L5"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"clear/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"},{"html_id":"clear/Steppable","kind":"module","full_name":"Steppable","name":"Steppable"}],"doc":"A `Char` represents a [Unicode](http://en.wikipedia.org/wiki/Unicode) [code point](http://en.wikipedia.org/wiki/Code_point).\nIt occupies 32 bits.\n\nIt is created by enclosing an UTF-8 character in single quotes.\n\n```\n'a'\n'z'\n'0'\n'_'\n'あ'\n```\n\nYou can use a backslash to denote some characters:\n\n```\n'\\'' # single quote\n'\\\\' # backslash\n'\\e' # escape\n'\\f' # form feed\n'\\n' # newline\n'\\r' # carriage return\n'\\t' # tab\n'\\v' # vertical tab\n```\n\nYou can use a backslash followed by an *u* and four hexadecimal characters to denote a unicode codepoint written:\n\n```\n'\\u0041' # == 'A'\n```\n\nOr you can use curly braces and specify up to four hexadecimal numbers:\n\n```\n'\\u{41}' # == 'A'\n```\n\nSee [`Char` literals](https://crystal-lang.org/reference/syntax_and_semantics/literals/char.html) in the language reference.","summary":"

A Char represents a Unicode code point.

","instance_methods":[{"html_id":"to_json(json:JSON::Builder)-instance-method","name":"to_json","abstract":false,"args":[{"name":"json","external_name":"json","restriction":"JSON::Builder"}],"args_string":"(json : JSON::Builder)","args_html":"(json : JSON::Builder)","location":{"filename":"src/clear/extensions/core_ext.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/core_ext.cr#L6"},"def":{"name":"to_json","args":[{"name":"json","external_name":"json","restriction":"JSON::Builder"}],"visibility":"Public","body":"json.string(\"#{self}\")"}}]},{"html_id":"clear/Citext","path":"Citext.html","kind":"struct","full_name":"Citext","name":"Citext","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/extensions/citext/citext.cr","line_number":3,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/citext/citext.cr#L3"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"doc":"Represents a case insensitive text, used by Postgres\nWrap a string and basically change the equality check to make it case insensitive.s","summary":"

Represents a case insensitive text, used by Postgres Wrap a string and basically change the equality check to make it case insensitive.s

","constructors":[{"html_id":"new(string:String)-class-method","name":"new","abstract":false,"args":[{"name":"string","external_name":"string","restriction":"::String"}],"args_string":"(string : String)","args_html":"(string : String)","location":{"filename":"src/clear/extensions/citext/citext.cr","line_number":8,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/citext/citext.cr#L8"},"def":{"name":"new","args":[{"name":"string","external_name":"string","restriction":"::String"}],"visibility":"Public","body":"_ = allocate\n_.initialize(string)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"!=(x:String|Citext)-instance-method","name":"!=","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"String | Citext"}],"args_string":"(x : String | Citext)","args_html":"(x : String | Citext)","location":{"filename":"src/clear/extensions/citext/citext.cr","line_number":15,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/citext/citext.cr#L15"},"def":{"name":"!=","args":[{"name":"x","external_name":"x","restriction":"String | Citext"}],"visibility":"Public","body":"!(self == x)"}},{"html_id":"==(x:String|Citext)-instance-method","name":"==","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"String | Citext"}],"args_string":"(x : String | Citext)","args_html":"(x : String | Citext)","location":{"filename":"src/clear/extensions/citext/citext.cr","line_number":11,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/citext/citext.cr#L11"},"def":{"name":"==","args":[{"name":"x","external_name":"x","restriction":"String | Citext"}],"visibility":"Public","body":"(compare(x.to_s, true)) == 0"}},{"html_id":"string:String-instance-method","name":"string","abstract":false,"location":{"filename":"src/clear/extensions/citext/citext.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/citext/citext.cr#L4"},"def":{"name":"string","return_type":"String","visibility":"Public","body":"@string"}}],"macros":[{"html_id":"method_missing(call)-macro","name":"method_missing","abstract":false,"args":[{"name":"call","external_name":"call","restriction":""}],"args_string":"(call)","args_html":"(call)","location":{"filename":"src/clear/extensions/citext/citext.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/citext/citext.cr#L6"},"def":{"name":"method_missing","args":[{"name":"call","external_name":"call","restriction":""}],"visibility":"Public","body":" @string.\n{{ call }}\n\n \n"}}]},{"html_id":"clear/Clear","path":"Clear.html","kind":"module","full_name":"Clear","name":"Clear","abstract":false,"locations":[{"filename":"src/clear/cli.cr","line_number":9,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli.cr#L9"},{"filename":"src/clear/extensions/enum/enum.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/enum/enum.cr#L1"},{"filename":"src/clear/log.cr","line_number":3,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/log.cr#L3"},{"filename":"src/clear/model/converters/json_any_converter.cr","line_number":24,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/json_any_converter.cr#L24"},{"filename":"src/clear/seed.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/seed.cr#L1"},{"filename":"src/clear/sql/lock.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/lock.cr#L1"},{"filename":"src/clear/sql/sql.cr","line_number":19,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/sql.cr#L19"},{"filename":"src/clear/sql/truncate.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/truncate.cr#L1"},{"filename":"src/clear/version.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/version.cr#L1"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"Log","name":"Log","value":"::Log.for(\"clear\")"},{"id":"VERSION","name":"VERSION","value":"{{ (`shards version /home/runner/work/clear/clear/src/clear`).chomp.stringify }}"}],"class_methods":[{"html_id":"apply_seeds-class-method","name":"apply_seeds","abstract":false,"location":{"filename":"src/clear/seed.cr","line_number":12,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/seed.cr#L12"},"def":{"name":"apply_seeds","visibility":"Public","body":"Clear::SQL.transaction do\n @@seed_list.each(&.call)\nend"}},{"html_id":"seed(&block)-class-method","name":"seed","doc":"Register a seed block.\nthis block will be called by `Clear.apply_seeds`\nor conveniently by the CLI\nusing `$cli_cmd migrate seeds`","summary":"

Register a seed block.

","abstract":false,"location":{"filename":"src/clear/seed.cr","line_number":8,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/seed.cr#L8"},"def":{"name":"seed","yields":0,"block_arity":0,"block_arg":{"name":"block","external_name":"block","restriction":""},"visibility":"Public","body":"@@seed_list << block"}},{"html_id":"with_cli(&)-class-method","name":"with_cli","doc":"Check for the CLI. If the CLI is not triggered, yield the block passed as parameter","summary":"

Check for the CLI.

","abstract":false,"location":{"filename":"src/clear/cli.cr","line_number":32,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli.cr#L32"},"def":{"name":"with_cli","yields":0,"block_arity":0,"visibility":"Public","body":"if ARGV.size > 0 && (ARGV[0] == \"clear\")\n ARGV.shift\n Clear::CLI.run\nelse\n yield\nend"}}],"macros":[{"html_id":"enum(name,*values,&block)-macro","name":"enum","doc":"## Enum\n\nClear offers full support of postgres enum strings.\n\n### Example\n\nLet's say you need to define an enum for genders:\n\n```\n# Define the enum\nClear.enum MyApp::Gender, \"male\", \"female\" # , ...\n```\n\nIn migration, we tell Postgres about the enum:\n\n```\ncreate_enum :gender, MyApp::Gender # < Create the new type `gender` in the database\n\ncreate_table :users do |t|\n # ...\n t.gender \"gender\" # < first `gender` is the type of column, while second is the name of the column\nend\n```\n\nFinally in your model, simply add the enum as column:\n\n```\nclass User\n include Clear::Model\n # ...\n\n column gender : MyApp::Gender\nend\n```\n\nNow, you can assign the enum:\n\n```\nu = User.new\nu.gender = MyApp::Gender::Male\n```\n\nYou can dynamically check and build the enumeration values:\n\n```\nMyApp::Gender.authorized_values # < return [\"male\", \"female\"]\nMyApp::Gender.all # < return [MyApp::Gender::Male, MyApp::Gender::Female]\n\nMyApp::Gender.from_string(\"male\") # < return MyApp::Gender::Male\nMyApp::Gender.from_string(\"unknown\") # < throw Clear::IllegalEnumValueError\n\nMyApp::Gender.valid?(\"female\") # < Return true\nMyApp::Gender.valid?(\"unknown\") # < Return false\n```\n\nHowever, you cannot write:\n\n```\nu = User.new\nu.gender = \"male\"\n```\n\nBut instead:\n\n```\nu = User.new\nu.gender = MyApp::Gender::Male\n```","summary":"

\n \n \nEnum

","abstract":false,"args":[{"name":"name","external_name":"name","restriction":""},{"name":"values","external_name":"values","restriction":""}],"args_string":"(name, *values, &block)","args_html":"(name, *values, &block)","location":{"filename":"src/clear/extensions/enum/enum.cr","line_number":113,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/enum/enum.cr#L113"},"def":{"name":"enum","args":[{"name":"name","external_name":"name","restriction":""},{"name":"values","external_name":"values","restriction":""}],"splat_index":1,"block_arg":{"name":"block","external_name":"block","restriction":""},"visibility":"Public","body":" struct \n{{ name.id }}\n < ::Clear::Enum\n \n{% for i in values %}\n {{ i.camelcase.id }} = {{ name.id }}.new(\"{{ i.id }}\")\n {% end %}\n\n\n \n{% if true %}\n AUTHORIZED_VALUES = {\n {% for i in values %}\n \"{{ i.id }}\" => {{ i.camelcase.id }},\n {% end %}\n }\n {% end %}\n\n\n \n# Return the enum with the string passed as parameter.\n\n \n# Throw Clear::IllegalEnumValueError if the string is not found.\n\n def self.from_string(str : String)\n AUTHORIZED_VALUES[str]? || raise ::Clear::IllegalEnumValueError.new(\"Illegal enum value for `#{self.class}`: '#{str}'\")\n \nend\n\n \n# Return the list of authorized values\n\n def self.authorized_values\n AUTHORIZED_VALUES.keys\n \nend\n\n def self.all\n AUTHORIZED_VALUES.values\n \nend\n\n def self.valid?(x)\n AUTHORIZED_VALUES[x]?\n \nend\n\n macro finished\n module ::Clear::Model::Converter::\n\\{\n{@type}}Converter\n def self.to_column(x) : ::\n\\{\n{@type}}?\n case x\n when Nil\n nil\n when ::\n\\{\n{@type}}\n x\n when String\n ::\n\\{\n{@type}}.from_string(x)\n when Slice(UInt8)\n ::\n\\{\n{@type}}.from_string(String.new(x))\n \nelse\n raise Clear::ErrorMessages.converter_error(x.class.name, \"::\n\\{\n{@type}}\")\n \nend\n \nend\n\n def self.to_db(x : ::\n\\{\n{@type}}?)\n x.to_s\n \nend\n \nend\n\n Clear::Model::Converter.add_converter(\"\n\\{\n{@type}}\", ::Clear::Model::Converter::\n\\{\n{@type}}Converter)\n \nend\n\n \n{{ yield }}\n\n \nend\n \n"}},{"html_id":"json_serializable_converter(type)-macro","name":"json_serializable_converter","doc":"Register a type to allow use in Clear column system.\nType must include JSON::Serializable.\n[More info about how to use JSON::Serializable it can be found here](https://crystal-lang.org/api/latest/JSON/Serializable.html)\n\n```\nClear.json_serializable_converter(MyJsonType)\n\n# ...\n\nclass YourModel\n include Clear::Model\n # ...\n column my_column : MyJsonType # jsonb (recommended), json or string column in postgresql.\nend\n```","summary":"

Register a type to allow use in Clear column system.

","abstract":false,"args":[{"name":"type","external_name":"type","restriction":""}],"args_string":"(type)","args_html":"(type)","location":{"filename":"src/clear/model/converters/json_any_converter.cr","line_number":40,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/json_any_converter.cr#L40"},"def":{"name":"json_serializable_converter","args":[{"name":"type","external_name":"type","restriction":""}],"visibility":"Public","body":" \n{% type = type.resolve %}\n\n module ::Clear::Model::Converter::\n{{ type }}\nConverter\n def self.to_column(x) : ::\n{{ type }}\n?\n case x\n when ::\n{{ type }}\n\n x\n when String\n ::\n{{ type }}\n.new(::JSON::PullParser.new(x))\n when ::JSON::PullParser\n ::\n{{ type }}\n.new(x)\n when ::JSON::Any\n ::\n{{ type }}\n.new(::JSON::PullParser.new(x.to_json))\n \nelse\n raise \"Cannot convert to \n{{ type }}\n from #{x.class}\"\n \nend\n \nend\n\n def self.to_db(x : ::\n{{ type }}\n?)\n x ? x.to_json : nil\n \nend\n \nend\n\n ::Clear::Model::Converter.add_converter(\n{{ \"#{type}\" }}\n, ::Clear::Model::Converter::\n{{ type }}\nConverter)\n \n"}}],"types":[{"html_id":"clear/Clear/CLI","path":"Clear/CLI.html","kind":"module","full_name":"Clear::CLI","name":"CLI","abstract":false,"locations":[{"filename":"src/clear/cli.cr","line_number":10,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli.cr#L10"},{"filename":"src/clear/cli/command.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/command.cr#L1"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear","kind":"module","full_name":"Clear","name":"Clear"},"class_methods":[{"html_id":"run-class-method","name":"run","abstract":false,"location":{"filename":"src/clear/cli.cr","line_number":11,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli.cr#L11"},"def":{"name":"run","visibility":"Public","body":"Clear::CLI::Base.run"}}],"types":[{"html_id":"clear/Clear/CLI/Base","path":"Clear/CLI/Base.html","kind":"class","full_name":"Clear::CLI::Base","name":"Base","abstract":false,"superclass":{"html_id":"clear/Admiral/Command","kind":"class","full_name":"Admiral::Command","name":"Command"},"ancestors":[{"html_id":"clear/Admiral/Command/Run","kind":"module","full_name":"Admiral::Command::Run","name":"Run"},{"html_id":"clear/Clear/CLI/Command","kind":"module","full_name":"Clear::CLI::Command","name":"Command"},{"html_id":"clear/Admiral/Command","kind":"class","full_name":"Admiral::Command","name":"Command"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli.cr","line_number":15,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli.cr#L15"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"HELP","name":"HELP","value":"{\"description\" => \"\"}"}],"included_modules":[{"html_id":"clear/Admiral/Command/Run","kind":"module","full_name":"Admiral::Command::Run","name":"Run"},{"html_id":"clear/Clear/CLI/Command","kind":"module","full_name":"Clear::CLI::Command","name":"Command"}],"namespace":{"html_id":"clear/Clear/CLI","kind":"module","full_name":"Clear::CLI","name":"CLI"},"class_methods":[{"html_id":"description-class-method","name":"description","abstract":false,"location":{"filename":"src/clear/cli.cr","line_number":15,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli.cr#L15"},"def":{"name":"description","visibility":"Public","body":"HELP[\"description\"]"}},{"html_id":"run(*args,**params)-class-method","name":"run","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **params)","args_html":"(*args, **params)","location":{"filename":"src/clear/cli.cr","line_number":15,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli.cr#L15"},"def":{"name":"run","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"params","external_name":"params","restriction":""},"splat_index":0,"visibility":"Public","body":"(new(*args, **params)).parse_and_run"}}],"instance_methods":[{"html_id":"__rescue_from___Admiral__Error(e)-instance-method","name":"__rescue_from___Admiral__Error","abstract":false,"args":[{"name":"e","external_name":"e","restriction":""}],"args_string":"(e)","args_html":"(e)","def":{"name":"__rescue_from___Admiral__Error","args":[{"name":"e","external_name":"e","restriction":""}],"visibility":"Public","body":"panic(e.message.colorize(:red))"}},{"html_id":"arguments-instance-method","name":"arguments","doc":"Returns the commands `Arguments` object.\n\nYou can access names arguments by name.\nYou can also access the remaning arguments using `.arguments[index]`.","summary":"

Returns the commands Arguments object.

","abstract":false,"location":{"filename":"src/clear/cli.cr","line_number":15,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli.cr#L15"},"def":{"name":"arguments","visibility":"Public","body":"@arguments || (@arguments = Arguments.new(self))"}},{"html_id":"flags-instance-method","name":"flags","doc":"Returns the commands `Flags` object.\n\nYou can access names flags by name.","summary":"

Returns the commands Flags object.

","abstract":false,"location":{"filename":"src/clear/cli.cr","line_number":15,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli.cr#L15"},"def":{"name":"flags","visibility":"Public","body":"@flags || (@flags = Flags.new(self))"}},{"html_id":"help-instance-method","name":"help","abstract":false,"def":{"name":"help","visibility":"Public","body":"[help_usage, \"\" + \"\\n\", help_flags, help_arguments, help_sub_commands].reject() do |__arg0|\n __arg0.strip.empty?\nend.join(\"\\n\")"}},{"html_id":"run-instance-method","name":"run","doc":"The run command.","summary":"

The run command.

","abstract":false,"location":{"filename":"src/clear/cli.cr","line_number":16,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli.cr#L16"},"def":{"name":"run","visibility":"Public","body":"Colorize.enabled = !flags.no_color\nrun_impl\n"}},{"html_id":"run_impl-instance-method","name":"run_impl","abstract":false,"location":{"filename":"src/clear/cli.cr","line_number":25,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli.cr#L25"},"def":{"name":"run_impl","visibility":"Public","body":"STDOUT.puts(help)"}},{"html_id":"sub(command,*args,**params)-instance-method","name":"sub","doc":"Invokes a sub command by name, passing `self` as the parent.","summary":"

Invokes a sub command by name, passing self as the parent.

","abstract":false,"args":[{"name":"command","external_name":"command","restriction":""},{"name":"args","external_name":"args","restriction":""}],"args_string":"(command, *args, **params)","args_html":"(command, *args, **params)","location":{"filename":"src/clear/cli.cr","line_number":15,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli.cr#L15"},"def":{"name":"sub","args":[{"name":"command","external_name":"command","restriction":""},{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"params","external_name":"params","restriction":""},"splat_index":1,"visibility":"Public","body":"SubCommands.invoke(command, *args, **params, parent: self)"}},{"html_id":"version-instance-method","name":"version","abstract":false,"location":{"filename":"src/clear/cli.cr","line_number":18,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli.cr#L18"},"def":{"name":"version","visibility":"Public","body":"Clear::VERSION"}}],"types":[{"html_id":"clear/Clear/CLI/Base/Arguments","path":"Clear/CLI/Base/Arguments.html","kind":"struct","full_name":"Clear::CLI::Base::Arguments","name":"Arguments","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Iterable","kind":"module","full_name":"Iterable","name":"Iterable"},{"html_id":"clear/Enumerable","kind":"module","full_name":"Enumerable","name":"Enumerable"},{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli.cr","line_number":15,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli.cr#L15"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"SPECS","name":"SPECS","value":"{} of String => NamedTuple(type: String, description: Tuple(String, String | ::Nil), default: String, is_required: Bool)"}],"included_modules":[{"html_id":"clear/Enumerable","kind":"module","full_name":"Enumerable","name":"Enumerable"},{"html_id":"clear/Iterable","kind":"module","full_name":"Iterable","name":"Iterable"}],"namespace":{"html_id":"clear/Clear/CLI/Base","kind":"class","full_name":"Clear::CLI::Base","name":"Base"},"constructors":[{"html_id":"new(command:Admiral::Command)-class-method","name":"new","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"new","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":"_ = allocate\n_.initialize(command)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"[](*args,**options)-instance-method","name":"[]","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","def":{"name":"[]","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@__rest__[*args, **options]"}},{"html_id":"[](*args,**options,&)-instance-method","name":"[]","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","def":{"name":"[]","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@__rest__.[](*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"each(*args,**options)-instance-method","name":"each","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","def":{"name":"each","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@__rest__.each(*args, **options)"}},{"html_id":"each(*args,**options,&)-instance-method","name":"each","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","def":{"name":"each","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@__rest__.each(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"exists?(name:Symbol)-instance-method","name":"exists?","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"exists?","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":"!!SPECS[name]?"}},{"html_id":"get(name:Symbol)-instance-method","name":"get","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"get","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":""}},{"html_id":"get?(name:Symbol)-instance-method","name":"get?","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"get?","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":"exists?(name) ? get(name) : false"}},{"html_id":"inspect(io)-instance-method","name":"inspect","abstract":false,"args":[{"name":"io","external_name":"io","restriction":""}],"args_string":"(io)","args_html":"(io)","location":{"filename":"src/clear/cli.cr","line_number":15,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli.cr#L15"},"def":{"name":"inspect","args":[{"name":"io","external_name":"io","restriction":""}],"visibility":"Public","body":"names = SPECS.keys\nif size > 0\n names << \"...\"\nend\nio << \"<#{self.class}\"\nio << \"(\"\nif names.empty?\nelse\n io << (names.join(\", \"))\nend\nio << \")\"\nio << \">\"\n"}},{"html_id":"rest:Array(String)-instance-method","name":"rest","abstract":false,"def":{"name":"rest","visibility":"Public","body":"@__rest__"}},{"html_id":"validate!(command:Admiral::Command)-instance-method","name":"validate!","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"validate!","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":""}},{"html_id":"value_from_spec(command:Admiral::Command,*,arg:String,type,default,is_required:Bool)-instance-method","name":"value_from_spec","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"},{"name":"","external_name":"","restriction":""},{"name":"arg","external_name":"arg","restriction":"String"},{"name":"type","external_name":"type","restriction":""},{"name":"default","external_name":"default","restriction":""},{"name":"is_required","external_name":"is_required","restriction":"Bool"}],"args_string":"(command : Admiral::Command, *, arg : String, type, default, is_required : Bool)","args_html":"(command : Admiral::Command, *, arg : String, type, default, is_required : Bool)","location":{"filename":"src/clear/cli.cr","line_number":15,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli.cr#L15"},"def":{"name":"value_from_spec","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"},{"name":"","external_name":"","restriction":""},{"name":"arg","external_name":"arg","restriction":"String"},{"name":"type","external_name":"type","restriction":""},{"name":"default","external_name":"default","restriction":""},{"name":"is_required","external_name":"is_required","restriction":"Bool"}],"splat_index":1,"visibility":"Public","body":"pos_only = false\nindex = 0\nwhile ((command.@argv)[index]?.to_s.starts_with?(\"-\")) && !pos_only\n index = index + 1\n pos_only = (command.@argv)[index]? == \"--\"\nend\nif (command.@argv)[index]?\n value = (command.@argv).delete_at(index)\n type.new(value)\nelse\n default\nend\n"}}]},{"html_id":"clear/Clear/CLI/Base/Flags","path":"Clear/CLI/Base/Flags.html","kind":"struct","full_name":"Clear::CLI::Base::Flags","name":"Flags","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli.cr","line_number":15,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli.cr#L15"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"DESCRIPTIONS","name":"DESCRIPTIONS","value":"{} of String => String"},{"id":"SPECS","name":"SPECS","value":"{\"verbose\" => {kind: \"bool\", type: \"Bool\", default: \"false\", description: {\"--verbose, -v\", \"Display verbose informations during execution\"}, short: \"v\", long: \"verbose\", is_required: true}, \"no_color\" => {kind: \"bool\", type: \"Bool\", default: \"false\", description: {\"--no-color\", \"Cancel color output\"}, short: \"nil\", long: \"no-color\", is_required: true}, \"__version__\" => {kind: \"bool\", type: \"Bool\", default: \"false\", description: {\"--version\", \"Displays the version of the current application.\"}, short: \"nil\", long: \"version\", is_required: true}, \"__help__\" => {kind: \"bool\", type: \"Bool\", default: \"false\", description: {\"--help\", \"Displays help for the current command.\"}, short: \"nil\", long: \"help\", is_required: true}} of String => NamedTuple(kind: String, type: String, default: String, description: Tuple(String, String | ::Nil), short: String | ::Nil, long: String, is_required: Bool)"}],"namespace":{"html_id":"clear/Clear/CLI/Base","kind":"class","full_name":"Clear::CLI::Base","name":"Base"},"doc":"Extend the flags struct to include the flag","summary":"

Extend the flags struct to include the flag

","constructors":[{"html_id":"new(command:Admiral::Command)-class-method","name":"new","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"new","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":"_ = allocate\n_.initialize(command)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"__help__-instance-method","name":"__help__","abstract":false,"def":{"name":"__help__","visibility":"Public","body":"@__help__.not_nil!"}},{"html_id":"__version__-instance-method","name":"__version__","abstract":false,"def":{"name":"__version__","visibility":"Public","body":"@__version__.not_nil!"}},{"html_id":"inspect(io)-instance-method","name":"inspect","abstract":false,"args":[{"name":"io","external_name":"io","restriction":""}],"args_string":"(io)","args_html":"(io)","location":{"filename":"src/clear/cli.cr","line_number":15,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli.cr#L15"},"def":{"name":"inspect","args":[{"name":"io","external_name":"io","restriction":""}],"visibility":"Public","body":"io << \"<#{self.class}\"\nio << \"(\"\nif SPECS.empty?\nelse\n io << (SPECS.keys.join(\", \"))\nend\nio << \")\"\nio << \">\"\n"}},{"html_id":"no_color-instance-method","name":"no_color","abstract":false,"def":{"name":"no_color","visibility":"Public","body":"@no_color.not_nil!"}},{"html_id":"validate!(command)-instance-method","name":"validate!","abstract":false,"args":[{"name":"command","external_name":"command","restriction":""}],"args_string":"(command)","args_html":"(command)","def":{"name":"validate!","args":[{"name":"command","external_name":"command","restriction":""}],"visibility":"Public","body":"if @verbose.nil?\n raise(Admiral::Error.new(\"Flag required: --verbose\"))\nend\nif @no_color.nil?\n raise(Admiral::Error.new(\"Flag required: --no-color\"))\nend\nif @__version__.nil?\n raise(Admiral::Error.new(\"Flag required: --version\"))\nend\nif @__help__.nil?\n raise(Admiral::Error.new(\"Flag required: --help\"))\nend\nraise_extra_flags!(command)\n"}},{"html_id":"verbose-instance-method","name":"verbose","abstract":false,"def":{"name":"verbose","visibility":"Public","body":"@verbose.not_nil!"}}]}]},{"html_id":"clear/Clear/CLI/Command","path":"Clear/CLI/Command.html","kind":"module","full_name":"Clear::CLI::Command","name":"Command","abstract":false,"locations":[{"filename":"src/clear/cli/command.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/command.cr#L1"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"clear/Clear/CLI/Base","kind":"class","full_name":"Clear::CLI::Base","name":"Base"},{"html_id":"clear/Clear/CLI/Generator","kind":"class","full_name":"Clear::CLI::Generator","name":"Generator"},{"html_id":"clear/Clear/CLI/Generator/Migration","kind":"class","full_name":"Clear::CLI::Generator::Migration","name":"Migration"},{"html_id":"clear/Clear/CLI/Generator/Model","kind":"class","full_name":"Clear::CLI::Generator::Model","name":"Model"},{"html_id":"clear/Clear/CLI/Generator/NewKemal","kind":"class","full_name":"Clear::CLI::Generator::NewKemal","name":"NewKemal"},{"html_id":"clear/Clear/CLI/Migration","kind":"class","full_name":"Clear::CLI::Migration","name":"Migration"},{"html_id":"clear/Clear/CLI/Migration/Down","kind":"class","full_name":"Clear::CLI::Migration::Down","name":"Down"},{"html_id":"clear/Clear/CLI/Migration/Migrate","kind":"class","full_name":"Clear::CLI::Migration::Migrate","name":"Migrate"},{"html_id":"clear/Clear/CLI/Migration/Rollback","kind":"class","full_name":"Clear::CLI::Migration::Rollback","name":"Rollback"},{"html_id":"clear/Clear/CLI/Migration/Seed","kind":"class","full_name":"Clear::CLI::Migration::Seed","name":"Seed"},{"html_id":"clear/Clear/CLI/Migration/Set","kind":"class","full_name":"Clear::CLI::Migration::Set","name":"Set"},{"html_id":"clear/Clear/CLI/Migration/Status","kind":"class","full_name":"Clear::CLI::Migration::Status","name":"Status"},{"html_id":"clear/Clear/CLI/Migration/Up","kind":"class","full_name":"Clear::CLI::Migration::Up","name":"Up"},{"html_id":"clear/Clear/CLI/Seed","kind":"class","full_name":"Clear::CLI::Seed","name":"Seed"}],"namespace":{"html_id":"clear/Clear/CLI","kind":"module","full_name":"Clear::CLI","name":"CLI"}},{"html_id":"clear/Clear/CLI/Generator","path":"Clear/CLI/Generator.html","kind":"class","full_name":"Clear::CLI::Generator","name":"Generator","abstract":false,"superclass":{"html_id":"clear/Admiral/Command","kind":"class","full_name":"Admiral::Command","name":"Command"},"ancestors":[{"html_id":"clear/Admiral/Command/Run","kind":"module","full_name":"Admiral::Command::Run","name":"Run"},{"html_id":"clear/Clear/CLI/Command","kind":"module","full_name":"Clear::CLI::Command","name":"Command"},{"html_id":"clear/Admiral/Command","kind":"class","full_name":"Admiral::Command","name":"Command"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli/generator.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generator.cr#L4"},{"filename":"src/clear/cli/generators/migration.cr","line_number":3,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/migration.cr#L3"},{"filename":"src/clear/cli/generators/model.cr","line_number":3,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/model.cr#L3"},{"filename":"src/clear/cli/generators/new/kemal.cr","line_number":3,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/new/kemal.cr#L3"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"HELP","name":"HELP","value":"{\"description\" => \"\"}"}],"included_modules":[{"html_id":"clear/Admiral/Command/Run","kind":"module","full_name":"Admiral::Command::Run","name":"Run"},{"html_id":"clear/Clear/CLI/Command","kind":"module","full_name":"Clear::CLI::Command","name":"Command"}],"namespace":{"html_id":"clear/Clear/CLI","kind":"module","full_name":"Clear::CLI","name":"CLI"},"class_methods":[{"html_id":"[](name)-class-method","name":"[]","abstract":false,"args":[{"name":"name","external_name":"name","restriction":""}],"args_string":"(name)","args_html":"(name)","location":{"filename":"src/clear/cli/generator.cr","line_number":21,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generator.cr#L21"},"def":{"name":"[]","args":[{"name":"name","external_name":"name","restriction":""}],"visibility":"Public","body":"@@generators[name]"}},{"html_id":"[]?(name)-class-method","name":"[]?","abstract":false,"args":[{"name":"name","external_name":"name","restriction":""}],"args_string":"(name)","args_html":"(name)","location":{"filename":"src/clear/cli/generator.cr","line_number":17,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generator.cr#L17"},"def":{"name":"[]?","args":[{"name":"name","external_name":"name","restriction":""}],"visibility":"Public","body":"@@generators[name]?"}},{"html_id":"add(name,desc,&block:Array(String)->Nil)-class-method","name":"add","abstract":false,"args":[{"name":"name","external_name":"name","restriction":""},{"name":"desc","external_name":"desc","restriction":""}],"args_string":"(name, desc, &block : Array(String) -> Nil)","args_html":"(name, desc, &block : Array(String) -> Nil)","location":{"filename":"src/clear/cli/generator.cr","line_number":13,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generator.cr#L13"},"def":{"name":"add","args":[{"name":"name","external_name":"name","restriction":""},{"name":"desc","external_name":"desc","restriction":""}],"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Array(String) -> Nil)"},"visibility":"Public","body":"@@generators[name] = Record.new(name, desc, block)"}},{"html_id":"description-class-method","name":"description","abstract":false,"location":{"filename":"src/clear/cli/generator.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generator.cr#L4"},"def":{"name":"description","visibility":"Public","body":"HELP[\"description\"]"}},{"html_id":"generators-class-method","name":"generators","abstract":false,"location":{"filename":"src/clear/cli/generator.cr","line_number":11,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generator.cr#L11"},"def":{"name":"generators","visibility":"Public","body":"@@generators"}},{"html_id":"run(*args,**params)-class-method","name":"run","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **params)","args_html":"(*args, **params)","location":{"filename":"src/clear/cli/generator.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generator.cr#L4"},"def":{"name":"run","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"params","external_name":"params","restriction":""},"splat_index":0,"visibility":"Public","body":"(new(*args, **params)).parse_and_run"}}],"instance_methods":[{"html_id":"__rescue_from___Admiral__Error(e)-instance-method","name":"__rescue_from___Admiral__Error","abstract":false,"args":[{"name":"e","external_name":"e","restriction":""}],"args_string":"(e)","args_html":"(e)","def":{"name":"__rescue_from___Admiral__Error","args":[{"name":"e","external_name":"e","restriction":""}],"visibility":"Public","body":"panic(e.message.colorize(:red))"}},{"html_id":"arguments-instance-method","name":"arguments","doc":"Returns the commands `Arguments` object.\n\nYou can access names arguments by name.\nYou can also access the remaning arguments using `.arguments[index]`.","summary":"

Returns the commands Arguments object.

","abstract":false,"location":{"filename":"src/clear/cli/generator.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generator.cr#L4"},"def":{"name":"arguments","visibility":"Public","body":"@arguments || (@arguments = Arguments.new(self))"}},{"html_id":"flags-instance-method","name":"flags","doc":"Returns the commands `Flags` object.\n\nYou can access names flags by name.","summary":"

Returns the commands Flags object.

","abstract":false,"location":{"filename":"src/clear/cli/generator.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generator.cr#L4"},"def":{"name":"flags","visibility":"Public","body":"@flags || (@flags = Flags.new(self))"}},{"html_id":"help-instance-method","name":"help","abstract":false,"def":{"name":"help","visibility":"Public","body":"[help_usage, \"Generate code automatically\" + \"\\n\", help_flags, help_arguments, help_sub_commands].reject() do |__arg0|\n __arg0.strip.empty?\nend.join(\"\\n\")"}},{"html_id":"run-instance-method","name":"run","doc":"The run command.","summary":"

The run command.

","abstract":false,"location":{"filename":"src/clear/cli/generator.cr","line_number":5,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generator.cr#L5"},"def":{"name":"run","visibility":"Public","body":"Colorize.enabled = !flags.no_color\nrun_impl\n"}},{"html_id":"run_impl-instance-method","name":"run_impl","abstract":false,"location":{"filename":"src/clear/cli/generator.cr","line_number":25,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generator.cr#L25"},"def":{"name":"run_impl","visibility":"Public","body":"puts(help)"}},{"html_id":"sub(command,*args,**params)-instance-method","name":"sub","doc":"Invokes a sub command by name, passing `self` as the parent.","summary":"

Invokes a sub command by name, passing self as the parent.

","abstract":false,"args":[{"name":"command","external_name":"command","restriction":""},{"name":"args","external_name":"args","restriction":""}],"args_string":"(command, *args, **params)","args_html":"(command, *args, **params)","location":{"filename":"src/clear/cli/generator.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generator.cr#L4"},"def":{"name":"sub","args":[{"name":"command","external_name":"command","restriction":""},{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"params","external_name":"params","restriction":""},"splat_index":1,"visibility":"Public","body":"SubCommands.invoke(command, *args, **params, parent: self)"}}],"macros":[{"html_id":"ecr_to_s(string,opts)-macro","name":"ecr_to_s","abstract":false,"args":[{"name":"string","external_name":"string","restriction":""},{"name":"opts","external_name":"opts","restriction":""}],"args_string":"(string, opts)","args_html":"(string, opts)","location":{"filename":"src/clear/cli/generator.cr","line_number":29,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generator.cr#L29"},"def":{"name":"ecr_to_s","args":[{"name":"string","external_name":"string","restriction":""},{"name":"opts","external_name":"opts","restriction":""}],"visibility":"Public","body":" opts = \n{{ opts }}\n\n io = IO::Memory.new\n ECR.embed \n{{ string }}\n, io\n io.to_s\n \n"}}],"types":[{"html_id":"clear/Clear/CLI/Generator/Arguments","path":"Clear/CLI/Generator/Arguments.html","kind":"struct","full_name":"Clear::CLI::Generator::Arguments","name":"Arguments","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Iterable","kind":"module","full_name":"Iterable","name":"Iterable"},{"html_id":"clear/Enumerable","kind":"module","full_name":"Enumerable","name":"Enumerable"},{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli/generator.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generator.cr#L4"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"SPECS","name":"SPECS","value":"{} of String => NamedTuple(type: String, description: Tuple(String, String | ::Nil), default: String, is_required: Bool)"}],"included_modules":[{"html_id":"clear/Enumerable","kind":"module","full_name":"Enumerable","name":"Enumerable"},{"html_id":"clear/Iterable","kind":"module","full_name":"Iterable","name":"Iterable"}],"namespace":{"html_id":"clear/Clear/CLI/Generator","kind":"class","full_name":"Clear::CLI::Generator","name":"Generator"},"constructors":[{"html_id":"new(command:Admiral::Command)-class-method","name":"new","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"new","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":"_ = allocate\n_.initialize(command)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"[](*args,**options)-instance-method","name":"[]","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","def":{"name":"[]","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@__rest__[*args, **options]"}},{"html_id":"[](*args,**options,&)-instance-method","name":"[]","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","def":{"name":"[]","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@__rest__.[](*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"each(*args,**options)-instance-method","name":"each","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","def":{"name":"each","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@__rest__.each(*args, **options)"}},{"html_id":"each(*args,**options,&)-instance-method","name":"each","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","def":{"name":"each","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@__rest__.each(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"exists?(name:Symbol)-instance-method","name":"exists?","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"exists?","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":"!!SPECS[name]?"}},{"html_id":"get(name:Symbol)-instance-method","name":"get","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"get","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":""}},{"html_id":"get?(name:Symbol)-instance-method","name":"get?","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"get?","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":"exists?(name) ? get(name) : false"}},{"html_id":"inspect(io)-instance-method","name":"inspect","abstract":false,"args":[{"name":"io","external_name":"io","restriction":""}],"args_string":"(io)","args_html":"(io)","location":{"filename":"src/clear/cli/generator.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generator.cr#L4"},"def":{"name":"inspect","args":[{"name":"io","external_name":"io","restriction":""}],"visibility":"Public","body":"names = SPECS.keys\nif size > 0\n names << \"...\"\nend\nio << \"<#{self.class}\"\nio << \"(\"\nif names.empty?\nelse\n io << (names.join(\", \"))\nend\nio << \")\"\nio << \">\"\n"}},{"html_id":"rest:Array(String)-instance-method","name":"rest","abstract":false,"def":{"name":"rest","visibility":"Public","body":"@__rest__"}},{"html_id":"validate!(command:Admiral::Command)-instance-method","name":"validate!","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"validate!","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":""}},{"html_id":"value_from_spec(command:Admiral::Command,*,arg:String,type,default,is_required:Bool)-instance-method","name":"value_from_spec","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"},{"name":"","external_name":"","restriction":""},{"name":"arg","external_name":"arg","restriction":"String"},{"name":"type","external_name":"type","restriction":""},{"name":"default","external_name":"default","restriction":""},{"name":"is_required","external_name":"is_required","restriction":"Bool"}],"args_string":"(command : Admiral::Command, *, arg : String, type, default, is_required : Bool)","args_html":"(command : Admiral::Command, *, arg : String, type, default, is_required : Bool)","location":{"filename":"src/clear/cli/generator.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generator.cr#L4"},"def":{"name":"value_from_spec","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"},{"name":"","external_name":"","restriction":""},{"name":"arg","external_name":"arg","restriction":"String"},{"name":"type","external_name":"type","restriction":""},{"name":"default","external_name":"default","restriction":""},{"name":"is_required","external_name":"is_required","restriction":"Bool"}],"splat_index":1,"visibility":"Public","body":"pos_only = false\nindex = 0\nwhile ((command.@argv)[index]?.to_s.starts_with?(\"-\")) && !pos_only\n index = index + 1\n pos_only = (command.@argv)[index]? == \"--\"\nend\nif (command.@argv)[index]?\n value = (command.@argv).delete_at(index)\n type.new(value)\nelse\n default\nend\n"}}]},{"html_id":"clear/Clear/CLI/Generator/Flags","path":"Clear/CLI/Generator/Flags.html","kind":"struct","full_name":"Clear::CLI::Generator::Flags","name":"Flags","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli/generator.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generator.cr#L4"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"DESCRIPTIONS","name":"DESCRIPTIONS","value":"{} of String => String"},{"id":"SPECS","name":"SPECS","value":"{\"verbose\" => {kind: \"bool\", type: \"Bool\", default: \"false\", description: {\"--verbose, -v\", \"Display verbose informations during execution\"}, short: \"v\", long: \"verbose\", is_required: true}, \"no_color\" => {kind: \"bool\", type: \"Bool\", default: \"false\", description: {\"--no-color\", \"Cancel color output\"}, short: \"nil\", long: \"no-color\", is_required: true}, \"__help__\" => {kind: \"bool\", type: \"Bool\", default: \"false\", description: {\"--help\", \"Displays help for the current command.\"}, short: \"nil\", long: \"help\", is_required: true}} of String => NamedTuple(kind: String, type: String, default: String, description: Tuple(String, String | ::Nil), short: String | ::Nil, long: String, is_required: Bool)"}],"namespace":{"html_id":"clear/Clear/CLI/Generator","kind":"class","full_name":"Clear::CLI::Generator","name":"Generator"},"doc":"Extend the flags struct to include the flag","summary":"

Extend the flags struct to include the flag

","constructors":[{"html_id":"new(command:Admiral::Command)-class-method","name":"new","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"new","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":"_ = allocate\n_.initialize(command)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"__help__-instance-method","name":"__help__","abstract":false,"def":{"name":"__help__","visibility":"Public","body":"@__help__.not_nil!"}},{"html_id":"inspect(io)-instance-method","name":"inspect","abstract":false,"args":[{"name":"io","external_name":"io","restriction":""}],"args_string":"(io)","args_html":"(io)","location":{"filename":"src/clear/cli/generator.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generator.cr#L4"},"def":{"name":"inspect","args":[{"name":"io","external_name":"io","restriction":""}],"visibility":"Public","body":"io << \"<#{self.class}\"\nio << \"(\"\nif SPECS.empty?\nelse\n io << (SPECS.keys.join(\", \"))\nend\nio << \")\"\nio << \">\"\n"}},{"html_id":"no_color-instance-method","name":"no_color","abstract":false,"def":{"name":"no_color","visibility":"Public","body":"@no_color.not_nil!"}},{"html_id":"validate!(command)-instance-method","name":"validate!","abstract":false,"args":[{"name":"command","external_name":"command","restriction":""}],"args_string":"(command)","args_html":"(command)","def":{"name":"validate!","args":[{"name":"command","external_name":"command","restriction":""}],"visibility":"Public","body":"if @verbose.nil?\n raise(Admiral::Error.new(\"Flag required: --verbose\"))\nend\nif @no_color.nil?\n raise(Admiral::Error.new(\"Flag required: --no-color\"))\nend\nif @__help__.nil?\n raise(Admiral::Error.new(\"Flag required: --help\"))\nend\nraise_extra_flags!(command)\n"}},{"html_id":"verbose-instance-method","name":"verbose","abstract":false,"def":{"name":"verbose","visibility":"Public","body":"@verbose.not_nil!"}}]},{"html_id":"clear/Clear/CLI/Generator/Migration","path":"Clear/CLI/Generator/Migration.html","kind":"class","full_name":"Clear::CLI::Generator::Migration","name":"Migration","abstract":false,"superclass":{"html_id":"clear/Admiral/Command","kind":"class","full_name":"Admiral::Command","name":"Command"},"ancestors":[{"html_id":"clear/Clear/CLI/Command","kind":"module","full_name":"Clear::CLI::Command","name":"Command"},{"html_id":"clear/Admiral/Command","kind":"class","full_name":"Admiral::Command","name":"Command"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli/generators/migration.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/migration.cr#L6"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"HELP","name":"HELP","value":"{\"description\" => \"\"}"}],"included_modules":[{"html_id":"clear/Clear/CLI/Command","kind":"module","full_name":"Clear::CLI::Command","name":"Command"}],"namespace":{"html_id":"clear/Clear/CLI/Generator","kind":"class","full_name":"Clear::CLI::Generator","name":"Generator"},"class_methods":[{"html_id":"description-class-method","name":"description","abstract":false,"location":{"filename":"src/clear/cli/generators/migration.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/migration.cr#L6"},"def":{"name":"description","visibility":"Public","body":"HELP[\"description\"]"}},{"html_id":"run(*args,**params)-class-method","name":"run","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **params)","args_html":"(*args, **params)","location":{"filename":"src/clear/cli/generators/migration.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/migration.cr#L6"},"def":{"name":"run","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"params","external_name":"params","restriction":""},"splat_index":0,"visibility":"Public","body":"(new(*args, **params)).parse_and_run"}}],"instance_methods":[{"html_id":"__rescue_from___Admiral__Error(e)-instance-method","name":"__rescue_from___Admiral__Error","abstract":false,"args":[{"name":"e","external_name":"e","restriction":""}],"args_string":"(e)","args_html":"(e)","def":{"name":"__rescue_from___Admiral__Error","args":[{"name":"e","external_name":"e","restriction":""}],"visibility":"Public","body":"panic(e.message.colorize(:red))"}},{"html_id":"arguments-instance-method","name":"arguments","doc":"Returns the commands `Arguments` object.\n\nYou can access names arguments by name.\nYou can also access the remaning arguments using `.arguments[index]`.","summary":"

Returns the commands Arguments object.

","abstract":false,"location":{"filename":"src/clear/cli/generators/migration.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/migration.cr#L6"},"def":{"name":"arguments","visibility":"Public","body":"@arguments || (@arguments = Arguments.new(self))"}},{"html_id":"flags-instance-method","name":"flags","doc":"Returns the commands `Flags` object.\n\nYou can access names flags by name.","summary":"

Returns the commands Flags object.

","abstract":false,"location":{"filename":"src/clear/cli/generators/migration.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/migration.cr#L6"},"def":{"name":"flags","visibility":"Public","body":"@flags || (@flags = Flags.new(self))"}},{"html_id":"help-instance-method","name":"help","abstract":false,"def":{"name":"help","visibility":"Public","body":"[help_usage, \"Generate a new migration\" + \"\\n\", help_flags, help_arguments, help_sub_commands].reject() do |__arg0|\n __arg0.strip.empty?\nend.join(\"\\n\")"}},{"html_id":"run-instance-method","name":"run","doc":"The run command.","summary":"

The run command.

","abstract":false,"location":{"filename":"src/clear/cli/generators/migration.cr","line_number":7,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/migration.cr#L7"},"def":{"name":"run","visibility":"Public","body":"Colorize.enabled = !flags.no_color\nrun_impl\n"}},{"html_id":"run_impl-instance-method","name":"run_impl","abstract":false,"location":{"filename":"src/clear/cli/generators/migration.cr","line_number":19,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/migration.cr#L19"},"def":{"name":"run_impl","visibility":"Public","body":"g = Generate::Generator.new\ng.target_directory = flags.directory\nname = arguments.name\nif name\n name_underscore = name.underscore\n class_name = name.camelcase\n migration_uid = Time.local.to_unix.to_s.rjust(10, '0')\n g[\"migration_uid\"] = migration_uid\n g[\"class_name\"] = class_name\n migration_file = \"#{migration_uid}_#{name_underscore}.cr\"\n if Dir[File.join(g.target_directory, \"src/db/migrations/*_#{name_underscore}.cr\")].empty?\n else\n puts(\"A migration file `xxxx_#{name_underscore}.cr` already exists\")\n exit(1)\n end\n g.in_directory(\"src/db/migrations\") do\n g.file(migration_file, Clear::CLI::Generator.ecr_to_s(\"/home/runner/work/clear/clear/src/clear/cli/generators/../../../../templates/migration.cr.ecr\", g))\n end\nelse\n puts(\"Please provide a name for the migration\")\n exit(1)\nend\n"}},{"html_id":"sub(command,*args,**params)-instance-method","name":"sub","doc":"Invokes a sub command by name, passing `self` as the parent.","summary":"

Invokes a sub command by name, passing self as the parent.

","abstract":false,"args":[{"name":"command","external_name":"command","restriction":""},{"name":"args","external_name":"args","restriction":""}],"args_string":"(command, *args, **params)","args_html":"(command, *args, **params)","location":{"filename":"src/clear/cli/generators/migration.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/migration.cr#L6"},"def":{"name":"sub","args":[{"name":"command","external_name":"command","restriction":""},{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"params","external_name":"params","restriction":""},"splat_index":1,"visibility":"Public","body":"SubCommands.invoke(command, *args, **params, parent: self)"}}],"types":[{"html_id":"clear/Clear/CLI/Generator/Migration/Arguments","path":"Clear/CLI/Generator/Migration/Arguments.html","kind":"struct","full_name":"Clear::CLI::Generator::Migration::Arguments","name":"Arguments","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Iterable","kind":"module","full_name":"Iterable","name":"Iterable"},{"html_id":"clear/Enumerable","kind":"module","full_name":"Enumerable","name":"Enumerable"},{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli/generators/migration.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/migration.cr#L6"},{"filename":"src/clear/cli/generators/migration.cr","line_number":17,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/migration.cr#L17"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"SPECS","name":"SPECS","value":"{\"name\" => {type: \"String\", description: {\"name\", \"\"}, default: \"nil\", is_required: false}} of String => NamedTuple(type: String, description: Tuple(String, String | ::Nil), default: String, is_required: Bool)"}],"included_modules":[{"html_id":"clear/Enumerable","kind":"module","full_name":"Enumerable","name":"Enumerable"},{"html_id":"clear/Iterable","kind":"module","full_name":"Iterable","name":"Iterable"}],"namespace":{"html_id":"clear/Clear/CLI/Generator/Migration","kind":"class","full_name":"Clear::CLI::Generator::Migration","name":"Migration"},"constructors":[{"html_id":"new(command:Admiral::Command)-class-method","name":"new","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"new","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":"_ = allocate\n_.initialize(command)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"[](*args,**options)-instance-method","name":"[]","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","def":{"name":"[]","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@__rest__[*args, **options]"}},{"html_id":"[](*args,**options,&)-instance-method","name":"[]","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","def":{"name":"[]","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@__rest__.[](*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"each(*args,**options)-instance-method","name":"each","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","def":{"name":"each","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@__rest__.each(*args, **options)"}},{"html_id":"each(*args,**options,&)-instance-method","name":"each","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","def":{"name":"each","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@__rest__.each(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"exists?(name:Symbol)-instance-method","name":"exists?","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"exists?","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":"!!SPECS[name]?"}},{"html_id":"get(name:Symbol)-instance-method","name":"get","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"get","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":"{name: @name}[name]?"}},{"html_id":"get?(name:Symbol)-instance-method","name":"get?","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"get?","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":"exists?(name) ? get(name) : false"}},{"html_id":"inspect(io)-instance-method","name":"inspect","abstract":false,"args":[{"name":"io","external_name":"io","restriction":""}],"args_string":"(io)","args_html":"(io)","location":{"filename":"src/clear/cli/generators/migration.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/migration.cr#L6"},"def":{"name":"inspect","args":[{"name":"io","external_name":"io","restriction":""}],"visibility":"Public","body":"names = SPECS.keys\nif size > 0\n names << \"...\"\nend\nio << \"<#{self.class}\"\nio << \"(\"\nif names.empty?\nelse\n io << (names.join(\", \"))\nend\nio << \")\"\nio << \">\"\n"}},{"html_id":"name:String|Nil-instance-method","name":"name","abstract":false,"location":{"filename":"src/clear/cli/generators/migration.cr","line_number":17,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/migration.cr#L17"},"def":{"name":"name","return_type":"String | Nil","visibility":"Public","body":"@name"}},{"html_id":"rest:Array(String)-instance-method","name":"rest","abstract":false,"def":{"name":"rest","visibility":"Public","body":"@__rest__"}},{"html_id":"validate!(command:Admiral::Command)-instance-method","name":"validate!","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"validate!","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":"if {type: \"String\", description: {\"name\", \"\"}, default: \"nil\", is_required: false}[:is_required] && @name.nil?\n raise(Admiral::Error.new(\"Argument required: name\"))\nend"}},{"html_id":"value_from_spec(command:Admiral::Command,*,arg:String,type,default,is_required:Bool)-instance-method","name":"value_from_spec","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"},{"name":"","external_name":"","restriction":""},{"name":"arg","external_name":"arg","restriction":"String"},{"name":"type","external_name":"type","restriction":""},{"name":"default","external_name":"default","restriction":""},{"name":"is_required","external_name":"is_required","restriction":"Bool"}],"args_string":"(command : Admiral::Command, *, arg : String, type, default, is_required : Bool)","args_html":"(command : Admiral::Command, *, arg : String, type, default, is_required : Bool)","location":{"filename":"src/clear/cli/generators/migration.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/migration.cr#L6"},"def":{"name":"value_from_spec","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"},{"name":"","external_name":"","restriction":""},{"name":"arg","external_name":"arg","restriction":"String"},{"name":"type","external_name":"type","restriction":""},{"name":"default","external_name":"default","restriction":""},{"name":"is_required","external_name":"is_required","restriction":"Bool"}],"splat_index":1,"visibility":"Public","body":"pos_only = false\nindex = 0\nwhile ((command.@argv)[index]?.to_s.starts_with?(\"-\")) && !pos_only\n index = index + 1\n pos_only = (command.@argv)[index]? == \"--\"\nend\nif (command.@argv)[index]?\n value = (command.@argv).delete_at(index)\n type.new(value)\nelse\n default\nend\n"}}]},{"html_id":"clear/Clear/CLI/Generator/Migration/Flags","path":"Clear/CLI/Generator/Migration/Flags.html","kind":"struct","full_name":"Clear::CLI::Generator::Migration::Flags","name":"Flags","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli/generators/migration.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/migration.cr#L6"},{"filename":"src/clear/cli/generators/migration.cr","line_number":11,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/migration.cr#L11"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"DESCRIPTIONS","name":"DESCRIPTIONS","value":"{} of String => String"},{"id":"SPECS","name":"SPECS","value":"{\"verbose\" => {kind: \"bool\", type: \"Bool\", default: \"false\", description: {\"--verbose, -v\", \"Display verbose informations during execution\"}, short: \"v\", long: \"verbose\", is_required: true}, \"no_color\" => {kind: \"bool\", type: \"Bool\", default: \"false\", description: {\"--no-color\", \"Cancel color output\"}, short: \"nil\", long: \"no-color\", is_required: true}, \"__help__\" => {kind: \"bool\", type: \"Bool\", default: \"false\", description: {\"--help\", \"Displays help for the current command.\"}, short: \"nil\", long: \"help\", is_required: true}, \"directory\" => {kind: \"nil\", type: \"String\", default: \"\\\".\\\"\", description: {\"--directory, -d (default: \\\".\\\")\", \"Set target directory\"}, short: \"d\", long: \"directory\", is_required: true}} of String => NamedTuple(kind: String, type: String, default: String, description: Tuple(String, String | ::Nil), short: String | ::Nil, long: String, is_required: Bool)"}],"namespace":{"html_id":"clear/Clear/CLI/Generator/Migration","kind":"class","full_name":"Clear::CLI::Generator::Migration","name":"Migration"},"doc":"Extend the flags struct to include the flag","summary":"

Extend the flags struct to include the flag

","constructors":[{"html_id":"new(command:Admiral::Command)-class-method","name":"new","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"new","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":"_ = allocate\n_.initialize(command)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"__help__-instance-method","name":"__help__","abstract":false,"def":{"name":"__help__","visibility":"Public","body":"@__help__.not_nil!"}},{"html_id":"directory-instance-method","name":"directory","abstract":false,"location":{"filename":"src/clear/cli/generators/migration.cr","line_number":11,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/migration.cr#L11"},"def":{"name":"directory","visibility":"Public","body":"@directory.not_nil!"}},{"html_id":"inspect(io)-instance-method","name":"inspect","abstract":false,"args":[{"name":"io","external_name":"io","restriction":""}],"args_string":"(io)","args_html":"(io)","location":{"filename":"src/clear/cli/generators/migration.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/migration.cr#L6"},"def":{"name":"inspect","args":[{"name":"io","external_name":"io","restriction":""}],"visibility":"Public","body":"io << \"<#{self.class}\"\nio << \"(\"\nif SPECS.empty?\nelse\n io << (SPECS.keys.join(\", \"))\nend\nio << \")\"\nio << \">\"\n"}},{"html_id":"no_color-instance-method","name":"no_color","abstract":false,"def":{"name":"no_color","visibility":"Public","body":"@no_color.not_nil!"}},{"html_id":"validate!(command)-instance-method","name":"validate!","abstract":false,"args":[{"name":"command","external_name":"command","restriction":""}],"args_string":"(command)","args_html":"(command)","def":{"name":"validate!","args":[{"name":"command","external_name":"command","restriction":""}],"visibility":"Public","body":"if @verbose.nil?\n raise(Admiral::Error.new(\"Flag required: --verbose\"))\nend\nif @no_color.nil?\n raise(Admiral::Error.new(\"Flag required: --no-color\"))\nend\nif @__help__.nil?\n raise(Admiral::Error.new(\"Flag required: --help\"))\nend\nif @directory.nil?\n raise(Admiral::Error.new(\"Flag required: --directory\"))\nend\nraise_extra_flags!(command)\n"}},{"html_id":"verbose-instance-method","name":"verbose","abstract":false,"def":{"name":"verbose","visibility":"Public","body":"@verbose.not_nil!"}}]}]},{"html_id":"clear/Clear/CLI/Generator/Model","path":"Clear/CLI/Generator/Model.html","kind":"class","full_name":"Clear::CLI::Generator::Model","name":"Model","abstract":false,"superclass":{"html_id":"clear/Admiral/Command","kind":"class","full_name":"Admiral::Command","name":"Command"},"ancestors":[{"html_id":"clear/Clear/CLI/Command","kind":"module","full_name":"Clear::CLI::Command","name":"Command"},{"html_id":"clear/Admiral/Command","kind":"class","full_name":"Admiral::Command","name":"Command"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli/generators/model.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/model.cr#L6"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"HELP","name":"HELP","value":"{\"description\" => \"\"}"}],"included_modules":[{"html_id":"clear/Clear/CLI/Command","kind":"module","full_name":"Clear::CLI::Command","name":"Command"}],"namespace":{"html_id":"clear/Clear/CLI/Generator","kind":"class","full_name":"Clear::CLI::Generator","name":"Generator"},"class_methods":[{"html_id":"description-class-method","name":"description","abstract":false,"location":{"filename":"src/clear/cli/generators/model.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/model.cr#L6"},"def":{"name":"description","visibility":"Public","body":"HELP[\"description\"]"}},{"html_id":"run(*args,**params)-class-method","name":"run","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **params)","args_html":"(*args, **params)","location":{"filename":"src/clear/cli/generators/model.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/model.cr#L6"},"def":{"name":"run","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"params","external_name":"params","restriction":""},"splat_index":0,"visibility":"Public","body":"(new(*args, **params)).parse_and_run"}}],"instance_methods":[{"html_id":"__rescue_from___Admiral__Error(e)-instance-method","name":"__rescue_from___Admiral__Error","abstract":false,"args":[{"name":"e","external_name":"e","restriction":""}],"args_string":"(e)","args_html":"(e)","def":{"name":"__rescue_from___Admiral__Error","args":[{"name":"e","external_name":"e","restriction":""}],"visibility":"Public","body":"panic(e.message.colorize(:red))"}},{"html_id":"arguments-instance-method","name":"arguments","doc":"Returns the commands `Arguments` object.\n\nYou can access names arguments by name.\nYou can also access the remaning arguments using `.arguments[index]`.","summary":"

Returns the commands Arguments object.

","abstract":false,"location":{"filename":"src/clear/cli/generators/model.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/model.cr#L6"},"def":{"name":"arguments","visibility":"Public","body":"@arguments || (@arguments = Arguments.new(self))"}},{"html_id":"flags-instance-method","name":"flags","doc":"Returns the commands `Flags` object.\n\nYou can access names flags by name.","summary":"

Returns the commands Flags object.

","abstract":false,"location":{"filename":"src/clear/cli/generators/model.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/model.cr#L6"},"def":{"name":"flags","visibility":"Public","body":"@flags || (@flags = Flags.new(self))"}},{"html_id":"help-instance-method","name":"help","abstract":false,"def":{"name":"help","visibility":"Public","body":"[help_usage, \"Create a new model and the first migration\" + \"\\n\", help_flags, help_arguments, help_sub_commands].reject() do |__arg0|\n __arg0.strip.empty?\nend.join(\"\\n\")"}},{"html_id":"run-instance-method","name":"run","doc":"The run command.","summary":"

The run command.

","abstract":false,"location":{"filename":"src/clear/cli/generators/model.cr","line_number":7,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/model.cr#L7"},"def":{"name":"run","visibility":"Public","body":"Colorize.enabled = !flags.no_color\nrun_impl\n"}},{"html_id":"run_impl-instance-method","name":"run_impl","abstract":false,"location":{"filename":"src/clear/cli/generators/model.cr","line_number":19,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/model.cr#L19"},"def":{"name":"run_impl","visibility":"Public","body":"g = Generate::Generator.new\ng.target_directory = flags.directory\nname = arguments.name\nif name\n name_underscore = name.underscore\n model_table = name_underscore.pluralize\n class_name = name.camelcase\n fields = @argv.join(\"|\")\n migration_uid = Time.local.to_unix.to_s.rjust(10, '0')\n g[\"model_class\"] = class_name\n g[\"migration_uid\"] = migration_uid\n g[\"model_table\"] = model_table\n g[\"model_fields\"] = fields\n model_file = \"#{name_underscore}.cr\"\n migration_file = \"#{migration_uid}_create_#{name_underscore.pluralize}.cr\"\n if Dir[File.join(g.target_directory, \"src/db/migrations/*_create_#{name_underscore.pluralize}.cr\")].empty?\n else\n puts(\"A migration file `xxxx__create_#{name_underscore.pluralize}.cr` already exists\")\n exit(1)\n end\n g.in_directory(\"src/models\") do\n g.file(model_file, Clear::CLI::Generator.ecr_to_s(\"/home/runner/work/clear/clear/src/clear/cli/generators/../../../../templates/model/model.cr.ecr\", g))\n end\n g.in_directory(\"src/db/migrations\") do\n g.file(migration_file, Clear::CLI::Generator.ecr_to_s(\"/home/runner/work/clear/clear/src/clear/cli/generators/../../../../templates/model/migration.cr.ecr\", g))\n end\nelse\n puts(\"Please provide a name for the model\")\n exit(1)\nend\n"}},{"html_id":"sub(command,*args,**params)-instance-method","name":"sub","doc":"Invokes a sub command by name, passing `self` as the parent.","summary":"

Invokes a sub command by name, passing self as the parent.

","abstract":false,"args":[{"name":"command","external_name":"command","restriction":""},{"name":"args","external_name":"args","restriction":""}],"args_string":"(command, *args, **params)","args_html":"(command, *args, **params)","location":{"filename":"src/clear/cli/generators/model.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/model.cr#L6"},"def":{"name":"sub","args":[{"name":"command","external_name":"command","restriction":""},{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"params","external_name":"params","restriction":""},"splat_index":1,"visibility":"Public","body":"SubCommands.invoke(command, *args, **params, parent: self)"}}],"types":[{"html_id":"clear/Clear/CLI/Generator/Model/Arguments","path":"Clear/CLI/Generator/Model/Arguments.html","kind":"struct","full_name":"Clear::CLI::Generator::Model::Arguments","name":"Arguments","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Iterable","kind":"module","full_name":"Iterable","name":"Iterable"},{"html_id":"clear/Enumerable","kind":"module","full_name":"Enumerable","name":"Enumerable"},{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli/generators/model.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/model.cr#L6"},{"filename":"src/clear/cli/generators/model.cr","line_number":17,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/model.cr#L17"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"SPECS","name":"SPECS","value":"{\"name\" => {type: \"String\", description: {\"name\", \"\"}, default: \"nil\", is_required: false}} of String => NamedTuple(type: String, description: Tuple(String, String | ::Nil), default: String, is_required: Bool)"}],"included_modules":[{"html_id":"clear/Enumerable","kind":"module","full_name":"Enumerable","name":"Enumerable"},{"html_id":"clear/Iterable","kind":"module","full_name":"Iterable","name":"Iterable"}],"namespace":{"html_id":"clear/Clear/CLI/Generator/Model","kind":"class","full_name":"Clear::CLI::Generator::Model","name":"Model"},"constructors":[{"html_id":"new(command:Admiral::Command)-class-method","name":"new","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"new","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":"_ = allocate\n_.initialize(command)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"[](*args,**options)-instance-method","name":"[]","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","def":{"name":"[]","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@__rest__[*args, **options]"}},{"html_id":"[](*args,**options,&)-instance-method","name":"[]","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","def":{"name":"[]","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@__rest__.[](*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"each(*args,**options)-instance-method","name":"each","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","def":{"name":"each","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@__rest__.each(*args, **options)"}},{"html_id":"each(*args,**options,&)-instance-method","name":"each","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","def":{"name":"each","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@__rest__.each(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"exists?(name:Symbol)-instance-method","name":"exists?","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"exists?","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":"!!SPECS[name]?"}},{"html_id":"get(name:Symbol)-instance-method","name":"get","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"get","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":"{name: @name}[name]?"}},{"html_id":"get?(name:Symbol)-instance-method","name":"get?","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"get?","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":"exists?(name) ? get(name) : false"}},{"html_id":"inspect(io)-instance-method","name":"inspect","abstract":false,"args":[{"name":"io","external_name":"io","restriction":""}],"args_string":"(io)","args_html":"(io)","location":{"filename":"src/clear/cli/generators/model.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/model.cr#L6"},"def":{"name":"inspect","args":[{"name":"io","external_name":"io","restriction":""}],"visibility":"Public","body":"names = SPECS.keys\nif size > 0\n names << \"...\"\nend\nio << \"<#{self.class}\"\nio << \"(\"\nif names.empty?\nelse\n io << (names.join(\", \"))\nend\nio << \")\"\nio << \">\"\n"}},{"html_id":"name:String|Nil-instance-method","name":"name","abstract":false,"location":{"filename":"src/clear/cli/generators/model.cr","line_number":17,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/model.cr#L17"},"def":{"name":"name","return_type":"String | Nil","visibility":"Public","body":"@name"}},{"html_id":"rest:Array(String)-instance-method","name":"rest","abstract":false,"def":{"name":"rest","visibility":"Public","body":"@__rest__"}},{"html_id":"validate!(command:Admiral::Command)-instance-method","name":"validate!","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"validate!","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":"if {type: \"String\", description: {\"name\", \"\"}, default: \"nil\", is_required: false}[:is_required] && @name.nil?\n raise(Admiral::Error.new(\"Argument required: name\"))\nend"}},{"html_id":"value_from_spec(command:Admiral::Command,*,arg:String,type,default,is_required:Bool)-instance-method","name":"value_from_spec","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"},{"name":"","external_name":"","restriction":""},{"name":"arg","external_name":"arg","restriction":"String"},{"name":"type","external_name":"type","restriction":""},{"name":"default","external_name":"default","restriction":""},{"name":"is_required","external_name":"is_required","restriction":"Bool"}],"args_string":"(command : Admiral::Command, *, arg : String, type, default, is_required : Bool)","args_html":"(command : Admiral::Command, *, arg : String, type, default, is_required : Bool)","location":{"filename":"src/clear/cli/generators/model.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/model.cr#L6"},"def":{"name":"value_from_spec","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"},{"name":"","external_name":"","restriction":""},{"name":"arg","external_name":"arg","restriction":"String"},{"name":"type","external_name":"type","restriction":""},{"name":"default","external_name":"default","restriction":""},{"name":"is_required","external_name":"is_required","restriction":"Bool"}],"splat_index":1,"visibility":"Public","body":"pos_only = false\nindex = 0\nwhile ((command.@argv)[index]?.to_s.starts_with?(\"-\")) && !pos_only\n index = index + 1\n pos_only = (command.@argv)[index]? == \"--\"\nend\nif (command.@argv)[index]?\n value = (command.@argv).delete_at(index)\n type.new(value)\nelse\n default\nend\n"}}]},{"html_id":"clear/Clear/CLI/Generator/Model/Flags","path":"Clear/CLI/Generator/Model/Flags.html","kind":"struct","full_name":"Clear::CLI::Generator::Model::Flags","name":"Flags","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli/generators/model.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/model.cr#L6"},{"filename":"src/clear/cli/generators/model.cr","line_number":11,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/model.cr#L11"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"DESCRIPTIONS","name":"DESCRIPTIONS","value":"{} of String => String"},{"id":"SPECS","name":"SPECS","value":"{\"verbose\" => {kind: \"bool\", type: \"Bool\", default: \"false\", description: {\"--verbose, -v\", \"Display verbose informations during execution\"}, short: \"v\", long: \"verbose\", is_required: true}, \"no_color\" => {kind: \"bool\", type: \"Bool\", default: \"false\", description: {\"--no-color\", \"Cancel color output\"}, short: \"nil\", long: \"no-color\", is_required: true}, \"__help__\" => {kind: \"bool\", type: \"Bool\", default: \"false\", description: {\"--help\", \"Displays help for the current command.\"}, short: \"nil\", long: \"help\", is_required: true}, \"directory\" => {kind: \"nil\", type: \"String\", default: \"\\\".\\\"\", description: {\"--directory, -d (default: \\\".\\\")\", \"Set target directory\"}, short: \"d\", long: \"directory\", is_required: true}} of String => NamedTuple(kind: String, type: String, default: String, description: Tuple(String, String | ::Nil), short: String | ::Nil, long: String, is_required: Bool)"}],"namespace":{"html_id":"clear/Clear/CLI/Generator/Model","kind":"class","full_name":"Clear::CLI::Generator::Model","name":"Model"},"doc":"Extend the flags struct to include the flag","summary":"

Extend the flags struct to include the flag

","constructors":[{"html_id":"new(command:Admiral::Command)-class-method","name":"new","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"new","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":"_ = allocate\n_.initialize(command)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"__help__-instance-method","name":"__help__","abstract":false,"def":{"name":"__help__","visibility":"Public","body":"@__help__.not_nil!"}},{"html_id":"directory-instance-method","name":"directory","abstract":false,"location":{"filename":"src/clear/cli/generators/model.cr","line_number":11,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/model.cr#L11"},"def":{"name":"directory","visibility":"Public","body":"@directory.not_nil!"}},{"html_id":"inspect(io)-instance-method","name":"inspect","abstract":false,"args":[{"name":"io","external_name":"io","restriction":""}],"args_string":"(io)","args_html":"(io)","location":{"filename":"src/clear/cli/generators/model.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/model.cr#L6"},"def":{"name":"inspect","args":[{"name":"io","external_name":"io","restriction":""}],"visibility":"Public","body":"io << \"<#{self.class}\"\nio << \"(\"\nif SPECS.empty?\nelse\n io << (SPECS.keys.join(\", \"))\nend\nio << \")\"\nio << \">\"\n"}},{"html_id":"no_color-instance-method","name":"no_color","abstract":false,"def":{"name":"no_color","visibility":"Public","body":"@no_color.not_nil!"}},{"html_id":"validate!(command)-instance-method","name":"validate!","abstract":false,"args":[{"name":"command","external_name":"command","restriction":""}],"args_string":"(command)","args_html":"(command)","def":{"name":"validate!","args":[{"name":"command","external_name":"command","restriction":""}],"visibility":"Public","body":"if @verbose.nil?\n raise(Admiral::Error.new(\"Flag required: --verbose\"))\nend\nif @no_color.nil?\n raise(Admiral::Error.new(\"Flag required: --no-color\"))\nend\nif @__help__.nil?\n raise(Admiral::Error.new(\"Flag required: --help\"))\nend\nif @directory.nil?\n raise(Admiral::Error.new(\"Flag required: --directory\"))\nend\nraise_extra_flags!(command)\n"}},{"html_id":"verbose-instance-method","name":"verbose","abstract":false,"def":{"name":"verbose","visibility":"Public","body":"@verbose.not_nil!"}}]}]},{"html_id":"clear/Clear/CLI/Generator/NewKemal","path":"Clear/CLI/Generator/NewKemal.html","kind":"class","full_name":"Clear::CLI::Generator::NewKemal","name":"NewKemal","abstract":false,"superclass":{"html_id":"clear/Admiral/Command","kind":"class","full_name":"Admiral::Command","name":"Command"},"ancestors":[{"html_id":"clear/Clear/CLI/Command","kind":"module","full_name":"Clear::CLI::Command","name":"Command"},{"html_id":"clear/Admiral/Command","kind":"class","full_name":"Admiral::Command","name":"Command"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli/generators/new/kemal.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/new/kemal.cr#L6"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"HELP","name":"HELP","value":"{\"description\" => \"\"}"}],"included_modules":[{"html_id":"clear/Clear/CLI/Command","kind":"module","full_name":"Clear::CLI::Command","name":"Command"}],"namespace":{"html_id":"clear/Clear/CLI/Generator","kind":"class","full_name":"Clear::CLI::Generator","name":"Generator"},"class_methods":[{"html_id":"description-class-method","name":"description","abstract":false,"location":{"filename":"src/clear/cli/generators/new/kemal.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/new/kemal.cr#L6"},"def":{"name":"description","visibility":"Public","body":"HELP[\"description\"]"}},{"html_id":"run(*args,**params)-class-method","name":"run","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **params)","args_html":"(*args, **params)","location":{"filename":"src/clear/cli/generators/new/kemal.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/new/kemal.cr#L6"},"def":{"name":"run","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"params","external_name":"params","restriction":""},"splat_index":0,"visibility":"Public","body":"(new(*args, **params)).parse_and_run"}}],"instance_methods":[{"html_id":"__rescue_from___Admiral__Error(e)-instance-method","name":"__rescue_from___Admiral__Error","abstract":false,"args":[{"name":"e","external_name":"e","restriction":""}],"args_string":"(e)","args_html":"(e)","def":{"name":"__rescue_from___Admiral__Error","args":[{"name":"e","external_name":"e","restriction":""}],"visibility":"Public","body":"panic(e.message.colorize(:red))"}},{"html_id":"arguments-instance-method","name":"arguments","doc":"Returns the commands `Arguments` object.\n\nYou can access names arguments by name.\nYou can also access the remaning arguments using `.arguments[index]`.","summary":"

Returns the commands Arguments object.

","abstract":false,"location":{"filename":"src/clear/cli/generators/new/kemal.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/new/kemal.cr#L6"},"def":{"name":"arguments","visibility":"Public","body":"@arguments || (@arguments = Arguments.new(self))"}},{"html_id":"flags-instance-method","name":"flags","doc":"Returns the commands `Flags` object.\n\nYou can access names flags by name.","summary":"

Returns the commands Flags object.

","abstract":false,"location":{"filename":"src/clear/cli/generators/new/kemal.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/new/kemal.cr#L6"},"def":{"name":"flags","visibility":"Public","body":"@flags || (@flags = Flags.new(self))"}},{"html_id":"run-instance-method","name":"run","doc":"The run command.","summary":"

The run command.

","abstract":false,"location":{"filename":"src/clear/cli/generators/new/kemal.cr","line_number":7,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/new/kemal.cr#L7"},"def":{"name":"run","visibility":"Public","body":"Colorize.enabled = !flags.no_color\nrun_impl\n"}},{"html_id":"run_impl-instance-method","name":"run_impl","abstract":false,"location":{"filename":"src/clear/cli/generators/new/kemal.cr","line_number":17,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/new/kemal.cr#L17"},"def":{"name":"run_impl","visibility":"Public","body":"g = Generate::Generator.new\ng.target_directory = flags.directory\ng[\"app_name\"] = arguments.name || (File.basename(g.target_directory))\ng[\"app_name_underscore\"] = g[\"app_name\"].underscore\ng[\"app_name_camelcase\"] = g[\"app_name\"].camelcase\ng[\"git_username\"] = (`git config user.email`).chomp || \"email@example.com\"\ng[\"git_email\"] = (`git config user.name`).chomp || \"Your Name\"\ng.in_directory(\"bin\") do\n g.file(\"appctl\", Clear::CLI::Generator.ecr_to_s(\"/home/runner/work/clear/clear/src/clear/cli/generators/new/../../../../../templates/kemal/bin/appctl.ecr\", g))\n g.file(\"clear_cli.cr\", Clear::CLI::Generator.ecr_to_s(\"/home/runner/work/clear/clear/src/clear/cli/generators/new/../../../../../templates/kemal/bin/clear_cli.cr.ecr\", g))\n g.file(\"server.cr\", Clear::CLI::Generator.ecr_to_s(\"/home/runner/work/clear/clear/src/clear/cli/generators/new/../../../../../templates/kemal/bin/server.cr.ecr\", g))\nend\ng.in_directory(\"config\") do\n g.file(\"database.yml\", Clear::CLI::Generator.ecr_to_s(\"/home/runner/work/clear/clear/src/clear/cli/generators/new/../../../../../templates/kemal/config/database.yml.ecr\", g))\nend\ng.in_directory(\"src\") do\n g.in_directory(\"controllers\") do\n g.file(\"application_controller.cr\", Clear::CLI::Generator.ecr_to_s(\"/home/runner/work/clear/clear/src/clear/cli/generators/new/../../../../../templates/kemal/src/controllers/application_controller.ecr\", g))\n g.file(\"welcome_controller.cr\", Clear::CLI::Generator.ecr_to_s(\"/home/runner/work/clear/clear/src/clear/cli/generators/new/../../../../../templates/kemal/src/controllers/welcome_controller.ecr\", g))\n end\n g.in_directory(\"db\") do\n g.file(\"init.cr\", Clear::CLI::Generator.ecr_to_s(\"/home/runner/work/clear/clear/src/clear/cli/generators/new/../../../../../templates/kemal/src/db/init.ecr\", g))\n end\n g.in_directory(\"models\") do\n g.file(\"init.cr\", Clear::CLI::Generator.ecr_to_s(\"/home/runner/work/clear/clear/src/clear/cli/generators/new/../../../../../templates/kemal/src/models/application_model.ecr\", g))\n end\n g.in_directory(\"views\") do\n g.in_directory(\"components\") do\n g.file(\"footer.cr\", Clear::CLI::Generator.ecr_to_s(\"/home/runner/work/clear/clear/src/clear/cli/generators/new/../../../../../templates/kemal/src/views/components/footer.ecr\", g))\n end\n g.in_directory(\"layouts\") do\n g.file(\"application.cr\", Clear::CLI::Generator.ecr_to_s(\"/home/runner/work/clear/clear/src/clear/cli/generators/new/../../../../../templates/kemal/src/views/layouts/application.ecr\", g))\n end\n g.in_directory(\"welcome\") do\n g.file(\"index.cr\", Clear::CLI::Generator.ecr_to_s(\"/home/runner/work/clear/clear/src/clear/cli/generators/new/../../../../../templates/kemal/src/views/welcome/index.ecr\", g))\n end\n end\n g.file(\"app.cr\", Clear::CLI::Generator.ecr_to_s(\"/home/runner/work/clear/clear/src/clear/cli/generators/new/../../../../../templates/kemal/src/app.ecr\", g))\nend\ng.file(\".gitignore\", Clear::CLI::Generator.ecr_to_s(\"/home/runner/work/clear/clear/src/clear/cli/generators/new/../../../../../templates/kemal/_gitignore.ecr\", g))\ng.file(\"shard.yml\", Clear::CLI::Generator.ecr_to_s(\"/home/runner/work/clear/clear/src/clear/cli/generators/new/../../../../../templates/kemal/shard.yml.ecr\", g))\nsystem(\"chmod +x #{g.target_directory}/bin/appctl\")\nsystem(\"cd #{g.target_directory} && shards\")\nputs(\"Clear + Kemal template is now generated. `cd #{g.target_directory} && clear-cli server` to play ! :-)\")\n"}},{"html_id":"sub(command,*args,**params)-instance-method","name":"sub","doc":"Invokes a sub command by name, passing `self` as the parent.","summary":"

Invokes a sub command by name, passing self as the parent.

","abstract":false,"args":[{"name":"command","external_name":"command","restriction":""},{"name":"args","external_name":"args","restriction":""}],"args_string":"(command, *args, **params)","args_html":"(command, *args, **params)","location":{"filename":"src/clear/cli/generators/new/kemal.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/new/kemal.cr#L6"},"def":{"name":"sub","args":[{"name":"command","external_name":"command","restriction":""},{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"params","external_name":"params","restriction":""},"splat_index":1,"visibility":"Public","body":"SubCommands.invoke(command, *args, **params, parent: self)"}}],"types":[{"html_id":"clear/Clear/CLI/Generator/NewKemal/Arguments","path":"Clear/CLI/Generator/NewKemal/Arguments.html","kind":"struct","full_name":"Clear::CLI::Generator::NewKemal::Arguments","name":"Arguments","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Iterable","kind":"module","full_name":"Iterable","name":"Iterable"},{"html_id":"clear/Enumerable","kind":"module","full_name":"Enumerable","name":"Enumerable"},{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli/generators/new/kemal.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/new/kemal.cr#L6"},{"filename":"src/clear/cli/generators/new/kemal.cr","line_number":15,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/new/kemal.cr#L15"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"SPECS","name":"SPECS","value":"{\"name\" => {type: \"String\", description: {\"name\", \"\"}, default: \"nil\", is_required: false}} of String => NamedTuple(type: String, description: Tuple(String, String | ::Nil), default: String, is_required: Bool)"}],"included_modules":[{"html_id":"clear/Enumerable","kind":"module","full_name":"Enumerable","name":"Enumerable"},{"html_id":"clear/Iterable","kind":"module","full_name":"Iterable","name":"Iterable"}],"namespace":{"html_id":"clear/Clear/CLI/Generator/NewKemal","kind":"class","full_name":"Clear::CLI::Generator::NewKemal","name":"NewKemal"},"constructors":[{"html_id":"new(command:Admiral::Command)-class-method","name":"new","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"new","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":"_ = allocate\n_.initialize(command)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"[](*args,**options)-instance-method","name":"[]","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","def":{"name":"[]","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@__rest__[*args, **options]"}},{"html_id":"[](*args,**options,&)-instance-method","name":"[]","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","def":{"name":"[]","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@__rest__.[](*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"each(*args,**options)-instance-method","name":"each","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","def":{"name":"each","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@__rest__.each(*args, **options)"}},{"html_id":"each(*args,**options,&)-instance-method","name":"each","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","def":{"name":"each","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@__rest__.each(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"exists?(name:Symbol)-instance-method","name":"exists?","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"exists?","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":"!!SPECS[name]?"}},{"html_id":"get(name:Symbol)-instance-method","name":"get","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"get","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":"{name: @name}[name]?"}},{"html_id":"get?(name:Symbol)-instance-method","name":"get?","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"get?","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":"exists?(name) ? get(name) : false"}},{"html_id":"inspect(io)-instance-method","name":"inspect","abstract":false,"args":[{"name":"io","external_name":"io","restriction":""}],"args_string":"(io)","args_html":"(io)","location":{"filename":"src/clear/cli/generators/new/kemal.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/new/kemal.cr#L6"},"def":{"name":"inspect","args":[{"name":"io","external_name":"io","restriction":""}],"visibility":"Public","body":"names = SPECS.keys\nif size > 0\n names << \"...\"\nend\nio << \"<#{self.class}\"\nio << \"(\"\nif names.empty?\nelse\n io << (names.join(\", \"))\nend\nio << \")\"\nio << \">\"\n"}},{"html_id":"name:String|Nil-instance-method","name":"name","abstract":false,"location":{"filename":"src/clear/cli/generators/new/kemal.cr","line_number":15,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/new/kemal.cr#L15"},"def":{"name":"name","return_type":"String | Nil","visibility":"Public","body":"@name"}},{"html_id":"rest:Array(String)-instance-method","name":"rest","abstract":false,"def":{"name":"rest","visibility":"Public","body":"@__rest__"}},{"html_id":"validate!(command:Admiral::Command)-instance-method","name":"validate!","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"validate!","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":"if {type: \"String\", description: {\"name\", \"\"}, default: \"nil\", is_required: false}[:is_required] && @name.nil?\n raise(Admiral::Error.new(\"Argument required: name\"))\nend"}},{"html_id":"value_from_spec(command:Admiral::Command,*,arg:String,type,default,is_required:Bool)-instance-method","name":"value_from_spec","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"},{"name":"","external_name":"","restriction":""},{"name":"arg","external_name":"arg","restriction":"String"},{"name":"type","external_name":"type","restriction":""},{"name":"default","external_name":"default","restriction":""},{"name":"is_required","external_name":"is_required","restriction":"Bool"}],"args_string":"(command : Admiral::Command, *, arg : String, type, default, is_required : Bool)","args_html":"(command : Admiral::Command, *, arg : String, type, default, is_required : Bool)","location":{"filename":"src/clear/cli/generators/new/kemal.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/new/kemal.cr#L6"},"def":{"name":"value_from_spec","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"},{"name":"","external_name":"","restriction":""},{"name":"arg","external_name":"arg","restriction":"String"},{"name":"type","external_name":"type","restriction":""},{"name":"default","external_name":"default","restriction":""},{"name":"is_required","external_name":"is_required","restriction":"Bool"}],"splat_index":1,"visibility":"Public","body":"pos_only = false\nindex = 0\nwhile ((command.@argv)[index]?.to_s.starts_with?(\"-\")) && !pos_only\n index = index + 1\n pos_only = (command.@argv)[index]? == \"--\"\nend\nif (command.@argv)[index]?\n value = (command.@argv).delete_at(index)\n type.new(value)\nelse\n default\nend\n"}}]},{"html_id":"clear/Clear/CLI/Generator/NewKemal/Flags","path":"Clear/CLI/Generator/NewKemal/Flags.html","kind":"struct","full_name":"Clear::CLI::Generator::NewKemal::Flags","name":"Flags","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli/generators/new/kemal.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/new/kemal.cr#L6"},{"filename":"src/clear/cli/generators/new/kemal.cr","line_number":9,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/new/kemal.cr#L9"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"DESCRIPTIONS","name":"DESCRIPTIONS","value":"{} of String => String"},{"id":"SPECS","name":"SPECS","value":"{\"verbose\" => {kind: \"bool\", type: \"Bool\", default: \"false\", description: {\"--verbose, -v\", \"Display verbose informations during execution\"}, short: \"v\", long: \"verbose\", is_required: true}, \"no_color\" => {kind: \"bool\", type: \"Bool\", default: \"false\", description: {\"--no-color\", \"Cancel color output\"}, short: \"nil\", long: \"no-color\", is_required: true}, \"directory\" => {kind: \"nil\", type: \"String\", default: \"\\\".\\\"\", description: {\"--directory, -d (default: \\\".\\\")\", \"Set target directory\"}, short: \"d\", long: \"directory\", is_required: true}} of String => NamedTuple(kind: String, type: String, default: String, description: Tuple(String, String | ::Nil), short: String | ::Nil, long: String, is_required: Bool)"}],"namespace":{"html_id":"clear/Clear/CLI/Generator/NewKemal","kind":"class","full_name":"Clear::CLI::Generator::NewKemal","name":"NewKemal"},"doc":"Extend the flags struct to include the flag","summary":"

Extend the flags struct to include the flag

","constructors":[{"html_id":"new(command:Admiral::Command)-class-method","name":"new","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"new","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":"_ = allocate\n_.initialize(command)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"directory-instance-method","name":"directory","abstract":false,"location":{"filename":"src/clear/cli/generators/new/kemal.cr","line_number":9,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/new/kemal.cr#L9"},"def":{"name":"directory","visibility":"Public","body":"@directory.not_nil!"}},{"html_id":"inspect(io)-instance-method","name":"inspect","abstract":false,"args":[{"name":"io","external_name":"io","restriction":""}],"args_string":"(io)","args_html":"(io)","location":{"filename":"src/clear/cli/generators/new/kemal.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/new/kemal.cr#L6"},"def":{"name":"inspect","args":[{"name":"io","external_name":"io","restriction":""}],"visibility":"Public","body":"io << \"<#{self.class}\"\nio << \"(\"\nif SPECS.empty?\nelse\n io << (SPECS.keys.join(\", \"))\nend\nio << \")\"\nio << \">\"\n"}},{"html_id":"no_color-instance-method","name":"no_color","abstract":false,"def":{"name":"no_color","visibility":"Public","body":"@no_color.not_nil!"}},{"html_id":"validate!(command)-instance-method","name":"validate!","abstract":false,"args":[{"name":"command","external_name":"command","restriction":""}],"args_string":"(command)","args_html":"(command)","def":{"name":"validate!","args":[{"name":"command","external_name":"command","restriction":""}],"visibility":"Public","body":"if @verbose.nil?\n raise(Admiral::Error.new(\"Flag required: --verbose\"))\nend\nif @no_color.nil?\n raise(Admiral::Error.new(\"Flag required: --no-color\"))\nend\nif @directory.nil?\n raise(Admiral::Error.new(\"Flag required: --directory\"))\nend\nraise_extra_flags!(command)\n"}},{"html_id":"verbose-instance-method","name":"verbose","abstract":false,"def":{"name":"verbose","visibility":"Public","body":"@verbose.not_nil!"}}]}]},{"html_id":"clear/Clear/CLI/Generator/Record","path":"Clear/CLI/Generator/Record.html","kind":"struct","full_name":"Clear::CLI::Generator::Record","name":"Record","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli/generator.cr","line_number":7,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generator.cr#L7"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/CLI/Generator","kind":"class","full_name":"Clear::CLI::Generator","name":"Generator"},"constructors":[{"html_id":"new(name:String,desc:String,callback:Array(String)->Nil)-class-method","name":"new","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"String"},{"name":"desc","external_name":"desc","restriction":"String"},{"name":"callback","external_name":"callback","restriction":"(Array(String) -> Nil)"}],"args_string":"(name : String, desc : String, callback : Array(String) -> Nil)","args_html":"(name : String, desc : String, callback : Array(String) -> Nil)","location":{"filename":"src/clear/cli/generator.cr","line_number":7,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generator.cr#L7"},"def":{"name":"new","args":[{"name":"name","external_name":"name","restriction":"String"},{"name":"desc","external_name":"desc","restriction":"String"},{"name":"callback","external_name":"callback","restriction":"(Array(String) -> Nil)"}],"visibility":"Public","body":"_ = allocate\n_.initialize(name, desc, callback)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"callback:Array(String)->Nil-instance-method","name":"callback","abstract":false,"def":{"name":"callback","return_type":"(Array(String) -> Nil)","visibility":"Public","body":"@callback"}},{"html_id":"clone-instance-method","name":"clone","abstract":false,"location":{"filename":"src/clear/cli/generator.cr","line_number":7,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generator.cr#L7"},"def":{"name":"clone","visibility":"Public","body":"self.class.new(@name.clone, @desc.clone, @callback.clone)"}},{"html_id":"copy_with(name_name=@name,desc_desc=@desc,callback_callback=@callback)-instance-method","name":"copy_with","abstract":false,"args":[{"name":"_name","default_value":"@name","external_name":"name","restriction":""},{"name":"_desc","default_value":"@desc","external_name":"desc","restriction":""},{"name":"_callback","default_value":"@callback","external_name":"callback","restriction":""}],"args_string":"(name _name = @name, desc _desc = @desc, callback _callback = @callback)","args_html":"(name _name = @name, desc _desc = @desc, callback _callback = @callback)","location":{"filename":"src/clear/cli/generator.cr","line_number":7,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generator.cr#L7"},"def":{"name":"copy_with","args":[{"name":"_name","default_value":"@name","external_name":"name","restriction":""},{"name":"_desc","default_value":"@desc","external_name":"desc","restriction":""},{"name":"_callback","default_value":"@callback","external_name":"callback","restriction":""}],"visibility":"Public","body":"self.class.new(_name, _desc, _callback)"}},{"html_id":"desc:String-instance-method","name":"desc","abstract":false,"def":{"name":"desc","return_type":"String","visibility":"Public","body":"@desc"}},{"html_id":"name:String-instance-method","name":"name","abstract":false,"def":{"name":"name","return_type":"String","visibility":"Public","body":"@name"}}]}]},{"html_id":"clear/Clear/CLI/Migration","path":"Clear/CLI/Migration.html","kind":"class","full_name":"Clear::CLI::Migration","name":"Migration","abstract":false,"superclass":{"html_id":"clear/Admiral/Command","kind":"class","full_name":"Admiral::Command","name":"Command"},"ancestors":[{"html_id":"clear/Admiral/Command/Run","kind":"module","full_name":"Admiral::Command::Run","name":"Run"},{"html_id":"clear/Clear/CLI/Command","kind":"module","full_name":"Clear::CLI::Command","name":"Command"},{"html_id":"clear/Admiral/Command","kind":"class","full_name":"Admiral::Command","name":"Command"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli/migration.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L1"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"HELP","name":"HELP","value":"{\"description\" => \"\"}"}],"included_modules":[{"html_id":"clear/Admiral/Command/Run","kind":"module","full_name":"Admiral::Command::Run","name":"Run"},{"html_id":"clear/Clear/CLI/Command","kind":"module","full_name":"Clear::CLI::Command","name":"Command"}],"namespace":{"html_id":"clear/Clear/CLI","kind":"module","full_name":"Clear::CLI","name":"CLI"},"class_methods":[{"html_id":"description-class-method","name":"description","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L1"},"def":{"name":"description","visibility":"Public","body":"HELP[\"description\"]"}},{"html_id":"run(*args,**params)-class-method","name":"run","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **params)","args_html":"(*args, **params)","location":{"filename":"src/clear/cli/migration.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L1"},"def":{"name":"run","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"params","external_name":"params","restriction":""},"splat_index":0,"visibility":"Public","body":"(new(*args, **params)).parse_and_run"}}],"instance_methods":[{"html_id":"__rescue_from___Admiral__Error(e)-instance-method","name":"__rescue_from___Admiral__Error","abstract":false,"args":[{"name":"e","external_name":"e","restriction":""}],"args_string":"(e)","args_html":"(e)","def":{"name":"__rescue_from___Admiral__Error","args":[{"name":"e","external_name":"e","restriction":""}],"visibility":"Public","body":"panic(e.message.colorize(:red))"}},{"html_id":"arguments-instance-method","name":"arguments","doc":"Returns the commands `Arguments` object.\n\nYou can access names arguments by name.\nYou can also access the remaning arguments using `.arguments[index]`.","summary":"

Returns the commands Arguments object.

","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L1"},"def":{"name":"arguments","visibility":"Public","body":"@arguments || (@arguments = Arguments.new(self))"}},{"html_id":"flags-instance-method","name":"flags","doc":"Returns the commands `Flags` object.\n\nYou can access names flags by name.","summary":"

Returns the commands Flags object.

","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L1"},"def":{"name":"flags","visibility":"Public","body":"@flags || (@flags = Flags.new(self))"}},{"html_id":"help-instance-method","name":"help","abstract":false,"def":{"name":"help","visibility":"Public","body":"[help_usage, \"Manage migration state of your database\" + \"\\n\", help_flags, help_arguments, help_sub_commands].reject() do |__arg0|\n __arg0.strip.empty?\nend.join(\"\\n\")"}},{"html_id":"run-instance-method","name":"run","doc":"The run command.","summary":"

The run command.

","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":2,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L2"},"def":{"name":"run","visibility":"Public","body":"Colorize.enabled = !flags.no_color\nrun_impl\n"}},{"html_id":"run_impl-instance-method","name":"run_impl","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":108,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L108"},"def":{"name":"run_impl","visibility":"Public","body":"Clear::Migration::Manager.instance.apply_all"}},{"html_id":"sub(command,*args,**params)-instance-method","name":"sub","doc":"Invokes a sub command by name, passing `self` as the parent.","summary":"

Invokes a sub command by name, passing self as the parent.

","abstract":false,"args":[{"name":"command","external_name":"command","restriction":""},{"name":"args","external_name":"args","restriction":""}],"args_string":"(command, *args, **params)","args_html":"(command, *args, **params)","location":{"filename":"src/clear/cli/migration.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L1"},"def":{"name":"sub","args":[{"name":"command","external_name":"command","restriction":""},{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"params","external_name":"params","restriction":""},"splat_index":1,"visibility":"Public","body":"SubCommands.invoke(command, *args, **params, parent: self)"}}],"types":[{"html_id":"clear/Clear/CLI/Migration/Arguments","path":"Clear/CLI/Migration/Arguments.html","kind":"struct","full_name":"Clear::CLI::Migration::Arguments","name":"Arguments","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Iterable","kind":"module","full_name":"Iterable","name":"Iterable"},{"html_id":"clear/Enumerable","kind":"module","full_name":"Enumerable","name":"Enumerable"},{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli/migration.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L1"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"SPECS","name":"SPECS","value":"{} of String => NamedTuple(type: String, description: Tuple(String, String | ::Nil), default: String, is_required: Bool)"}],"included_modules":[{"html_id":"clear/Enumerable","kind":"module","full_name":"Enumerable","name":"Enumerable"},{"html_id":"clear/Iterable","kind":"module","full_name":"Iterable","name":"Iterable"}],"namespace":{"html_id":"clear/Clear/CLI/Migration","kind":"class","full_name":"Clear::CLI::Migration","name":"Migration"},"constructors":[{"html_id":"new(command:Admiral::Command)-class-method","name":"new","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"new","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":"_ = allocate\n_.initialize(command)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"[](*args,**options)-instance-method","name":"[]","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","def":{"name":"[]","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@__rest__[*args, **options]"}},{"html_id":"[](*args,**options,&)-instance-method","name":"[]","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","def":{"name":"[]","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@__rest__.[](*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"each(*args,**options)-instance-method","name":"each","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","def":{"name":"each","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@__rest__.each(*args, **options)"}},{"html_id":"each(*args,**options,&)-instance-method","name":"each","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","def":{"name":"each","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@__rest__.each(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"exists?(name:Symbol)-instance-method","name":"exists?","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"exists?","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":"!!SPECS[name]?"}},{"html_id":"get(name:Symbol)-instance-method","name":"get","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"get","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":""}},{"html_id":"get?(name:Symbol)-instance-method","name":"get?","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"get?","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":"exists?(name) ? get(name) : false"}},{"html_id":"inspect(io)-instance-method","name":"inspect","abstract":false,"args":[{"name":"io","external_name":"io","restriction":""}],"args_string":"(io)","args_html":"(io)","location":{"filename":"src/clear/cli/migration.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L1"},"def":{"name":"inspect","args":[{"name":"io","external_name":"io","restriction":""}],"visibility":"Public","body":"names = SPECS.keys\nif size > 0\n names << \"...\"\nend\nio << \"<#{self.class}\"\nio << \"(\"\nif names.empty?\nelse\n io << (names.join(\", \"))\nend\nio << \")\"\nio << \">\"\n"}},{"html_id":"rest:Array(String)-instance-method","name":"rest","abstract":false,"def":{"name":"rest","visibility":"Public","body":"@__rest__"}},{"html_id":"validate!(command:Admiral::Command)-instance-method","name":"validate!","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"validate!","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":""}},{"html_id":"value_from_spec(command:Admiral::Command,*,arg:String,type,default,is_required:Bool)-instance-method","name":"value_from_spec","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"},{"name":"","external_name":"","restriction":""},{"name":"arg","external_name":"arg","restriction":"String"},{"name":"type","external_name":"type","restriction":""},{"name":"default","external_name":"default","restriction":""},{"name":"is_required","external_name":"is_required","restriction":"Bool"}],"args_string":"(command : Admiral::Command, *, arg : String, type, default, is_required : Bool)","args_html":"(command : Admiral::Command, *, arg : String, type, default, is_required : Bool)","location":{"filename":"src/clear/cli/migration.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L1"},"def":{"name":"value_from_spec","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"},{"name":"","external_name":"","restriction":""},{"name":"arg","external_name":"arg","restriction":"String"},{"name":"type","external_name":"type","restriction":""},{"name":"default","external_name":"default","restriction":""},{"name":"is_required","external_name":"is_required","restriction":"Bool"}],"splat_index":1,"visibility":"Public","body":"pos_only = false\nindex = 0\nwhile ((command.@argv)[index]?.to_s.starts_with?(\"-\")) && !pos_only\n index = index + 1\n pos_only = (command.@argv)[index]? == \"--\"\nend\nif (command.@argv)[index]?\n value = (command.@argv).delete_at(index)\n type.new(value)\nelse\n default\nend\n"}}]},{"html_id":"clear/Clear/CLI/Migration/Down","path":"Clear/CLI/Migration/Down.html","kind":"class","full_name":"Clear::CLI::Migration::Down","name":"Down","abstract":false,"superclass":{"html_id":"clear/Admiral/Command","kind":"class","full_name":"Admiral::Command","name":"Command"},"ancestors":[{"html_id":"clear/Clear/CLI/Command","kind":"module","full_name":"Clear::CLI::Command","name":"Command"},{"html_id":"clear/Admiral/Command","kind":"class","full_name":"Admiral::Command","name":"Command"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli/migration.cr","line_number":37,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L37"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"HELP","name":"HELP","value":"{\"description\" => \"\"}"}],"included_modules":[{"html_id":"clear/Clear/CLI/Command","kind":"module","full_name":"Clear::CLI::Command","name":"Command"}],"namespace":{"html_id":"clear/Clear/CLI/Migration","kind":"class","full_name":"Clear::CLI::Migration","name":"Migration"},"class_methods":[{"html_id":"description-class-method","name":"description","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":37,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L37"},"def":{"name":"description","visibility":"Public","body":"HELP[\"description\"]"}},{"html_id":"run(*args,**params)-class-method","name":"run","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **params)","args_html":"(*args, **params)","location":{"filename":"src/clear/cli/migration.cr","line_number":37,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L37"},"def":{"name":"run","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"params","external_name":"params","restriction":""},"splat_index":0,"visibility":"Public","body":"(new(*args, **params)).parse_and_run"}}],"instance_methods":[{"html_id":"__rescue_from___Admiral__Error(e)-instance-method","name":"__rescue_from___Admiral__Error","abstract":false,"args":[{"name":"e","external_name":"e","restriction":""}],"args_string":"(e)","args_html":"(e)","def":{"name":"__rescue_from___Admiral__Error","args":[{"name":"e","external_name":"e","restriction":""}],"visibility":"Public","body":"panic(e.message.colorize(:red))"}},{"html_id":"arguments-instance-method","name":"arguments","doc":"Returns the commands `Arguments` object.\n\nYou can access names arguments by name.\nYou can also access the remaning arguments using `.arguments[index]`.","summary":"

Returns the commands Arguments object.

","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":37,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L37"},"def":{"name":"arguments","visibility":"Public","body":"@arguments || (@arguments = Arguments.new(self))"}},{"html_id":"flags-instance-method","name":"flags","doc":"Returns the commands `Flags` object.\n\nYou can access names flags by name.","summary":"

Returns the commands Flags object.

","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":37,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L37"},"def":{"name":"flags","visibility":"Public","body":"@flags || (@flags = Flags.new(self))"}},{"html_id":"help-instance-method","name":"help","abstract":false,"def":{"name":"help","visibility":"Public","body":"[help_usage, \"Downgrade your database to a specific migration version\" + \"\\n\", help_flags, help_arguments, help_sub_commands].reject() do |__arg0|\n __arg0.strip.empty?\nend.join(\"\\n\")"}},{"html_id":"run-instance-method","name":"run","doc":"The run command.","summary":"

The run command.

","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":38,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L38"},"def":{"name":"run","visibility":"Public","body":"Colorize.enabled = !flags.no_color\nrun_impl\n"}},{"html_id":"run_impl-instance-method","name":"run_impl","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":43,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L43"},"def":{"name":"run_impl","visibility":"Public","body":"Clear::Migration::Manager.instance.down(arguments.migration_number)"}},{"html_id":"sub(command,*args,**params)-instance-method","name":"sub","doc":"Invokes a sub command by name, passing `self` as the parent.","summary":"

Invokes a sub command by name, passing self as the parent.

","abstract":false,"args":[{"name":"command","external_name":"command","restriction":""},{"name":"args","external_name":"args","restriction":""}],"args_string":"(command, *args, **params)","args_html":"(command, *args, **params)","location":{"filename":"src/clear/cli/migration.cr","line_number":37,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L37"},"def":{"name":"sub","args":[{"name":"command","external_name":"command","restriction":""},{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"params","external_name":"params","restriction":""},"splat_index":1,"visibility":"Public","body":"SubCommands.invoke(command, *args, **params, parent: self)"}}],"types":[{"html_id":"clear/Clear/CLI/Migration/Down/Arguments","path":"Clear/CLI/Migration/Down/Arguments.html","kind":"struct","full_name":"Clear::CLI::Migration::Down::Arguments","name":"Arguments","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Iterable","kind":"module","full_name":"Iterable","name":"Iterable"},{"html_id":"clear/Enumerable","kind":"module","full_name":"Enumerable","name":"Enumerable"},{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli/migration.cr","line_number":37,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L37"},{"filename":"src/clear/cli/migration.cr","line_number":40,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L40"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"SPECS","name":"SPECS","value":"{\"migration_number\" => {type: \"Int64\", description: {\"migration_number (required)\", \"\"}, default: \"nil\", is_required: true}} of String => NamedTuple(type: String, description: Tuple(String, String | ::Nil), default: String, is_required: Bool)"}],"included_modules":[{"html_id":"clear/Enumerable","kind":"module","full_name":"Enumerable","name":"Enumerable"},{"html_id":"clear/Iterable","kind":"module","full_name":"Iterable","name":"Iterable"}],"namespace":{"html_id":"clear/Clear/CLI/Migration/Down","kind":"class","full_name":"Clear::CLI::Migration::Down","name":"Down"},"constructors":[{"html_id":"new(command:Admiral::Command)-class-method","name":"new","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"new","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":"_ = allocate\n_.initialize(command)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"[](*args,**options)-instance-method","name":"[]","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","def":{"name":"[]","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@__rest__[*args, **options]"}},{"html_id":"[](*args,**options,&)-instance-method","name":"[]","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","def":{"name":"[]","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@__rest__.[](*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"each(*args,**options)-instance-method","name":"each","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","def":{"name":"each","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@__rest__.each(*args, **options)"}},{"html_id":"each(*args,**options,&)-instance-method","name":"each","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","def":{"name":"each","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@__rest__.each(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"exists?(name:Symbol)-instance-method","name":"exists?","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"exists?","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":"!!SPECS[name]?"}},{"html_id":"get(name:Symbol)-instance-method","name":"get","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"get","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":"{migration_number: @migration_number}[name]?"}},{"html_id":"get?(name:Symbol)-instance-method","name":"get?","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"get?","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":"exists?(name) ? get(name) : false"}},{"html_id":"inspect(io)-instance-method","name":"inspect","abstract":false,"args":[{"name":"io","external_name":"io","restriction":""}],"args_string":"(io)","args_html":"(io)","location":{"filename":"src/clear/cli/migration.cr","line_number":37,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L37"},"def":{"name":"inspect","args":[{"name":"io","external_name":"io","restriction":""}],"visibility":"Public","body":"names = SPECS.keys\nif size > 0\n names << \"...\"\nend\nio << \"<#{self.class}\"\nio << \"(\"\nif names.empty?\nelse\n io << (names.join(\", \"))\nend\nio << \")\"\nio << \">\"\n"}},{"html_id":"migration_number:Int64-instance-method","name":"migration_number","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":40,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L40"},"def":{"name":"migration_number","return_type":"Int64","visibility":"Public","body":"@migration_number.not_nil!"}},{"html_id":"rest:Array(String)-instance-method","name":"rest","abstract":false,"def":{"name":"rest","visibility":"Public","body":"@__rest__"}},{"html_id":"validate!(command:Admiral::Command)-instance-method","name":"validate!","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"validate!","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":"if {type: \"Int64\", description: {\"migration_number (required)\", \"\"}, default: \"nil\", is_required: true}[:is_required] && @migration_number.nil?\n raise(Admiral::Error.new(\"Argument required: migration_number\"))\nend"}},{"html_id":"value_from_spec(command:Admiral::Command,*,arg:String,type,default,is_required:Bool)-instance-method","name":"value_from_spec","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"},{"name":"","external_name":"","restriction":""},{"name":"arg","external_name":"arg","restriction":"String"},{"name":"type","external_name":"type","restriction":""},{"name":"default","external_name":"default","restriction":""},{"name":"is_required","external_name":"is_required","restriction":"Bool"}],"args_string":"(command : Admiral::Command, *, arg : String, type, default, is_required : Bool)","args_html":"(command : Admiral::Command, *, arg : String, type, default, is_required : Bool)","location":{"filename":"src/clear/cli/migration.cr","line_number":37,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L37"},"def":{"name":"value_from_spec","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"},{"name":"","external_name":"","restriction":""},{"name":"arg","external_name":"arg","restriction":"String"},{"name":"type","external_name":"type","restriction":""},{"name":"default","external_name":"default","restriction":""},{"name":"is_required","external_name":"is_required","restriction":"Bool"}],"splat_index":1,"visibility":"Public","body":"pos_only = false\nindex = 0\nwhile ((command.@argv)[index]?.to_s.starts_with?(\"-\")) && !pos_only\n index = index + 1\n pos_only = (command.@argv)[index]? == \"--\"\nend\nif (command.@argv)[index]?\n value = (command.@argv).delete_at(index)\n type.new(value)\nelse\n default\nend\n"}}]},{"html_id":"clear/Clear/CLI/Migration/Down/Flags","path":"Clear/CLI/Migration/Down/Flags.html","kind":"struct","full_name":"Clear::CLI::Migration::Down::Flags","name":"Flags","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli/migration.cr","line_number":37,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L37"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"DESCRIPTIONS","name":"DESCRIPTIONS","value":"{} of String => String"},{"id":"SPECS","name":"SPECS","value":"{\"verbose\" => {kind: \"bool\", type: \"Bool\", default: \"false\", description: {\"--verbose, -v\", \"Display verbose informations during execution\"}, short: \"v\", long: \"verbose\", is_required: true}, \"no_color\" => {kind: \"bool\", type: \"Bool\", default: \"false\", description: {\"--no-color\", \"Cancel color output\"}, short: \"nil\", long: \"no-color\", is_required: true}, \"__help__\" => {kind: \"bool\", type: \"Bool\", default: \"false\", description: {\"--help\", \"Displays help for the current command.\"}, short: \"nil\", long: \"help\", is_required: true}} of String => NamedTuple(kind: String, type: String, default: String, description: Tuple(String, String | ::Nil), short: String | ::Nil, long: String, is_required: Bool)"}],"namespace":{"html_id":"clear/Clear/CLI/Migration/Down","kind":"class","full_name":"Clear::CLI::Migration::Down","name":"Down"},"doc":"Extend the flags struct to include the flag","summary":"

Extend the flags struct to include the flag

","constructors":[{"html_id":"new(command:Admiral::Command)-class-method","name":"new","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"new","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":"_ = allocate\n_.initialize(command)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"__help__-instance-method","name":"__help__","abstract":false,"def":{"name":"__help__","visibility":"Public","body":"@__help__.not_nil!"}},{"html_id":"inspect(io)-instance-method","name":"inspect","abstract":false,"args":[{"name":"io","external_name":"io","restriction":""}],"args_string":"(io)","args_html":"(io)","location":{"filename":"src/clear/cli/migration.cr","line_number":37,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L37"},"def":{"name":"inspect","args":[{"name":"io","external_name":"io","restriction":""}],"visibility":"Public","body":"io << \"<#{self.class}\"\nio << \"(\"\nif SPECS.empty?\nelse\n io << (SPECS.keys.join(\", \"))\nend\nio << \")\"\nio << \">\"\n"}},{"html_id":"no_color-instance-method","name":"no_color","abstract":false,"def":{"name":"no_color","visibility":"Public","body":"@no_color.not_nil!"}},{"html_id":"validate!(command)-instance-method","name":"validate!","abstract":false,"args":[{"name":"command","external_name":"command","restriction":""}],"args_string":"(command)","args_html":"(command)","def":{"name":"validate!","args":[{"name":"command","external_name":"command","restriction":""}],"visibility":"Public","body":"if @verbose.nil?\n raise(Admiral::Error.new(\"Flag required: --verbose\"))\nend\nif @no_color.nil?\n raise(Admiral::Error.new(\"Flag required: --no-color\"))\nend\nif @__help__.nil?\n raise(Admiral::Error.new(\"Flag required: --help\"))\nend\nraise_extra_flags!(command)\n"}},{"html_id":"verbose-instance-method","name":"verbose","abstract":false,"def":{"name":"verbose","visibility":"Public","body":"@verbose.not_nil!"}}]}]},{"html_id":"clear/Clear/CLI/Migration/Flags","path":"Clear/CLI/Migration/Flags.html","kind":"struct","full_name":"Clear::CLI::Migration::Flags","name":"Flags","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli/migration.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L1"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"DESCRIPTIONS","name":"DESCRIPTIONS","value":"{} of String => String"},{"id":"SPECS","name":"SPECS","value":"{\"verbose\" => {kind: \"bool\", type: \"Bool\", default: \"false\", description: {\"--verbose, -v\", \"Display verbose informations during execution\"}, short: \"v\", long: \"verbose\", is_required: true}, \"no_color\" => {kind: \"bool\", type: \"Bool\", default: \"false\", description: {\"--no-color\", \"Cancel color output\"}, short: \"nil\", long: \"no-color\", is_required: true}, \"__help__\" => {kind: \"bool\", type: \"Bool\", default: \"false\", description: {\"--help\", \"Displays help for the current command.\"}, short: \"nil\", long: \"help\", is_required: true}} of String => NamedTuple(kind: String, type: String, default: String, description: Tuple(String, String | ::Nil), short: String | ::Nil, long: String, is_required: Bool)"}],"namespace":{"html_id":"clear/Clear/CLI/Migration","kind":"class","full_name":"Clear::CLI::Migration","name":"Migration"},"doc":"Extend the flags struct to include the flag","summary":"

Extend the flags struct to include the flag

","constructors":[{"html_id":"new(command:Admiral::Command)-class-method","name":"new","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"new","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":"_ = allocate\n_.initialize(command)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"__help__-instance-method","name":"__help__","abstract":false,"def":{"name":"__help__","visibility":"Public","body":"@__help__.not_nil!"}},{"html_id":"inspect(io)-instance-method","name":"inspect","abstract":false,"args":[{"name":"io","external_name":"io","restriction":""}],"args_string":"(io)","args_html":"(io)","location":{"filename":"src/clear/cli/migration.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L1"},"def":{"name":"inspect","args":[{"name":"io","external_name":"io","restriction":""}],"visibility":"Public","body":"io << \"<#{self.class}\"\nio << \"(\"\nif SPECS.empty?\nelse\n io << (SPECS.keys.join(\", \"))\nend\nio << \")\"\nio << \">\"\n"}},{"html_id":"no_color-instance-method","name":"no_color","abstract":false,"def":{"name":"no_color","visibility":"Public","body":"@no_color.not_nil!"}},{"html_id":"validate!(command)-instance-method","name":"validate!","abstract":false,"args":[{"name":"command","external_name":"command","restriction":""}],"args_string":"(command)","args_html":"(command)","def":{"name":"validate!","args":[{"name":"command","external_name":"command","restriction":""}],"visibility":"Public","body":"if @verbose.nil?\n raise(Admiral::Error.new(\"Flag required: --verbose\"))\nend\nif @no_color.nil?\n raise(Admiral::Error.new(\"Flag required: --no-color\"))\nend\nif @__help__.nil?\n raise(Admiral::Error.new(\"Flag required: --help\"))\nend\nraise_extra_flags!(command)\n"}},{"html_id":"verbose-instance-method","name":"verbose","abstract":false,"def":{"name":"verbose","visibility":"Public","body":"@verbose.not_nil!"}}]},{"html_id":"clear/Clear/CLI/Migration/Migrate","path":"Clear/CLI/Migration/Migrate.html","kind":"class","full_name":"Clear::CLI::Migration::Migrate","name":"Migrate","abstract":false,"superclass":{"html_id":"clear/Admiral/Command","kind":"class","full_name":"Admiral::Command","name":"Command"},"ancestors":[{"html_id":"clear/Clear/CLI/Command","kind":"module","full_name":"Clear::CLI::Command","name":"Command"},{"html_id":"clear/Admiral/Command","kind":"class","full_name":"Admiral::Command","name":"Command"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli/migration.cr","line_number":71,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L71"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"HELP","name":"HELP","value":"{\"description\" => \"\"}"}],"included_modules":[{"html_id":"clear/Clear/CLI/Command","kind":"module","full_name":"Clear::CLI::Command","name":"Command"}],"namespace":{"html_id":"clear/Clear/CLI/Migration","kind":"class","full_name":"Clear::CLI::Migration","name":"Migration"},"class_methods":[{"html_id":"description-class-method","name":"description","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":71,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L71"},"def":{"name":"description","visibility":"Public","body":"HELP[\"description\"]"}},{"html_id":"run(*args,**params)-class-method","name":"run","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **params)","args_html":"(*args, **params)","location":{"filename":"src/clear/cli/migration.cr","line_number":71,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L71"},"def":{"name":"run","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"params","external_name":"params","restriction":""},"splat_index":0,"visibility":"Public","body":"(new(*args, **params)).parse_and_run"}}],"instance_methods":[{"html_id":"__rescue_from___Admiral__Error(e)-instance-method","name":"__rescue_from___Admiral__Error","abstract":false,"args":[{"name":"e","external_name":"e","restriction":""}],"args_string":"(e)","args_html":"(e)","def":{"name":"__rescue_from___Admiral__Error","args":[{"name":"e","external_name":"e","restriction":""}],"visibility":"Public","body":"panic(e.message.colorize(:red))"}},{"html_id":"arguments-instance-method","name":"arguments","doc":"Returns the commands `Arguments` object.\n\nYou can access names arguments by name.\nYou can also access the remaning arguments using `.arguments[index]`.","summary":"

Returns the commands Arguments object.

","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":71,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L71"},"def":{"name":"arguments","visibility":"Public","body":"@arguments || (@arguments = Arguments.new(self))"}},{"html_id":"flags-instance-method","name":"flags","doc":"Returns the commands `Flags` object.\n\nYou can access names flags by name.","summary":"

Returns the commands Flags object.

","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":71,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L71"},"def":{"name":"flags","visibility":"Public","body":"@flags || (@flags = Flags.new(self))"}},{"html_id":"run-instance-method","name":"run","doc":"The run command.","summary":"

The run command.

","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":72,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L72"},"def":{"name":"run","visibility":"Public","body":"Colorize.enabled = !flags.no_color\nrun_impl\n"}},{"html_id":"run_impl-instance-method","name":"run_impl","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":74,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L74"},"def":{"name":"run_impl","visibility":"Public","body":"Clear::Migration::Manager.instance.apply_all"}},{"html_id":"sub(command,*args,**params)-instance-method","name":"sub","doc":"Invokes a sub command by name, passing `self` as the parent.","summary":"

Invokes a sub command by name, passing self as the parent.

","abstract":false,"args":[{"name":"command","external_name":"command","restriction":""},{"name":"args","external_name":"args","restriction":""}],"args_string":"(command, *args, **params)","args_html":"(command, *args, **params)","location":{"filename":"src/clear/cli/migration.cr","line_number":71,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L71"},"def":{"name":"sub","args":[{"name":"command","external_name":"command","restriction":""},{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"params","external_name":"params","restriction":""},"splat_index":1,"visibility":"Public","body":"SubCommands.invoke(command, *args, **params, parent: self)"}}],"types":[{"html_id":"clear/Clear/CLI/Migration/Migrate/Arguments","path":"Clear/CLI/Migration/Migrate/Arguments.html","kind":"struct","full_name":"Clear::CLI::Migration::Migrate::Arguments","name":"Arguments","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Iterable","kind":"module","full_name":"Iterable","name":"Iterable"},{"html_id":"clear/Enumerable","kind":"module","full_name":"Enumerable","name":"Enumerable"},{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli/migration.cr","line_number":71,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L71"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"SPECS","name":"SPECS","value":"{} of String => NamedTuple(type: String, description: Tuple(String, String | ::Nil), default: String, is_required: Bool)"}],"included_modules":[{"html_id":"clear/Enumerable","kind":"module","full_name":"Enumerable","name":"Enumerable"},{"html_id":"clear/Iterable","kind":"module","full_name":"Iterable","name":"Iterable"}],"namespace":{"html_id":"clear/Clear/CLI/Migration/Migrate","kind":"class","full_name":"Clear::CLI::Migration::Migrate","name":"Migrate"},"constructors":[{"html_id":"new(command:Admiral::Command)-class-method","name":"new","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"new","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":"_ = allocate\n_.initialize(command)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"[](*args,**options)-instance-method","name":"[]","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","def":{"name":"[]","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@__rest__[*args, **options]"}},{"html_id":"[](*args,**options,&)-instance-method","name":"[]","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","def":{"name":"[]","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@__rest__.[](*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"each(*args,**options)-instance-method","name":"each","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","def":{"name":"each","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@__rest__.each(*args, **options)"}},{"html_id":"each(*args,**options,&)-instance-method","name":"each","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","def":{"name":"each","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@__rest__.each(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"exists?(name:Symbol)-instance-method","name":"exists?","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"exists?","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":"!!SPECS[name]?"}},{"html_id":"get(name:Symbol)-instance-method","name":"get","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"get","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":""}},{"html_id":"get?(name:Symbol)-instance-method","name":"get?","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"get?","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":"exists?(name) ? get(name) : false"}},{"html_id":"inspect(io)-instance-method","name":"inspect","abstract":false,"args":[{"name":"io","external_name":"io","restriction":""}],"args_string":"(io)","args_html":"(io)","location":{"filename":"src/clear/cli/migration.cr","line_number":71,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L71"},"def":{"name":"inspect","args":[{"name":"io","external_name":"io","restriction":""}],"visibility":"Public","body":"names = SPECS.keys\nif size > 0\n names << \"...\"\nend\nio << \"<#{self.class}\"\nio << \"(\"\nif names.empty?\nelse\n io << (names.join(\", \"))\nend\nio << \")\"\nio << \">\"\n"}},{"html_id":"rest:Array(String)-instance-method","name":"rest","abstract":false,"def":{"name":"rest","visibility":"Public","body":"@__rest__"}},{"html_id":"validate!(command:Admiral::Command)-instance-method","name":"validate!","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"validate!","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":""}},{"html_id":"value_from_spec(command:Admiral::Command,*,arg:String,type,default,is_required:Bool)-instance-method","name":"value_from_spec","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"},{"name":"","external_name":"","restriction":""},{"name":"arg","external_name":"arg","restriction":"String"},{"name":"type","external_name":"type","restriction":""},{"name":"default","external_name":"default","restriction":""},{"name":"is_required","external_name":"is_required","restriction":"Bool"}],"args_string":"(command : Admiral::Command, *, arg : String, type, default, is_required : Bool)","args_html":"(command : Admiral::Command, *, arg : String, type, default, is_required : Bool)","location":{"filename":"src/clear/cli/migration.cr","line_number":71,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L71"},"def":{"name":"value_from_spec","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"},{"name":"","external_name":"","restriction":""},{"name":"arg","external_name":"arg","restriction":"String"},{"name":"type","external_name":"type","restriction":""},{"name":"default","external_name":"default","restriction":""},{"name":"is_required","external_name":"is_required","restriction":"Bool"}],"splat_index":1,"visibility":"Public","body":"pos_only = false\nindex = 0\nwhile ((command.@argv)[index]?.to_s.starts_with?(\"-\")) && !pos_only\n index = index + 1\n pos_only = (command.@argv)[index]? == \"--\"\nend\nif (command.@argv)[index]?\n value = (command.@argv).delete_at(index)\n type.new(value)\nelse\n default\nend\n"}}]},{"html_id":"clear/Clear/CLI/Migration/Migrate/Flags","path":"Clear/CLI/Migration/Migrate/Flags.html","kind":"struct","full_name":"Clear::CLI::Migration::Migrate::Flags","name":"Flags","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli/migration.cr","line_number":71,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L71"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"DESCRIPTIONS","name":"DESCRIPTIONS","value":"{} of String => String"},{"id":"SPECS","name":"SPECS","value":"{\"verbose\" => {kind: \"bool\", type: \"Bool\", default: \"false\", description: {\"--verbose, -v\", \"Display verbose informations during execution\"}, short: \"v\", long: \"verbose\", is_required: true}, \"no_color\" => {kind: \"bool\", type: \"Bool\", default: \"false\", description: {\"--no-color\", \"Cancel color output\"}, short: \"nil\", long: \"no-color\", is_required: true}} of String => NamedTuple(kind: String, type: String, default: String, description: Tuple(String, String | ::Nil), short: String | ::Nil, long: String, is_required: Bool)"}],"namespace":{"html_id":"clear/Clear/CLI/Migration/Migrate","kind":"class","full_name":"Clear::CLI::Migration::Migrate","name":"Migrate"},"doc":"Extend the flags struct to include the flag","summary":"

Extend the flags struct to include the flag

","constructors":[{"html_id":"new(command:Admiral::Command)-class-method","name":"new","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"new","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":"_ = allocate\n_.initialize(command)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"inspect(io)-instance-method","name":"inspect","abstract":false,"args":[{"name":"io","external_name":"io","restriction":""}],"args_string":"(io)","args_html":"(io)","location":{"filename":"src/clear/cli/migration.cr","line_number":71,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L71"},"def":{"name":"inspect","args":[{"name":"io","external_name":"io","restriction":""}],"visibility":"Public","body":"io << \"<#{self.class}\"\nio << \"(\"\nif SPECS.empty?\nelse\n io << (SPECS.keys.join(\", \"))\nend\nio << \")\"\nio << \">\"\n"}},{"html_id":"no_color-instance-method","name":"no_color","abstract":false,"def":{"name":"no_color","visibility":"Public","body":"@no_color.not_nil!"}},{"html_id":"validate!(command)-instance-method","name":"validate!","abstract":false,"args":[{"name":"command","external_name":"command","restriction":""}],"args_string":"(command)","args_html":"(command)","def":{"name":"validate!","args":[{"name":"command","external_name":"command","restriction":""}],"visibility":"Public","body":"if @verbose.nil?\n raise(Admiral::Error.new(\"Flag required: --verbose\"))\nend\nif @no_color.nil?\n raise(Admiral::Error.new(\"Flag required: --no-color\"))\nend\nraise_extra_flags!(command)\n"}},{"html_id":"verbose-instance-method","name":"verbose","abstract":false,"def":{"name":"verbose","visibility":"Public","body":"@verbose.not_nil!"}}]}]},{"html_id":"clear/Clear/CLI/Migration/Rollback","path":"Clear/CLI/Migration/Rollback.html","kind":"class","full_name":"Clear::CLI::Migration::Rollback","name":"Rollback","abstract":false,"superclass":{"html_id":"clear/Admiral/Command","kind":"class","full_name":"Admiral::Command","name":"Command"},"ancestors":[{"html_id":"clear/Clear/CLI/Command","kind":"module","full_name":"Clear::CLI::Command","name":"Command"},{"html_id":"clear/Admiral/Command","kind":"class","full_name":"Admiral::Command","name":"Command"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli/migration.cr","line_number":79,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L79"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"HELP","name":"HELP","value":"{\"description\" => \"\"}"}],"included_modules":[{"html_id":"clear/Clear/CLI/Command","kind":"module","full_name":"Clear::CLI::Command","name":"Command"}],"namespace":{"html_id":"clear/Clear/CLI/Migration","kind":"class","full_name":"Clear::CLI::Migration","name":"Migration"},"class_methods":[{"html_id":"description-class-method","name":"description","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":79,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L79"},"def":{"name":"description","visibility":"Public","body":"HELP[\"description\"]"}},{"html_id":"run(*args,**params)-class-method","name":"run","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **params)","args_html":"(*args, **params)","location":{"filename":"src/clear/cli/migration.cr","line_number":79,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L79"},"def":{"name":"run","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"params","external_name":"params","restriction":""},"splat_index":0,"visibility":"Public","body":"(new(*args, **params)).parse_and_run"}}],"instance_methods":[{"html_id":"__rescue_from___Admiral__Error(e)-instance-method","name":"__rescue_from___Admiral__Error","abstract":false,"args":[{"name":"e","external_name":"e","restriction":""}],"args_string":"(e)","args_html":"(e)","def":{"name":"__rescue_from___Admiral__Error","args":[{"name":"e","external_name":"e","restriction":""}],"visibility":"Public","body":"panic(e.message.colorize(:red))"}},{"html_id":"arguments-instance-method","name":"arguments","doc":"Returns the commands `Arguments` object.\n\nYou can access names arguments by name.\nYou can also access the remaning arguments using `.arguments[index]`.","summary":"

Returns the commands Arguments object.

","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":79,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L79"},"def":{"name":"arguments","visibility":"Public","body":"@arguments || (@arguments = Arguments.new(self))"}},{"html_id":"flags-instance-method","name":"flags","doc":"Returns the commands `Flags` object.\n\nYou can access names flags by name.","summary":"

Returns the commands Flags object.

","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":79,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L79"},"def":{"name":"flags","visibility":"Public","body":"@flags || (@flags = Flags.new(self))"}},{"html_id":"help-instance-method","name":"help","abstract":false,"def":{"name":"help","visibility":"Public","body":"[help_usage, \"Rollback the last up migration\" + \"\\n\", help_flags, help_arguments, help_sub_commands].reject() do |__arg0|\n __arg0.strip.empty?\nend.join(\"\\n\")"}},{"html_id":"run-instance-method","name":"run","doc":"The run command.","summary":"

The run command.

","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":80,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L80"},"def":{"name":"run","visibility":"Public","body":"Colorize.enabled = !flags.no_color\nrun_impl\n"}},{"html_id":"run_impl-instance-method","name":"run_impl","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":85,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L85"},"def":{"name":"run_impl","visibility":"Public","body":"array = Clear::Migration::Manager.instance.migrations_up.to_a.sort\nnum = (arguments.num.try(&.to_i) || 1) + 1\nif num > array.size\n num = array.size - 1\nend\nClear::Migration::Manager.instance.apply_to(array[-num], direction: :down)\n"}},{"html_id":"sub(command,*args,**params)-instance-method","name":"sub","doc":"Invokes a sub command by name, passing `self` as the parent.","summary":"

Invokes a sub command by name, passing self as the parent.

","abstract":false,"args":[{"name":"command","external_name":"command","restriction":""},{"name":"args","external_name":"args","restriction":""}],"args_string":"(command, *args, **params)","args_html":"(command, *args, **params)","location":{"filename":"src/clear/cli/migration.cr","line_number":79,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L79"},"def":{"name":"sub","args":[{"name":"command","external_name":"command","restriction":""},{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"params","external_name":"params","restriction":""},"splat_index":1,"visibility":"Public","body":"SubCommands.invoke(command, *args, **params, parent: self)"}}],"types":[{"html_id":"clear/Clear/CLI/Migration/Rollback/Arguments","path":"Clear/CLI/Migration/Rollback/Arguments.html","kind":"struct","full_name":"Clear::CLI::Migration::Rollback::Arguments","name":"Arguments","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Iterable","kind":"module","full_name":"Iterable","name":"Iterable"},{"html_id":"clear/Enumerable","kind":"module","full_name":"Enumerable","name":"Enumerable"},{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli/migration.cr","line_number":79,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L79"},{"filename":"src/clear/cli/migration.cr","line_number":83,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L83"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"SPECS","name":"SPECS","value":"{\"num\" => {type: \"Int64\", description: {\"num\", \"\"}, default: \"nil\", is_required: false}} of String => NamedTuple(type: String, description: Tuple(String, String | ::Nil), default: String, is_required: Bool)"}],"included_modules":[{"html_id":"clear/Enumerable","kind":"module","full_name":"Enumerable","name":"Enumerable"},{"html_id":"clear/Iterable","kind":"module","full_name":"Iterable","name":"Iterable"}],"namespace":{"html_id":"clear/Clear/CLI/Migration/Rollback","kind":"class","full_name":"Clear::CLI::Migration::Rollback","name":"Rollback"},"constructors":[{"html_id":"new(command:Admiral::Command)-class-method","name":"new","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"new","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":"_ = allocate\n_.initialize(command)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"[](*args,**options)-instance-method","name":"[]","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","def":{"name":"[]","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@__rest__[*args, **options]"}},{"html_id":"[](*args,**options,&)-instance-method","name":"[]","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","def":{"name":"[]","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@__rest__.[](*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"each(*args,**options)-instance-method","name":"each","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","def":{"name":"each","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@__rest__.each(*args, **options)"}},{"html_id":"each(*args,**options,&)-instance-method","name":"each","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","def":{"name":"each","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@__rest__.each(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"exists?(name:Symbol)-instance-method","name":"exists?","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"exists?","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":"!!SPECS[name]?"}},{"html_id":"get(name:Symbol)-instance-method","name":"get","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"get","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":"{num: @num}[name]?"}},{"html_id":"get?(name:Symbol)-instance-method","name":"get?","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"get?","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":"exists?(name) ? get(name) : false"}},{"html_id":"inspect(io)-instance-method","name":"inspect","abstract":false,"args":[{"name":"io","external_name":"io","restriction":""}],"args_string":"(io)","args_html":"(io)","location":{"filename":"src/clear/cli/migration.cr","line_number":79,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L79"},"def":{"name":"inspect","args":[{"name":"io","external_name":"io","restriction":""}],"visibility":"Public","body":"names = SPECS.keys\nif size > 0\n names << \"...\"\nend\nio << \"<#{self.class}\"\nio << \"(\"\nif names.empty?\nelse\n io << (names.join(\", \"))\nend\nio << \")\"\nio << \">\"\n"}},{"html_id":"num:Int64|Nil-instance-method","name":"num","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":83,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L83"},"def":{"name":"num","return_type":"Int64 | Nil","visibility":"Public","body":"@num"}},{"html_id":"rest:Array(String)-instance-method","name":"rest","abstract":false,"def":{"name":"rest","visibility":"Public","body":"@__rest__"}},{"html_id":"validate!(command:Admiral::Command)-instance-method","name":"validate!","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"validate!","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":"if {type: \"Int64\", description: {\"num\", \"\"}, default: \"nil\", is_required: false}[:is_required] && @num.nil?\n raise(Admiral::Error.new(\"Argument required: num\"))\nend"}},{"html_id":"value_from_spec(command:Admiral::Command,*,arg:String,type,default,is_required:Bool)-instance-method","name":"value_from_spec","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"},{"name":"","external_name":"","restriction":""},{"name":"arg","external_name":"arg","restriction":"String"},{"name":"type","external_name":"type","restriction":""},{"name":"default","external_name":"default","restriction":""},{"name":"is_required","external_name":"is_required","restriction":"Bool"}],"args_string":"(command : Admiral::Command, *, arg : String, type, default, is_required : Bool)","args_html":"(command : Admiral::Command, *, arg : String, type, default, is_required : Bool)","location":{"filename":"src/clear/cli/migration.cr","line_number":79,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L79"},"def":{"name":"value_from_spec","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"},{"name":"","external_name":"","restriction":""},{"name":"arg","external_name":"arg","restriction":"String"},{"name":"type","external_name":"type","restriction":""},{"name":"default","external_name":"default","restriction":""},{"name":"is_required","external_name":"is_required","restriction":"Bool"}],"splat_index":1,"visibility":"Public","body":"pos_only = false\nindex = 0\nwhile ((command.@argv)[index]?.to_s.starts_with?(\"-\")) && !pos_only\n index = index + 1\n pos_only = (command.@argv)[index]? == \"--\"\nend\nif (command.@argv)[index]?\n value = (command.@argv).delete_at(index)\n type.new(value)\nelse\n default\nend\n"}}]},{"html_id":"clear/Clear/CLI/Migration/Rollback/Flags","path":"Clear/CLI/Migration/Rollback/Flags.html","kind":"struct","full_name":"Clear::CLI::Migration::Rollback::Flags","name":"Flags","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli/migration.cr","line_number":79,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L79"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"DESCRIPTIONS","name":"DESCRIPTIONS","value":"{} of String => String"},{"id":"SPECS","name":"SPECS","value":"{\"verbose\" => {kind: \"bool\", type: \"Bool\", default: \"false\", description: {\"--verbose, -v\", \"Display verbose informations during execution\"}, short: \"v\", long: \"verbose\", is_required: true}, \"no_color\" => {kind: \"bool\", type: \"Bool\", default: \"false\", description: {\"--no-color\", \"Cancel color output\"}, short: \"nil\", long: \"no-color\", is_required: true}, \"__help__\" => {kind: \"bool\", type: \"Bool\", default: \"false\", description: {\"--help\", \"Displays help for the current command.\"}, short: \"nil\", long: \"help\", is_required: true}} of String => NamedTuple(kind: String, type: String, default: String, description: Tuple(String, String | ::Nil), short: String | ::Nil, long: String, is_required: Bool)"}],"namespace":{"html_id":"clear/Clear/CLI/Migration/Rollback","kind":"class","full_name":"Clear::CLI::Migration::Rollback","name":"Rollback"},"doc":"Extend the flags struct to include the flag","summary":"

Extend the flags struct to include the flag

","constructors":[{"html_id":"new(command:Admiral::Command)-class-method","name":"new","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"new","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":"_ = allocate\n_.initialize(command)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"__help__-instance-method","name":"__help__","abstract":false,"def":{"name":"__help__","visibility":"Public","body":"@__help__.not_nil!"}},{"html_id":"inspect(io)-instance-method","name":"inspect","abstract":false,"args":[{"name":"io","external_name":"io","restriction":""}],"args_string":"(io)","args_html":"(io)","location":{"filename":"src/clear/cli/migration.cr","line_number":79,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L79"},"def":{"name":"inspect","args":[{"name":"io","external_name":"io","restriction":""}],"visibility":"Public","body":"io << \"<#{self.class}\"\nio << \"(\"\nif SPECS.empty?\nelse\n io << (SPECS.keys.join(\", \"))\nend\nio << \")\"\nio << \">\"\n"}},{"html_id":"no_color-instance-method","name":"no_color","abstract":false,"def":{"name":"no_color","visibility":"Public","body":"@no_color.not_nil!"}},{"html_id":"validate!(command)-instance-method","name":"validate!","abstract":false,"args":[{"name":"command","external_name":"command","restriction":""}],"args_string":"(command)","args_html":"(command)","def":{"name":"validate!","args":[{"name":"command","external_name":"command","restriction":""}],"visibility":"Public","body":"if @verbose.nil?\n raise(Admiral::Error.new(\"Flag required: --verbose\"))\nend\nif @no_color.nil?\n raise(Admiral::Error.new(\"Flag required: --no-color\"))\nend\nif @__help__.nil?\n raise(Admiral::Error.new(\"Flag required: --help\"))\nend\nraise_extra_flags!(command)\n"}},{"html_id":"verbose-instance-method","name":"verbose","abstract":false,"def":{"name":"verbose","visibility":"Public","body":"@verbose.not_nil!"}}]}]},{"html_id":"clear/Clear/CLI/Migration/Seed","path":"Clear/CLI/Migration/Seed.html","kind":"class","full_name":"Clear::CLI::Migration::Seed","name":"Seed","abstract":false,"superclass":{"html_id":"clear/Admiral/Command","kind":"class","full_name":"Admiral::Command","name":"Command"},"ancestors":[{"html_id":"clear/Clear/CLI/Command","kind":"module","full_name":"Clear::CLI::Command","name":"Command"},{"html_id":"clear/Admiral/Command","kind":"class","full_name":"Admiral::Command","name":"Command"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli/migration.cr","line_number":16,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L16"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"HELP","name":"HELP","value":"{\"description\" => \"\"}"}],"included_modules":[{"html_id":"clear/Clear/CLI/Command","kind":"module","full_name":"Clear::CLI::Command","name":"Command"}],"namespace":{"html_id":"clear/Clear/CLI/Migration","kind":"class","full_name":"Clear::CLI::Migration","name":"Migration"},"class_methods":[{"html_id":"description-class-method","name":"description","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":16,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L16"},"def":{"name":"description","visibility":"Public","body":"HELP[\"description\"]"}},{"html_id":"run(*args,**params)-class-method","name":"run","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **params)","args_html":"(*args, **params)","location":{"filename":"src/clear/cli/migration.cr","line_number":16,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L16"},"def":{"name":"run","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"params","external_name":"params","restriction":""},"splat_index":0,"visibility":"Public","body":"(new(*args, **params)).parse_and_run"}}],"instance_methods":[{"html_id":"__rescue_from___Admiral__Error(e)-instance-method","name":"__rescue_from___Admiral__Error","abstract":false,"args":[{"name":"e","external_name":"e","restriction":""}],"args_string":"(e)","args_html":"(e)","def":{"name":"__rescue_from___Admiral__Error","args":[{"name":"e","external_name":"e","restriction":""}],"visibility":"Public","body":"panic(e.message.colorize(:red))"}},{"html_id":"arguments-instance-method","name":"arguments","doc":"Returns the commands `Arguments` object.\n\nYou can access names arguments by name.\nYou can also access the remaning arguments using `.arguments[index]`.","summary":"

Returns the commands Arguments object.

","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":16,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L16"},"def":{"name":"arguments","visibility":"Public","body":"@arguments || (@arguments = Arguments.new(self))"}},{"html_id":"flags-instance-method","name":"flags","doc":"Returns the commands `Flags` object.\n\nYou can access names flags by name.","summary":"

Returns the commands Flags object.

","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":16,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L16"},"def":{"name":"flags","visibility":"Public","body":"@flags || (@flags = Flags.new(self))"}},{"html_id":"help-instance-method","name":"help","abstract":false,"def":{"name":"help","visibility":"Public","body":"[help_usage, \"Call the seeds data\" + \"\\n\", help_flags, help_arguments, help_sub_commands].reject() do |__arg0|\n __arg0.strip.empty?\nend.join(\"\\n\")"}},{"html_id":"run-instance-method","name":"run","doc":"The run command.","summary":"

The run command.

","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":17,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L17"},"def":{"name":"run","visibility":"Public","body":"Colorize.enabled = !flags.no_color\nrun_impl\n"}},{"html_id":"run_impl-instance-method","name":"run_impl","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":21,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L21"},"def":{"name":"run_impl","visibility":"Public","body":"Clear.apply_seeds"}},{"html_id":"sub(command,*args,**params)-instance-method","name":"sub","doc":"Invokes a sub command by name, passing `self` as the parent.","summary":"

Invokes a sub command by name, passing self as the parent.

","abstract":false,"args":[{"name":"command","external_name":"command","restriction":""},{"name":"args","external_name":"args","restriction":""}],"args_string":"(command, *args, **params)","args_html":"(command, *args, **params)","location":{"filename":"src/clear/cli/migration.cr","line_number":16,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L16"},"def":{"name":"sub","args":[{"name":"command","external_name":"command","restriction":""},{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"params","external_name":"params","restriction":""},"splat_index":1,"visibility":"Public","body":"SubCommands.invoke(command, *args, **params, parent: self)"}}],"types":[{"html_id":"clear/Clear/CLI/Migration/Seed/Arguments","path":"Clear/CLI/Migration/Seed/Arguments.html","kind":"struct","full_name":"Clear::CLI::Migration::Seed::Arguments","name":"Arguments","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Iterable","kind":"module","full_name":"Iterable","name":"Iterable"},{"html_id":"clear/Enumerable","kind":"module","full_name":"Enumerable","name":"Enumerable"},{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli/migration.cr","line_number":16,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L16"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"SPECS","name":"SPECS","value":"{} of String => NamedTuple(type: String, description: Tuple(String, String | ::Nil), default: String, is_required: Bool)"}],"included_modules":[{"html_id":"clear/Enumerable","kind":"module","full_name":"Enumerable","name":"Enumerable"},{"html_id":"clear/Iterable","kind":"module","full_name":"Iterable","name":"Iterable"}],"namespace":{"html_id":"clear/Clear/CLI/Migration/Seed","kind":"class","full_name":"Clear::CLI::Migration::Seed","name":"Seed"},"constructors":[{"html_id":"new(command:Admiral::Command)-class-method","name":"new","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"new","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":"_ = allocate\n_.initialize(command)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"[](*args,**options)-instance-method","name":"[]","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","def":{"name":"[]","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@__rest__[*args, **options]"}},{"html_id":"[](*args,**options,&)-instance-method","name":"[]","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","def":{"name":"[]","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@__rest__.[](*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"each(*args,**options)-instance-method","name":"each","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","def":{"name":"each","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@__rest__.each(*args, **options)"}},{"html_id":"each(*args,**options,&)-instance-method","name":"each","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","def":{"name":"each","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@__rest__.each(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"exists?(name:Symbol)-instance-method","name":"exists?","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"exists?","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":"!!SPECS[name]?"}},{"html_id":"get(name:Symbol)-instance-method","name":"get","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"get","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":""}},{"html_id":"get?(name:Symbol)-instance-method","name":"get?","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"get?","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":"exists?(name) ? get(name) : false"}},{"html_id":"inspect(io)-instance-method","name":"inspect","abstract":false,"args":[{"name":"io","external_name":"io","restriction":""}],"args_string":"(io)","args_html":"(io)","location":{"filename":"src/clear/cli/migration.cr","line_number":16,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L16"},"def":{"name":"inspect","args":[{"name":"io","external_name":"io","restriction":""}],"visibility":"Public","body":"names = SPECS.keys\nif size > 0\n names << \"...\"\nend\nio << \"<#{self.class}\"\nio << \"(\"\nif names.empty?\nelse\n io << (names.join(\", \"))\nend\nio << \")\"\nio << \">\"\n"}},{"html_id":"rest:Array(String)-instance-method","name":"rest","abstract":false,"def":{"name":"rest","visibility":"Public","body":"@__rest__"}},{"html_id":"validate!(command:Admiral::Command)-instance-method","name":"validate!","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"validate!","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":""}},{"html_id":"value_from_spec(command:Admiral::Command,*,arg:String,type,default,is_required:Bool)-instance-method","name":"value_from_spec","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"},{"name":"","external_name":"","restriction":""},{"name":"arg","external_name":"arg","restriction":"String"},{"name":"type","external_name":"type","restriction":""},{"name":"default","external_name":"default","restriction":""},{"name":"is_required","external_name":"is_required","restriction":"Bool"}],"args_string":"(command : Admiral::Command, *, arg : String, type, default, is_required : Bool)","args_html":"(command : Admiral::Command, *, arg : String, type, default, is_required : Bool)","location":{"filename":"src/clear/cli/migration.cr","line_number":16,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L16"},"def":{"name":"value_from_spec","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"},{"name":"","external_name":"","restriction":""},{"name":"arg","external_name":"arg","restriction":"String"},{"name":"type","external_name":"type","restriction":""},{"name":"default","external_name":"default","restriction":""},{"name":"is_required","external_name":"is_required","restriction":"Bool"}],"splat_index":1,"visibility":"Public","body":"pos_only = false\nindex = 0\nwhile ((command.@argv)[index]?.to_s.starts_with?(\"-\")) && !pos_only\n index = index + 1\n pos_only = (command.@argv)[index]? == \"--\"\nend\nif (command.@argv)[index]?\n value = (command.@argv).delete_at(index)\n type.new(value)\nelse\n default\nend\n"}}]},{"html_id":"clear/Clear/CLI/Migration/Seed/Flags","path":"Clear/CLI/Migration/Seed/Flags.html","kind":"struct","full_name":"Clear::CLI::Migration::Seed::Flags","name":"Flags","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli/migration.cr","line_number":16,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L16"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"DESCRIPTIONS","name":"DESCRIPTIONS","value":"{} of String => String"},{"id":"SPECS","name":"SPECS","value":"{\"verbose\" => {kind: \"bool\", type: \"Bool\", default: \"false\", description: {\"--verbose, -v\", \"Display verbose informations during execution\"}, short: \"v\", long: \"verbose\", is_required: true}, \"no_color\" => {kind: \"bool\", type: \"Bool\", default: \"false\", description: {\"--no-color\", \"Cancel color output\"}, short: \"nil\", long: \"no-color\", is_required: true}, \"__help__\" => {kind: \"bool\", type: \"Bool\", default: \"false\", description: {\"--help\", \"Displays help for the current command.\"}, short: \"nil\", long: \"help\", is_required: true}} of String => NamedTuple(kind: String, type: String, default: String, description: Tuple(String, String | ::Nil), short: String | ::Nil, long: String, is_required: Bool)"}],"namespace":{"html_id":"clear/Clear/CLI/Migration/Seed","kind":"class","full_name":"Clear::CLI::Migration::Seed","name":"Seed"},"doc":"Extend the flags struct to include the flag","summary":"

Extend the flags struct to include the flag

","constructors":[{"html_id":"new(command:Admiral::Command)-class-method","name":"new","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"new","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":"_ = allocate\n_.initialize(command)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"__help__-instance-method","name":"__help__","abstract":false,"def":{"name":"__help__","visibility":"Public","body":"@__help__.not_nil!"}},{"html_id":"inspect(io)-instance-method","name":"inspect","abstract":false,"args":[{"name":"io","external_name":"io","restriction":""}],"args_string":"(io)","args_html":"(io)","location":{"filename":"src/clear/cli/migration.cr","line_number":16,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L16"},"def":{"name":"inspect","args":[{"name":"io","external_name":"io","restriction":""}],"visibility":"Public","body":"io << \"<#{self.class}\"\nio << \"(\"\nif SPECS.empty?\nelse\n io << (SPECS.keys.join(\", \"))\nend\nio << \")\"\nio << \">\"\n"}},{"html_id":"no_color-instance-method","name":"no_color","abstract":false,"def":{"name":"no_color","visibility":"Public","body":"@no_color.not_nil!"}},{"html_id":"validate!(command)-instance-method","name":"validate!","abstract":false,"args":[{"name":"command","external_name":"command","restriction":""}],"args_string":"(command)","args_html":"(command)","def":{"name":"validate!","args":[{"name":"command","external_name":"command","restriction":""}],"visibility":"Public","body":"if @verbose.nil?\n raise(Admiral::Error.new(\"Flag required: --verbose\"))\nend\nif @no_color.nil?\n raise(Admiral::Error.new(\"Flag required: --no-color\"))\nend\nif @__help__.nil?\n raise(Admiral::Error.new(\"Flag required: --help\"))\nend\nraise_extra_flags!(command)\n"}},{"html_id":"verbose-instance-method","name":"verbose","abstract":false,"def":{"name":"verbose","visibility":"Public","body":"@verbose.not_nil!"}}]}]},{"html_id":"clear/Clear/CLI/Migration/Set","path":"Clear/CLI/Migration/Set.html","kind":"class","full_name":"Clear::CLI::Migration::Set","name":"Set","abstract":false,"superclass":{"html_id":"clear/Admiral/Command","kind":"class","full_name":"Admiral::Command","name":"Command"},"ancestors":[{"html_id":"clear/Clear/CLI/Command","kind":"module","full_name":"Clear::CLI::Command","name":"Command"},{"html_id":"clear/Admiral/Command","kind":"class","full_name":"Admiral::Command","name":"Command"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli/migration.cr","line_number":48,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L48"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"HELP","name":"HELP","value":"{\"description\" => \"\"}"}],"included_modules":[{"html_id":"clear/Clear/CLI/Command","kind":"module","full_name":"Clear::CLI::Command","name":"Command"}],"namespace":{"html_id":"clear/Clear/CLI/Migration","kind":"class","full_name":"Clear::CLI::Migration","name":"Migration"},"class_methods":[{"html_id":"description-class-method","name":"description","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":48,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L48"},"def":{"name":"description","visibility":"Public","body":"HELP[\"description\"]"}},{"html_id":"run(*args,**params)-class-method","name":"run","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **params)","args_html":"(*args, **params)","location":{"filename":"src/clear/cli/migration.cr","line_number":48,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L48"},"def":{"name":"run","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"params","external_name":"params","restriction":""},"splat_index":0,"visibility":"Public","body":"(new(*args, **params)).parse_and_run"}}],"instance_methods":[{"html_id":"__rescue_from___Admiral__Error(e)-instance-method","name":"__rescue_from___Admiral__Error","abstract":false,"args":[{"name":"e","external_name":"e","restriction":""}],"args_string":"(e)","args_html":"(e)","def":{"name":"__rescue_from___Admiral__Error","args":[{"name":"e","external_name":"e","restriction":""}],"visibility":"Public","body":"panic(e.message.colorize(:red))"}},{"html_id":"arguments-instance-method","name":"arguments","doc":"Returns the commands `Arguments` object.\n\nYou can access names arguments by name.\nYou can also access the remaning arguments using `.arguments[index]`.","summary":"

Returns the commands Arguments object.

","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":48,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L48"},"def":{"name":"arguments","visibility":"Public","body":"@arguments || (@arguments = Arguments.new(self))"}},{"html_id":"flags-instance-method","name":"flags","doc":"Returns the commands `Flags` object.\n\nYou can access names flags by name.","summary":"

Returns the commands Flags object.

","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":48,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L48"},"def":{"name":"flags","visibility":"Public","body":"@flags || (@flags = Flags.new(self))"}},{"html_id":"run-instance-method","name":"run","doc":"The run command.","summary":"

The run command.

","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":49,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L49"},"def":{"name":"run","visibility":"Public","body":"Colorize.enabled = !flags.no_color\nrun_impl\n"}},{"html_id":"run_impl-instance-method","name":"run_impl","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":54,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L54"},"def":{"name":"run_impl","visibility":"Public","body":"dir_symbol = case flags.direction\nwhen \"up\"\n :up\nwhen \"down\"\n :down\nwhen \"both\"\n :both\nelse\n puts(\"Bad argument --direction : #{flags.direction}. Must be up|down|both\")\n exit(1)\nend\nClear::Migration::Manager.instance.apply_to(arguments.to, direction: dir_symbol)\n"}},{"html_id":"sub(command,*args,**params)-instance-method","name":"sub","doc":"Invokes a sub command by name, passing `self` as the parent.","summary":"

Invokes a sub command by name, passing self as the parent.

","abstract":false,"args":[{"name":"command","external_name":"command","restriction":""},{"name":"args","external_name":"args","restriction":""}],"args_string":"(command, *args, **params)","args_html":"(command, *args, **params)","location":{"filename":"src/clear/cli/migration.cr","line_number":48,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L48"},"def":{"name":"sub","args":[{"name":"command","external_name":"command","restriction":""},{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"params","external_name":"params","restriction":""},"splat_index":1,"visibility":"Public","body":"SubCommands.invoke(command, *args, **params, parent: self)"}}],"types":[{"html_id":"clear/Clear/CLI/Migration/Set/Arguments","path":"Clear/CLI/Migration/Set/Arguments.html","kind":"struct","full_name":"Clear::CLI::Migration::Set::Arguments","name":"Arguments","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Iterable","kind":"module","full_name":"Iterable","name":"Iterable"},{"html_id":"clear/Enumerable","kind":"module","full_name":"Enumerable","name":"Enumerable"},{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli/migration.cr","line_number":48,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L48"},{"filename":"src/clear/cli/migration.cr","line_number":52,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L52"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"SPECS","name":"SPECS","value":"{\"to\" => {type: \"Int64\", description: {\"to (required)\", \"\"}, default: \"nil\", is_required: true}} of String => NamedTuple(type: String, description: Tuple(String, String | ::Nil), default: String, is_required: Bool)"}],"included_modules":[{"html_id":"clear/Enumerable","kind":"module","full_name":"Enumerable","name":"Enumerable"},{"html_id":"clear/Iterable","kind":"module","full_name":"Iterable","name":"Iterable"}],"namespace":{"html_id":"clear/Clear/CLI/Migration/Set","kind":"class","full_name":"Clear::CLI::Migration::Set","name":"Set"},"constructors":[{"html_id":"new(command:Admiral::Command)-class-method","name":"new","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"new","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":"_ = allocate\n_.initialize(command)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"[](*args,**options)-instance-method","name":"[]","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","def":{"name":"[]","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@__rest__[*args, **options]"}},{"html_id":"[](*args,**options,&)-instance-method","name":"[]","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","def":{"name":"[]","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@__rest__.[](*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"each(*args,**options)-instance-method","name":"each","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","def":{"name":"each","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@__rest__.each(*args, **options)"}},{"html_id":"each(*args,**options,&)-instance-method","name":"each","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","def":{"name":"each","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@__rest__.each(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"exists?(name:Symbol)-instance-method","name":"exists?","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"exists?","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":"!!SPECS[name]?"}},{"html_id":"get(name:Symbol)-instance-method","name":"get","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"get","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":"{to: @to}[name]?"}},{"html_id":"get?(name:Symbol)-instance-method","name":"get?","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"get?","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":"exists?(name) ? get(name) : false"}},{"html_id":"inspect(io)-instance-method","name":"inspect","abstract":false,"args":[{"name":"io","external_name":"io","restriction":""}],"args_string":"(io)","args_html":"(io)","location":{"filename":"src/clear/cli/migration.cr","line_number":48,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L48"},"def":{"name":"inspect","args":[{"name":"io","external_name":"io","restriction":""}],"visibility":"Public","body":"names = SPECS.keys\nif size > 0\n names << \"...\"\nend\nio << \"<#{self.class}\"\nio << \"(\"\nif names.empty?\nelse\n io << (names.join(\", \"))\nend\nio << \")\"\nio << \">\"\n"}},{"html_id":"rest:Array(String)-instance-method","name":"rest","abstract":false,"def":{"name":"rest","visibility":"Public","body":"@__rest__"}},{"html_id":"to:Int64-instance-method","name":"to","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":52,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L52"},"def":{"name":"to","return_type":"Int64","visibility":"Public","body":"@to.not_nil!"}},{"html_id":"validate!(command:Admiral::Command)-instance-method","name":"validate!","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"validate!","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":"if {type: \"Int64\", description: {\"to (required)\", \"\"}, default: \"nil\", is_required: true}[:is_required] && @to.nil?\n raise(Admiral::Error.new(\"Argument required: to\"))\nend"}},{"html_id":"value_from_spec(command:Admiral::Command,*,arg:String,type,default,is_required:Bool)-instance-method","name":"value_from_spec","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"},{"name":"","external_name":"","restriction":""},{"name":"arg","external_name":"arg","restriction":"String"},{"name":"type","external_name":"type","restriction":""},{"name":"default","external_name":"default","restriction":""},{"name":"is_required","external_name":"is_required","restriction":"Bool"}],"args_string":"(command : Admiral::Command, *, arg : String, type, default, is_required : Bool)","args_html":"(command : Admiral::Command, *, arg : String, type, default, is_required : Bool)","location":{"filename":"src/clear/cli/migration.cr","line_number":48,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L48"},"def":{"name":"value_from_spec","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"},{"name":"","external_name":"","restriction":""},{"name":"arg","external_name":"arg","restriction":"String"},{"name":"type","external_name":"type","restriction":""},{"name":"default","external_name":"default","restriction":""},{"name":"is_required","external_name":"is_required","restriction":"Bool"}],"splat_index":1,"visibility":"Public","body":"pos_only = false\nindex = 0\nwhile ((command.@argv)[index]?.to_s.starts_with?(\"-\")) && !pos_only\n index = index + 1\n pos_only = (command.@argv)[index]? == \"--\"\nend\nif (command.@argv)[index]?\n value = (command.@argv).delete_at(index)\n type.new(value)\nelse\n default\nend\n"}}]},{"html_id":"clear/Clear/CLI/Migration/Set/Flags","path":"Clear/CLI/Migration/Set/Flags.html","kind":"struct","full_name":"Clear::CLI::Migration::Set::Flags","name":"Flags","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli/migration.cr","line_number":48,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L48"},{"filename":"src/clear/cli/migration.cr","line_number":51,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L51"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"DESCRIPTIONS","name":"DESCRIPTIONS","value":"{} of String => String"},{"id":"SPECS","name":"SPECS","value":"{\"verbose\" => {kind: \"bool\", type: \"Bool\", default: \"false\", description: {\"--verbose, -v\", \"Display verbose informations during execution\"}, short: \"v\", long: \"verbose\", is_required: true}, \"no_color\" => {kind: \"bool\", type: \"Bool\", default: \"false\", description: {\"--no-color\", \"Cancel color output\"}, short: \"nil\", long: \"no-color\", is_required: true}, \"direction\" => {kind: \"nil\", type: \"String\", default: \"\\\"both\\\"\", description: {\"--direction, -d (default: \\\"both\\\")\", \"\"}, short: \"d\", long: \"direction\", is_required: true}} of String => NamedTuple(kind: String, type: String, default: String, description: Tuple(String, String | ::Nil), short: String | ::Nil, long: String, is_required: Bool)"}],"namespace":{"html_id":"clear/Clear/CLI/Migration/Set","kind":"class","full_name":"Clear::CLI::Migration::Set","name":"Set"},"doc":"Extend the flags struct to include the flag","summary":"

Extend the flags struct to include the flag

","constructors":[{"html_id":"new(command:Admiral::Command)-class-method","name":"new","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"new","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":"_ = allocate\n_.initialize(command)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"direction-instance-method","name":"direction","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":51,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L51"},"def":{"name":"direction","visibility":"Public","body":"@direction.not_nil!"}},{"html_id":"inspect(io)-instance-method","name":"inspect","abstract":false,"args":[{"name":"io","external_name":"io","restriction":""}],"args_string":"(io)","args_html":"(io)","location":{"filename":"src/clear/cli/migration.cr","line_number":48,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L48"},"def":{"name":"inspect","args":[{"name":"io","external_name":"io","restriction":""}],"visibility":"Public","body":"io << \"<#{self.class}\"\nio << \"(\"\nif SPECS.empty?\nelse\n io << (SPECS.keys.join(\", \"))\nend\nio << \")\"\nio << \">\"\n"}},{"html_id":"no_color-instance-method","name":"no_color","abstract":false,"def":{"name":"no_color","visibility":"Public","body":"@no_color.not_nil!"}},{"html_id":"validate!(command)-instance-method","name":"validate!","abstract":false,"args":[{"name":"command","external_name":"command","restriction":""}],"args_string":"(command)","args_html":"(command)","def":{"name":"validate!","args":[{"name":"command","external_name":"command","restriction":""}],"visibility":"Public","body":"if @verbose.nil?\n raise(Admiral::Error.new(\"Flag required: --verbose\"))\nend\nif @no_color.nil?\n raise(Admiral::Error.new(\"Flag required: --no-color\"))\nend\nif @direction.nil?\n raise(Admiral::Error.new(\"Flag required: --direction\"))\nend\nraise_extra_flags!(command)\n"}},{"html_id":"verbose-instance-method","name":"verbose","abstract":false,"def":{"name":"verbose","visibility":"Public","body":"@verbose.not_nil!"}}]}]},{"html_id":"clear/Clear/CLI/Migration/Status","path":"Clear/CLI/Migration/Status.html","kind":"class","full_name":"Clear::CLI::Migration::Status","name":"Status","abstract":false,"superclass":{"html_id":"clear/Admiral/Command","kind":"class","full_name":"Admiral::Command","name":"Command"},"ancestors":[{"html_id":"clear/Clear/CLI/Command","kind":"module","full_name":"Clear::CLI::Command","name":"Command"},{"html_id":"clear/Admiral/Command","kind":"class","full_name":"Admiral::Command","name":"Command"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli/migration.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L6"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"HELP","name":"HELP","value":"{\"description\" => \"\"}"}],"included_modules":[{"html_id":"clear/Clear/CLI/Command","kind":"module","full_name":"Clear::CLI::Command","name":"Command"}],"namespace":{"html_id":"clear/Clear/CLI/Migration","kind":"class","full_name":"Clear::CLI::Migration","name":"Migration"},"class_methods":[{"html_id":"description-class-method","name":"description","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L6"},"def":{"name":"description","visibility":"Public","body":"HELP[\"description\"]"}},{"html_id":"run(*args,**params)-class-method","name":"run","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **params)","args_html":"(*args, **params)","location":{"filename":"src/clear/cli/migration.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L6"},"def":{"name":"run","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"params","external_name":"params","restriction":""},"splat_index":0,"visibility":"Public","body":"(new(*args, **params)).parse_and_run"}}],"instance_methods":[{"html_id":"__rescue_from___Admiral__Error(e)-instance-method","name":"__rescue_from___Admiral__Error","abstract":false,"args":[{"name":"e","external_name":"e","restriction":""}],"args_string":"(e)","args_html":"(e)","def":{"name":"__rescue_from___Admiral__Error","args":[{"name":"e","external_name":"e","restriction":""}],"visibility":"Public","body":"panic(e.message.colorize(:red))"}},{"html_id":"arguments-instance-method","name":"arguments","doc":"Returns the commands `Arguments` object.\n\nYou can access names arguments by name.\nYou can also access the remaning arguments using `.arguments[index]`.","summary":"

Returns the commands Arguments object.

","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L6"},"def":{"name":"arguments","visibility":"Public","body":"@arguments || (@arguments = Arguments.new(self))"}},{"html_id":"flags-instance-method","name":"flags","doc":"Returns the commands `Flags` object.\n\nYou can access names flags by name.","summary":"

Returns the commands Flags object.

","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L6"},"def":{"name":"flags","visibility":"Public","body":"@flags || (@flags = Flags.new(self))"}},{"html_id":"help-instance-method","name":"help","abstract":false,"def":{"name":"help","visibility":"Public","body":"[help_usage, \"Return the current state of the database\" + \"\\n\", help_flags, help_arguments, help_sub_commands].reject() do |__arg0|\n __arg0.strip.empty?\nend.join(\"\\n\")"}},{"html_id":"run-instance-method","name":"run","doc":"The run command.","summary":"

The run command.

","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":7,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L7"},"def":{"name":"run","visibility":"Public","body":"Colorize.enabled = !flags.no_color\nrun_impl\n"}},{"html_id":"run_impl-instance-method","name":"run_impl","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":11,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L11"},"def":{"name":"run_impl","visibility":"Public","body":"puts(Clear::Migration::Manager.instance.print_status)"}},{"html_id":"sub(command,*args,**params)-instance-method","name":"sub","doc":"Invokes a sub command by name, passing `self` as the parent.","summary":"

Invokes a sub command by name, passing self as the parent.

","abstract":false,"args":[{"name":"command","external_name":"command","restriction":""},{"name":"args","external_name":"args","restriction":""}],"args_string":"(command, *args, **params)","args_html":"(command, *args, **params)","location":{"filename":"src/clear/cli/migration.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L6"},"def":{"name":"sub","args":[{"name":"command","external_name":"command","restriction":""},{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"params","external_name":"params","restriction":""},"splat_index":1,"visibility":"Public","body":"SubCommands.invoke(command, *args, **params, parent: self)"}}],"types":[{"html_id":"clear/Clear/CLI/Migration/Status/Arguments","path":"Clear/CLI/Migration/Status/Arguments.html","kind":"struct","full_name":"Clear::CLI::Migration::Status::Arguments","name":"Arguments","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Iterable","kind":"module","full_name":"Iterable","name":"Iterable"},{"html_id":"clear/Enumerable","kind":"module","full_name":"Enumerable","name":"Enumerable"},{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli/migration.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L6"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"SPECS","name":"SPECS","value":"{} of String => NamedTuple(type: String, description: Tuple(String, String | ::Nil), default: String, is_required: Bool)"}],"included_modules":[{"html_id":"clear/Enumerable","kind":"module","full_name":"Enumerable","name":"Enumerable"},{"html_id":"clear/Iterable","kind":"module","full_name":"Iterable","name":"Iterable"}],"namespace":{"html_id":"clear/Clear/CLI/Migration/Status","kind":"class","full_name":"Clear::CLI::Migration::Status","name":"Status"},"constructors":[{"html_id":"new(command:Admiral::Command)-class-method","name":"new","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"new","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":"_ = allocate\n_.initialize(command)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"[](*args,**options)-instance-method","name":"[]","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","def":{"name":"[]","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@__rest__[*args, **options]"}},{"html_id":"[](*args,**options,&)-instance-method","name":"[]","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","def":{"name":"[]","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@__rest__.[](*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"each(*args,**options)-instance-method","name":"each","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","def":{"name":"each","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@__rest__.each(*args, **options)"}},{"html_id":"each(*args,**options,&)-instance-method","name":"each","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","def":{"name":"each","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@__rest__.each(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"exists?(name:Symbol)-instance-method","name":"exists?","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"exists?","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":"!!SPECS[name]?"}},{"html_id":"get(name:Symbol)-instance-method","name":"get","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"get","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":""}},{"html_id":"get?(name:Symbol)-instance-method","name":"get?","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"get?","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":"exists?(name) ? get(name) : false"}},{"html_id":"inspect(io)-instance-method","name":"inspect","abstract":false,"args":[{"name":"io","external_name":"io","restriction":""}],"args_string":"(io)","args_html":"(io)","location":{"filename":"src/clear/cli/migration.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L6"},"def":{"name":"inspect","args":[{"name":"io","external_name":"io","restriction":""}],"visibility":"Public","body":"names = SPECS.keys\nif size > 0\n names << \"...\"\nend\nio << \"<#{self.class}\"\nio << \"(\"\nif names.empty?\nelse\n io << (names.join(\", \"))\nend\nio << \")\"\nio << \">\"\n"}},{"html_id":"rest:Array(String)-instance-method","name":"rest","abstract":false,"def":{"name":"rest","visibility":"Public","body":"@__rest__"}},{"html_id":"validate!(command:Admiral::Command)-instance-method","name":"validate!","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"validate!","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":""}},{"html_id":"value_from_spec(command:Admiral::Command,*,arg:String,type,default,is_required:Bool)-instance-method","name":"value_from_spec","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"},{"name":"","external_name":"","restriction":""},{"name":"arg","external_name":"arg","restriction":"String"},{"name":"type","external_name":"type","restriction":""},{"name":"default","external_name":"default","restriction":""},{"name":"is_required","external_name":"is_required","restriction":"Bool"}],"args_string":"(command : Admiral::Command, *, arg : String, type, default, is_required : Bool)","args_html":"(command : Admiral::Command, *, arg : String, type, default, is_required : Bool)","location":{"filename":"src/clear/cli/migration.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L6"},"def":{"name":"value_from_spec","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"},{"name":"","external_name":"","restriction":""},{"name":"arg","external_name":"arg","restriction":"String"},{"name":"type","external_name":"type","restriction":""},{"name":"default","external_name":"default","restriction":""},{"name":"is_required","external_name":"is_required","restriction":"Bool"}],"splat_index":1,"visibility":"Public","body":"pos_only = false\nindex = 0\nwhile ((command.@argv)[index]?.to_s.starts_with?(\"-\")) && !pos_only\n index = index + 1\n pos_only = (command.@argv)[index]? == \"--\"\nend\nif (command.@argv)[index]?\n value = (command.@argv).delete_at(index)\n type.new(value)\nelse\n default\nend\n"}}]},{"html_id":"clear/Clear/CLI/Migration/Status/Flags","path":"Clear/CLI/Migration/Status/Flags.html","kind":"struct","full_name":"Clear::CLI::Migration::Status::Flags","name":"Flags","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli/migration.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L6"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"DESCRIPTIONS","name":"DESCRIPTIONS","value":"{} of String => String"},{"id":"SPECS","name":"SPECS","value":"{\"verbose\" => {kind: \"bool\", type: \"Bool\", default: \"false\", description: {\"--verbose, -v\", \"Display verbose informations during execution\"}, short: \"v\", long: \"verbose\", is_required: true}, \"no_color\" => {kind: \"bool\", type: \"Bool\", default: \"false\", description: {\"--no-color\", \"Cancel color output\"}, short: \"nil\", long: \"no-color\", is_required: true}, \"__help__\" => {kind: \"bool\", type: \"Bool\", default: \"false\", description: {\"--help\", \"Displays help for the current command.\"}, short: \"nil\", long: \"help\", is_required: true}} of String => NamedTuple(kind: String, type: String, default: String, description: Tuple(String, String | ::Nil), short: String | ::Nil, long: String, is_required: Bool)"}],"namespace":{"html_id":"clear/Clear/CLI/Migration/Status","kind":"class","full_name":"Clear::CLI::Migration::Status","name":"Status"},"doc":"Extend the flags struct to include the flag","summary":"

Extend the flags struct to include the flag

","constructors":[{"html_id":"new(command:Admiral::Command)-class-method","name":"new","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"new","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":"_ = allocate\n_.initialize(command)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"__help__-instance-method","name":"__help__","abstract":false,"def":{"name":"__help__","visibility":"Public","body":"@__help__.not_nil!"}},{"html_id":"inspect(io)-instance-method","name":"inspect","abstract":false,"args":[{"name":"io","external_name":"io","restriction":""}],"args_string":"(io)","args_html":"(io)","location":{"filename":"src/clear/cli/migration.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L6"},"def":{"name":"inspect","args":[{"name":"io","external_name":"io","restriction":""}],"visibility":"Public","body":"io << \"<#{self.class}\"\nio << \"(\"\nif SPECS.empty?\nelse\n io << (SPECS.keys.join(\", \"))\nend\nio << \")\"\nio << \">\"\n"}},{"html_id":"no_color-instance-method","name":"no_color","abstract":false,"def":{"name":"no_color","visibility":"Public","body":"@no_color.not_nil!"}},{"html_id":"validate!(command)-instance-method","name":"validate!","abstract":false,"args":[{"name":"command","external_name":"command","restriction":""}],"args_string":"(command)","args_html":"(command)","def":{"name":"validate!","args":[{"name":"command","external_name":"command","restriction":""}],"visibility":"Public","body":"if @verbose.nil?\n raise(Admiral::Error.new(\"Flag required: --verbose\"))\nend\nif @no_color.nil?\n raise(Admiral::Error.new(\"Flag required: --no-color\"))\nend\nif @__help__.nil?\n raise(Admiral::Error.new(\"Flag required: --help\"))\nend\nraise_extra_flags!(command)\n"}},{"html_id":"verbose-instance-method","name":"verbose","abstract":false,"def":{"name":"verbose","visibility":"Public","body":"@verbose.not_nil!"}}]}]},{"html_id":"clear/Clear/CLI/Migration/Up","path":"Clear/CLI/Migration/Up.html","kind":"class","full_name":"Clear::CLI::Migration::Up","name":"Up","abstract":false,"superclass":{"html_id":"clear/Admiral/Command","kind":"class","full_name":"Admiral::Command","name":"Command"},"ancestors":[{"html_id":"clear/Clear/CLI/Command","kind":"module","full_name":"Clear::CLI::Command","name":"Command"},{"html_id":"clear/Admiral/Command","kind":"class","full_name":"Admiral::Command","name":"Command"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli/migration.cr","line_number":26,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L26"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"HELP","name":"HELP","value":"{\"description\" => \"\"}"}],"included_modules":[{"html_id":"clear/Clear/CLI/Command","kind":"module","full_name":"Clear::CLI::Command","name":"Command"}],"namespace":{"html_id":"clear/Clear/CLI/Migration","kind":"class","full_name":"Clear::CLI::Migration","name":"Migration"},"class_methods":[{"html_id":"description-class-method","name":"description","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":26,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L26"},"def":{"name":"description","visibility":"Public","body":"HELP[\"description\"]"}},{"html_id":"run(*args,**params)-class-method","name":"run","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **params)","args_html":"(*args, **params)","location":{"filename":"src/clear/cli/migration.cr","line_number":26,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L26"},"def":{"name":"run","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"params","external_name":"params","restriction":""},"splat_index":0,"visibility":"Public","body":"(new(*args, **params)).parse_and_run"}}],"instance_methods":[{"html_id":"__rescue_from___Admiral__Error(e)-instance-method","name":"__rescue_from___Admiral__Error","abstract":false,"args":[{"name":"e","external_name":"e","restriction":""}],"args_string":"(e)","args_html":"(e)","def":{"name":"__rescue_from___Admiral__Error","args":[{"name":"e","external_name":"e","restriction":""}],"visibility":"Public","body":"panic(e.message.colorize(:red))"}},{"html_id":"arguments-instance-method","name":"arguments","doc":"Returns the commands `Arguments` object.\n\nYou can access names arguments by name.\nYou can also access the remaning arguments using `.arguments[index]`.","summary":"

Returns the commands Arguments object.

","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":26,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L26"},"def":{"name":"arguments","visibility":"Public","body":"@arguments || (@arguments = Arguments.new(self))"}},{"html_id":"flags-instance-method","name":"flags","doc":"Returns the commands `Flags` object.\n\nYou can access names flags by name.","summary":"

Returns the commands Flags object.

","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":26,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L26"},"def":{"name":"flags","visibility":"Public","body":"@flags || (@flags = Flags.new(self))"}},{"html_id":"help-instance-method","name":"help","abstract":false,"def":{"name":"help","visibility":"Public","body":"[help_usage, \"Upgrade your database to a specific migration version\" + \"\\n\", help_flags, help_arguments, help_sub_commands].reject() do |__arg0|\n __arg0.strip.empty?\nend.join(\"\\n\")"}},{"html_id":"run-instance-method","name":"run","doc":"The run command.","summary":"

The run command.

","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":27,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L27"},"def":{"name":"run","visibility":"Public","body":"Colorize.enabled = !flags.no_color\nrun_impl\n"}},{"html_id":"run_impl-instance-method","name":"run_impl","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":32,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L32"},"def":{"name":"run_impl","visibility":"Public","body":"Clear::Migration::Manager.instance.up(arguments.migration_number)"}},{"html_id":"sub(command,*args,**params)-instance-method","name":"sub","doc":"Invokes a sub command by name, passing `self` as the parent.","summary":"

Invokes a sub command by name, passing self as the parent.

","abstract":false,"args":[{"name":"command","external_name":"command","restriction":""},{"name":"args","external_name":"args","restriction":""}],"args_string":"(command, *args, **params)","args_html":"(command, *args, **params)","location":{"filename":"src/clear/cli/migration.cr","line_number":26,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L26"},"def":{"name":"sub","args":[{"name":"command","external_name":"command","restriction":""},{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"params","external_name":"params","restriction":""},"splat_index":1,"visibility":"Public","body":"SubCommands.invoke(command, *args, **params, parent: self)"}}],"types":[{"html_id":"clear/Clear/CLI/Migration/Up/Arguments","path":"Clear/CLI/Migration/Up/Arguments.html","kind":"struct","full_name":"Clear::CLI::Migration::Up::Arguments","name":"Arguments","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Iterable","kind":"module","full_name":"Iterable","name":"Iterable"},{"html_id":"clear/Enumerable","kind":"module","full_name":"Enumerable","name":"Enumerable"},{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli/migration.cr","line_number":26,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L26"},{"filename":"src/clear/cli/migration.cr","line_number":29,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L29"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"SPECS","name":"SPECS","value":"{\"migration_number\" => {type: \"Int64\", description: {\"migration_number (required)\", \"\"}, default: \"nil\", is_required: true}} of String => NamedTuple(type: String, description: Tuple(String, String | ::Nil), default: String, is_required: Bool)"}],"included_modules":[{"html_id":"clear/Enumerable","kind":"module","full_name":"Enumerable","name":"Enumerable"},{"html_id":"clear/Iterable","kind":"module","full_name":"Iterable","name":"Iterable"}],"namespace":{"html_id":"clear/Clear/CLI/Migration/Up","kind":"class","full_name":"Clear::CLI::Migration::Up","name":"Up"},"constructors":[{"html_id":"new(command:Admiral::Command)-class-method","name":"new","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"new","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":"_ = allocate\n_.initialize(command)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"[](*args,**options)-instance-method","name":"[]","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","def":{"name":"[]","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@__rest__[*args, **options]"}},{"html_id":"[](*args,**options,&)-instance-method","name":"[]","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","def":{"name":"[]","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@__rest__.[](*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"each(*args,**options)-instance-method","name":"each","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","def":{"name":"each","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@__rest__.each(*args, **options)"}},{"html_id":"each(*args,**options,&)-instance-method","name":"each","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","def":{"name":"each","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@__rest__.each(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"exists?(name:Symbol)-instance-method","name":"exists?","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"exists?","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":"!!SPECS[name]?"}},{"html_id":"get(name:Symbol)-instance-method","name":"get","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"get","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":"{migration_number: @migration_number}[name]?"}},{"html_id":"get?(name:Symbol)-instance-method","name":"get?","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"get?","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":"exists?(name) ? get(name) : false"}},{"html_id":"inspect(io)-instance-method","name":"inspect","abstract":false,"args":[{"name":"io","external_name":"io","restriction":""}],"args_string":"(io)","args_html":"(io)","location":{"filename":"src/clear/cli/migration.cr","line_number":26,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L26"},"def":{"name":"inspect","args":[{"name":"io","external_name":"io","restriction":""}],"visibility":"Public","body":"names = SPECS.keys\nif size > 0\n names << \"...\"\nend\nio << \"<#{self.class}\"\nio << \"(\"\nif names.empty?\nelse\n io << (names.join(\", \"))\nend\nio << \")\"\nio << \">\"\n"}},{"html_id":"migration_number:Int64-instance-method","name":"migration_number","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":29,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L29"},"def":{"name":"migration_number","return_type":"Int64","visibility":"Public","body":"@migration_number.not_nil!"}},{"html_id":"rest:Array(String)-instance-method","name":"rest","abstract":false,"def":{"name":"rest","visibility":"Public","body":"@__rest__"}},{"html_id":"validate!(command:Admiral::Command)-instance-method","name":"validate!","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"validate!","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":"if {type: \"Int64\", description: {\"migration_number (required)\", \"\"}, default: \"nil\", is_required: true}[:is_required] && @migration_number.nil?\n raise(Admiral::Error.new(\"Argument required: migration_number\"))\nend"}},{"html_id":"value_from_spec(command:Admiral::Command,*,arg:String,type,default,is_required:Bool)-instance-method","name":"value_from_spec","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"},{"name":"","external_name":"","restriction":""},{"name":"arg","external_name":"arg","restriction":"String"},{"name":"type","external_name":"type","restriction":""},{"name":"default","external_name":"default","restriction":""},{"name":"is_required","external_name":"is_required","restriction":"Bool"}],"args_string":"(command : Admiral::Command, *, arg : String, type, default, is_required : Bool)","args_html":"(command : Admiral::Command, *, arg : String, type, default, is_required : Bool)","location":{"filename":"src/clear/cli/migration.cr","line_number":26,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L26"},"def":{"name":"value_from_spec","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"},{"name":"","external_name":"","restriction":""},{"name":"arg","external_name":"arg","restriction":"String"},{"name":"type","external_name":"type","restriction":""},{"name":"default","external_name":"default","restriction":""},{"name":"is_required","external_name":"is_required","restriction":"Bool"}],"splat_index":1,"visibility":"Public","body":"pos_only = false\nindex = 0\nwhile ((command.@argv)[index]?.to_s.starts_with?(\"-\")) && !pos_only\n index = index + 1\n pos_only = (command.@argv)[index]? == \"--\"\nend\nif (command.@argv)[index]?\n value = (command.@argv).delete_at(index)\n type.new(value)\nelse\n default\nend\n"}}]},{"html_id":"clear/Clear/CLI/Migration/Up/Flags","path":"Clear/CLI/Migration/Up/Flags.html","kind":"struct","full_name":"Clear::CLI::Migration::Up::Flags","name":"Flags","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli/migration.cr","line_number":26,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L26"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"DESCRIPTIONS","name":"DESCRIPTIONS","value":"{} of String => String"},{"id":"SPECS","name":"SPECS","value":"{\"verbose\" => {kind: \"bool\", type: \"Bool\", default: \"false\", description: {\"--verbose, -v\", \"Display verbose informations during execution\"}, short: \"v\", long: \"verbose\", is_required: true}, \"no_color\" => {kind: \"bool\", type: \"Bool\", default: \"false\", description: {\"--no-color\", \"Cancel color output\"}, short: \"nil\", long: \"no-color\", is_required: true}, \"__help__\" => {kind: \"bool\", type: \"Bool\", default: \"false\", description: {\"--help\", \"Displays help for the current command.\"}, short: \"nil\", long: \"help\", is_required: true}} of String => NamedTuple(kind: String, type: String, default: String, description: Tuple(String, String | ::Nil), short: String | ::Nil, long: String, is_required: Bool)"}],"namespace":{"html_id":"clear/Clear/CLI/Migration/Up","kind":"class","full_name":"Clear::CLI::Migration::Up","name":"Up"},"doc":"Extend the flags struct to include the flag","summary":"

Extend the flags struct to include the flag

","constructors":[{"html_id":"new(command:Admiral::Command)-class-method","name":"new","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"new","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":"_ = allocate\n_.initialize(command)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"__help__-instance-method","name":"__help__","abstract":false,"def":{"name":"__help__","visibility":"Public","body":"@__help__.not_nil!"}},{"html_id":"inspect(io)-instance-method","name":"inspect","abstract":false,"args":[{"name":"io","external_name":"io","restriction":""}],"args_string":"(io)","args_html":"(io)","location":{"filename":"src/clear/cli/migration.cr","line_number":26,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L26"},"def":{"name":"inspect","args":[{"name":"io","external_name":"io","restriction":""}],"visibility":"Public","body":"io << \"<#{self.class}\"\nio << \"(\"\nif SPECS.empty?\nelse\n io << (SPECS.keys.join(\", \"))\nend\nio << \")\"\nio << \">\"\n"}},{"html_id":"no_color-instance-method","name":"no_color","abstract":false,"def":{"name":"no_color","visibility":"Public","body":"@no_color.not_nil!"}},{"html_id":"validate!(command)-instance-method","name":"validate!","abstract":false,"args":[{"name":"command","external_name":"command","restriction":""}],"args_string":"(command)","args_html":"(command)","def":{"name":"validate!","args":[{"name":"command","external_name":"command","restriction":""}],"visibility":"Public","body":"if @verbose.nil?\n raise(Admiral::Error.new(\"Flag required: --verbose\"))\nend\nif @no_color.nil?\n raise(Admiral::Error.new(\"Flag required: --no-color\"))\nend\nif @__help__.nil?\n raise(Admiral::Error.new(\"Flag required: --help\"))\nend\nraise_extra_flags!(command)\n"}},{"html_id":"verbose-instance-method","name":"verbose","abstract":false,"def":{"name":"verbose","visibility":"Public","body":"@verbose.not_nil!"}}]}]}]},{"html_id":"clear/Clear/CLI/Seed","path":"Clear/CLI/Seed.html","kind":"class","full_name":"Clear::CLI::Seed","name":"Seed","abstract":false,"superclass":{"html_id":"clear/Admiral/Command","kind":"class","full_name":"Admiral::Command","name":"Command"},"ancestors":[{"html_id":"clear/Clear/CLI/Command","kind":"module","full_name":"Clear::CLI::Command","name":"Command"},{"html_id":"clear/Admiral/Command","kind":"class","full_name":"Admiral::Command","name":"Command"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli/seed.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/seed.cr#L1"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"HELP","name":"HELP","value":"{\"description\" => \"\"}"}],"included_modules":[{"html_id":"clear/Clear/CLI/Command","kind":"module","full_name":"Clear::CLI::Command","name":"Command"}],"namespace":{"html_id":"clear/Clear/CLI","kind":"module","full_name":"Clear::CLI","name":"CLI"},"class_methods":[{"html_id":"description-class-method","name":"description","abstract":false,"location":{"filename":"src/clear/cli/seed.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/seed.cr#L1"},"def":{"name":"description","visibility":"Public","body":"HELP[\"description\"]"}},{"html_id":"run(*args,**params)-class-method","name":"run","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **params)","args_html":"(*args, **params)","location":{"filename":"src/clear/cli/seed.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/seed.cr#L1"},"def":{"name":"run","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"params","external_name":"params","restriction":""},"splat_index":0,"visibility":"Public","body":"(new(*args, **params)).parse_and_run"}}],"instance_methods":[{"html_id":"__rescue_from___Admiral__Error(e)-instance-method","name":"__rescue_from___Admiral__Error","abstract":false,"args":[{"name":"e","external_name":"e","restriction":""}],"args_string":"(e)","args_html":"(e)","def":{"name":"__rescue_from___Admiral__Error","args":[{"name":"e","external_name":"e","restriction":""}],"visibility":"Public","body":"panic(e.message.colorize(:red))"}},{"html_id":"arguments-instance-method","name":"arguments","doc":"Returns the commands `Arguments` object.\n\nYou can access names arguments by name.\nYou can also access the remaning arguments using `.arguments[index]`.","summary":"

Returns the commands Arguments object.

","abstract":false,"location":{"filename":"src/clear/cli/seed.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/seed.cr#L1"},"def":{"name":"arguments","visibility":"Public","body":"@arguments || (@arguments = Arguments.new(self))"}},{"html_id":"flags-instance-method","name":"flags","doc":"Returns the commands `Flags` object.\n\nYou can access names flags by name.","summary":"

Returns the commands Flags object.

","abstract":false,"location":{"filename":"src/clear/cli/seed.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/seed.cr#L1"},"def":{"name":"flags","visibility":"Public","body":"@flags || (@flags = Flags.new(self))"}},{"html_id":"help-instance-method","name":"help","abstract":false,"def":{"name":"help","visibility":"Public","body":"[help_usage, \"Seed the database with seed data\" + \"\\n\", help_flags, help_arguments, help_sub_commands].reject() do |__arg0|\n __arg0.strip.empty?\nend.join(\"\\n\")"}},{"html_id":"run-instance-method","name":"run","doc":"The run command.","summary":"

The run command.

","abstract":false,"location":{"filename":"src/clear/cli/seed.cr","line_number":2,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/seed.cr#L2"},"def":{"name":"run","visibility":"Public","body":"Colorize.enabled = !flags.no_color\nrun_impl\n"}},{"html_id":"run_impl-instance-method","name":"run_impl","abstract":false,"location":{"filename":"src/clear/cli/seed.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/seed.cr#L6"},"def":{"name":"run_impl","visibility":"Public","body":"Clear.apply_seeds"}},{"html_id":"sub(command,*args,**params)-instance-method","name":"sub","doc":"Invokes a sub command by name, passing `self` as the parent.","summary":"

Invokes a sub command by name, passing self as the parent.

","abstract":false,"args":[{"name":"command","external_name":"command","restriction":""},{"name":"args","external_name":"args","restriction":""}],"args_string":"(command, *args, **params)","args_html":"(command, *args, **params)","location":{"filename":"src/clear/cli/seed.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/seed.cr#L1"},"def":{"name":"sub","args":[{"name":"command","external_name":"command","restriction":""},{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"params","external_name":"params","restriction":""},"splat_index":1,"visibility":"Public","body":"SubCommands.invoke(command, *args, **params, parent: self)"}}],"types":[{"html_id":"clear/Clear/CLI/Seed/Arguments","path":"Clear/CLI/Seed/Arguments.html","kind":"struct","full_name":"Clear::CLI::Seed::Arguments","name":"Arguments","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Iterable","kind":"module","full_name":"Iterable","name":"Iterable"},{"html_id":"clear/Enumerable","kind":"module","full_name":"Enumerable","name":"Enumerable"},{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli/seed.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/seed.cr#L1"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"SPECS","name":"SPECS","value":"{} of String => NamedTuple(type: String, description: Tuple(String, String | ::Nil), default: String, is_required: Bool)"}],"included_modules":[{"html_id":"clear/Enumerable","kind":"module","full_name":"Enumerable","name":"Enumerable"},{"html_id":"clear/Iterable","kind":"module","full_name":"Iterable","name":"Iterable"}],"namespace":{"html_id":"clear/Clear/CLI/Seed","kind":"class","full_name":"Clear::CLI::Seed","name":"Seed"},"constructors":[{"html_id":"new(command:Admiral::Command)-class-method","name":"new","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"new","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":"_ = allocate\n_.initialize(command)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"[](*args,**options)-instance-method","name":"[]","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","def":{"name":"[]","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@__rest__[*args, **options]"}},{"html_id":"[](*args,**options,&)-instance-method","name":"[]","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","def":{"name":"[]","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@__rest__.[](*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"each(*args,**options)-instance-method","name":"each","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","def":{"name":"each","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@__rest__.each(*args, **options)"}},{"html_id":"each(*args,**options,&)-instance-method","name":"each","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","def":{"name":"each","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@__rest__.each(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"exists?(name:Symbol)-instance-method","name":"exists?","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"exists?","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":"!!SPECS[name]?"}},{"html_id":"get(name:Symbol)-instance-method","name":"get","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"get","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":""}},{"html_id":"get?(name:Symbol)-instance-method","name":"get?","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"get?","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":"exists?(name) ? get(name) : false"}},{"html_id":"inspect(io)-instance-method","name":"inspect","abstract":false,"args":[{"name":"io","external_name":"io","restriction":""}],"args_string":"(io)","args_html":"(io)","location":{"filename":"src/clear/cli/seed.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/seed.cr#L1"},"def":{"name":"inspect","args":[{"name":"io","external_name":"io","restriction":""}],"visibility":"Public","body":"names = SPECS.keys\nif size > 0\n names << \"...\"\nend\nio << \"<#{self.class}\"\nio << \"(\"\nif names.empty?\nelse\n io << (names.join(\", \"))\nend\nio << \")\"\nio << \">\"\n"}},{"html_id":"rest:Array(String)-instance-method","name":"rest","abstract":false,"def":{"name":"rest","visibility":"Public","body":"@__rest__"}},{"html_id":"validate!(command:Admiral::Command)-instance-method","name":"validate!","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"validate!","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":""}},{"html_id":"value_from_spec(command:Admiral::Command,*,arg:String,type,default,is_required:Bool)-instance-method","name":"value_from_spec","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"},{"name":"","external_name":"","restriction":""},{"name":"arg","external_name":"arg","restriction":"String"},{"name":"type","external_name":"type","restriction":""},{"name":"default","external_name":"default","restriction":""},{"name":"is_required","external_name":"is_required","restriction":"Bool"}],"args_string":"(command : Admiral::Command, *, arg : String, type, default, is_required : Bool)","args_html":"(command : Admiral::Command, *, arg : String, type, default, is_required : Bool)","location":{"filename":"src/clear/cli/seed.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/seed.cr#L1"},"def":{"name":"value_from_spec","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"},{"name":"","external_name":"","restriction":""},{"name":"arg","external_name":"arg","restriction":"String"},{"name":"type","external_name":"type","restriction":""},{"name":"default","external_name":"default","restriction":""},{"name":"is_required","external_name":"is_required","restriction":"Bool"}],"splat_index":1,"visibility":"Public","body":"pos_only = false\nindex = 0\nwhile ((command.@argv)[index]?.to_s.starts_with?(\"-\")) && !pos_only\n index = index + 1\n pos_only = (command.@argv)[index]? == \"--\"\nend\nif (command.@argv)[index]?\n value = (command.@argv).delete_at(index)\n type.new(value)\nelse\n default\nend\n"}}]},{"html_id":"clear/Clear/CLI/Seed/Flags","path":"Clear/CLI/Seed/Flags.html","kind":"struct","full_name":"Clear::CLI::Seed::Flags","name":"Flags","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli/seed.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/seed.cr#L1"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"DESCRIPTIONS","name":"DESCRIPTIONS","value":"{} of String => String"},{"id":"SPECS","name":"SPECS","value":"{\"verbose\" => {kind: \"bool\", type: \"Bool\", default: \"false\", description: {\"--verbose, -v\", \"Display verbose informations during execution\"}, short: \"v\", long: \"verbose\", is_required: true}, \"no_color\" => {kind: \"bool\", type: \"Bool\", default: \"false\", description: {\"--no-color\", \"Cancel color output\"}, short: \"nil\", long: \"no-color\", is_required: true}, \"__help__\" => {kind: \"bool\", type: \"Bool\", default: \"false\", description: {\"--help\", \"Displays help for the current command.\"}, short: \"nil\", long: \"help\", is_required: true}} of String => NamedTuple(kind: String, type: String, default: String, description: Tuple(String, String | ::Nil), short: String | ::Nil, long: String, is_required: Bool)"}],"namespace":{"html_id":"clear/Clear/CLI/Seed","kind":"class","full_name":"Clear::CLI::Seed","name":"Seed"},"doc":"Extend the flags struct to include the flag","summary":"

Extend the flags struct to include the flag

","constructors":[{"html_id":"new(command:Admiral::Command)-class-method","name":"new","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"new","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":"_ = allocate\n_.initialize(command)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"__help__-instance-method","name":"__help__","abstract":false,"def":{"name":"__help__","visibility":"Public","body":"@__help__.not_nil!"}},{"html_id":"inspect(io)-instance-method","name":"inspect","abstract":false,"args":[{"name":"io","external_name":"io","restriction":""}],"args_string":"(io)","args_html":"(io)","location":{"filename":"src/clear/cli/seed.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/seed.cr#L1"},"def":{"name":"inspect","args":[{"name":"io","external_name":"io","restriction":""}],"visibility":"Public","body":"io << \"<#{self.class}\"\nio << \"(\"\nif SPECS.empty?\nelse\n io << (SPECS.keys.join(\", \"))\nend\nio << \")\"\nio << \">\"\n"}},{"html_id":"no_color-instance-method","name":"no_color","abstract":false,"def":{"name":"no_color","visibility":"Public","body":"@no_color.not_nil!"}},{"html_id":"validate!(command)-instance-method","name":"validate!","abstract":false,"args":[{"name":"command","external_name":"command","restriction":""}],"args_string":"(command)","args_html":"(command)","def":{"name":"validate!","args":[{"name":"command","external_name":"command","restriction":""}],"visibility":"Public","body":"if @verbose.nil?\n raise(Admiral::Error.new(\"Flag required: --verbose\"))\nend\nif @no_color.nil?\n raise(Admiral::Error.new(\"Flag required: --no-color\"))\nend\nif @__help__.nil?\n raise(Admiral::Error.new(\"Flag required: --help\"))\nend\nraise_extra_flags!(command)\n"}},{"html_id":"verbose-instance-method","name":"verbose","abstract":false,"def":{"name":"verbose","visibility":"Public","body":"@verbose.not_nil!"}}]}]}]},{"html_id":"clear/Clear/Enum","path":"Clear/Enum.html","kind":"struct","full_name":"Clear::Enum","name":"Enum","abstract":true,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Clear/Expression/Literal","kind":"module","full_name":"Clear::Expression::Literal","name":"Literal"},{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/extensions/enum/enum.cr","line_number":7,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/enum/enum.cr#L7"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"clear/Clear/Expression/Literal","kind":"module","full_name":"Clear::Expression::Literal","name":"Literal"}],"namespace":{"html_id":"clear/Clear","kind":"module","full_name":"Clear","name":"Clear"},"doc":"Clear::Enum wrap the enums used in PostgreSQL.\nSee `Clear.enum` macro helper.","summary":"

Clear::Enum wrap the enums used in PostgreSQL.

","constructors":[{"html_id":"new(value:JSON::PullParser|String)-class-method","name":"new","abstract":false,"args":[{"name":"value","external_name":"value","restriction":"::JSON::PullParser | ::String"}],"args_string":"(value : JSON::PullParser | String)","args_html":"(value : JSON::PullParser | String)","location":{"filename":"src/clear/extensions/enum/enum.cr","line_number":12,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/enum/enum.cr#L12"},"def":{"name":"new","args":[{"name":"value","external_name":"value","restriction":"::JSON::PullParser | ::String"}],"visibility":"Public","body":"_ = allocate\n_.initialize(value)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"==(x)-instance-method","name":"==","doc":"Returns `true` if this struct is equal to *other*.\n\nBoth structs' instance vars are compared to each other. Thus, two\nstructs are considered equal if each of their instance variables are\nequal. Subclasses should override this method to provide specific\nequality semantics.\n\n```\nstruct Point\n def initialize(@x : Int32, @y : Int32)\n end\nend\n\np1 = Point.new 1, 2\np2 = Point.new 1, 2\np3 = Point.new 3, 4\n\np1 == p2 # => true\np1 == p3 # => false\n```","summary":"

Returns true if this struct is equal to other.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x)","args_html":"(x)","location":{"filename":"src/clear/extensions/enum/enum.cr","line_number":27,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/enum/enum.cr#L27"},"def":{"name":"==","args":[{"name":"x","external_name":"x","restriction":""}],"visibility":"Public","body":"(super(x)) || (@value == x)"}},{"html_id":"to_json(json:JSON::Builder)-instance-method","name":"to_json","abstract":false,"args":[{"name":"json","external_name":"json","restriction":"JSON::Builder"}],"args_string":"(json : JSON::Builder)","args_html":"(json : JSON::Builder)","location":{"filename":"src/clear/extensions/enum/enum.cr","line_number":23,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/enum/enum.cr#L23"},"def":{"name":"to_json","args":[{"name":"json","external_name":"json","restriction":"JSON::Builder"}],"visibility":"Public","body":"json.string(@value)"}},{"html_id":"to_s:String-instance-method","name":"to_s","doc":"Returns a nicely readable and concise string representation of this object,\ntypically intended for users.\n\nThis method should usually **not** be overridden. It delegates to\n`#to_s(IO)` which can be overridden for custom implementations.\n\nAlso see `#inspect`.","summary":"

Returns a nicely readable and concise string representation of this object, typically intended for users.

","abstract":false,"location":{"filename":"src/clear/extensions/enum/enum.cr","line_number":15,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/enum/enum.cr#L15"},"def":{"name":"to_s","return_type":"String","visibility":"Public","body":"@value.to_s"}},{"html_id":"to_sql:String-instance-method","name":"to_sql","abstract":false,"location":{"filename":"src/clear/extensions/enum/enum.cr","line_number":19,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/enum/enum.cr#L19"},"def":{"name":"to_sql","return_type":"String","visibility":"Public","body":"@value.to_sql"}}],"types":[{"html_id":"clear/Clear/Enum/Converter","path":"Clear/Enum/Converter.html","kind":"module","full_name":"Clear::Enum::Converter(T)","name":"Converter","abstract":false,"locations":[{"filename":"src/clear/extensions/enum/enum.cr","line_number":31,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/enum/enum.cr#L31"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Enum","kind":"struct","full_name":"Clear::Enum","name":"Enum"},"class_methods":[{"html_id":"to_column(x):T|Nil-class-method","name":"to_column","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x) : T | Nil","args_html":"(x) : T | Nil","location":{"filename":"src/clear/extensions/enum/enum.cr","line_number":32,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/enum/enum.cr#L32"},"def":{"name":"to_column","args":[{"name":"x","external_name":"x","restriction":""}],"return_type":"T | ::Nil","visibility":"Public","body":"case x\nwhen String\n T.authorized_values[x]\nwhen Nil\n nil\nelse\n raise(converter_error(x.class.name, \"Enum: #{T.class.name}\"))\nend"}}]}]},{"html_id":"clear/Clear/ErrorMessages","path":"Clear/ErrorMessages.html","kind":"module","full_name":"Clear::ErrorMessages","name":"ErrorMessages","abstract":false,"locations":[{"filename":"src/clear/error_messages.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/error_messages.cr#L4"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"extended_modules":[{"html_id":"clear/Clear/ErrorMessages","kind":"module","full_name":"Clear::ErrorMessages","name":"ErrorMessages"}],"including_types":[{"html_id":"clear/Clear/Migration","kind":"module","full_name":"Clear::Migration","name":"Migration"},{"html_id":"clear/Clear/Migration/Manager","kind":"class","full_name":"Clear::Migration::Manager","name":"Manager"},{"html_id":"clear/Clear/Migration/Operation","kind":"class","full_name":"Clear::Migration::Operation","name":"Operation"},{"html_id":"clear/Clear/Model","kind":"module","full_name":"Clear::Model","name":"Model"},{"html_id":"clear/Clear/Model/Column","kind":"class","full_name":"Clear::Model::Column(T, C)","name":"Column"}],"namespace":{"html_id":"clear/Clear","kind":"module","full_name":"Clear","name":"Clear"},"doc":"This module list most of the runtime errors happening in Clear.\nIt's an attempt to make Clear user friendly by enabling advanced resolution\nof problems when they raise.","summary":"

This module list most of the runtime errors happening in Clear.

","instance_methods":[{"html_id":"build_error_message(message:String,ways_to_resolve:Tuple|Array=Tuple.new,manual_pages:Tuple|Array=Tuple.new)-instance-method","name":"build_error_message","abstract":false,"args":[{"name":"message","external_name":"message","restriction":"String"},{"name":"ways_to_resolve","default_value":"Tuple.new","external_name":"ways_to_resolve","restriction":"Tuple | Array"},{"name":"manual_pages","default_value":"Tuple.new","external_name":"manual_pages","restriction":"Tuple | Array"}],"args_string":"(message : String, ways_to_resolve : Tuple | Array = Tuple.new, manual_pages : Tuple | Array = Tuple.new)","args_html":"(message : String, ways_to_resolve : Tuple | Array = Tuple.new, manual_pages : Tuple | Array = Tuple.new)","location":{"filename":"src/clear/error_messages.cr","line_number":65,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/error_messages.cr#L65"},"def":{"name":"build_error_message","args":[{"name":"message","external_name":"message","restriction":"String"},{"name":"ways_to_resolve","default_value":"Tuple.new","external_name":"ways_to_resolve","restriction":"Tuple | Array"},{"name":"manual_pages","default_value":"Tuple.new","external_name":"manual_pages","restriction":"Tuple | Array"}],"visibility":"Public","body":"{% if flag?(:release) %}\n message\n {% else %}\n format_width({\n build_message(message),\n build_tips(ways_to_resolve),\n build_manual(manual_pages),\n (\n \"You may also have encountered a bug. \\n\" +\n \"Feel free to submit an issue: \\n#{build_url(\"https://github.com/anykeyh/clear/issues/new\")}\"\n ),\n \"\\n\\nStack trace:\\n\",\n }.join)\n {% end %}"}},{"html_id":"converter_error(from,to)-instance-method","name":"converter_error","abstract":false,"args":[{"name":"from","external_name":"from","restriction":""},{"name":"to","external_name":"to","restriction":""}],"args_string":"(from, to)","args_html":"(from, to)","location":{"filename":"src/clear/error_messages.cr","line_number":209,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/error_messages.cr#L209"},"def":{"name":"converter_error","args":[{"name":"from","external_name":"from","restriction":""},{"name":"to","external_name":"to","restriction":""}],"visibility":"Public","body":"build_error_message(\"Clear cannot convert from `#{from}` to #{to}.\", {\"Ensure your database column type matches the column declaration in Clear\"}, {\"model/Definition.md\"})"}},{"html_id":"format_width(x,w=80)-instance-method","name":"format_width","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""},{"name":"w","default_value":"80","external_name":"w","restriction":""}],"args_string":"(x, w = 80)","args_html":"(x, w = 80)","location":{"filename":"src/clear/error_messages.cr","line_number":11,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/error_messages.cr#L11"},"def":{"name":"format_width","args":[{"name":"x","external_name":"x","restriction":""},{"name":"w","default_value":"80","external_name":"w","restriction":""}],"visibility":"Public","body":"counter = 0\no = [] of String\n(x.split(/([ \\n\\t])/)).each do |word|\n case word\n when \"\\n\"\n o << word\n counter = 0\n else\n counter = counter + word.size\n if counter > w\n o << \"\\n\"\n if word == \" \"\n counter = 0\n else\n o << word\n counter = word.size\n end\n else\n o << word\n end\n end\nend\no.join\n"}},{"html_id":"illegal_setter_access_to_undefined_column(name)-instance-method","name":"illegal_setter_access_to_undefined_column","abstract":false,"args":[{"name":"name","external_name":"name","restriction":""}],"args_string":"(name)","args_html":"(name)","location":{"filename":"src/clear/error_messages.cr","line_number":177,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/error_messages.cr#L177"},"def":{"name":"illegal_setter_access_to_undefined_column","args":[{"name":"name","external_name":"name","restriction":""}],"visibility":"Public","body":"build_error_message(\"You're trying to access to the column `#{name}` but it is not initialized.\", {\"Ensure that the column `#{name}` exists in your table\", \"If the model comes from a collection query, there was maybe a filtering on your `select` clause, \" + \"and you forgot to declare the column `#{name}`\", \"In the case of unpersisted models, please initialize by calling `#{name}=` first\", \"For validator, try `ensure_than` method, or use `#{name}_column.defined?` to avoid your validation code.\", \"Are you calling `#{name}_column.revert` somewhere before?\", \"If your model comes from JSON, please ensure the JSON source defines the column. Usage of `strict` mode will \" + \"trigger exception on JSON loading.\"}, {\"model/Definition.md\", \"model/Lifecycle.md\"})"}},{"html_id":"lack_of_primary_key(model_name)-instance-method","name":"lack_of_primary_key","abstract":false,"args":[{"name":"model_name","external_name":"model_name","restriction":""}],"args_string":"(model_name)","args_html":"(model_name)","location":{"filename":"src/clear/error_messages.cr","line_number":218,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/error_messages.cr#L218"},"def":{"name":"lack_of_primary_key","args":[{"name":"model_name","external_name":"model_name","restriction":""}],"visibility":"Public","body":"build_error_message(\"Model `#{model_name}` lacks of primary key field\", {\"Define a column as primary key\", \"Only one column can be primary key (no compound keys are allowed in Clear for now)\", \"You can use the helpers for primary key (see manual page)\"}, {\"model/PrimaryKeyTweaking.md\"})"}},{"html_id":"migration_already_down(number)-instance-method","name":"migration_already_down","abstract":false,"args":[{"name":"number","external_name":"number","restriction":""}],"args_string":"(number)","args_html":"(number)","location":{"filename":"src/clear/error_messages.cr","line_number":94,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/error_messages.cr#L94"},"def":{"name":"migration_already_down","args":[{"name":"number","external_name":"number","restriction":""}],"visibility":"Public","body":"build_error_message(\"Migration already down: #{number}\", {\"You're trying to force a migration which is not set in your database yet. \" + \"You should up the migration first, then down it again.\"}, {\"migration/Migration.md\"})"}},{"html_id":"migration_already_up(number)-instance-method","name":"migration_already_up","abstract":false,"args":[{"name":"number","external_name":"number","restriction":""}],"args_string":"(number)","args_html":"(number)","location":{"filename":"src/clear/error_messages.cr","line_number":82,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/error_messages.cr#L82"},"def":{"name":"migration_already_up","args":[{"name":"number","external_name":"number","restriction":""}],"visibility":"Public","body":"build_error_message(\"Migration already up: #{number}\", {\"You're trying to force a migration which is already existing in your database. \" + \"You should down the migration first, then up it again.\"}, {\"migration/Migration.md\"})"}},{"html_id":"migration_irreversible(name=nil,operation=nil)-instance-method","name":"migration_irreversible","abstract":false,"args":[{"name":"name","default_value":"nil","external_name":"name","restriction":""},{"name":"operation","default_value":"nil","external_name":"operation","restriction":""}],"args_string":"(name = nil, operation = nil)","args_html":"(name = nil, operation = nil)","location":{"filename":"src/clear/error_messages.cr","line_number":144,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/error_messages.cr#L144"},"def":{"name":"migration_irreversible","args":[{"name":"name","default_value":"nil","external_name":"name","restriction":""},{"name":"operation","default_value":"nil","external_name":"operation","restriction":""}],"visibility":"Public","body":"op_string = operation ? \"This is caused by the operation #{operation} which is irreversible.\" : nil\nmig_string = name ? \"The migration `#{name}` is irreversible. You're trying to down a migration which is not downable, \" + \"because the operations are one way only.\" : \"A migration is irreversible. You're trying to down a migration which is not downable, \" + \"because the operations are one way only.\"\nbuild_error_message(mig_string, [op_string, \"Build a way to revert the migration\", \"Do not revert the migration\", \"Maybe you need to manually flush the migration using Postgres. `__clear_metadatas` table store loaded \" + \"migrations. Good luck !\"].compact, {\"migration/Migration.md\"})\n"}},{"html_id":"migration_not_found(number)-instance-method","name":"migration_not_found","abstract":false,"args":[{"name":"number","external_name":"number","restriction":""}],"args_string":"(number)","args_html":"(number)","location":{"filename":"src/clear/error_messages.cr","line_number":106,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/error_messages.cr#L106"},"def":{"name":"migration_not_found","args":[{"name":"number","external_name":"number","restriction":""}],"visibility":"Public","body":"build_error_message(\"The migration number `#{number}` is not found.\", {\"Ensure your migration files are required\", \"Number of the migrations can be found in the filename, \" + \"in the classname or in the `uid` method of the migration.\"}, {\"migration/Migration.md\"})"}},{"html_id":"migration_not_unique(numbers)-instance-method","name":"migration_not_unique","abstract":false,"args":[{"name":"numbers","external_name":"numbers","restriction":""}],"args_string":"(numbers)","args_html":"(numbers)","location":{"filename":"src/clear/error_messages.cr","line_number":164,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/error_messages.cr#L164"},"def":{"name":"migration_not_unique","args":[{"name":"numbers","external_name":"numbers","restriction":""}],"visibility":"Public","body":"build_error_message(\"The migration manage found collision on migration number. Migrations number are: #{numbers.join(\", \")}\", {\"It happens when migration share the same `uid`. Try to change the UID of one of your migrations\", \"By default, Clear has a `-1` migration used internally. Do not use this migration number.\", \"Migration numbers can be found in filename, classname or return of `uid` method\"}, {\"migration/Migration.md\"})"}},{"html_id":"no_migration_yet(version)-instance-method","name":"no_migration_yet","abstract":false,"args":[{"name":"version","external_name":"version","restriction":""}],"args_string":"(version)","args_html":"(version)","location":{"filename":"src/clear/error_messages.cr","line_number":119,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/error_messages.cr#L119"},"def":{"name":"no_migration_yet","args":[{"name":"version","external_name":"version","restriction":""}],"visibility":"Public","body":"build_error_message(\"No migrations are registered yet, so we cannot go to version=#{version}\", {\"Ensure your migration files are required\", \"Ensure you have some migration files. Captain obvious to the rescue! ;-)\"}, {\"migration/Migration.md\"})"}},{"html_id":"null_column_mapping_error(name,type)-instance-method","name":"null_column_mapping_error","abstract":false,"args":[{"name":"name","external_name":"name","restriction":""},{"name":"type","external_name":"type","restriction":""}],"args_string":"(name, type)","args_html":"(name, type)","location":{"filename":"src/clear/error_messages.cr","line_number":196,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/error_messages.cr#L196"},"def":{"name":"null_column_mapping_error","args":[{"name":"name","external_name":"name","restriction":""},{"name":"type","external_name":"type","restriction":""}],"visibility":"Public","body":"build_error_message(\"Your field `#{name}` is declared as `#{type}` but `NULL` value has been found in the database.\", {\"In your model, declare your column `column #{name} : #{type}?` (note the `?` which allow nil value)\", \"In your database, adding `DEFAULT` value and/or `NOT NULL` constraint should disallow NULL fields \" + \"from your data.\"}, {\"model/Definition.md#presence-validation\"})"}},{"html_id":"order_by_error_invalid_order(current_order)-instance-method","name":"order_by_error_invalid_order","abstract":false,"args":[{"name":"current_order","external_name":"current_order","restriction":""}],"args_string":"(current_order)","args_html":"(current_order)","location":{"filename":"src/clear/error_messages.cr","line_number":259,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/error_messages.cr#L259"},"def":{"name":"order_by_error_invalid_order","args":[{"name":"current_order","external_name":"current_order","restriction":""}],"visibility":"Public","body":"build_error_message(\"Order by allow only ASC and DESC directions. But #{current_order} was given.\", {\"Ensure to use :asc, :desc symbol (or string) when constructing your query.\", \"If the code is dynamic, force the casting to one of the two value above, to avoid SQL injection.\"}, {\"querying/RequestBuilding.md\"})"}},{"html_id":"polymorphic_nil(through)-instance-method","name":"polymorphic_nil","abstract":false,"args":[{"name":"through","external_name":"through","restriction":""}],"args_string":"(through)","args_html":"(through)","location":{"filename":"src/clear/error_messages.cr","line_number":229,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/error_messages.cr#L229"},"def":{"name":"polymorphic_nil","args":[{"name":"through","external_name":"through","restriction":""}],"visibility":"Public","body":"build_error_message(\"Impossible to instantiate polymorphic object, because the type given by the data is nil.\", {\"The column `#{through}` contains NULL value, but is set as storage for \" + \"the type of the polymorphic object.\", \"Try to set DEFAULT value for your column `#{through}`\", \"In case of new implementation of polymorphic system, we recommend you to update the column to the previous \" + \"Class value. Value must be equal to the fully qualified model class name in Crystal (e.g. `MyApp::MyModel`)\"}, {\"model/Polymorphism.md\"})"}},{"html_id":"polymorphic_unknown_class(class_name)-instance-method","name":"polymorphic_unknown_class","abstract":false,"args":[{"name":"class_name","external_name":"class_name","restriction":""}],"args_string":"(class_name)","args_html":"(class_name)","location":{"filename":"src/clear/error_messages.cr","line_number":242,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/error_messages.cr#L242"},"def":{"name":"polymorphic_unknown_class","args":[{"name":"class_name","external_name":"class_name","restriction":""}],"visibility":"Public","body":"build_error_message(\"Impossible to instantiate a new `#{class_name}` using polymorphism.\", {((\"Ensure the type is properly setup in your `polymorphic` helper. \" + \"Any model which can exists in your database needs to manually be setup as in the example below:\\n\") + \"`polymorphic Dog, Cat, through: \\\"type\\\"`\\n\") + \"In this case, if you have a `Cow` object in your database, then add it in the list of allowed polymorphic objects.\", (\"Ensure the name match a fully qualified, with full path, Clear model:\\n\" + \"`polymorphic ::Animal::Dog, ::Animal::Cat, through: \\\"type\\\"`\\n\") + \"The column should then contains `Animal::Dog` and not `Dog`\"}, {\"model/Polymorphism.md\"})"}},{"html_id":"query_building_error(message)-instance-method","name":"query_building_error","abstract":false,"args":[{"name":"message","external_name":"message","restriction":""}],"args_string":"(message)","args_html":"(message)","location":{"filename":"src/clear/error_messages.cr","line_number":271,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/error_messages.cr#L271"},"def":{"name":"query_building_error","args":[{"name":"message","external_name":"message","restriction":""}],"visibility":"Public","body":"Clear::SQL::QueryBuildingError.new(build_error_message({\"You're trying to construct an invalid SQL request:\\n\", message}.join, manual_pages: {\"querying/RequestBuilding.md\"}))"}},{"html_id":"uid_not_found(class_name)-instance-method","name":"uid_not_found","abstract":false,"args":[{"name":"class_name","external_name":"class_name","restriction":""}],"args_string":"(class_name)","args_html":"(class_name)","location":{"filename":"src/clear/error_messages.cr","line_number":131,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/error_messages.cr#L131"},"def":{"name":"uid_not_found","args":[{"name":"class_name","external_name":"class_name","restriction":""}],"visibility":"Public","body":"build_error_message(\"I don't know how to order the migration `#{class_name}`\", {\"Rename your migration class to have the migration UID at the end of the class name\", \"Rename the file where your migration stand to have the migration UID in front of the filename\", \"Override the method `uid`. Be sure the number is immutable (e.g. return constant)\"}, {\"migration/Migration.md\"})"}},{"html_id":"uninitialized_db_connection(connection)-instance-method","name":"uninitialized_db_connection","abstract":false,"args":[{"name":"connection","external_name":"connection","restriction":""}],"args_string":"(connection)","args_html":"(connection)","location":{"filename":"src/clear/error_messages.cr","line_number":278,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/error_messages.cr#L278"},"def":{"name":"uninitialized_db_connection","args":[{"name":"connection","external_name":"connection","restriction":""}],"visibility":"Public","body":"build_error_message(\"You're trying to access the connection #{connection} which is not initialized\", {\"Use `Clear::SQL.init(#{connection}: \\\"postgres://XXX...\\\" )` on startup of your application\", \"The name of the connection (#{connection}) can't be found. It may have been mistyped.\"}, {\"Setup.md\", \"model/MultiConnection.md\"})"}}]},{"html_id":"clear/Clear/Expression","path":"Clear/Expression.html","kind":"class","full_name":"Clear::Expression","name":"Expression","abstract":false,"superclass":{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/expression/expression.cr","line_number":55,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/expression.cr#L55"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"DATABASE_DATE_FORMAT","name":"DATABASE_DATE_FORMAT","value":"\"%Y-%m-%d\""},{"id":"DATABASE_DATE_TIME_FORMAT","name":"DATABASE_DATE_TIME_FORMAT","value":"\"%Y-%m-%d %H:%M:%S.%L %:z\""}],"namespace":{"html_id":"clear/Clear","kind":"module","full_name":"Clear","name":"Clear"},"doc":"## Clear's Expression engine\n\nThe goal of this module is to offer the most natural way to write down your\nquery in crystal.\n\nIf you're familiar with Sequel on Ruby, then here you have !\n\nInstead of writing:\n\n```\nmodel_collection.where(\"created_at BETWEEN ? AND ?\", 1.day.ago, DateTime.local)\n```\n\nYou can write:\n```\nmodel_collection.where { created_at.between(1.day.ago, DateTime.local) }\n```\n\nor even:\n\n```\nmodel_collection.where { created_at.in?(1.day.ago..DateTime.local) }\n```\n\n(Note for the later, it will generate `created_at > 1.day.ago AND created_at < DateTime.local`)\n\n## Limitations\n\nDue to the use of `missing_method` macro, some case can be confusing.\n\n### Existing local variable / instance method\n\n```\nid = 1\nmodel_collection.where { id > 100 } # Will raise an error, because the expression is resolved by Crystal !\n# Should be:\nid = 1\nmodel_collection.where { var(\"id\") > 100 } # Will works\n```\n\n### Usage of AND / OR\n\nAnd/Or can be used using the bitwises operators `&` and `|`.\nDue to the impossibility to reuse `||` and `&&`, beware the operator precendance\nrules are changed.\n\n```\n# v-- This below will not works, as we cannot redefine the `or` operator\nmodel_collection.where { first_name == \"yacine\" || last_name == \"petitprez\" }\n# v-- This will works, but beware of the parenthesis between each terms, as `|` is prioritary on `==`\nmodel.collection.where { (firt_name == \"yacine\") | (last_name == \"petitprez\") }\n# ^-- ... WHERE first_name = 'yacine' OR last_name == ''\n```\n","summary":"

\n \n \nClear's Expression engine

","class_methods":[{"html_id":"[](arg)-class-method","name":"[]","doc":"A fast way to call `self.safe_literal`\nSee `safe_literal(x : _)`","summary":"

A fast way to call self.safe_literal See .safe_literal(x : _)

","abstract":false,"args":[{"name":"arg","external_name":"arg","restriction":""}],"args_string":"(arg)","args_html":"(arg)","location":{"filename":"src/clear/expression/expression.cr","line_number":97,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/expression.cr#L97"},"def":{"name":"[]","args":[{"name":"arg","external_name":"arg","restriction":""}],"visibility":"Public","body":"safe_literal(arg)"}},{"html_id":"ensure_node!(any)-class-method","name":"ensure_node!","doc":"This method will raise error on compilation if discovered in the code.\nThis allow to avoid issues like this one at compile type:\n\n```\nid = 1\n# ... and later\nUser.query.where { id == 2 }\n```\n\nIn this case, the local var id will be evaluated in the expression engine.\nleading to buggy code.\n\nHaving this method prevent the code to compile.\n\nTo be able to pass a literal or values other than node, please use `raw`\nmethod.\n","summary":"

This method will raise error on compilation if discovered in the code.

","abstract":false,"args":[{"name":"any","external_name":"any","restriction":""}],"args_string":"(any)","args_html":"(any)","location":{"filename":"src/clear/expression/expression.cr","line_number":188,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/expression.cr#L188"},"def":{"name":"ensure_node!","args":[{"name":"any","external_name":"any","restriction":""}],"visibility":"Public","body":"{% raise(((((\"The expression engine discovered a runtime-evaluable condition.\\n\" + \"It happens when a test is done with values on both sides.\\n\") + \"Maybe a local variable is breaking the expression engine like here:\\n\") + \"id = 1\\n\") + \"Users.where { id == nil }\\n\\n\") + \"In this case, please use `raw(\\\"id IS NULL\\\")` to allow the expression.\") %}"}},{"html_id":"raw(x:String,*args)-class-method","name":"raw","doc":"In case the name of the variable is a reserved word (e.g. `not`, `var`, `raw`)\nor in case of a complex piece of computation impossible to express with the expression engine\n(e.g. usage of functions) you can use then raw to pass the String.\n\nBE AWARE than the String is pasted AS-IS and can lead to SQL injection if not used properly.\n\n```\nhaving { raw(\"COUNT(*)\") > 5 } # SELECT ... FROM ... HAVING COUNT(*) > 5\nwhere { raw(\"func(?, ?) = ?\", a, b, c) } # SELECT ... FROM ... WHERE function(a, b) = c\n```\n","summary":"

In case the name of the variable is a reserved word (e.g.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"String"},{"name":"args","external_name":"args","restriction":""}],"args_string":"(x : String, *args)","args_html":"(x : String, *args)","location":{"filename":"src/clear/expression/expression.cr","line_number":252,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/expression.cr#L252"},"def":{"name":"raw","args":[{"name":"x","external_name":"x","restriction":"String"},{"name":"args","external_name":"args","restriction":""}],"splat_index":1,"visibility":"Public","body":"raw_enum(x, args)"}},{"html_id":"raw(__template:String,**tuple)-class-method","name":"raw","doc":"In case the name of the variable is a reserved word (e.g. `not`, `var`, `raw`)\nor in case of a complex piece of computation impossible to express with the expression engine\n(e.g. usage of functions) you can use then raw to pass the String.\n\nBE AWARE than the String is pasted AS-IS and can lead to SQL injection if not used properly.\n\n```\nhaving { raw(\"COUNT(*)\") > 5 } # SELECT ... FROM ... HAVING COUNT(*) > 5\nwhere { raw(\"func(:a, :b) = :c\", a: a, b: b, c: c) } # SELECT ... FROM ... WHERE function(a, b) = c\n```\n","summary":"

In case the name of the variable is a reserved word (e.g.

","abstract":false,"args":[{"name":"__template","external_name":"__template","restriction":"String"}],"args_string":"(__template : String, **tuple)","args_html":"(__template : String, **tuple)","location":{"filename":"src/clear/expression/expression.cr","line_number":296,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/expression.cr#L296"},"def":{"name":"raw","args":[{"name":"__template","external_name":"__template","restriction":"String"}],"double_splat":{"name":"tuple","external_name":"tuple","restriction":""},"visibility":"Public","body":"__template.gsub(/(^|[^:])\\:([a-zA-Z0-9_]+)/) do |_, match|\n begin\n sym = match[2]\n match[1] + Clear::Expression[tuple[sym]]\n rescue e : KeyError\n raise(Clear::ErrorMessages.query_building_error(e.message))\n end\nend"}},{"html_id":"raw_enum(x:String,args)-class-method","name":"raw_enum","doc":"See `self.raw`\nCan pass an array to this version","summary":"

See self.raw Can pass an array to this version

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"String"},{"name":"args","external_name":"args","restriction":""}],"args_string":"(x : String, args)","args_html":"(x : String, args)","location":{"filename":"src/clear/expression/expression.cr","line_number":258,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/expression.cr#L258"},"def":{"name":"raw_enum","args":[{"name":"x","external_name":"x","restriction":"String"},{"name":"args","external_name":"args","restriction":""}],"visibility":"Public","body":"idx = -1\nx.gsub(\"?\") do |_|\n begin\n Clear::Expression[args[idx = idx + 1]]\n rescue e : IndexError\n raise(Clear::ErrorMessages.query_building_error(e.message))\n end\nend\n"}},{"html_id":"safe_literal(x:Enumerable(AvailableLiteral)):Enumerable(String)-class-method","name":"safe_literal","doc":"Transform multiple objects into a string which is SQL-Injection safe.","summary":"

Transform multiple objects into a string which is SQL-Injection safe.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Enumerable(AvailableLiteral)"}],"args_string":"(x : Enumerable(AvailableLiteral)) : Enumerable(String)","args_html":"(x : Enumerable(AvailableLiteral)) : Enumerable(String)","location":{"filename":"src/clear/expression/expression.cr","line_number":127,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/expression.cr#L127"},"def":{"name":"safe_literal","args":[{"name":"x","external_name":"x","restriction":"Enumerable(AvailableLiteral)"}],"return_type":"Enumerable(String)","visibility":"Public","body":"x.map do |item|\n safe_literal(item)\nend"}},{"html_id":"safe_literal(x:Time,date:Bool=false):String-class-method","name":"safe_literal","doc":"Safe literal of a time return a string representation of time in the format understood by postgresql.\n\nIf the optional parameter `date` is passed, the time is truncated and only the date is passed:\n\n## Example\n\n```\nClear::Expression[Time.local] # < \"2017-04-03 23:04:43.234 +08:00\"\nClear::Expression[Time.local, date: true] # < \"2017-04-03\"\n```","summary":"

Safe literal of a time return a string representation of time in the format understood by postgresql.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Time"},{"name":"date","default_value":"false","external_name":"date","restriction":"Bool"}],"args_string":"(x : Time, date : Bool = false) : String","args_html":"(x : Time, date : Bool = false) : String","location":{"filename":"src/clear/expression/expression.cr","line_number":147,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/expression.cr#L147"},"def":{"name":"safe_literal","args":[{"name":"x","external_name":"x","restriction":"Time"},{"name":"date","default_value":"false","external_name":"date","restriction":"Bool"}],"return_type":"String","visibility":"Public","body":"{\"'\", x.to_utc.to_s(date ? DATABASE_DATE_FORMAT : DATABASE_DATE_TIME_FORMAT), \"'\"}.join"}},{"html_id":"safe_literal(x:_):String-class-method","name":"safe_literal","doc":"Sanitize an object and return a `String` representation of itself which is proofed against SQL injections.","summary":"

Sanitize an object and return a String representation of itself which is proofed against SQL injections.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"_"}],"args_string":"(x : _) : String","args_html":"(x : _) : String","location":{"filename":"src/clear/expression/expression.cr","line_number":167,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/expression.cr#L167"},"def":{"name":"safe_literal","args":[{"name":"x","external_name":"x","restriction":"_"}],"return_type":"String","visibility":"Public","body":"safe_literal(x.to_s)"}},{"html_id":"unsafe(x)-class-method","name":"unsafe","doc":"Return unsafe string injected to the query.\n can be used for example in `insert` query building","summary":"

Return unsafe string injected to the query.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x)","args_html":"(x)","location":{"filename":"src/clear/expression/expression.cr","line_number":133,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/expression.cr#L133"},"def":{"name":"unsafe","args":[{"name":"x","external_name":"x","restriction":""}],"visibility":"Public","body":"Clear::Expression::UnsafeSql.new(x)"}},{"html_id":"where(&):Node-class-method","name":"where","doc":"Return a node of the expression engine\nThis node can then be combined with others node\nin case of chain request creation `where {...}.where {...}`\nthrough the chaining engine","summary":"

Return a node of the expression engine This node can then be combined with others node in case of chain request creation where {...}.where {...} through the chaining engine

","abstract":false,"location":{"filename":"src/clear/expression/expression.cr","line_number":207,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/expression.cr#L207"},"def":{"name":"where","yields":0,"block_arity":0,"return_type":"Node","visibility":"Public","body":"expression_engine = new\nensure_node!(with expression_engine yield)\n"}}],"instance_methods":[{"html_id":"not(x:Node)-instance-method","name":"not","doc":"`NOT` operator\n\nReturn an logically reversed version of the contained `Node`\n\n## Example\n\n```\nClear::Expression.where { not(a == b) }.resolve # >> \"WHERE NOT( a = b )\n```","summary":"

NOT operator

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Node"}],"args_string":"(x : Node)","args_html":"(x : Node)","location":{"filename":"src/clear/expression/expression.cr","line_number":222,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/expression.cr#L222"},"def":{"name":"not","args":[{"name":"x","external_name":"x","restriction":"Node"}],"visibility":"Public","body":"Node::Not.new(x)"}},{"html_id":"op(a:Node|AvailableLiteral,b:Node|AvailableLiteral,op:String)-instance-method","name":"op","doc":"Because many postgresql operators are not transcriptable in Crystal lang,\nthis helpers helps to write the expressions:\n\n```\nwhere { op(jsonb_field, \"something\", \"?\") } # << Return \"jsonb_field ? 'something'\"\n```\n","summary":"

Because many postgresql operators are not transcriptable in Crystal lang, this helpers helps to write the expressions:

","abstract":false,"args":[{"name":"a","external_name":"a","restriction":"Node | AvailableLiteral"},{"name":"b","external_name":"b","restriction":"Node | AvailableLiteral"},{"name":"op","external_name":"op","restriction":"String"}],"args_string":"(a : Node | AvailableLiteral, b : Node | AvailableLiteral, op : String)","args_html":"(a : Node | AvailableLiteral, b : Node | AvailableLiteral, op : String)","location":{"filename":"src/clear/expression/expression.cr","line_number":337,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/expression.cr#L337"},"def":{"name":"op","args":[{"name":"a","external_name":"a","restriction":"Node | AvailableLiteral"},{"name":"b","external_name":"b","restriction":"Node | AvailableLiteral"},{"name":"op","external_name":"op","restriction":"String"}],"visibility":"Public","body":"if a.is_a?(AvailableLiteral)\n a = Node::Literal.new(a)\nend\nif b.is_a?(AvailableLiteral)\n b = Node::Literal.new(b)\nend\nNode::DoubleOperator.new(a, b, op)\n"}},{"html_id":"raw(x:String,*args)-instance-method","name":"raw","doc":"In case the name of the variable is a reserved word (e.g. `not`, `var`, `raw`)\nor in case of a complex piece of computation impossible to express with the expression engine\n(e.g. usage of functions) you can use then raw to pass the String.\n\nBE AWARE than the String is pasted AS-IS and can lead to SQL injection if not used properly.\n\n```\nhaving { raw(\"COUNT(*)\") > 5 } # SELECT ... FROM ... HAVING COUNT(*) > 5\nwhere { raw(\"func(?, ?) = ?\", a, b, c) } # SELECT ... FROM ... WHERE function(a, b) = c\n```\n","summary":"

In case the name of the variable is a reserved word (e.g.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"String"},{"name":"args","external_name":"args","restriction":""}],"args_string":"(x : String, *args)","args_html":"(x : String, *args)","location":{"filename":"src/clear/expression/expression.cr","line_number":237,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/expression.cr#L237"},"def":{"name":"raw","args":[{"name":"x","external_name":"x","restriction":"String"},{"name":"args","external_name":"args","restriction":""}],"splat_index":1,"visibility":"Public","body":"Node::Raw.new(self.class.raw(x, *args))"}},{"html_id":"raw(__template:String,**tuple)-instance-method","name":"raw","doc":"In case the name of the variable is a reserved word (e.g. `not`, `var`, `raw`)\nor in case of a complex piece of computation impossible to express with the expression engine\n(e.g. usage of functions) you can use then raw to pass the String.\n\nBE AWARE than the String is pasted AS-IS and can lead to SQL injection if not used properly.\n\n```\nhaving { raw(\"COUNT(*)\") > 5 } # SELECT ... FROM ... HAVING COUNT(*) > 5\nwhere { raw(\"func(:a, :b) = :c\", a: a, b: b, c: c) } # SELECT ... FROM ... WHERE function(a, b) = c\n```\n","summary":"

In case the name of the variable is a reserved word (e.g.

","abstract":false,"args":[{"name":"__template","external_name":"__template","restriction":"String"}],"args_string":"(__template : String, **tuple)","args_html":"(__template : String, **tuple)","location":{"filename":"src/clear/expression/expression.cr","line_number":281,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/expression.cr#L281"},"def":{"name":"raw","args":[{"name":"__template","external_name":"__template","restriction":"String"}],"double_splat":{"name":"tuple","external_name":"tuple","restriction":""},"visibility":"Public","body":"Node::Raw.new(self.class.raw(__template, **tuple))"}},{"html_id":"var(*parts)-instance-method","name":"var","doc":"Use var to create expression of variable. Variables are columns with or without the namespace and tablename:\n\nIt escapes each part of the expression with double-quote as requested by PostgreSQL.\nThis is useful to escape SQL keywords or `.` and `\"` character in the name of a column.\n\n```\nvar(\"template1\", \"users\", \"name\") # \"template1\".\"users\".\"name\"\nvar(\"template1\", \"users.table2\", \"name\") # \"template1\".\"users.table2\".\"name\"\nvar(\"order\") # \"order\"\n```","summary":"

Use var to create expression of variable.

","abstract":false,"args":[{"name":"parts","external_name":"parts","restriction":""}],"args_string":"(*parts)","args_html":"(*parts)","location":{"filename":"src/clear/expression/expression.cr","line_number":317,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/expression.cr#L317"},"def":{"name":"var","args":[{"name":"parts","external_name":"parts","restriction":""}],"splat_index":0,"visibility":"Public","body":"_var(parts)"}}],"types":[{"html_id":"clear/Clear/Expression/AvailableLiteral","path":"Clear/Expression/AvailableLiteral.html","kind":"alias","full_name":"Clear::Expression::AvailableLiteral","name":"AvailableLiteral","abstract":false,"locations":[{"filename":"src/clear/expression/expression.cr","line_number":91,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/expression.cr#L91"}],"repository_name":"clear","program":false,"enum":false,"alias":true,"aliased":"(Bool | Clear::Expression::Literal | Float32 | Float64 | Int16 | Int32 | Int64 | Int8 | String | Symbol | Time | UInt16 | UInt32 | UInt64 | UInt8 | Nil)","aliased_html":"Bool | Clear::Expression::Literal | Float32 | Float64 | Int16 | Int32 | Int64 | Int8 | String | Symbol | Time | UInt16 | UInt32 | UInt64 | UInt8 | Nil","const":false,"namespace":{"html_id":"clear/Clear/Expression","kind":"class","full_name":"Clear::Expression","name":"Expression"}},{"html_id":"clear/Clear/Expression/JSONB","path":"Clear/Expression/JSONB.html","kind":"module","full_name":"Clear::Expression::JSONB","name":"JSONB","abstract":false,"locations":[{"filename":"src/clear/extensions/jsonb/node.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/jsonb/node.cr#L1"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Expression","kind":"class","full_name":"Clear::Expression","name":"Expression"},"types":[{"html_id":"clear/Clear/Expression/JSONB/Node","path":"Clear/Expression/JSONB/Node.html","kind":"module","full_name":"Clear::Expression::JSONB::Node","name":"Node","abstract":false,"locations":[{"filename":"src/clear/extensions/jsonb/node.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/jsonb/node.cr#L1"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"}],"namespace":{"html_id":"clear/Clear/Expression/JSONB","kind":"module","full_name":"Clear::Expression::JSONB","name":"JSONB"},"instance_methods":[{"html_id":"jsonb(key:String)-instance-method","name":"jsonb","abstract":false,"args":[{"name":"key","external_name":"key","restriction":"String"}],"args_string":"(key : String)","args_html":"(key : String)","location":{"filename":"src/clear/extensions/jsonb/node.cr","line_number":21,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/jsonb/node.cr#L21"},"def":{"name":"jsonb","args":[{"name":"key","external_name":"key","restriction":"String"}],"visibility":"Public","body":"Clear::Expression::Node::JSONB::Field.new(self, key)"}},{"html_id":"jsonb_all_keys_exists?(keys:Array(T))forallT-instance-method","name":"jsonb_all_keys_exists?","abstract":false,"args":[{"name":"keys","external_name":"keys","restriction":"Array(T)"}],"args_string":"(keys : Array(T)) forall T","args_html":"(keys : Array(T)) forall T","location":{"filename":"src/clear/extensions/jsonb/node.cr","line_number":17,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/jsonb/node.cr#L17"},"def":{"name":"jsonb_all_keys_exists?","args":[{"name":"keys","external_name":"keys","restriction":"Array(T)"}],"visibility":"Public","body":"_jsonb_keys_exists(keys, \"?&\")"}},{"html_id":"jsonb_any_key_exists?(keys:Array(T))forallT-instance-method","name":"jsonb_any_key_exists?","abstract":false,"args":[{"name":"keys","external_name":"keys","restriction":"Array(T)"}],"args_string":"(keys : Array(T)) forall T","args_html":"(keys : Array(T)) forall T","location":{"filename":"src/clear/extensions/jsonb/node.cr","line_number":13,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/jsonb/node.cr#L13"},"def":{"name":"jsonb_any_key_exists?","args":[{"name":"keys","external_name":"keys","restriction":"Array(T)"}],"visibility":"Public","body":"_jsonb_keys_exists(keys, \"?|\")"}},{"html_id":"jsonb_key_exists?(key:String)-instance-method","name":"jsonb_key_exists?","abstract":false,"args":[{"name":"key","external_name":"key","restriction":"String"}],"args_string":"(key : String)","args_html":"(key : String)","location":{"filename":"src/clear/extensions/jsonb/node.cr","line_number":2,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/jsonb/node.cr#L2"},"def":{"name":"jsonb_key_exists?","args":[{"name":"key","external_name":"key","restriction":"String"}],"visibility":"Public","body":"Clear::Expression::Node::DoubleOperator.new(self, Clear::Expression::Node::Literal.new(key), \"?\")"}}]}]},{"html_id":"clear/Clear/Expression/Literal","path":"Clear/Expression/Literal.html","kind":"module","full_name":"Clear::Expression::Literal","name":"Literal","abstract":false,"locations":[{"filename":"src/clear/expression/expression.cr","line_number":62,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/expression.cr#L62"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"clear/Clear/Enum","kind":"struct","full_name":"Clear::Enum","name":"Enum"},{"html_id":"clear/Clear/Expression/UnsafeSql","kind":"class","full_name":"Clear::Expression::UnsafeSql","name":"UnsafeSql"}],"namespace":{"html_id":"clear/Clear/Expression","kind":"class","full_name":"Clear::Expression","name":"Expression"},"doc":"Allow any type to be used into the expression engine\n by including the module Clear::Expression::Literal\n and defining the method `to_sql`.","summary":"

Allow any type to be used into the expression engine by including the module Clear::Expression::Literal and defining the method #to_sql.

","instance_methods":[{"html_id":"to_json(json:JSON::Builder)-instance-method","name":"to_json","abstract":true,"args":[{"name":"json","external_name":"json","restriction":"JSON::Builder"}],"args_string":"(json : JSON::Builder)","args_html":"(json : JSON::Builder)","location":{"filename":"src/clear/expression/expression.cr","line_number":64,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/expression.cr#L64"},"def":{"name":"to_json","args":[{"name":"json","external_name":"json","restriction":"JSON::Builder"}],"visibility":"Public","body":""}},{"html_id":"to_sql-instance-method","name":"to_sql","abstract":true,"location":{"filename":"src/clear/expression/expression.cr","line_number":63,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/expression.cr#L63"},"def":{"name":"to_sql","visibility":"Public","body":""}}]},{"html_id":"clear/Clear/Expression/Node","path":"Clear/Expression/Node.html","kind":"class","full_name":"Clear::Expression::Node","name":"Node","abstract":true,"superclass":{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"clear/Clear/Expression/JSONB/Node","kind":"module","full_name":"Clear::Expression::JSONB::Node","name":"Node"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/expression/nodes/node.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/node.cr#L4"},{"filename":"src/clear/extensions/jsonb/jsonb.cr","line_number":144,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/jsonb/jsonb.cr#L144"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"clear/Clear/Expression/JSONB/Node","kind":"module","full_name":"Clear::Expression::JSONB::Node","name":"Node"}],"subclasses":[{"html_id":"clear/Clear/Expression/Node/Between","kind":"class","full_name":"Clear::Expression::Node::Between","name":"Between"},{"html_id":"clear/Clear/Expression/Node/DoubleOperator","kind":"class","full_name":"Clear::Expression::Node::DoubleOperator","name":"DoubleOperator"},{"html_id":"clear/Clear/Expression/Node/Function","kind":"class","full_name":"Clear::Expression::Node::Function","name":"Function"},{"html_id":"clear/Clear/Expression/Node/InArray","kind":"class","full_name":"Clear::Expression::Node::InArray","name":"InArray"},{"html_id":"clear/Clear/Expression/Node/InRange","kind":"class","full_name":"Clear::Expression::Node::InRange","name":"InRange"},{"html_id":"clear/Clear/Expression/Node/InSelect","kind":"class","full_name":"Clear::Expression::Node::InSelect","name":"InSelect"},{"html_id":"clear/Clear/Expression/Node/JSONB/ArrayContains","kind":"class","full_name":"Clear::Expression::Node::JSONB::ArrayContains","name":"ArrayContains"},{"html_id":"clear/Clear/Expression/Node/JSONB/Equality","kind":"class","full_name":"Clear::Expression::Node::JSONB::Equality","name":"Equality"},{"html_id":"clear/Clear/Expression/Node/JSONB/Field","kind":"class","full_name":"Clear::Expression::Node::JSONB::Field","name":"Field"},{"html_id":"clear/Clear/Expression/Node/Literal","kind":"class","full_name":"Clear::Expression::Node::Literal","name":"Literal"},{"html_id":"clear/Clear/Expression/Node/Minus","kind":"class","full_name":"Clear::Expression::Node::Minus","name":"Minus"},{"html_id":"clear/Clear/Expression/Node/NodeArray","kind":"class","full_name":"Clear::Expression::Node::NodeArray","name":"NodeArray"},{"html_id":"clear/Clear/Expression/Node/Not","kind":"class","full_name":"Clear::Expression::Node::Not","name":"Not"},{"html_id":"clear/Clear/Expression/Node/NotBetween","kind":"class","full_name":"Clear::Expression::Node::NotBetween","name":"NotBetween"},{"html_id":"clear/Clear/Expression/Node/Null","kind":"class","full_name":"Clear::Expression::Node::Null","name":"Null"},{"html_id":"clear/Clear/Expression/Node/PGArray","kind":"class","full_name":"Clear::Expression::Node::PGArray(T)","name":"PGArray"},{"html_id":"clear/Clear/Expression/Node/Raw","kind":"class","full_name":"Clear::Expression::Node::Raw","name":"Raw"},{"html_id":"clear/Clear/Expression/Node/Variable","kind":"class","full_name":"Clear::Expression::Node::Variable","name":"Variable"}],"namespace":{"html_id":"clear/Clear/Expression","kind":"class","full_name":"Clear::Expression","name":"Expression"},"doc":"Mother class of all the rendering nodes","summary":"

Mother class of all the rendering nodes

","instance_methods":[{"html_id":"!=(any:Node):Node-instance-method","name":"!=","abstract":false,"args":[{"name":"any","external_name":"any","restriction":"Node"}],"args_string":"(any : Node) : Node","args_html":"(any : Node) : Node","location":{"filename":"src/clear/expression/nodes/node.cr","line_number":49,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/node.cr#L49"},"def":{"name":"!=","args":[{"name":"any","external_name":"any","restriction":"Node"}],"return_type":"Node","visibility":"Public","body":"Node::DoubleOperator.new(self, any, \"<>\")"}},{"html_id":"!=(some_nil:Nil):Node-instance-method","name":"!=","abstract":false,"args":[{"name":"some_nil","external_name":"some_nil","restriction":"Nil"}],"args_string":"(some_nil : Nil) : Node","args_html":"(some_nil : Nil) : Node","location":{"filename":"src/clear/expression/nodes/node.cr","line_number":49,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/node.cr#L49"},"def":{"name":"!=","args":[{"name":"some_nil","external_name":"some_nil","restriction":"Nil"}],"return_type":"Node","visibility":"Public","body":"Node::DoubleOperator.new(self, Null.new, \"IS NOT\")"}},{"html_id":"!=(any:T):NodeforallT-instance-method","name":"!=","abstract":false,"args":[{"name":"any","external_name":"any","restriction":"T"}],"args_string":"(any : T) : Node forall T","args_html":"(any : T) : Node forall T","location":{"filename":"src/clear/expression/nodes/node.cr","line_number":49,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/node.cr#L49"},"def":{"name":"!=","args":[{"name":"any","external_name":"any","restriction":"T"}],"return_type":"Node","visibility":"Public","body":"Node::DoubleOperator.new(self, Literal.new(any), \"<>\")"}},{"html_id":"!~(any:Node):Node-instance-method","name":"!~","abstract":false,"args":[{"name":"any","external_name":"any","restriction":"Node"}],"args_string":"(any : Node) : Node","args_html":"(any : Node) : Node","location":{"filename":"src/clear/expression/nodes/node.cr","line_number":29,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/node.cr#L29"},"def":{"name":"!~","args":[{"name":"any","external_name":"any","restriction":"Node"}],"return_type":"Node","visibility":"Public","body":"Node::DoubleOperator.new(self, any, \"!~\")"}},{"html_id":"!~(regexp:Regex):Node-instance-method","name":"!~","abstract":false,"args":[{"name":"regexp","external_name":"regexp","restriction":"Regex"}],"args_string":"(regexp : Regex) : Node","args_html":"(regexp : Regex) : Node","location":{"filename":"src/clear/expression/nodes/node.cr","line_number":41,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/node.cr#L41"},"def":{"name":"!~","args":[{"name":"regexp","external_name":"regexp","restriction":"Regex"}],"return_type":"Node","visibility":"Public","body":"if regexp.options.ignore_case?\n Node::DoubleOperator.new(self, Literal.new(regexp.source), \"!~*\")\nelse\n Node::DoubleOperator.new(self, Literal.new(regexp.source), \"!~\")\nend"}},{"html_id":"&(any:Node):Node-instance-method","name":"&","abstract":false,"args":[{"name":"any","external_name":"any","restriction":"Node"}],"args_string":"(any : Node) : Node","args_html":"(any : Node) : Node","location":{"filename":"src/clear/expression/nodes/node.cr","line_number":53,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/node.cr#L53"},"def":{"name":"&","args":[{"name":"any","external_name":"any","restriction":"Node"}],"return_type":"Node","visibility":"Public","body":"Node::DoubleOperator.new(self, any, \"AND\")"}},{"html_id":"&(any:T):NodeforallT-instance-method","name":"&","abstract":false,"args":[{"name":"any","external_name":"any","restriction":"T"}],"args_string":"(any : T) : Node forall T","args_html":"(any : T) : Node forall T","location":{"filename":"src/clear/expression/nodes/node.cr","line_number":53,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/node.cr#L53"},"def":{"name":"&","args":[{"name":"any","external_name":"any","restriction":"T"}],"return_type":"Node","visibility":"Public","body":"Node::DoubleOperator.new(self, Literal.new(any), \"AND\")"}},{"html_id":"*(any:Node):Node-instance-method","name":"*","abstract":false,"args":[{"name":"any","external_name":"any","restriction":"Node"}],"args_string":"(any : Node) : Node","args_html":"(any : Node) : Node","def":{"name":"*","args":[{"name":"any","external_name":"any","restriction":"Node"}],"return_type":"Node","visibility":"Public","body":"Node::DoubleOperator.new(self, any, \"*\")"}},{"html_id":"*(any:T):NodeforallT-instance-method","name":"*","abstract":false,"args":[{"name":"any","external_name":"any","restriction":"T"}],"args_string":"(any : T) : Node forall T","args_html":"(any : T) : Node forall T","def":{"name":"*","args":[{"name":"any","external_name":"any","restriction":"T"}],"return_type":"Node","visibility":"Public","body":"Node::DoubleOperator.new(self, Literal.new(any), \"*\")"}},{"html_id":"+(any:Node):Node-instance-method","name":"+","abstract":false,"args":[{"name":"any","external_name":"any","restriction":"Node"}],"args_string":"(any : Node) : Node","args_html":"(any : Node) : Node","def":{"name":"+","args":[{"name":"any","external_name":"any","restriction":"Node"}],"return_type":"Node","visibility":"Public","body":"Node::DoubleOperator.new(self, any, \"+\")"}},{"html_id":"+(any:T):NodeforallT-instance-method","name":"+","abstract":false,"args":[{"name":"any","external_name":"any","restriction":"T"}],"args_string":"(any : T) : Node forall T","args_html":"(any : T) : Node forall T","def":{"name":"+","args":[{"name":"any","external_name":"any","restriction":"T"}],"return_type":"Node","visibility":"Public","body":"Node::DoubleOperator.new(self, Literal.new(any), \"+\")"}},{"html_id":"-(any:Node):Node-instance-method","name":"-","abstract":false,"args":[{"name":"any","external_name":"any","restriction":"Node"}],"args_string":"(any : Node) : Node","args_html":"(any : Node) : Node","def":{"name":"-","args":[{"name":"any","external_name":"any","restriction":"Node"}],"return_type":"Node","visibility":"Public","body":"Node::DoubleOperator.new(self, any, \"-\")"}},{"html_id":"-(any:T):NodeforallT-instance-method","name":"-","abstract":false,"args":[{"name":"any","external_name":"any","restriction":"T"}],"args_string":"(any : T) : Node forall T","args_html":"(any : T) : Node forall T","def":{"name":"-","args":[{"name":"any","external_name":"any","restriction":"T"}],"return_type":"Node","visibility":"Public","body":"Node::DoubleOperator.new(self, Literal.new(any), \"-\")"}},{"html_id":"--instance-method","name":"-","abstract":false,"location":{"filename":"src/clear/expression/nodes/node.cr","line_number":78,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/node.cr#L78"},"def":{"name":"-","visibility":"Public","body":"Node::Minus.new(self)"}},{"html_id":"/(any:Node):Node-instance-method","name":"/","abstract":false,"args":[{"name":"any","external_name":"any","restriction":"Node"}],"args_string":"(any : Node) : Node","args_html":"(any : Node) : Node","def":{"name":"/","args":[{"name":"any","external_name":"any","restriction":"Node"}],"return_type":"Node","visibility":"Public","body":"Node::DoubleOperator.new(self, any, \"/\")"}},{"html_id":"/(any:T):NodeforallT-instance-method","name":"/","abstract":false,"args":[{"name":"any","external_name":"any","restriction":"T"}],"args_string":"(any : T) : Node forall T","args_html":"(any : T) : Node forall T","def":{"name":"/","args":[{"name":"any","external_name":"any","restriction":"T"}],"return_type":"Node","visibility":"Public","body":"Node::DoubleOperator.new(self, Literal.new(any), \"/\")"}},{"html_id":"<(any:Node):Node-instance-method","name":"<","abstract":false,"args":[{"name":"any","external_name":"any","restriction":"Node"}],"args_string":"(any : Node) : Node","args_html":"(any : Node) : Node","def":{"name":"<","args":[{"name":"any","external_name":"any","restriction":"Node"}],"return_type":"Node","visibility":"Public","body":"Node::DoubleOperator.new(self, any, \"<\")"}},{"html_id":"<(any:T):NodeforallT-instance-method","name":"<","abstract":false,"args":[{"name":"any","external_name":"any","restriction":"T"}],"args_string":"(any : T) : Node forall T","args_html":"(any : T) : Node forall T","def":{"name":"<","args":[{"name":"any","external_name":"any","restriction":"T"}],"return_type":"Node","visibility":"Public","body":"Node::DoubleOperator.new(self, Literal.new(any), \"<\")"}},{"html_id":"<=(any:Node):Node-instance-method","name":"<=","abstract":false,"args":[{"name":"any","external_name":"any","restriction":"Node"}],"args_string":"(any : Node) : Node","args_html":"(any : Node) : Node","def":{"name":"<=","args":[{"name":"any","external_name":"any","restriction":"Node"}],"return_type":"Node","visibility":"Public","body":"Node::DoubleOperator.new(self, any, \"<=\")"}},{"html_id":"<=(any:T):NodeforallT-instance-method","name":"<=","abstract":false,"args":[{"name":"any","external_name":"any","restriction":"T"}],"args_string":"(any : T) : Node forall T","args_html":"(any : T) : Node forall T","def":{"name":"<=","args":[{"name":"any","external_name":"any","restriction":"T"}],"return_type":"Node","visibility":"Public","body":"Node::DoubleOperator.new(self, Literal.new(any), \"<=\")"}},{"html_id":"==(any:Node):Node-instance-method","name":"==","abstract":false,"args":[{"name":"any","external_name":"any","restriction":"Node"}],"args_string":"(any : Node) : Node","args_html":"(any : Node) : Node","location":{"filename":"src/clear/expression/nodes/node.cr","line_number":50,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/node.cr#L50"},"def":{"name":"==","args":[{"name":"any","external_name":"any","restriction":"Node"}],"return_type":"Node","visibility":"Public","body":"Node::DoubleOperator.new(self, any, \"=\")"}},{"html_id":"==(some_nil:Nil):Node-instance-method","name":"==","abstract":false,"args":[{"name":"some_nil","external_name":"some_nil","restriction":"Nil"}],"args_string":"(some_nil : Nil) : Node","args_html":"(some_nil : Nil) : Node","location":{"filename":"src/clear/expression/nodes/node.cr","line_number":50,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/node.cr#L50"},"def":{"name":"==","args":[{"name":"some_nil","external_name":"some_nil","restriction":"Nil"}],"return_type":"Node","visibility":"Public","body":"Node::DoubleOperator.new(self, Null.new, \"IS\")"}},{"html_id":"==(any:T):NodeforallT-instance-method","name":"==","abstract":false,"args":[{"name":"any","external_name":"any","restriction":"T"}],"args_string":"(any : T) : Node forall T","args_html":"(any : T) : Node forall T","location":{"filename":"src/clear/expression/nodes/node.cr","line_number":50,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/node.cr#L50"},"def":{"name":"==","args":[{"name":"any","external_name":"any","restriction":"T"}],"return_type":"Node","visibility":"Public","body":"Node::DoubleOperator.new(self, Literal.new(any), \"=\")"}},{"html_id":"=~(any:Node):Node-instance-method","name":"=~","abstract":false,"args":[{"name":"any","external_name":"any","restriction":"Node"}],"args_string":"(any : Node) : Node","args_html":"(any : Node) : Node","location":{"filename":"src/clear/expression/nodes/node.cr","line_number":25,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/node.cr#L25"},"def":{"name":"=~","args":[{"name":"any","external_name":"any","restriction":"Node"}],"return_type":"Node","visibility":"Public","body":"Node::DoubleOperator.new(self, any, \"~\")"}},{"html_id":"=~(regexp:Regex):Node-instance-method","name":"=~","abstract":false,"args":[{"name":"regexp","external_name":"regexp","restriction":"Regex"}],"args_string":"(regexp : Regex) : Node","args_html":"(regexp : Regex) : Node","location":{"filename":"src/clear/expression/nodes/node.cr","line_number":33,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/node.cr#L33"},"def":{"name":"=~","args":[{"name":"regexp","external_name":"regexp","restriction":"Regex"}],"return_type":"Node","visibility":"Public","body":"if regexp.options.ignore_case?\n Node::DoubleOperator.new(self, Literal.new(regexp.source), \"~*\")\nelse\n Node::DoubleOperator.new(self, Literal.new(regexp.source), \"~\")\nend"}},{"html_id":">(any:Node):Node-instance-method","name":">","abstract":false,"args":[{"name":"any","external_name":"any","restriction":"Node"}],"args_string":"(any : Node) : Node","args_html":"(any : Node) : Node","def":{"name":">","args":[{"name":"any","external_name":"any","restriction":"Node"}],"return_type":"Node","visibility":"Public","body":"Node::DoubleOperator.new(self, any, \">\")"}},{"html_id":">(any:T):NodeforallT-instance-method","name":">","abstract":false,"args":[{"name":"any","external_name":"any","restriction":"T"}],"args_string":"(any : T) : Node forall T","args_html":"(any : T) : Node forall T","def":{"name":">","args":[{"name":"any","external_name":"any","restriction":"T"}],"return_type":"Node","visibility":"Public","body":"Node::DoubleOperator.new(self, Literal.new(any), \">\")"}},{"html_id":">=(any:Node):Node-instance-method","name":">=","abstract":false,"args":[{"name":"any","external_name":"any","restriction":"Node"}],"args_string":"(any : Node) : Node","args_html":"(any : Node) : Node","def":{"name":">=","args":[{"name":"any","external_name":"any","restriction":"Node"}],"return_type":"Node","visibility":"Public","body":"Node::DoubleOperator.new(self, any, \">=\")"}},{"html_id":">=(any:T):NodeforallT-instance-method","name":">=","abstract":false,"args":[{"name":"any","external_name":"any","restriction":"T"}],"args_string":"(any : T) : Node forall T","args_html":"(any : T) : Node forall T","def":{"name":">=","args":[{"name":"any","external_name":"any","restriction":"T"}],"return_type":"Node","visibility":"Public","body":"Node::DoubleOperator.new(self, Literal.new(any), \">=\")"}},{"html_id":"|(any:Node):Node-instance-method","name":"|","abstract":false,"args":[{"name":"any","external_name":"any","restriction":"Node"}],"args_string":"(any : Node) : Node","args_html":"(any : Node) : Node","location":{"filename":"src/clear/expression/nodes/node.cr","line_number":54,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/node.cr#L54"},"def":{"name":"|","args":[{"name":"any","external_name":"any","restriction":"Node"}],"return_type":"Node","visibility":"Public","body":"Node::DoubleOperator.new(self, any, \"OR\")"}},{"html_id":"|(any:T):NodeforallT-instance-method","name":"|","abstract":false,"args":[{"name":"any","external_name":"any","restriction":"T"}],"args_string":"(any : T) : Node forall T","args_html":"(any : T) : Node forall T","location":{"filename":"src/clear/expression/nodes/node.cr","line_number":54,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/node.cr#L54"},"def":{"name":"|","args":[{"name":"any","external_name":"any","restriction":"T"}],"return_type":"Node","visibility":"Public","body":"Node::DoubleOperator.new(self, Literal.new(any), \"OR\")"}},{"html_id":"~-instance-method","name":"~","abstract":false,"location":{"filename":"src/clear/expression/nodes/node.cr","line_number":82,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/node.cr#L82"},"def":{"name":"~","visibility":"Public","body":"Node::Not.new(self)"}},{"html_id":"between(a,b)-instance-method","name":"between","abstract":false,"args":[{"name":"a","external_name":"a","restriction":""},{"name":"b","external_name":"b","restriction":""}],"args_string":"(a, b)","args_html":"(a, b)","location":{"filename":"src/clear/expression/nodes/node.cr","line_number":74,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/node.cr#L74"},"def":{"name":"between","args":[{"name":"a","external_name":"a","restriction":""},{"name":"b","external_name":"b","restriction":""}],"visibility":"Public","body":"Node::Between.new(self, a, b)"}},{"html_id":"ilike(any:Node):Node-instance-method","name":"ilike","abstract":false,"args":[{"name":"any","external_name":"any","restriction":"Node"}],"args_string":"(any : Node) : Node","args_html":"(any : Node) : Node","location":{"filename":"src/clear/expression/nodes/node.cr","line_number":52,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/node.cr#L52"},"def":{"name":"ilike","args":[{"name":"any","external_name":"any","restriction":"Node"}],"return_type":"Node","visibility":"Public","body":"Node::DoubleOperator.new(self, any, \"ILIKE\")"}},{"html_id":"ilike(any:T):NodeforallT-instance-method","name":"ilike","abstract":false,"args":[{"name":"any","external_name":"any","restriction":"T"}],"args_string":"(any : T) : Node forall T","args_html":"(any : T) : Node forall T","location":{"filename":"src/clear/expression/nodes/node.cr","line_number":52,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/node.cr#L52"},"def":{"name":"ilike","args":[{"name":"any","external_name":"any","restriction":"T"}],"return_type":"Node","visibility":"Public","body":"Node::DoubleOperator.new(self, Literal.new(any), \"ILIKE\")"}},{"html_id":"in?(range:Range(B,E))forallB,E-instance-method","name":"in?","abstract":false,"args":[{"name":"range","external_name":"range","restriction":"Range(B, E)"}],"args_string":"(range : Range(B, E)) forall B, E","args_html":"(range : Range(B, E)) forall B, E","location":{"filename":"src/clear/expression/nodes/node.cr","line_number":56,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/node.cr#L56"},"def":{"name":"in?","args":[{"name":"range","external_name":"range","restriction":"Range(B, E)"}],"visibility":"Public","body":"Node::InRange.new(self, Clear::Expression[range.begin]..Clear::Expression[range.end], range.exclusive?)"}},{"html_id":"in?(arr:Array(T))forallT-instance-method","name":"in?","abstract":false,"args":[{"name":"arr","external_name":"arr","restriction":"Array(T)"}],"args_string":"(arr : Array(T)) forall T","args_html":"(arr : Array(T)) forall T","location":{"filename":"src/clear/expression/nodes/node.cr","line_number":62,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/node.cr#L62"},"def":{"name":"in?","args":[{"name":"arr","external_name":"arr","restriction":"Array(T)"}],"visibility":"Public","body":"Node::InArray.new(self, arr.map do |x|\n Clear::Expression[x]\nend)"}},{"html_id":"in?(tuple:Tuple(*T))forallT-instance-method","name":"in?","abstract":false,"args":[{"name":"tuple","external_name":"tuple","restriction":"Tuple(*T)"}],"args_string":"(tuple : Tuple(*T)) forall T","args_html":"(tuple : Tuple(*T)) forall T","location":{"filename":"src/clear/expression/nodes/node.cr","line_number":66,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/node.cr#L66"},"def":{"name":"in?","args":[{"name":"tuple","external_name":"tuple","restriction":"Tuple(*T)"}],"visibility":"Public","body":"in?(tuple.to_a)"}},{"html_id":"in?(request:Clear::SQL::SelectBuilder)-instance-method","name":"in?","abstract":false,"args":[{"name":"request","external_name":"request","restriction":"::Clear::SQL::SelectBuilder"}],"args_string":"(request : Clear::SQL::SelectBuilder)","args_html":"(request : Clear::SQL::SelectBuilder)","location":{"filename":"src/clear/expression/nodes/node.cr","line_number":70,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/node.cr#L70"},"def":{"name":"in?","args":[{"name":"request","external_name":"request","restriction":"::Clear::SQL::SelectBuilder"}],"visibility":"Public","body":"Node::InSelect.new(self, request)"}},{"html_id":"like(any:Node):Node-instance-method","name":"like","abstract":false,"args":[{"name":"any","external_name":"any","restriction":"Node"}],"args_string":"(any : Node) : Node","args_html":"(any : Node) : Node","location":{"filename":"src/clear/expression/nodes/node.cr","line_number":51,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/node.cr#L51"},"def":{"name":"like","args":[{"name":"any","external_name":"any","restriction":"Node"}],"return_type":"Node","visibility":"Public","body":"Node::DoubleOperator.new(self, any, \"LIKE\")"}},{"html_id":"like(any:T):NodeforallT-instance-method","name":"like","abstract":false,"args":[{"name":"any","external_name":"any","restriction":"T"}],"args_string":"(any : T) : Node forall T","args_html":"(any : T) : Node forall T","location":{"filename":"src/clear/expression/nodes/node.cr","line_number":51,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/node.cr#L51"},"def":{"name":"like","args":[{"name":"any","external_name":"any","restriction":"T"}],"return_type":"Node","visibility":"Public","body":"Node::DoubleOperator.new(self, Literal.new(any), \"LIKE\")"}},{"html_id":"resolve:String-instance-method","name":"resolve","abstract":true,"location":{"filename":"src/clear/expression/nodes/node.cr","line_number":86,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/node.cr#L86"},"def":{"name":"resolve","return_type":"String","visibility":"Public","body":""}}],"macros":[{"html_id":"define_operator(op_name,sql_name,null=false)-macro","name":"define_operator","abstract":false,"args":[{"name":"op_name","external_name":"op_name","restriction":""},{"name":"sql_name","external_name":"sql_name","restriction":""},{"name":"null","default_value":"false","external_name":"null","restriction":""}],"args_string":"(op_name, sql_name, null = false)","args_html":"(op_name, sql_name, null = false)","location":{"filename":"src/clear/expression/nodes/node.cr","line_number":5,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/node.cr#L5"},"def":{"name":"define_operator","args":[{"name":"op_name","external_name":"op_name","restriction":""},{"name":"sql_name","external_name":"sql_name","restriction":""},{"name":"null","default_value":"false","external_name":"null","restriction":""}],"visibility":"Public","body":" def \n{{ op_name.id }}\n(any : Node) : Node\n Node::DoubleOperator.new(self, any, \"\n{{ sql_name.id }}\n\")\n \nend\n\n \n{% if null %}\n def {{ op_name.id }}(some_nil : Nil) : Node\n Node::DoubleOperator.new(self, Null.new, {{ null }} )\n end\n {% end %}\n\n\n def \n{{ op_name.id }}\n(any : T) : Node forall T\n Node::DoubleOperator.new(self, Literal.new(any), \"\n{{ sql_name.id }}\n\")\n \nend\n \n"}}],"types":[{"html_id":"clear/Clear/Expression/Node/Between","path":"Clear/Expression/Node/Between.html","kind":"class","full_name":"Clear::Expression::Node::Between","name":"Between","abstract":false,"superclass":{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},"ancestors":[{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},{"html_id":"clear/Clear/Expression/JSONB/Node","kind":"module","full_name":"Clear::Expression::JSONB::Node","name":"Node"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/expression/nodes/between.cr","line_number":5,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/between.cr#L5"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},"doc":"A node managing the rendering of `(var BETWEEN a AND b)`\nexpressions.","summary":"

A node managing the rendering of (var BETWEEN a AND b) expressions.

","constructors":[{"html_id":"new(target:Node,starts:BetweenType,ends:BetweenType)-class-method","name":"new","abstract":false,"args":[{"name":"target","external_name":"target","restriction":"Node"},{"name":"starts","external_name":"starts","restriction":"BetweenType"},{"name":"ends","external_name":"ends","restriction":"BetweenType"}],"args_string":"(target : Node, starts : BetweenType, ends : BetweenType)","args_html":"(target : Node, starts : BetweenType, ends : BetweenType)","location":{"filename":"src/clear/expression/nodes/between.cr","line_number":8,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/between.cr#L8"},"def":{"name":"new","args":[{"name":"target","external_name":"target","restriction":"Node"},{"name":"starts","external_name":"starts","restriction":"BetweenType"},{"name":"ends","external_name":"ends","restriction":"BetweenType"}],"visibility":"Public","body":"_ = allocate\n_.initialize(target, starts, ends)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"resolve:String-instance-method","name":"resolve","abstract":false,"location":{"filename":"src/clear/expression/nodes/between.cr","line_number":11,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/between.cr#L11"},"def":{"name":"resolve","return_type":"String","visibility":"Public","body":"{\"(\", @target.resolve, \" BETWEEN \", Clear::Expression.safe_literal(@starts), \" AND \", Clear::Expression.safe_literal(@ends), \")\"}.join"}}],"types":[{"html_id":"clear/Clear/Expression/Node/Between/BetweenType","path":"Clear/Expression/Node/Between/BetweenType.html","kind":"alias","full_name":"Clear::Expression::Node::Between::BetweenType","name":"BetweenType","abstract":false,"locations":[{"filename":"src/clear/expression/nodes/between.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/between.cr#L6"}],"repository_name":"clear","program":false,"enum":false,"alias":true,"aliased":"(Clear::Expression::Node | Float32 | Float64 | Int32 | Int64 | String | Time)","aliased_html":"Clear::Expression::Node | Float32 | Float64 | Int32 | Int64 | String | Time","const":false,"namespace":{"html_id":"clear/Clear/Expression/Node/Between","kind":"class","full_name":"Clear::Expression::Node::Between","name":"Between"}}]},{"html_id":"clear/Clear/Expression/Node/DoubleOperator","path":"Clear/Expression/Node/DoubleOperator.html","kind":"class","full_name":"Clear::Expression::Node::DoubleOperator","name":"DoubleOperator","abstract":false,"superclass":{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},"ancestors":[{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},{"html_id":"clear/Clear/Expression/JSONB/Node","kind":"module","full_name":"Clear::Expression::JSONB::Node","name":"Node"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/expression/nodes/double_operator.cr","line_number":5,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/double_operator.cr#L5"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},"doc":"A node managing the rendering of\ncombination operations like ` `","summary":"

A node managing the rendering of combination operations like <val1> <op> <val2>

","constructors":[{"html_id":"new(a:Node,b:Node,op:String)-class-method","name":"new","abstract":false,"args":[{"name":"a","external_name":"a","restriction":"Node"},{"name":"b","external_name":"b","restriction":"Node"},{"name":"op","external_name":"op","restriction":"String"}],"args_string":"(a : Node, b : Node, op : String)","args_html":"(a : Node, b : Node, op : String)","location":{"filename":"src/clear/expression/nodes/double_operator.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/double_operator.cr#L6"},"def":{"name":"new","args":[{"name":"a","external_name":"a","restriction":"Node"},{"name":"b","external_name":"b","restriction":"Node"},{"name":"op","external_name":"op","restriction":"String"}],"visibility":"Public","body":"_ = allocate\n_.initialize(a, b, op)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"resolve:String-instance-method","name":"resolve","abstract":false,"location":{"filename":"src/clear/expression/nodes/double_operator.cr","line_number":8,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/double_operator.cr#L8"},"def":{"name":"resolve","return_type":"String","visibility":"Public","body":"{\"(\", @a.resolve, \" \", @op, \" \", @b.resolve, \")\"}.join"}}]},{"html_id":"clear/Clear/Expression/Node/Function","path":"Clear/Expression/Node/Function.html","kind":"class","full_name":"Clear::Expression::Node::Function","name":"Function","abstract":false,"superclass":{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},"ancestors":[{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},{"html_id":"clear/Clear/Expression/JSONB/Node","kind":"module","full_name":"Clear::Expression::JSONB::Node","name":"Node"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/expression/nodes/function.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/function.cr#L4"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},"doc":"A node managing the rendering of functions in Postgres.","summary":"

A node managing the rendering of functions in Postgres.

","constructors":[{"html_id":"new(name:String,args:Array(String))-class-method","name":"new","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"String"},{"name":"args","external_name":"args","restriction":"Array(String)"}],"args_string":"(name : String, args : Array(String))","args_html":"(name : String, args : Array(String))","location":{"filename":"src/clear/expression/nodes/function.cr","line_number":5,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/function.cr#L5"},"def":{"name":"new","args":[{"name":"name","external_name":"name","restriction":"String"},{"name":"args","external_name":"args","restriction":"Array(String)"}],"visibility":"Public","body":"_ = allocate\n_.initialize(name, args)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"resolve:String-instance-method","name":"resolve","abstract":false,"location":{"filename":"src/clear/expression/nodes/function.cr","line_number":7,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/function.cr#L7"},"def":{"name":"resolve","return_type":"String","visibility":"Public","body":"{@name, \"(\", @args.join(\", \"), \")\"}.join"}}]},{"html_id":"clear/Clear/Expression/Node/InArray","path":"Clear/Expression/Node/InArray.html","kind":"class","full_name":"Clear::Expression::Node::InArray","name":"InArray","abstract":false,"superclass":{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},"ancestors":[{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},{"html_id":"clear/Clear/Expression/JSONB/Node","kind":"module","full_name":"Clear::Expression::JSONB::Node","name":"Node"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/expression/nodes/in_array.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/in_array.cr#L6"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},"doc":"A node managing the rendering of array in Postgres.\n- It renders `val IN (...)`.\n- If the array passed as argument is empty, it renders `FALSE` instead.","summary":"

A node managing the rendering of array in Postgres.

","constructors":[{"html_id":"new(target:Node,array:Array(String))-class-method","name":"new","abstract":false,"args":[{"name":"target","external_name":"target","restriction":"Node"},{"name":"array","external_name":"array","restriction":"Array(String)"}],"args_string":"(target : Node, array : Array(String))","args_html":"(target : Node, array : Array(String))","location":{"filename":"src/clear/expression/nodes/in_array.cr","line_number":7,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/in_array.cr#L7"},"def":{"name":"new","args":[{"name":"target","external_name":"target","restriction":"Node"},{"name":"array","external_name":"array","restriction":"Array(String)"}],"visibility":"Public","body":"_ = allocate\n_.initialize(target, array)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"resolve:String-instance-method","name":"resolve","abstract":false,"location":{"filename":"src/clear/expression/nodes/in_array.cr","line_number":9,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/in_array.cr#L9"},"def":{"name":"resolve","return_type":"String","visibility":"Public","body":"if @array.size == 0\n \"FALSE\"\nelse\n {@target.resolve, \" IN (\", @array.join(\", \"), \")\"}.join\nend"}}]},{"html_id":"clear/Clear/Expression/Node/InRange","path":"Clear/Expression/Node/InRange.html","kind":"class","full_name":"Clear::Expression::Node::InRange","name":"InRange","abstract":false,"superclass":{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},"ancestors":[{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},{"html_id":"clear/Clear/Expression/JSONB/Node","kind":"module","full_name":"Clear::Expression::JSONB::Node","name":"Node"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/expression/nodes/in_range.cr","line_number":19,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/in_range.cr#L19"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},"doc":"A node managing the rendering a range in Postgres.\n\nExample:\n\n```\nvalue.in?(1..5)\n```\n\nwill render:\n\n```\nvalue >= 1 AND value < 5\n```\n\nInclusion and exclusion of the last number of the range is featured\n","summary":"

A node managing the rendering a range in Postgres.

","constructors":[{"html_id":"new(target:Node,range:Range(String,String),exclusive:Bool=false)-class-method","name":"new","abstract":false,"args":[{"name":"target","external_name":"target","restriction":"Node"},{"name":"range","external_name":"range","restriction":"Range(String, String)"},{"name":"exclusive","default_value":"false","external_name":"exclusive","restriction":"::Bool"}],"args_string":"(target : Node, range : Range(String, String), exclusive : Bool = false)","args_html":"(target : Node, range : Range(String, String), exclusive : Bool = false)","location":{"filename":"src/clear/expression/nodes/in_range.cr","line_number":20,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/in_range.cr#L20"},"def":{"name":"new","args":[{"name":"target","external_name":"target","restriction":"Node"},{"name":"range","external_name":"range","restriction":"Range(String, String)"},{"name":"exclusive","default_value":"false","external_name":"exclusive","restriction":"::Bool"}],"visibility":"Public","body":"_ = allocate\n_.initialize(target, range, exclusive)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"resolve:String-instance-method","name":"resolve","abstract":false,"location":{"filename":"src/clear/expression/nodes/in_range.cr","line_number":22,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/in_range.cr#L22"},"def":{"name":"resolve","return_type":"String","visibility":"Public","body":"rt = @target.resolve\nfinal_op = @exclusive ? \" < \" : \" <= \"\n{\"(\", rt, \" >= \", @range.begin, \" AND \", rt, final_op, @range.end, \")\"}.join\n"}}]},{"html_id":"clear/Clear/Expression/Node/InSelect","path":"Clear/Expression/Node/InSelect.html","kind":"class","full_name":"Clear::Expression::Node::InSelect","name":"InSelect","abstract":false,"superclass":{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},"ancestors":[{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},{"html_id":"clear/Clear/Expression/JSONB/Node","kind":"module","full_name":"Clear::Expression::JSONB::Node","name":"Node"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/expression/nodes/in_select.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/in_select.cr#L4"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},"doc":" A node managing the rendering of `value IN ( )`","summary":"

A node managing the rendering of value IN ( <SUBQUERY> )

","constructors":[{"html_id":"new(target:Node,select__arg0:Clear::SQL::SelectBuilder)-class-method","name":"new","abstract":false,"args":[{"name":"target","external_name":"target","restriction":"Node"},{"name":"__arg0","external_name":"select","restriction":"Clear::SQL::SelectBuilder"}],"args_string":"(target : Node, select __arg0 : Clear::SQL::SelectBuilder)","args_html":"(target : Node, select __arg0 : Clear::SQL::SelectBuilder)","location":{"filename":"src/clear/expression/nodes/in_select.cr","line_number":5,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/in_select.cr#L5"},"def":{"name":"new","args":[{"name":"target","external_name":"target","restriction":"Node"},{"name":"__arg0","external_name":"select","restriction":"Clear::SQL::SelectBuilder"}],"visibility":"Public","body":"_ = allocate\n_.initialize(target, __arg0)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"resolve:String-instance-method","name":"resolve","abstract":false,"location":{"filename":"src/clear/expression/nodes/in_select.cr","line_number":7,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/in_select.cr#L7"},"def":{"name":"resolve","return_type":"String","visibility":"Public","body":"{@target.resolve, \" IN (\", @select.to_sql, \")\"}.join"}}]},{"html_id":"clear/Clear/Expression/Node/JSONB","path":"Clear/Expression/Node/JSONB.html","kind":"module","full_name":"Clear::Expression::Node::JSONB","name":"JSONB","abstract":false,"locations":[{"filename":"src/clear/extensions/jsonb/expression.cr","line_number":3,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/jsonb/expression.cr#L3"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},"types":[{"html_id":"clear/Clear/Expression/Node/JSONB/ArrayContains","path":"Clear/Expression/Node/JSONB/ArrayContains.html","kind":"class","full_name":"Clear::Expression::Node::JSONB::ArrayContains","name":"ArrayContains","abstract":false,"superclass":{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},"ancestors":[{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},{"html_id":"clear/Clear/Expression/JSONB/Node","kind":"module","full_name":"Clear::Expression::JSONB::Node","name":"Node"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/extensions/jsonb/expression.cr","line_number":58,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/jsonb/expression.cr#L58"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Expression/Node/JSONB","kind":"module","full_name":"Clear::Expression::Node::JSONB","name":"JSONB"},"doc":"Define a __array contains? (?)__ operation between a jsonb column and a json hash","summary":"

Define a array contains? (?) operation between a jsonb column and a json hash

","constructors":[{"html_id":"new(jsonb_field:String,value:String)-class-method","name":"new","abstract":false,"args":[{"name":"jsonb_field","external_name":"jsonb_field","restriction":"::String"},{"name":"value","external_name":"value","restriction":"::String"}],"args_string":"(jsonb_field : String, value : String)","args_html":"(jsonb_field : String, value : String)","location":{"filename":"src/clear/extensions/jsonb/expression.cr","line_number":62,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/jsonb/expression.cr#L62"},"def":{"name":"new","args":[{"name":"jsonb_field","external_name":"jsonb_field","restriction":"::String"},{"name":"value","external_name":"value","restriction":"::String"}],"visibility":"Public","body":"_ = allocate\n_.initialize(jsonb_field, value)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"jsonb_field:String-instance-method","name":"jsonb_field","abstract":false,"location":{"filename":"src/clear/extensions/jsonb/expression.cr","line_number":59,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/jsonb/expression.cr#L59"},"def":{"name":"jsonb_field","return_type":"String","visibility":"Public","body":"@jsonb_field"}},{"html_id":"resolve:String-instance-method","name":"resolve","abstract":false,"location":{"filename":"src/clear/extensions/jsonb/expression.cr","line_number":65,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/jsonb/expression.cr#L65"},"def":{"name":"resolve","return_type":"String","visibility":"Public","body":"{@jsonb_field, @value}.join(\" ? \")"}},{"html_id":"value:String-instance-method","name":"value","abstract":false,"location":{"filename":"src/clear/extensions/jsonb/expression.cr","line_number":60,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/jsonb/expression.cr#L60"},"def":{"name":"value","return_type":"String","visibility":"Public","body":"@value"}}]},{"html_id":"clear/Clear/Expression/Node/JSONB/Equality","path":"Clear/Expression/Node/JSONB/Equality.html","kind":"class","full_name":"Clear::Expression::Node::JSONB::Equality","name":"Equality","abstract":false,"superclass":{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},"ancestors":[{"html_id":"clear/Clear/SQL/JSONB","kind":"module","full_name":"Clear::SQL::JSONB","name":"JSONB"},{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},{"html_id":"clear/Clear/Expression/JSONB/Node","kind":"module","full_name":"Clear::Expression::JSONB::Node","name":"Node"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/extensions/jsonb/expression.cr","line_number":43,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/jsonb/expression.cr#L43"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"clear/Clear/SQL/JSONB","kind":"module","full_name":"Clear::SQL::JSONB","name":"JSONB"}],"namespace":{"html_id":"clear/Clear/Expression/Node/JSONB","kind":"module","full_name":"Clear::Expression::Node::JSONB","name":"JSONB"},"doc":"Define a __value match? (@>)__ operation between a jsonb column and a json hash","summary":"

Define a value match? (@>) operation between a jsonb column and a json hash

","constructors":[{"html_id":"new(jsonb_field:String,value:Hash(String,Clear::SQL::JSONB::JSONBKey))-class-method","name":"new","abstract":false,"args":[{"name":"jsonb_field","external_name":"jsonb_field","restriction":"::String"},{"name":"value","external_name":"value","restriction":"::Hash(::String, ::Clear::SQL::JSONB::JSONBKey)"}],"args_string":"(jsonb_field : String, value : Hash(String, Clear::SQL::JSONB::JSONBKey))","args_html":"(jsonb_field : String, value : Hash(String, Clear::SQL::JSONB::JSONBKey))","location":{"filename":"src/clear/extensions/jsonb/expression.cr","line_number":49,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/jsonb/expression.cr#L49"},"def":{"name":"new","args":[{"name":"jsonb_field","external_name":"jsonb_field","restriction":"::String"},{"name":"value","external_name":"value","restriction":"::Hash(::String, ::Clear::SQL::JSONB::JSONBKey)"}],"visibility":"Public","body":"_ = allocate\n_.initialize(jsonb_field, value)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"jsonb_field:String-instance-method","name":"jsonb_field","abstract":false,"location":{"filename":"src/clear/extensions/jsonb/expression.cr","line_number":46,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/jsonb/expression.cr#L46"},"def":{"name":"jsonb_field","return_type":"String","visibility":"Public","body":"@jsonb_field"}},{"html_id":"resolve:String-instance-method","name":"resolve","abstract":false,"location":{"filename":"src/clear/extensions/jsonb/expression.cr","line_number":52,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/jsonb/expression.cr#L52"},"def":{"name":"resolve","return_type":"String","visibility":"Public","body":"{@jsonb_field, Clear::Expression[@value.to_json]}.join(\" @> \")"}},{"html_id":"value:JSONBHash-instance-method","name":"value","abstract":false,"location":{"filename":"src/clear/extensions/jsonb/expression.cr","line_number":47,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/jsonb/expression.cr#L47"},"def":{"name":"value","return_type":"JSONBHash","visibility":"Public","body":"@value"}}]},{"html_id":"clear/Clear/Expression/Node/JSONB/Field","path":"Clear/Expression/Node/JSONB/Field.html","kind":"class","full_name":"Clear::Expression::Node::JSONB::Field","name":"Field","abstract":false,"superclass":{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},"ancestors":[{"html_id":"clear/Clear/SQL/JSONB","kind":"module","full_name":"Clear::SQL::JSONB","name":"JSONB"},{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},{"html_id":"clear/Clear/Expression/JSONB/Node","kind":"module","full_name":"Clear::Expression::JSONB::Node","name":"Node"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/extensions/jsonb/expression.cr","line_number":3,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/jsonb/expression.cr#L3"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"clear/Clear/SQL/JSONB","kind":"module","full_name":"Clear::SQL::JSONB","name":"JSONB"}],"namespace":{"html_id":"clear/Clear/Expression/Node/JSONB","kind":"module","full_name":"Clear::Expression::Node::JSONB","name":"JSONB"},"constructors":[{"html_id":"new(field:Clear::Expression::Node,key:String,cast:Nil|String=nil)-class-method","name":"new","abstract":false,"args":[{"name":"field","external_name":"field","restriction":"::Clear::Expression::Node"},{"name":"key","external_name":"key","restriction":"::String"},{"name":"cast","default_value":"nil","external_name":"cast","restriction":"::Nil | ::String"}],"args_string":"(field : Clear::Expression::Node, key : String, cast : Nil | String = nil)","args_html":"(field : Clear::Expression::Node, key : String, cast : Nil | String = nil)","location":{"filename":"src/clear/extensions/jsonb/expression.cr","line_number":10,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/jsonb/expression.cr#L10"},"def":{"name":"new","args":[{"name":"field","external_name":"field","restriction":"::Clear::Expression::Node"},{"name":"key","external_name":"key","restriction":"::String"},{"name":"cast","default_value":"nil","external_name":"cast","restriction":"::Nil | ::String"}],"visibility":"Public","body":"_ = allocate\n_.initialize(field, key, cast)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"==(value:Clear::Expression::Node)-instance-method","name":"==","abstract":false,"args":[{"name":"value","external_name":"value","restriction":"Clear::Expression::Node"}],"args_string":"(value : Clear::Expression::Node)","args_html":"(value : Clear::Expression::Node)","location":{"filename":"src/clear/extensions/jsonb/expression.cr","line_number":21,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/jsonb/expression.cr#L21"},"def":{"name":"==","args":[{"name":"value","external_name":"value","restriction":"Clear::Expression::Node"}],"visibility":"Public","body":"super(value)"}},{"html_id":"==(value:_)-instance-method","name":"==","abstract":false,"args":[{"name":"value","external_name":"value","restriction":"_"}],"args_string":"(value : _)","args_html":"(value : _)","location":{"filename":"src/clear/extensions/jsonb/expression.cr","line_number":25,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/jsonb/expression.cr#L25"},"def":{"name":"==","args":[{"name":"value","external_name":"value","restriction":"_"}],"visibility":"Public","body":"if @cast\n super(value)\nelse\n Clear::Expression::Node::JSONB::Equality.new(field.resolve, jsonb_k2h(key, value))\nend"}},{"html_id":"cast(cast:Nil|String)-instance-method","name":"cast","abstract":false,"args":[{"name":"cast","external_name":"cast","restriction":"::Nil | ::String"}],"args_string":"(cast : Nil | String)","args_html":"(cast : Nil | String)","location":{"filename":"src/clear/extensions/jsonb/expression.cr","line_number":17,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/jsonb/expression.cr#L17"},"def":{"name":"cast","args":[{"name":"cast","external_name":"cast","restriction":"::Nil | ::String"}],"visibility":"Public","body":"@cast = cast\nself\n"}},{"html_id":"cast:String|Nil-instance-method","name":"cast","abstract":false,"location":{"filename":"src/clear/extensions/jsonb/expression.cr","line_number":8,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/jsonb/expression.cr#L8"},"def":{"name":"cast","return_type":"String | ::Nil","visibility":"Public","body":"@cast"}},{"html_id":"contains?(expression:Clear::Expression::Node)-instance-method","name":"contains?","abstract":false,"args":[{"name":"expression","external_name":"expression","restriction":"Clear::Expression::Node"}],"args_string":"(expression : Clear::Expression::Node)","args_html":"(expression : Clear::Expression::Node)","location":{"filename":"src/clear/extensions/jsonb/expression.cr","line_number":33,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/jsonb/expression.cr#L33"},"def":{"name":"contains?","args":[{"name":"expression","external_name":"expression","restriction":"Clear::Expression::Node"}],"visibility":"Public","body":"Clear::Expression::Node::JSONB::ArrayContains.new(resolve, expression.resolve)"}},{"html_id":"contains?(expression)-instance-method","name":"contains?","abstract":false,"args":[{"name":"expression","external_name":"expression","restriction":""}],"args_string":"(expression)","args_html":"(expression)","location":{"filename":"src/clear/extensions/jsonb/expression.cr","line_number":37,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/jsonb/expression.cr#L37"},"def":{"name":"contains?","args":[{"name":"expression","external_name":"expression","restriction":""}],"visibility":"Public","body":"Clear::Expression::Node::JSONB::ArrayContains.new(resolve, Clear::Expression[expression])"}},{"html_id":"field:Node-instance-method","name":"field","abstract":false,"location":{"filename":"src/clear/extensions/jsonb/expression.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/jsonb/expression.cr#L6"},"def":{"name":"field","return_type":"Node","visibility":"Public","body":"@field"}},{"html_id":"key:String-instance-method","name":"key","abstract":false,"location":{"filename":"src/clear/extensions/jsonb/expression.cr","line_number":7,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/jsonb/expression.cr#L7"},"def":{"name":"key","return_type":"String","visibility":"Public","body":"@key"}},{"html_id":"resolve:String-instance-method","name":"resolve","abstract":false,"location":{"filename":"src/clear/extensions/jsonb/expression.cr","line_number":13,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/jsonb/expression.cr#L13"},"def":{"name":"resolve","return_type":"String","visibility":"Public","body":"jsonb_resolve(@field.resolve, jsonb_k2a(key), @cast)"}}]}]},{"html_id":"clear/Clear/Expression/Node/Literal","path":"Clear/Expression/Node/Literal.html","kind":"class","full_name":"Clear::Expression::Node::Literal","name":"Literal","abstract":false,"superclass":{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},"ancestors":[{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},{"html_id":"clear/Clear/Expression/JSONB/Node","kind":"module","full_name":"Clear::Expression::JSONB::Node","name":"Node"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/expression/nodes/literal.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/literal.cr#L4"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},"doc":"Management of rendering of literal values.","summary":"

Management of rendering of literal values.

","constructors":[{"html_id":"new(value)-class-method","name":"new","abstract":false,"args":[{"name":"value","external_name":"value","restriction":""}],"args_string":"(value)","args_html":"(value)","location":{"filename":"src/clear/expression/nodes/literal.cr","line_number":7,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/literal.cr#L7"},"def":{"name":"new","args":[{"name":"value","external_name":"value","restriction":""}],"visibility":"Public","body":"_ = allocate\n_.initialize(value)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"resolve:String-instance-method","name":"resolve","abstract":false,"location":{"filename":"src/clear/expression/nodes/literal.cr","line_number":17,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/literal.cr#L17"},"def":{"name":"resolve","return_type":"String","visibility":"Public","body":"Clear::Expression[@value]"}},{"html_id":"value:AvailableLiteral-instance-method","name":"value","abstract":false,"location":{"filename":"src/clear/expression/nodes/literal.cr","line_number":5,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/literal.cr#L5"},"def":{"name":"value","return_type":"AvailableLiteral","visibility":"Public","body":"@value"}}]},{"html_id":"clear/Clear/Expression/Node/Minus","path":"Clear/Expression/Node/Minus.html","kind":"class","full_name":"Clear::Expression::Node::Minus","name":"Minus","abstract":false,"superclass":{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},"ancestors":[{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},{"html_id":"clear/Clear/Expression/JSONB/Node","kind":"module","full_name":"Clear::Expression::JSONB::Node","name":"Node"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/expression/nodes/minus.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/minus.cr#L4"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},"doc":"A node managing the unary `-` operator.","summary":"

A node managing the unary - operator.

","constructors":[{"html_id":"new(a:Node)-class-method","name":"new","abstract":false,"args":[{"name":"a","external_name":"a","restriction":"Node"}],"args_string":"(a : Node)","args_html":"(a : Node)","location":{"filename":"src/clear/expression/nodes/minus.cr","line_number":5,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/minus.cr#L5"},"def":{"name":"new","args":[{"name":"a","external_name":"a","restriction":"Node"}],"visibility":"Public","body":"_ = allocate\n_.initialize(a)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"resolve:String-instance-method","name":"resolve","abstract":false,"location":{"filename":"src/clear/expression/nodes/minus.cr","line_number":7,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/minus.cr#L7"},"def":{"name":"resolve","return_type":"String","visibility":"Public","body":"{\"-\", @a.resolve}.join"}}]},{"html_id":"clear/Clear/Expression/Node/NodeArray","path":"Clear/Expression/Node/NodeArray.html","kind":"class","full_name":"Clear::Expression::Node::NodeArray","name":"NodeArray","abstract":false,"superclass":{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},"ancestors":[{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},{"html_id":"clear/Clear/Expression/JSONB/Node","kind":"module","full_name":"Clear::Expression::JSONB::Node","name":"Node"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/expression/nodes/node_array.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/node_array.cr#L4"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},"doc":"This node is used to generate expression like `( a AND b AND ... AND k )`","summary":"

This node is used to generate expression like `( a AND b AND ...

","constructors":[{"html_id":"new(expression:Array(Node),link:String)-class-method","name":"new","abstract":false,"args":[{"name":"expression","external_name":"expression","restriction":"Array(Node)"},{"name":"link","external_name":"link","restriction":"::String"}],"args_string":"(expression : Array(Node), link : String)","args_html":"(expression : Array(Node), link : String)","location":{"filename":"src/clear/expression/nodes/node_array.cr","line_number":8,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/node_array.cr#L8"},"def":{"name":"new","args":[{"name":"expression","external_name":"expression","restriction":"Array(Node)"},{"name":"link","external_name":"link","restriction":"::String"}],"visibility":"Public","body":"_ = allocate\n_.initialize(expression, link)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"expression:Array(Node)-instance-method","name":"expression","abstract":false,"location":{"filename":"src/clear/expression/nodes/node_array.cr","line_number":5,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/node_array.cr#L5"},"def":{"name":"expression","return_type":"Array(Node)","visibility":"Public","body":"@expression"}},{"html_id":"expression=(expression:Array(Node))-instance-method","name":"expression=","abstract":false,"args":[{"name":"expression","external_name":"expression","restriction":"Array(Node)"}],"args_string":"(expression : Array(Node))","args_html":"(expression : Array(Node))","location":{"filename":"src/clear/expression/nodes/node_array.cr","line_number":5,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/node_array.cr#L5"},"def":{"name":"expression=","args":[{"name":"expression","external_name":"expression","restriction":"Array(Node)"}],"visibility":"Public","body":"@expression = expression"}},{"html_id":"link:String-instance-method","name":"link","abstract":false,"location":{"filename":"src/clear/expression/nodes/node_array.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/node_array.cr#L6"},"def":{"name":"link","return_type":"String","visibility":"Public","body":"@link"}},{"html_id":"link=(link:String)-instance-method","name":"link=","abstract":false,"args":[{"name":"link","external_name":"link","restriction":"String"}],"args_string":"(link : String)","args_html":"(link : String)","location":{"filename":"src/clear/expression/nodes/node_array.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/node_array.cr#L6"},"def":{"name":"link=","args":[{"name":"link","external_name":"link","restriction":"String"}],"visibility":"Public","body":"@link = link"}},{"html_id":"resolve:String-instance-method","name":"resolve","abstract":false,"location":{"filename":"src/clear/expression/nodes/node_array.cr","line_number":12,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/node_array.cr#L12"},"def":{"name":"resolve","return_type":"String","visibility":"Public","body":"if !@expression.empty?\n {\"(\", @expression.join(\" #{@link} \", &.resolve), \")\"}.join\nelse\n \"\"\nend"}}]},{"html_id":"clear/Clear/Expression/Node/Not","path":"Clear/Expression/Node/Not.html","kind":"class","full_name":"Clear::Expression::Node::Not","name":"Not","abstract":false,"superclass":{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},"ancestors":[{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},{"html_id":"clear/Clear/Expression/JSONB/Node","kind":"module","full_name":"Clear::Expression::JSONB::Node","name":"Node"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/expression/nodes/not.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/not.cr#L4"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},"doc":"A node managing the unary `NOT` operator.","summary":"

A node managing the unary NOT operator.

","constructors":[{"html_id":"new(a:Node)-class-method","name":"new","abstract":false,"args":[{"name":"a","external_name":"a","restriction":"Node"}],"args_string":"(a : Node)","args_html":"(a : Node)","location":{"filename":"src/clear/expression/nodes/not.cr","line_number":5,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/not.cr#L5"},"def":{"name":"new","args":[{"name":"a","external_name":"a","restriction":"Node"}],"visibility":"Public","body":"_ = allocate\n_.initialize(a)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"resolve:String-instance-method","name":"resolve","abstract":false,"location":{"filename":"src/clear/expression/nodes/not.cr","line_number":7,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/not.cr#L7"},"def":{"name":"resolve","return_type":"String","visibility":"Public","body":"{\"NOT \", @a.resolve}.join"}}]},{"html_id":"clear/Clear/Expression/Node/NotBetween","path":"Clear/Expression/Node/NotBetween.html","kind":"class","full_name":"Clear::Expression::Node::NotBetween","name":"NotBetween","abstract":false,"superclass":{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},"ancestors":[{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},{"html_id":"clear/Clear/Expression/JSONB/Node","kind":"module","full_name":"Clear::Expression::JSONB::Node","name":"Node"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/expression/nodes/not_between.cr","line_number":5,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/not_between.cr#L5"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},"doc":"A node managing the rendering of `(var NOT BETWEEN a AND b)`\nexpressions.","summary":"

A node managing the rendering of (var NOT BETWEEN a AND b) expressions.

","constructors":[{"html_id":"new(target:Node,starts:BetweenType,ends:BetweenType)-class-method","name":"new","abstract":false,"args":[{"name":"target","external_name":"target","restriction":"Node"},{"name":"starts","external_name":"starts","restriction":"BetweenType"},{"name":"ends","external_name":"ends","restriction":"BetweenType"}],"args_string":"(target : Node, starts : BetweenType, ends : BetweenType)","args_html":"(target : Node, starts : BetweenType, ends : BetweenType)","location":{"filename":"src/clear/expression/nodes/not_between.cr","line_number":8,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/not_between.cr#L8"},"def":{"name":"new","args":[{"name":"target","external_name":"target","restriction":"Node"},{"name":"starts","external_name":"starts","restriction":"BetweenType"},{"name":"ends","external_name":"ends","restriction":"BetweenType"}],"visibility":"Public","body":"_ = allocate\n_.initialize(target, starts, ends)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"resolve:String-instance-method","name":"resolve","abstract":false,"location":{"filename":"src/clear/expression/nodes/not_between.cr","line_number":11,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/not_between.cr#L11"},"def":{"name":"resolve","return_type":"String","visibility":"Public","body":"{\"(\", @target.resolve, \" NOT BETWEEN \", Clear::Expression[@starts], \" AND \", Clear::Expression[@ends], \")\"}.join"}}],"types":[{"html_id":"clear/Clear/Expression/Node/NotBetween/BetweenType","path":"Clear/Expression/Node/NotBetween/BetweenType.html","kind":"alias","full_name":"Clear::Expression::Node::NotBetween::BetweenType","name":"BetweenType","abstract":false,"locations":[{"filename":"src/clear/expression/nodes/not_between.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/not_between.cr#L6"}],"repository_name":"clear","program":false,"enum":false,"alias":true,"aliased":"(Clear::Expression::Node | Float32 | Float64 | Int32 | Int64 | String | Time)","aliased_html":"Clear::Expression::Node | Float32 | Float64 | Int32 | Int64 | String | Time","const":false,"namespace":{"html_id":"clear/Clear/Expression/Node/NotBetween","kind":"class","full_name":"Clear::Expression::Node::NotBetween","name":"NotBetween"}}]},{"html_id":"clear/Clear/Expression/Node/Null","path":"Clear/Expression/Node/Null.html","kind":"class","full_name":"Clear::Expression::Node::Null","name":"Null","abstract":false,"superclass":{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},"ancestors":[{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},{"html_id":"clear/Clear/Expression/JSONB/Node","kind":"module","full_name":"Clear::Expression::JSONB::Node","name":"Node"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/expression/nodes/null.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/null.cr#L4"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},"doc":"Render NULL !","summary":"

Render NULL !

","constructors":[{"html_id":"new-class-method","name":"new","abstract":false,"location":{"filename":"src/clear/expression/nodes/null.cr","line_number":5,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/null.cr#L5"},"def":{"name":"new","visibility":"Public","body":"_ = allocate\n_.initialize\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"resolve:String-instance-method","name":"resolve","abstract":false,"location":{"filename":"src/clear/expression/nodes/null.cr","line_number":8,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/null.cr#L8"},"def":{"name":"resolve","return_type":"String","visibility":"Public","body":"\"NULL\""}}]},{"html_id":"clear/Clear/Expression/Node/PGArray","path":"Clear/Expression/Node/PGArray.html","kind":"class","full_name":"Clear::Expression::Node::PGArray(T)","name":"PGArray","abstract":false,"superclass":{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},"ancestors":[{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},{"html_id":"clear/Clear/Expression/JSONB/Node","kind":"module","full_name":"Clear::Expression::JSONB::Node","name":"Node"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/expression/nodes/pg_array.cr","line_number":5,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/pg_array.cr#L5"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},"doc":"A node managing PG structure `array[args...]`\nNamed PGArray instead of Array to avoid issue with naming","summary":"

A node managing PG structure array[args...] Named PGArray instead of Array to avoid issue with naming

","constructors":[{"html_id":"new(arr:Array(T))-class-method","name":"new","abstract":false,"args":[{"name":"arr","external_name":"arr","restriction":"Array(T)"}],"args_string":"(arr : Array(T))","args_html":"(arr : Array(T))","location":{"filename":"src/clear/expression/nodes/pg_array.cr","line_number":8,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/pg_array.cr#L8"},"def":{"name":"new","args":[{"name":"arr","external_name":"arr","restriction":"Array(T)"}],"visibility":"Public","body":"_ = PGArray(T).allocate\n_.initialize(arr)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"resolve:String-instance-method","name":"resolve","abstract":false,"location":{"filename":"src/clear/expression/nodes/pg_array.cr","line_number":11,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/pg_array.cr#L11"},"def":{"name":"resolve","return_type":"String","visibility":"Public","body":"{\"array[\", Clear::Expression[@arr].join(\", \"), \"]\"}.join"}}]},{"html_id":"clear/Clear/Expression/Node/Raw","path":"Clear/Expression/Node/Raw.html","kind":"class","full_name":"Clear::Expression::Node::Raw","name":"Raw","abstract":false,"superclass":{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},"ancestors":[{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},{"html_id":"clear/Clear/Expression/JSONB/Node","kind":"module","full_name":"Clear::Expression::JSONB::Node","name":"Node"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/expression/nodes/raw.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/raw.cr#L4"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},"doc":"This node manage the rendering of a raw SQL fragment.","summary":"

This node manage the rendering of a raw SQL fragment.

","constructors":[{"html_id":"new(raw:String)-class-method","name":"new","abstract":false,"args":[{"name":"raw","external_name":"raw","restriction":"String"}],"args_string":"(raw : String)","args_html":"(raw : String)","location":{"filename":"src/clear/expression/nodes/raw.cr","line_number":5,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/raw.cr#L5"},"def":{"name":"new","args":[{"name":"raw","external_name":"raw","restriction":"String"}],"visibility":"Public","body":"_ = allocate\n_.initialize(raw)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"resolve:String-instance-method","name":"resolve","abstract":false,"location":{"filename":"src/clear/expression/nodes/raw.cr","line_number":7,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/raw.cr#L7"},"def":{"name":"resolve","return_type":"String","visibility":"Public","body":"@raw"}}]},{"html_id":"clear/Clear/Expression/Node/Variable","path":"Clear/Expression/Node/Variable.html","kind":"class","full_name":"Clear::Expression::Node::Variable","name":"Variable","abstract":false,"superclass":{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},"ancestors":[{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},{"html_id":"clear/Clear/Expression/JSONB/Node","kind":"module","full_name":"Clear::Expression::JSONB::Node","name":"Node"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/expression/nodes/variable.cr","line_number":16,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/variable.cr#L16"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},"doc":"A variable AST node.\nIt's what's created under the hood when you use a non-existent variable:\n\n```\nwhere { users.id != nil }\n\nwill produce this tree:\n\n# => double_operator('<>')\n# # => variable('id', parent: 'users')\n# # => null\n\n```","summary":"

A variable AST node.

","constructors":[{"html_id":"new(name:String,parent:Variable|Nil=nil)-class-method","name":"new","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"String"},{"name":"parent","default_value":"nil","external_name":"parent","restriction":"Variable | ::Nil"}],"args_string":"(name : String, parent : Variable | Nil = nil)","args_html":"(name : String, parent : Variable | Nil = nil)","location":{"filename":"src/clear/expression/nodes/variable.cr","line_number":17,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/variable.cr#L17"},"def":{"name":"new","args":[{"name":"name","external_name":"name","restriction":"String"},{"name":"parent","default_value":"nil","external_name":"parent","restriction":"Variable | ::Nil"}],"visibility":"Public","body":"_ = allocate\n_.initialize(name, parent)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"resolve:String-instance-method","name":"resolve","abstract":false,"location":{"filename":"src/clear/expression/nodes/variable.cr","line_number":28,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/variable.cr#L28"},"def":{"name":"resolve","return_type":"String","visibility":"Public","body":"parent = @parent\nif parent\n {parent.resolve, \".\", Clear::SQL.escape(@name)}.join\nelse\n Clear::SQL.escape(@name)\nend\n"}}],"macros":[{"html_id":"method_missing(call)-macro","name":"method_missing","abstract":false,"args":[{"name":"call","external_name":"call","restriction":""}],"args_string":"(call)","args_html":"(call)","location":{"filename":"src/clear/expression/nodes/variable.cr","line_number":19,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/variable.cr#L19"},"def":{"name":"method_missing","args":[{"name":"call","external_name":"call","restriction":""}],"visibility":"Public","body":" \n{% if call.args.size > 0 %}\n args = Clear::Expression[{{ call.args }}].join(\", \")\n return Node::Variable.new(\"{{ call.name.id }}(#{args})\", self)\n {% else %}\n return Node::Variable.new({{ call.name.id.stringify }}, self)\n {% end %}\n\n \n"}}]}]},{"html_id":"clear/Clear/Expression/UnsafeSql","path":"Clear/Expression/UnsafeSql.html","kind":"class","full_name":"Clear::Expression::UnsafeSql","name":"UnsafeSql","abstract":false,"superclass":{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"clear/Clear/Expression/Literal","kind":"module","full_name":"Clear::Expression::Literal","name":"Literal"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/expression/expression.cr","line_number":70,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/expression.cr#L70"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"clear/Clear/Expression/Literal","kind":"module","full_name":"Clear::Expression::Literal","name":"Literal"}],"namespace":{"html_id":"clear/Clear/Expression","kind":"class","full_name":"Clear::Expression","name":"Expression"},"doc":"Wrap an unsafe string. Useful to cancel-out the\nsafe_literal function used internally.\nObviously, this can lead to SQL injection, so beware!","summary":"

Wrap an unsafe string.

","constructors":[{"html_id":"new(value:String)-class-method","name":"new","abstract":false,"args":[{"name":"value","external_name":"value","restriction":"::String"}],"args_string":"(value : String)","args_html":"(value : String)","location":{"filename":"src/clear/expression/expression.cr","line_number":75,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/expression.cr#L75"},"def":{"name":"new","args":[{"name":"value","external_name":"value","restriction":"::String"}],"visibility":"Public","body":"_ = allocate\n_.initialize(value)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"to_json(json=nil):String-instance-method","name":"to_json","abstract":false,"args":[{"name":"json","default_value":"nil","external_name":"json","restriction":""}],"args_string":"(json = nil) : String","args_html":"(json = nil) : String","location":{"filename":"src/clear/expression/expression.cr","line_number":86,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/expression.cr#L86"},"def":{"name":"to_json","args":[{"name":"json","default_value":"nil","external_name":"json","restriction":""}],"visibility":"Public","body":"@value"}},{"html_id":"to_s:String-instance-method","name":"to_s","doc":"Returns a nicely readable and concise string representation of this object,\ntypically intended for users.\n\nThis method should usually **not** be overridden. It delegates to\n`#to_s(IO)` which can be overridden for custom implementations.\n\nAlso see `#inspect`.","summary":"

Returns a nicely readable and concise string representation of this object, typically intended for users.

","abstract":false,"location":{"filename":"src/clear/expression/expression.cr","line_number":78,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/expression.cr#L78"},"def":{"name":"to_s","visibility":"Public","body":"@value"}},{"html_id":"to_sql:String-instance-method","name":"to_sql","abstract":false,"location":{"filename":"src/clear/expression/expression.cr","line_number":82,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/expression.cr#L82"},"def":{"name":"to_sql","visibility":"Public","body":"@value"}}]}]},{"html_id":"clear/Clear/IllegalEnumValueError","path":"Clear/IllegalEnumValueError.html","kind":"class","full_name":"Clear::IllegalEnumValueError","name":"IllegalEnumValueError","abstract":false,"superclass":{"html_id":"clear/Exception","kind":"class","full_name":"Exception","name":"Exception"},"ancestors":[{"html_id":"clear/Exception","kind":"class","full_name":"Exception","name":"Exception"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/extensions/enum/enum.cr","line_number":2,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/enum/enum.cr#L2"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear","kind":"module","full_name":"Clear","name":"Clear"}},{"html_id":"clear/Clear/Interval","path":"Clear/Interval.html","kind":"struct","full_name":"Clear::Interval","name":"Interval","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/extensions/interval/interval.cr","line_number":17,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/interval/interval.cr#L17"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear","kind":"module","full_name":"Clear","name":"Clear"},"doc":"It can be converted automatically from/to a `interval` column.\n\n## Usage example\n\n```\nclass MyModel\n include Clear::Model\n\n column interval : Clear::TimeInDay\nend\n\ninterval = Clear::Interval.new(60.days)\nrecord = MyModel.create!(interval: interval)\n```","summary":"

It can be converted automatically from/to a interval column.

","class_methods":[{"html_id":"decode(x:Slice(UInt8))-class-method","name":"decode","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Slice(UInt8)"}],"args_string":"(x : Slice(UInt8))","args_html":"(x : Slice(UInt8))","location":{"filename":"src/clear/extensions/interval/interval.cr","line_number":109,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/interval/interval.cr#L109"},"def":{"name":"decode","args":[{"name":"x","external_name":"x","restriction":"Slice(UInt8)"}],"visibility":"Public","body":"io = IO::Memory.new(x, writeable: false)\nnew(io)\n"}}],"constructors":[{"html_id":"new(months:Int32=0,days:Int32=0,hours:Int32=0,minutes:Int32=0,seconds:Int32=0,milliseconds:Int32=0,microseconds:Int64=0)-class-method","name":"new","abstract":false,"args":[{"name":"months","default_value":"0","external_name":"months","restriction":"Int32"},{"name":"days","default_value":"0","external_name":"days","restriction":"Int32"},{"name":"hours","default_value":"0","external_name":"hours","restriction":"Int32"},{"name":"minutes","default_value":"0","external_name":"minutes","restriction":"Int32"},{"name":"seconds","default_value":"0","external_name":"seconds","restriction":"Int32"},{"name":"milliseconds","default_value":"0","external_name":"milliseconds","restriction":"Int32"},{"name":"microseconds","default_value":"0","external_name":"microseconds","restriction":"Int64"}],"args_string":"(months : Int32 = 0, days : Int32 = 0, hours : Int32 = 0, minutes : Int32 = 0, seconds : Int32 = 0, milliseconds : Int32 = 0, microseconds : Int64 = 0)","args_html":"(months : Int32 = 0, days : Int32 = 0, hours : Int32 = 0, minutes : Int32 = 0, seconds : Int32 = 0, milliseconds : Int32 = 0, microseconds : Int64 = 0)","location":{"filename":"src/clear/extensions/interval/interval.cr","line_number":55,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/interval/interval.cr#L55"},"def":{"name":"new","args":[{"name":"months","default_value":"0","external_name":"months","restriction":"Int32"},{"name":"days","default_value":"0","external_name":"days","restriction":"Int32"},{"name":"hours","default_value":"0","external_name":"hours","restriction":"Int32"},{"name":"minutes","default_value":"0","external_name":"minutes","restriction":"Int32"},{"name":"seconds","default_value":"0","external_name":"seconds","restriction":"Int32"},{"name":"milliseconds","default_value":"0","external_name":"milliseconds","restriction":"Int32"},{"name":"microseconds","default_value":"0","external_name":"microseconds","restriction":"Int64"}],"visibility":"Public","body":"_ = allocate\n_.initialize(months, days, hours, minutes, seconds, milliseconds, microseconds)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new(months:Int32,days:Int32,microseconds:Number)-class-method","name":"new","doc":"For `PG::Interval`","summary":"

For PG::Interval

","abstract":false,"args":[{"name":"months","external_name":"months","restriction":"Int32"},{"name":"days","external_name":"days","restriction":"Int32"},{"name":"microseconds","external_name":"microseconds","restriction":"Number"}],"args_string":"(months : Int32, days : Int32, microseconds : Number)","args_html":"(months : Int32, days : Int32, microseconds : Number)","location":{"filename":"src/clear/extensions/interval/interval.cr","line_number":41,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/interval/interval.cr#L41"},"def":{"name":"new","args":[{"name":"months","external_name":"months","restriction":"Int32"},{"name":"days","external_name":"days","restriction":"Int32"},{"name":"microseconds","external_name":"microseconds","restriction":"Number"}],"visibility":"Public","body":"_ = allocate\n_.initialize(months, days, microseconds)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new(span:Time::Span)-class-method","name":"new","abstract":false,"args":[{"name":"span","external_name":"span","restriction":"Time::Span"}],"args_string":"(span : Time::Span)","args_html":"(span : Time::Span)","location":{"filename":"src/clear/extensions/interval/interval.cr","line_number":27,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/interval/interval.cr#L27"},"def":{"name":"new","args":[{"name":"span","external_name":"span","restriction":"Time::Span"}],"visibility":"Public","body":"_ = allocate\n_.initialize(span)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new(span:Time::MonthSpan)-class-method","name":"new","abstract":false,"args":[{"name":"span","external_name":"span","restriction":"Time::MonthSpan"}],"args_string":"(span : Time::MonthSpan)","args_html":"(span : Time::MonthSpan)","location":{"filename":"src/clear/extensions/interval/interval.cr","line_number":36,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/interval/interval.cr#L36"},"def":{"name":"new","args":[{"name":"span","external_name":"span","restriction":"Time::MonthSpan"}],"visibility":"Public","body":"_ = allocate\n_.initialize(span)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new(io:IO)-class-method","name":"new","abstract":false,"args":[{"name":"io","external_name":"io","restriction":"IO"}],"args_string":"(io : IO)","args_html":"(io : IO)","location":{"filename":"src/clear/extensions/interval/interval.cr","line_number":66,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/interval/interval.cr#L66"},"def":{"name":"new","args":[{"name":"io","external_name":"io","restriction":"IO"}],"visibility":"Public","body":"_ = allocate\n_.initialize(io)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"+(interval:self)-instance-method","name":"+","abstract":false,"args":[{"name":"interval","external_name":"interval","restriction":"self"}],"args_string":"(interval : self)","args_html":"(interval : self)","location":{"filename":"src/clear/extensions/interval/interval.cr","line_number":97,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/interval/interval.cr#L97"},"def":{"name":"+","args":[{"name":"interval","external_name":"interval","restriction":"self"}],"visibility":"Public","body":"new(months: self.months + interval.months, day: self.days + interval.days, hours: self.hours + interval.hours, minutes: self.minutes + interval.minutes, seconds: self.seconds + interval.seconds, milliseconds: self.milliseconds + interval.milliseconds, microseconds: self.microseconds + interval.microseconds)"}},{"html_id":"days:Int32-instance-method","name":"days","abstract":false,"location":{"filename":"src/clear/extensions/interval/interval.cr","line_number":19,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/interval/interval.cr#L19"},"def":{"name":"days","return_type":"Int32","visibility":"Public","body":"@days"}},{"html_id":"hours:Int32-instance-method","name":"hours","abstract":false,"location":{"filename":"src/clear/extensions/interval/interval.cr","line_number":22,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/interval/interval.cr#L22"},"def":{"name":"hours","return_type":"Int32","visibility":"Public","body":"@hours"}},{"html_id":"microseconds:Int64-instance-method","name":"microseconds","abstract":false,"location":{"filename":"src/clear/extensions/interval/interval.cr","line_number":20,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/interval/interval.cr#L20"},"def":{"name":"microseconds","return_type":"Int64","visibility":"Public","body":"@microseconds"}},{"html_id":"milliseconds:Int32-instance-method","name":"milliseconds","abstract":false,"location":{"filename":"src/clear/extensions/interval/interval.cr","line_number":25,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/interval/interval.cr#L25"},"def":{"name":"milliseconds","return_type":"Int32","visibility":"Public","body":"@milliseconds"}},{"html_id":"minutes:Int32-instance-method","name":"minutes","abstract":false,"location":{"filename":"src/clear/extensions/interval/interval.cr","line_number":23,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/interval/interval.cr#L23"},"def":{"name":"minutes","return_type":"Int32","visibility":"Public","body":"@minutes"}},{"html_id":"months:Int32-instance-method","name":"months","abstract":false,"location":{"filename":"src/clear/extensions/interval/interval.cr","line_number":18,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/interval/interval.cr#L18"},"def":{"name":"months","return_type":"Int32","visibility":"Public","body":"@months"}},{"html_id":"seconds:Int32-instance-method","name":"seconds","abstract":false,"location":{"filename":"src/clear/extensions/interval/interval.cr","line_number":24,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/interval/interval.cr#L24"},"def":{"name":"seconds","return_type":"Int32","visibility":"Public","body":"@seconds"}},{"html_id":"to_json(json:JSON::Builder):Nil-instance-method","name":"to_json","abstract":false,"args":[{"name":"json","external_name":"json","restriction":"JSON::Builder"}],"args_string":"(json : JSON::Builder) : Nil","args_html":"(json : JSON::Builder) : Nil","location":{"filename":"src/clear/extensions/interval/interval.cr","line_number":76,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/interval/interval.cr#L76"},"def":{"name":"to_json","args":[{"name":"json","external_name":"json","restriction":"JSON::Builder"}],"return_type":"Nil","visibility":"Public","body":"json.string(to_s)"}},{"html_id":"to_s(io)-instance-method","name":"to_s","abstract":false,"args":[{"name":"io","external_name":"io","restriction":""}],"args_string":"(io)","args_html":"(io)","location":{"filename":"src/clear/extensions/interval/interval.cr","line_number":72,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/interval/interval.cr#L72"},"def":{"name":"to_s","args":[{"name":"io","external_name":"io","restriction":""}],"visibility":"Public","body":"\"\""}},{"html_id":"to_sql-instance-method","name":"to_sql","abstract":false,"location":{"filename":"src/clear/extensions/interval/interval.cr","line_number":80,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/interval/interval.cr#L80"},"def":{"name":"to_sql","visibility":"Public","body":"o = [] of String\nif @months.zero?\nelse\n ((o << @months.to_s) << \"months\")\nend\nif @days.zero?\nelse\n ((o << @days.to_s) << \"days\")\nend\nif @hours.zero?\nelse\n ((o << @hours.to_s) << \"hours\")\nend\nif @minutes.zero?\nelse\n ((o << @minutes.to_s) << \"minutes\")\nend\nif @seconds.zero?\nelse\n ((o << @seconds.to_s) << \"seconds\")\nend\nif @milliseconds.zero?\nelse\n ((o << @milliseconds.to_s) << \"milliseconds\")\nend\nif @microseconds.zero?\nelse\n ((o << @microseconds.to_s) << \"microseconds\")\nend\nClear::SQL.unsafe({\"INTERVAL\", Clear::Expression[o.join(\" \")]}.join(\" \"))\n"}}],"types":[{"html_id":"clear/Clear/Interval/Converter","path":"Clear/Interval/Converter.html","kind":"class","full_name":"Clear::Interval::Converter","name":"Converter","abstract":false,"superclass":{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/extensions/interval/interval_converter.cr","line_number":27,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/interval/interval_converter.cr#L27"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Interval","kind":"struct","full_name":"Clear::Interval","name":"Interval"},"class_methods":[{"html_id":"to_column(x):Clear::Interval|Nil-class-method","name":"to_column","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x) : Clear::Interval | Nil","args_html":"(x) : Clear::Interval | Nil","location":{"filename":"src/clear/extensions/interval/interval_converter.cr","line_number":28,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/interval/interval_converter.cr#L28"},"def":{"name":"to_column","args":[{"name":"x","external_name":"x","restriction":""}],"return_type":"Clear::Interval | ::Nil","visibility":"Public","body":"case x\nwhen PG::Interval\n Clear::Interval.new(x.months, x.days, x.microseconds)\nwhen Slice(UInt8)\n Clear::Interval.decode(x.as(Slice(UInt8)))\nwhen Clear::Interval\n x\nwhen Nil\n nil\nelse\n raise(Clear::ErrorMessages.converter_error(x.class, \"Interval\"))\nend"}},{"html_id":"to_db(x:Clear::Interval|Nil)-class-method","name":"to_db","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Clear::Interval | ::Nil"}],"args_string":"(x : Clear::Interval | Nil)","args_html":"(x : Clear::Interval | Nil)","location":{"filename":"src/clear/extensions/interval/interval_converter.cr","line_number":43,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/interval/interval_converter.cr#L43"},"def":{"name":"to_db","args":[{"name":"x","external_name":"x","restriction":"Clear::Interval | ::Nil"}],"visibility":"Public","body":"x.try(&.to_sql)"}}]}]},{"html_id":"clear/Clear/Migration","path":"Clear/Migration.html","kind":"module","full_name":"Clear::Migration","name":"Migration","abstract":false,"ancestors":[{"html_id":"clear/Clear/Migration/Helper","kind":"module","full_name":"Clear::Migration::Helper","name":"Helper"},{"html_id":"clear/Clear/Migration/FullTextSearchableHelpers","kind":"module","full_name":"Clear::Migration::FullTextSearchableHelpers","name":"FullTextSearchableHelpers"},{"html_id":"clear/Clear/ErrorMessages","kind":"module","full_name":"Clear::ErrorMessages","name":"ErrorMessages"}],"locations":[{"filename":"src/clear/extensions/enum/migration.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/enum/migration.cr#L1"},{"filename":"src/clear/migration/direction.cr","line_number":22,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/direction.cr#L22"},{"filename":"src/clear/migration/migration.cr","line_number":57,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/migration.cr#L57"},{"filename":"src/clear/migration/operation/columns.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/columns.cr#L1"},{"filename":"src/clear/migration/operation/execute.cr","line_number":3,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/execute.cr#L3"},{"filename":"src/clear/migration/operation/indexes.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/indexes.cr#L1"},{"filename":"src/clear/migration/operation/operation.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/operation.cr#L1"},{"filename":"src/clear/migration/operation/table.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L1"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"Log","name":"Log","value":"::Log.for(\"clear.migration\")"}],"included_modules":[{"html_id":"clear/Clear/ErrorMessages","kind":"module","full_name":"Clear::ErrorMessages","name":"ErrorMessages"},{"html_id":"clear/Clear/Migration/Helper","kind":"module","full_name":"Clear::Migration::Helper","name":"Helper"}],"namespace":{"html_id":"clear/Clear","kind":"module","full_name":"Clear","name":"Clear"},"doc":"# Clear's migration system\n\nMigrations in Clear are very similar to active record's migrations.\nMigrations are two-way modification of the database.\n\nIt helps to keep a consistent database state during development lifecycle\nof your application.\n\nTo create a migration, two ways:\n\n## Clear command\n\n### TL;DR\n\nYou can create a new file which will be present in `src/db/migrate` using:\n\n`clear-cli migration:g migration_name`\n\nThus will create a migration in `src/db/migration/[:uid]_migration_name.cr`\n(with uid number) and a class `MigrationName`\n\n### Advanced options\n\nYou can use `clear-cli migration help` to get advanced options.\n\n## Manually\n\nYou can create a class following this naming convention:\n`Anything + Number.`\nThe number is then used to order the migration between each others and must be unique.\n\nFollowing the rule than inclusion is often better than inheritance, just\ninclude the module `Clear::Migration` to your class.\n\n## Methods of migration\n\n### Migration direction\n\nOnly one method must be overrided: `change`. In comparison to ActiveRecord, there's no\nup and down methods, instead you can put specific up/down code like this:\n\n```\ndef change(dir)\n dir.down { irreversible! }\nend\n```\n\n```\ndef change(dir)\n add_column :users, :full_name, :string\n\n dir.up do\n execute(\"UPDATE users SET full_name = (SELECT first_name || ' ' || last_name) from users\")\n end\nend\n```","summary":"

\n \n \nClear's migration system

","instance_methods":[{"html_id":"uid:Int64-instance-method","name":"uid","abstract":true,"location":{"filename":"src/clear/migration/migration.cr","line_number":62,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/migration.cr#L62"},"def":{"name":"uid","return_type":"Int64","visibility":"Public","body":""}}],"types":[{"html_id":"clear/Clear/Migration/AddColumn","path":"Clear/Migration/AddColumn.html","kind":"class","full_name":"Clear::Migration::AddColumn","name":"AddColumn","abstract":false,"superclass":{"html_id":"clear/Clear/Migration/Operation","kind":"class","full_name":"Clear::Migration::Operation","name":"Operation"},"ancestors":[{"html_id":"clear/Clear/Migration/Operation","kind":"class","full_name":"Clear::Migration::Operation","name":"Operation"},{"html_id":"clear/Clear/ErrorMessages","kind":"module","full_name":"Clear::ErrorMessages","name":"ErrorMessages"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/migration/operation/columns.cr","line_number":2,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/columns.cr#L2"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Migration","kind":"module","full_name":"Clear::Migration","name":"Migration"},"constructors":[{"html_id":"new(table:String,column:String,datatype,nullable:Bool=false,constraint:Nil|String=nil,default:Nil|String=nil,with_values:Bool=false)-class-method","name":"new","abstract":false,"args":[{"name":"table","external_name":"table","restriction":"::String"},{"name":"column","external_name":"column","restriction":"::String"},{"name":"datatype","external_name":"datatype","restriction":""},{"name":"nullable","default_value":"false","external_name":"nullable","restriction":"::Bool"},{"name":"constraint","default_value":"nil","external_name":"constraint","restriction":"::Nil | ::String"},{"name":"default","default_value":"nil","external_name":"default","restriction":"::Nil | ::String"},{"name":"with_values","default_value":"false","external_name":"with_values","restriction":"::Bool"}],"args_string":"(table : String, column : String, datatype, nullable : Bool = false, constraint : Nil | String = nil, default : Nil | String = nil, with_values : Bool = false)","args_html":"(table : String, column : String, datatype, nullable : Bool = false, constraint : Nil | String = nil, default : Nil | String = nil, with_values : Bool = false)","location":{"filename":"src/clear/migration/operation/columns.cr","line_number":18,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/columns.cr#L18"},"def":{"name":"new","args":[{"name":"table","external_name":"table","restriction":"::String"},{"name":"column","external_name":"column","restriction":"::String"},{"name":"datatype","external_name":"datatype","restriction":""},{"name":"nullable","default_value":"false","external_name":"nullable","restriction":"::Bool"},{"name":"constraint","default_value":"nil","external_name":"constraint","restriction":"::Nil | ::String"},{"name":"default","default_value":"nil","external_name":"default","restriction":"::Nil | ::String"},{"name":"with_values","default_value":"false","external_name":"with_values","restriction":"::Bool"}],"visibility":"Public","body":"_ = allocate\n_.initialize(table, column, datatype, nullable, constraint, default, with_values)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"down:Array(String)-instance-method","name":"down","abstract":false,"location":{"filename":"src/clear/migration/operation/columns.cr","line_number":34,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/columns.cr#L34"},"def":{"name":"down","return_type":"Array(String)","visibility":"Public","body":"[\"ALTER TABLE #{@table} DROP #{@column}\"]"}},{"html_id":"up:Array(String)-instance-method","name":"up","abstract":false,"location":{"filename":"src/clear/migration/operation/columns.cr","line_number":22,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/columns.cr#L22"},"def":{"name":"up","return_type":"Array(String)","visibility":"Public","body":"constraint = @constraint\ndefault = @default\nwith_values = @with_values\n[[\"ALTER TABLE\", @table, \"ADD\", @column, @datatype, @nullable ? \"NULL\" : \"NOT NULL\", constraint ? \"CONSTRAINT #{constraint}\" : nil, default ? \"DEFAULT #{default}\" : nil, with_values ? \"WITH VALUES\" : nil].compact.join(\" \")]\n"}}]},{"html_id":"clear/Clear/Migration/AddTable","path":"Clear/Migration/AddTable.html","kind":"class","full_name":"Clear::Migration::AddTable","name":"AddTable","abstract":false,"superclass":{"html_id":"clear/Clear/Migration/Operation","kind":"class","full_name":"Clear::Migration::Operation","name":"Operation"},"ancestors":[{"html_id":"clear/Clear/Migration/Operation","kind":"class","full_name":"Clear::Migration::Operation","name":"Operation"},{"html_id":"clear/Clear/ErrorMessages","kind":"module","full_name":"Clear::ErrorMessages","name":"ErrorMessages"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/migration/operation/table.cr","line_number":189,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L189"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Migration","kind":"module","full_name":"Clear::Migration","name":"Migration"},"constructors":[{"html_id":"new(table:String,schema:String)-class-method","name":"new","abstract":false,"args":[{"name":"table","external_name":"table","restriction":"::String"},{"name":"schema","external_name":"schema","restriction":"::String"}],"args_string":"(table : String, schema : String)","args_html":"(table : String, schema : String)","location":{"filename":"src/clear/migration/operation/table.cr","line_number":193,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L193"},"def":{"name":"new","args":[{"name":"table","external_name":"table","restriction":"::String"},{"name":"schema","external_name":"schema","restriction":"::String"}],"visibility":"Public","body":"_ = allocate\n_.initialize(table, schema)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"down:Array(String)-instance-method","name":"down","abstract":false,"location":{"filename":"src/clear/migration/operation/table.cr","line_number":204,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L204"},"def":{"name":"down","return_type":"Array(String)","visibility":"Public","body":"[\"DROP TABLE #{@table}\"]"}},{"html_id":"full_name-instance-method","name":"full_name","abstract":false,"location":{"filename":"src/clear/migration/operation/table.cr","line_number":196,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L196"},"def":{"name":"full_name","visibility":"Public","body":"{Clear::SQL.escape(@schema), Clear::SQL.escape(@name)}.join(\".\")"}},{"html_id":"schema:String-instance-method","name":"schema","abstract":false,"location":{"filename":"src/clear/migration/operation/table.cr","line_number":191,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L191"},"def":{"name":"schema","return_type":"String","visibility":"Public","body":"@schema"}},{"html_id":"table:String-instance-method","name":"table","abstract":false,"location":{"filename":"src/clear/migration/operation/table.cr","line_number":190,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L190"},"def":{"name":"table","return_type":"String","visibility":"Public","body":"@table"}},{"html_id":"up:Array(String)-instance-method","name":"up","abstract":false,"location":{"filename":"src/clear/migration/operation/table.cr","line_number":200,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L200"},"def":{"name":"up","return_type":"Array(String)","visibility":"Public","body":"[\"CREATE TABLE #{@table}\"]"}}]},{"html_id":"clear/Clear/Migration/ChangeColumnType","path":"Clear/Migration/ChangeColumnType.html","kind":"class","full_name":"Clear::Migration::ChangeColumnType","name":"ChangeColumnType","abstract":false,"superclass":{"html_id":"clear/Clear/Migration/Operation","kind":"class","full_name":"Clear::Migration::Operation","name":"Operation"},"ancestors":[{"html_id":"clear/Clear/Migration/Operation","kind":"class","full_name":"Clear::Migration::Operation","name":"Operation"},{"html_id":"clear/Clear/ErrorMessages","kind":"module","full_name":"Clear::ErrorMessages","name":"ErrorMessages"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/migration/operation/columns.cr","line_number":74,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/columns.cr#L74"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Migration","kind":"module","full_name":"Clear::Migration","name":"Migration"},"constructors":[{"html_id":"new(table:String,column_name:String,old_column_type,new_column_type)-class-method","name":"new","abstract":false,"args":[{"name":"table","external_name":"table","restriction":"::String"},{"name":"column_name","external_name":"column_name","restriction":"::String"},{"name":"old_column_type","external_name":"old_column_type","restriction":""},{"name":"new_column_type","external_name":"new_column_type","restriction":""}],"args_string":"(table : String, column_name : String, old_column_type, new_column_type)","args_html":"(table : String, column_name : String, old_column_type, new_column_type)","location":{"filename":"src/clear/migration/operation/columns.cr","line_number":80,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/columns.cr#L80"},"def":{"name":"new","args":[{"name":"table","external_name":"table","restriction":"::String"},{"name":"column_name","external_name":"column_name","restriction":"::String"},{"name":"old_column_type","external_name":"old_column_type","restriction":""},{"name":"new_column_type","external_name":"new_column_type","restriction":""}],"visibility":"Public","body":"_ = allocate\n_.initialize(table, column_name, old_column_type, new_column_type)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"down:Array(String)-instance-method","name":"down","abstract":false,"location":{"filename":"src/clear/migration/operation/columns.cr","line_number":89,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/columns.cr#L89"},"def":{"name":"down","return_type":"Array(String)","visibility":"Public","body":"[\"ALTER TABLE #{@table} ALTER COLUMN #{@column_name} SET DATA TYPE #{@old_column_type};\"]"}},{"html_id":"up:Array(String)-instance-method","name":"up","abstract":false,"location":{"filename":"src/clear/migration/operation/columns.cr","line_number":85,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/columns.cr#L85"},"def":{"name":"up","return_type":"Array(String)","visibility":"Public","body":"[\"ALTER TABLE #{@table} ALTER COLUMN #{@column_name} SET DATA TYPE #{@new_column_type};\"]"}}]},{"html_id":"clear/Clear/Migration/CreateEnum","path":"Clear/Migration/CreateEnum.html","kind":"class","full_name":"Clear::Migration::CreateEnum","name":"CreateEnum","abstract":false,"superclass":{"html_id":"clear/Clear/Migration/Operation","kind":"class","full_name":"Clear::Migration::Operation","name":"Operation"},"ancestors":[{"html_id":"clear/Clear/Migration/Operation","kind":"class","full_name":"Clear::Migration::Operation","name":"Operation"},{"html_id":"clear/Clear/ErrorMessages","kind":"module","full_name":"Clear::ErrorMessages","name":"ErrorMessages"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/extensions/enum/migration.cr","line_number":2,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/enum/migration.cr#L2"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Migration","kind":"module","full_name":"Clear::Migration","name":"Migration"},"constructors":[{"html_id":"new(name:String,values:Array(String))-class-method","name":"new","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"::String"},{"name":"values","external_name":"values","restriction":"::Array(::String)"}],"args_string":"(name : String, values : Array(String))","args_html":"(name : String, values : Array(String))","location":{"filename":"src/clear/extensions/enum/migration.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/enum/migration.cr#L6"},"def":{"name":"new","args":[{"name":"name","external_name":"name","restriction":"::String"},{"name":"values","external_name":"values","restriction":"::Array(::String)"}],"visibility":"Public","body":"_ = allocate\n_.initialize(name, values)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"down:Array(String)-instance-method","name":"down","abstract":false,"location":{"filename":"src/clear/extensions/enum/migration.cr","line_number":13,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/enum/migration.cr#L13"},"def":{"name":"down","return_type":"Array(String)","visibility":"Public","body":"[\"DROP TYPE #{@name}\"]"}},{"html_id":"up:Array(String)-instance-method","name":"up","abstract":false,"location":{"filename":"src/clear/extensions/enum/migration.cr","line_number":9,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/enum/migration.cr#L9"},"def":{"name":"up","return_type":"Array(String)","visibility":"Public","body":"[\"CREATE TYPE #{@name} AS ENUM (#{Clear::Expression[@values].join(\", \")})\"]"}}]},{"html_id":"clear/Clear/Migration/CreateIndex","path":"Clear/Migration/CreateIndex.html","kind":"class","full_name":"Clear::Migration::CreateIndex","name":"CreateIndex","abstract":false,"superclass":{"html_id":"clear/Clear/Migration/Operation","kind":"class","full_name":"Clear::Migration::Operation","name":"Operation"},"ancestors":[{"html_id":"clear/Clear/Migration/Operation","kind":"class","full_name":"Clear::Migration::Operation","name":"Operation"},{"html_id":"clear/Clear/ErrorMessages","kind":"module","full_name":"Clear::ErrorMessages","name":"ErrorMessages"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/migration/operation/indexes.cr","line_number":2,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/indexes.cr#L2"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Migration","kind":"module","full_name":"Clear::Migration","name":"Migration"},"constructors":[{"html_id":"new(table:String,fields:Array(String),name=nil,using:Nil|String=nil,unique:Bool=false)-class-method","name":"new","abstract":false,"args":[{"name":"table","external_name":"table","restriction":"::String"},{"name":"fields","external_name":"fields","restriction":"Array(String)"},{"name":"name","default_value":"nil","external_name":"name","restriction":""},{"name":"using","default_value":"nil","external_name":"using","restriction":"::Nil | ::String"},{"name":"unique","default_value":"false","external_name":"unique","restriction":"::Bool"}],"args_string":"(table : String, fields : Array(String), name = nil, using : Nil | String = nil, unique : Bool = false)","args_html":"(table : String, fields : Array(String), name = nil, using : Nil | String = nil, unique : Bool = false)","location":{"filename":"src/clear/migration/operation/indexes.cr","line_number":9,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/indexes.cr#L9"},"def":{"name":"new","args":[{"name":"table","external_name":"table","restriction":"::String"},{"name":"fields","external_name":"fields","restriction":"Array(String)"},{"name":"name","default_value":"nil","external_name":"name","restriction":""},{"name":"using","default_value":"nil","external_name":"using","restriction":"::Nil | ::String"},{"name":"unique","default_value":"false","external_name":"unique","restriction":"::Bool"}],"visibility":"Public","body":"_ = allocate\n_.initialize(table, fields, name, using, unique)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new(table:String,field:String|Symbol,name=nil,using:Nil|String=nil,unique:Bool=false)-class-method","name":"new","abstract":false,"args":[{"name":"table","external_name":"table","restriction":"::String"},{"name":"field","external_name":"field","restriction":"String | Symbol"},{"name":"name","default_value":"nil","external_name":"name","restriction":""},{"name":"using","default_value":"nil","external_name":"using","restriction":"::Nil | ::String"},{"name":"unique","default_value":"false","external_name":"unique","restriction":"::Bool"}],"args_string":"(table : String, field : String | Symbol, name = nil, using : Nil | String = nil, unique : Bool = false)","args_html":"(table : String, field : String | Symbol, name = nil, using : Nil | String = nil, unique : Bool = false)","location":{"filename":"src/clear/migration/operation/indexes.cr","line_number":13,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/indexes.cr#L13"},"def":{"name":"new","args":[{"name":"table","external_name":"table","restriction":"::String"},{"name":"field","external_name":"field","restriction":"String | Symbol"},{"name":"name","default_value":"nil","external_name":"name","restriction":""},{"name":"using","default_value":"nil","external_name":"using","restriction":"::Nil | ::String"},{"name":"unique","default_value":"false","external_name":"unique","restriction":"::Bool"}],"visibility":"Public","body":"_ = allocate\n_.initialize(table, field, name, using, unique)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"down:Array(String)-instance-method","name":"down","abstract":false,"location":{"filename":"src/clear/migration/operation/indexes.cr","line_number":38,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/indexes.cr#L38"},"def":{"name":"down","return_type":"Array(String)","visibility":"Public","body":"[\"DROP INDEX IF EXISTS #{@name}\"]"}},{"html_id":"safe_name(x)-instance-method","name":"safe_name","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x)","args_html":"(x)","location":{"filename":"src/clear/migration/operation/indexes.cr","line_number":18,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/indexes.cr#L18"},"def":{"name":"safe_name","args":[{"name":"x","external_name":"x","restriction":""}],"visibility":"Public","body":"x.gsub(/[^A-Za-z_0-9]/, \"_\")"}},{"html_id":"up:Array(String)-instance-method","name":"up","abstract":false,"location":{"filename":"src/clear/migration/operation/indexes.cr","line_number":34,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/indexes.cr#L34"},"def":{"name":"up","return_type":"Array(String)","visibility":"Public","body":"[[\"CREATE\", print_unique, \"INDEX\", safe_name(@name), \"ON\", @table, print_using, print_columns].compact.join(\" \")]"}}]},{"html_id":"clear/Clear/Migration/Direction","path":"Clear/Migration/Direction.html","kind":"enum","full_name":"Clear::Migration::Direction","name":"Direction","abstract":false,"ancestors":[{"html_id":"clear/Enum","kind":"struct","full_name":"Enum","name":"Enum"},{"html_id":"clear/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/migration/direction.cr","line_number":23,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/direction.cr#L23"}],"repository_name":"clear","program":false,"enum":true,"alias":false,"const":false,"constants":[{"id":"Up","name":"Up","value":"0"},{"id":"Down","name":"Down","value":"1"}],"namespace":{"html_id":"clear/Clear/Migration","kind":"module","full_name":"Clear::Migration","name":"Migration"},"instance_methods":[{"html_id":"down(&)-instance-method","name":"down","doc":"Run the block given in parameter if the direction is a rollback","summary":"

Run the block given in parameter if the direction is a rollback

","abstract":false,"location":{"filename":"src/clear/migration/direction.cr","line_number":38,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/direction.cr#L38"},"def":{"name":"down","yields":0,"block_arity":0,"visibility":"Public","body":"if down?\n yield\nend"}},{"html_id":"down?-instance-method","name":"down?","doc":"Return true whether the migration is a rollback","summary":"

Return true whether the migration is a rollback

","abstract":false,"location":{"filename":"src/clear/migration/direction.cr","line_number":43,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/direction.cr#L43"},"def":{"name":"down?","visibility":"Public","body":"self == Down"}},{"html_id":"up(&)-instance-method","name":"up","doc":"Run the block given in parameter if the direction is a upstream","summary":"

Run the block given in parameter if the direction is a upstream

","abstract":false,"location":{"filename":"src/clear/migration/direction.cr","line_number":28,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/direction.cr#L28"},"def":{"name":"up","yields":0,"block_arity":0,"visibility":"Public","body":"if self == Up\n yield\nend"}},{"html_id":"up?-instance-method","name":"up?","doc":"Return true whether the migration is a upstream","summary":"

Return true whether the migration is a upstream

","abstract":false,"location":{"filename":"src/clear/migration/direction.cr","line_number":33,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/direction.cr#L33"},"def":{"name":"up?","visibility":"Public","body":"self == Up"}}]},{"html_id":"clear/Clear/Migration/DropEnum","path":"Clear/Migration/DropEnum.html","kind":"class","full_name":"Clear::Migration::DropEnum","name":"DropEnum","abstract":false,"superclass":{"html_id":"clear/Clear/Migration/Operation","kind":"class","full_name":"Clear::Migration::Operation","name":"Operation"},"ancestors":[{"html_id":"clear/Clear/Migration/Operation","kind":"class","full_name":"Clear::Migration::Operation","name":"Operation"},{"html_id":"clear/Clear/ErrorMessages","kind":"module","full_name":"Clear::ErrorMessages","name":"ErrorMessages"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/extensions/enum/migration.cr","line_number":18,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/enum/migration.cr#L18"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Migration","kind":"module","full_name":"Clear::Migration","name":"Migration"},"constructors":[{"html_id":"new(name:String,values:Nil|Array(String))-class-method","name":"new","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"::String"},{"name":"values","external_name":"values","restriction":"::Nil | ::Array(::String)"}],"args_string":"(name : String, values : Nil | Array(String))","args_html":"(name : String, values : Nil | Array(String))","location":{"filename":"src/clear/extensions/enum/migration.cr","line_number":22,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/enum/migration.cr#L22"},"def":{"name":"new","args":[{"name":"name","external_name":"name","restriction":"::String"},{"name":"values","external_name":"values","restriction":"::Nil | ::Array(::String)"}],"visibility":"Public","body":"_ = allocate\n_.initialize(name, values)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"down:Array(String)-instance-method","name":"down","abstract":false,"location":{"filename":"src/clear/extensions/enum/migration.cr","line_number":29,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/enum/migration.cr#L29"},"def":{"name":"down","return_type":"Array(String)","visibility":"Public","body":"if values = @values\n [\"CREATE TYPE #{@name} AS ENUM (#{Clear::Expression[values].join(\", \")})\"]\nelse\n irreversible!\nend"}},{"html_id":"up:Array(String)-instance-method","name":"up","abstract":false,"location":{"filename":"src/clear/extensions/enum/migration.cr","line_number":25,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/enum/migration.cr#L25"},"def":{"name":"up","return_type":"Array(String)","visibility":"Public","body":"[\"DROP TYPE #{@name}\"]"}}]},{"html_id":"clear/Clear/Migration/DropTable","path":"Clear/Migration/DropTable.html","kind":"class","full_name":"Clear::Migration::DropTable","name":"DropTable","abstract":false,"superclass":{"html_id":"clear/Clear/Migration/Operation","kind":"class","full_name":"Clear::Migration::Operation","name":"Operation"},"ancestors":[{"html_id":"clear/Clear/Migration/Operation","kind":"class","full_name":"Clear::Migration::Operation","name":"Operation"},{"html_id":"clear/Clear/ErrorMessages","kind":"module","full_name":"Clear::ErrorMessages","name":"ErrorMessages"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/migration/operation/table.cr","line_number":209,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L209"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Migration","kind":"module","full_name":"Clear::Migration","name":"Migration"},"constructors":[{"html_id":"new(table:String,schema:String)-class-method","name":"new","abstract":false,"args":[{"name":"table","external_name":"table","restriction":"::String"},{"name":"schema","external_name":"schema","restriction":"::String"}],"args_string":"(table : String, schema : String)","args_html":"(table : String, schema : String)","location":{"filename":"src/clear/migration/operation/table.cr","line_number":213,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L213"},"def":{"name":"new","args":[{"name":"table","external_name":"table","restriction":"::String"},{"name":"schema","external_name":"schema","restriction":"::String"}],"visibility":"Public","body":"_ = allocate\n_.initialize(table, schema)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"down:Array(String)-instance-method","name":"down","abstract":false,"location":{"filename":"src/clear/migration/operation/table.cr","line_number":224,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L224"},"def":{"name":"down","return_type":"Array(String)","visibility":"Public","body":"[\"CREATE TABLE #{@table}\"]"}},{"html_id":"full_name-instance-method","name":"full_name","abstract":false,"location":{"filename":"src/clear/migration/operation/table.cr","line_number":216,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L216"},"def":{"name":"full_name","visibility":"Public","body":"{Clear::SQL.escape(@schema), Clear::SQL.escape(@name)}.join(\".\")"}},{"html_id":"schema:String-instance-method","name":"schema","abstract":false,"location":{"filename":"src/clear/migration/operation/table.cr","line_number":211,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L211"},"def":{"name":"schema","return_type":"String","visibility":"Public","body":"@schema"}},{"html_id":"table:String-instance-method","name":"table","abstract":false,"location":{"filename":"src/clear/migration/operation/table.cr","line_number":210,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L210"},"def":{"name":"table","return_type":"String","visibility":"Public","body":"@table"}},{"html_id":"up:Array(String)-instance-method","name":"up","abstract":false,"location":{"filename":"src/clear/migration/operation/table.cr","line_number":220,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L220"},"def":{"name":"up","return_type":"Array(String)","visibility":"Public","body":"[\"DROP TABLE #{@table}\"]"}}]},{"html_id":"clear/Clear/Migration/Execute","path":"Clear/Migration/Execute.html","kind":"class","full_name":"Clear::Migration::Execute","name":"Execute","abstract":false,"superclass":{"html_id":"clear/Clear/Migration/Operation","kind":"class","full_name":"Clear::Migration::Operation","name":"Operation"},"ancestors":[{"html_id":"clear/Clear/Migration/Operation","kind":"class","full_name":"Clear::Migration::Operation","name":"Operation"},{"html_id":"clear/Clear/ErrorMessages","kind":"module","full_name":"Clear::ErrorMessages","name":"ErrorMessages"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/migration/operation/execute.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/execute.cr#L4"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Migration","kind":"module","full_name":"Clear::Migration","name":"Migration"},"constructors":[{"html_id":"new(sql:String,irreversible:Bool|Nil=false)-class-method","name":"new","abstract":false,"args":[{"name":"sql","external_name":"sql","restriction":"String"},{"name":"irreversible","default_value":"false","external_name":"irreversible","restriction":"Bool | ::Nil"}],"args_string":"(sql : String, irreversible : Bool | Nil = false)","args_html":"(sql : String, irreversible : Bool | Nil = false)","location":{"filename":"src/clear/migration/operation/execute.cr","line_number":5,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/execute.cr#L5"},"def":{"name":"new","args":[{"name":"sql","external_name":"sql","restriction":"String"},{"name":"irreversible","default_value":"false","external_name":"irreversible","restriction":"Bool | ::Nil"}],"visibility":"Public","body":"_ = allocate\n_.initialize(sql, irreversible)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"down:Array(String)-instance-method","name":"down","abstract":false,"location":{"filename":"src/clear/migration/operation/execute.cr","line_number":12,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/execute.cr#L12"},"def":{"name":"down","return_type":"Array(String)","visibility":"Public","body":"if @irreversible\n irreversible!\nend\n[@sql].compact\n"}},{"html_id":"up:Array(String)-instance-method","name":"up","abstract":false,"location":{"filename":"src/clear/migration/operation/execute.cr","line_number":8,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/execute.cr#L8"},"def":{"name":"up","return_type":"Array(String)","visibility":"Public","body":"[@sql].compact"}}]},{"html_id":"clear/Clear/Migration/FullTextSearchableHelpers","path":"Clear/Migration/FullTextSearchableHelpers.html","kind":"module","full_name":"Clear::Migration::FullTextSearchableHelpers","name":"FullTextSearchableHelpers","abstract":false,"locations":[{"filename":"src/clear/extensions/full_text_searchable/migration.cr","line_number":83,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/full_text_searchable/migration.cr#L83"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"clear/Clear/Migration/Helper","kind":"module","full_name":"Clear::Migration::Helper","name":"Helper"}],"namespace":{"html_id":"clear/Clear/Migration","kind":"module","full_name":"Clear::Migration","name":"Migration"},"instance_methods":[{"html_id":"add_full_text_searchable(table,on:Array(Tuple(String,Char)),column_name=\"full_text_vector\",catalog=\"pg_catalog.english\",trigger_name=nil,function_name=nil)-instance-method","name":"add_full_text_searchable","doc":"Add a `tsvector` field to a table.\nCreate column, index and trigger.","summary":"

Add a tsvector field to a table.

","abstract":false,"args":[{"name":"table","external_name":"table","restriction":""},{"name":"on","external_name":"on","restriction":"Array(Tuple(String, Char))"},{"name":"column_name","default_value":"\"full_text_vector\"","external_name":"column_name","restriction":""},{"name":"catalog","default_value":"\"pg_catalog.english\"","external_name":"catalog","restriction":""},{"name":"trigger_name","default_value":"nil","external_name":"trigger_name","restriction":""},{"name":"function_name","default_value":"nil","external_name":"function_name","restriction":""}],"args_string":"(table, on : Array(Tuple(String, Char)), column_name = \"full_text_vector\", catalog = \"pg_catalog.english\", trigger_name = nil, function_name = nil)","args_html":"(table, on : Array(Tuple(String, Char)), column_name = "full_text_vector", catalog = "pg_catalog.english", trigger_name = nil, function_name = nil)","location":{"filename":"src/clear/extensions/full_text_searchable/migration.cr","line_number":86,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/full_text_searchable/migration.cr#L86"},"def":{"name":"add_full_text_searchable","args":[{"name":"table","external_name":"table","restriction":""},{"name":"on","external_name":"on","restriction":"Array(Tuple(String, Char))"},{"name":"column_name","default_value":"\"full_text_vector\"","external_name":"column_name","restriction":""},{"name":"catalog","default_value":"\"pg_catalog.english\"","external_name":"catalog","restriction":""},{"name":"trigger_name","default_value":"nil","external_name":"trigger_name","restriction":""},{"name":"function_name","default_value":"nil","external_name":"function_name","restriction":""}],"visibility":"Public","body":"add_column(table, column_name, \"tsvector\")\ncreate_index(table, column_name, using: \"gin\")\nmigration.add_operation(Clear::Migration::FullTextSearchableOperation.new(table, on, catalog, trigger_name, function_name, column_name))\n"}}]},{"html_id":"clear/Clear/Migration/FullTextSearchableOperation","path":"Clear/Migration/FullTextSearchableOperation.html","kind":"class","full_name":"Clear::Migration::FullTextSearchableOperation","name":"FullTextSearchableOperation","abstract":false,"superclass":{"html_id":"clear/Clear/Migration/Operation","kind":"class","full_name":"Clear::Migration::Operation","name":"Operation"},"ancestors":[{"html_id":"clear/Clear/Migration/Operation","kind":"class","full_name":"Clear::Migration::Operation","name":"Operation"},{"html_id":"clear/Clear/ErrorMessages","kind":"module","full_name":"Clear::ErrorMessages","name":"ErrorMessages"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/extensions/full_text_searchable/migration.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/full_text_searchable/migration.cr#L1"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Migration","kind":"module","full_name":"Clear::Migration","name":"Migration"},"constructors":[{"html_id":"new(table:String,src_fields:Array(Tuple(String,Char)),catalog:String=\"pg_catalog.english\",trigger_name=nil,function_name=nil,dest_field:String=\"full_text_vector\")-class-method","name":"new","abstract":false,"args":[{"name":"table","external_name":"table","restriction":"::String"},{"name":"src_fields","external_name":"src_fields","restriction":"::Array(::Tuple(::String, ::Char))"},{"name":"catalog","default_value":"\"pg_catalog.english\"","external_name":"catalog","restriction":"::String"},{"name":"trigger_name","default_value":"nil","external_name":"trigger_name","restriction":""},{"name":"function_name","default_value":"nil","external_name":"function_name","restriction":""},{"name":"dest_field","default_value":"\"full_text_vector\"","external_name":"dest_field","restriction":"::String"}],"args_string":"(table : String, src_fields : Array(Tuple(String, Char)), catalog : String = \"pg_catalog.english\", trigger_name = nil, function_name = nil, dest_field : String = \"full_text_vector\")","args_html":"(table : String, src_fields : Array(Tuple(String, Char)), catalog : String = "pg_catalog.english", trigger_name = nil, function_name = nil, dest_field : String = "full_text_vector")","location":{"filename":"src/clear/extensions/full_text_searchable/migration.cr","line_number":17,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/full_text_searchable/migration.cr#L17"},"def":{"name":"new","args":[{"name":"table","external_name":"table","restriction":"::String"},{"name":"src_fields","external_name":"src_fields","restriction":"::Array(::Tuple(::String, ::Char))"},{"name":"catalog","default_value":"\"pg_catalog.english\"","external_name":"catalog","restriction":"::String"},{"name":"trigger_name","default_value":"nil","external_name":"trigger_name","restriction":""},{"name":"function_name","default_value":"nil","external_name":"function_name","restriction":""},{"name":"dest_field","default_value":"\"full_text_vector\"","external_name":"dest_field","restriction":"::String"}],"visibility":"Public","body":"_ = allocate\n_.initialize(table, src_fields, catalog, trigger_name, function_name, dest_field)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"catalog:String-instance-method","name":"catalog","abstract":false,"location":{"filename":"src/clear/extensions/full_text_searchable/migration.cr","line_number":12,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/full_text_searchable/migration.cr#L12"},"def":{"name":"catalog","return_type":"String","visibility":"Public","body":"@catalog"}},{"html_id":"dest_field:String-instance-method","name":"dest_field","abstract":false,"location":{"filename":"src/clear/extensions/full_text_searchable/migration.cr","line_number":13,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/full_text_searchable/migration.cr#L13"},"def":{"name":"dest_field","return_type":"String","visibility":"Public","body":"@dest_field"}},{"html_id":"down:Array(String)-instance-method","name":"down","abstract":false,"location":{"filename":"src/clear/extensions/full_text_searchable/migration.cr","line_number":78,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/full_text_searchable/migration.cr#L78"},"def":{"name":"down","return_type":"Array(String)","visibility":"Public","body":"print_delete_trigger"}},{"html_id":"function_name:String-instance-method","name":"function_name","abstract":false,"location":{"filename":"src/clear/extensions/full_text_searchable/migration.cr","line_number":11,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/full_text_searchable/migration.cr#L11"},"def":{"name":"function_name","return_type":"String","visibility":"Public","body":"@function_name"}},{"html_id":"src_fields:Array(Tuple(String,Char))-instance-method","name":"src_fields","abstract":false,"location":{"filename":"src/clear/extensions/full_text_searchable/migration.cr","line_number":15,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/full_text_searchable/migration.cr#L15"},"def":{"name":"src_fields","return_type":"Array(::Tuple(String, Char))","visibility":"Public","body":"@src_fields"}},{"html_id":"table:String-instance-method","name":"table","abstract":false,"location":{"filename":"src/clear/extensions/full_text_searchable/migration.cr","line_number":9,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/full_text_searchable/migration.cr#L9"},"def":{"name":"table","return_type":"String","visibility":"Public","body":"@table"}},{"html_id":"trigger_name:String-instance-method","name":"trigger_name","abstract":false,"location":{"filename":"src/clear/extensions/full_text_searchable/migration.cr","line_number":10,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/full_text_searchable/migration.cr#L10"},"def":{"name":"trigger_name","return_type":"String","visibility":"Public","body":"@trigger_name"}},{"html_id":"up:Array(String)-instance-method","name":"up","abstract":false,"location":{"filename":"src/clear/extensions/full_text_searchable/migration.cr","line_number":74,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/full_text_searchable/migration.cr#L74"},"def":{"name":"up","return_type":"Array(String)","visibility":"Public","body":"print_trigger + print_update_current_data"}}],"types":[{"html_id":"clear/Clear/Migration/FullTextSearchableOperation/Priority","path":"Clear/Migration/FullTextSearchableOperation/Priority.html","kind":"module","full_name":"Clear::Migration::FullTextSearchableOperation::Priority","name":"Priority","abstract":false,"locations":[{"filename":"src/clear/extensions/full_text_searchable/migration.cr","line_number":2,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/full_text_searchable/migration.cr#L2"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"IMPORTANT","name":"IMPORTANT","value":"'B'"},{"id":"LOW","name":"LOW","value":"'D'"},{"id":"NORMAL","name":"NORMAL","value":"'C'"},{"id":"VERY_IMPORTANT","name":"VERY_IMPORTANT","value":"'A'"}],"namespace":{"html_id":"clear/Clear/Migration/FullTextSearchableOperation","kind":"class","full_name":"Clear::Migration::FullTextSearchableOperation","name":"FullTextSearchableOperation"}}]},{"html_id":"clear/Clear/Migration/FullTextSearchableTableHelpers","path":"Clear/Migration/FullTextSearchableTableHelpers.html","kind":"module","full_name":"Clear::Migration::FullTextSearchableTableHelpers","name":"FullTextSearchableTableHelpers","abstract":false,"locations":[{"filename":"src/clear/extensions/full_text_searchable/migration.cr","line_number":104,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/full_text_searchable/migration.cr#L104"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"clear/Clear/Migration/Table","kind":"class","full_name":"Clear::Migration::Table","name":"Table"}],"namespace":{"html_id":"clear/Clear/Migration","kind":"module","full_name":"Clear::Migration","name":"Migration"},"instance_methods":[{"html_id":"full_text_searchable(on:Array(Tuple(String,Char)),column_name=\"full_text_vector\",catalog=\"pg_catalog.english\",trigger_name=nil,function_name=nil)-instance-method","name":"full_text_searchable","abstract":false,"args":[{"name":"on","external_name":"on","restriction":"Array(Tuple(String, Char))"},{"name":"column_name","default_value":"\"full_text_vector\"","external_name":"column_name","restriction":""},{"name":"catalog","default_value":"\"pg_catalog.english\"","external_name":"catalog","restriction":""},{"name":"trigger_name","default_value":"nil","external_name":"trigger_name","restriction":""},{"name":"function_name","default_value":"nil","external_name":"function_name","restriction":""}],"args_string":"(on : Array(Tuple(String, Char)), column_name = \"full_text_vector\", catalog = \"pg_catalog.english\", trigger_name = nil, function_name = nil)","args_html":"(on : Array(Tuple(String, Char)), column_name = "full_text_vector", catalog = "pg_catalog.english", trigger_name = nil, function_name = nil)","location":{"filename":"src/clear/extensions/full_text_searchable/migration.cr","line_number":105,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/full_text_searchable/migration.cr#L105"},"def":{"name":"full_text_searchable","args":[{"name":"on","external_name":"on","restriction":"Array(Tuple(String, Char))"},{"name":"column_name","default_value":"\"full_text_vector\"","external_name":"column_name","restriction":""},{"name":"catalog","default_value":"\"pg_catalog.english\"","external_name":"catalog","restriction":""},{"name":"trigger_name","default_value":"nil","external_name":"trigger_name","restriction":""},{"name":"function_name","default_value":"nil","external_name":"function_name","restriction":""}],"visibility":"Public","body":"column(column_name, \"tsvector\", index: \"gin\")\nmigration.try(&.add_operation(Clear::Migration::FullTextSearchableOperation.new(name, on, catalog, trigger_name, function_name, column_name)))\n"}},{"html_id":"full_text_searchable(on:String,column_name=\"full_text_vector\",catalog=\"pg_catalog.english\",trigger_name=nil,function_name=nil)-instance-method","name":"full_text_searchable","abstract":false,"args":[{"name":"on","external_name":"on","restriction":"String"},{"name":"column_name","default_value":"\"full_text_vector\"","external_name":"column_name","restriction":""},{"name":"catalog","default_value":"\"pg_catalog.english\"","external_name":"catalog","restriction":""},{"name":"trigger_name","default_value":"nil","external_name":"trigger_name","restriction":""},{"name":"function_name","default_value":"nil","external_name":"function_name","restriction":""}],"args_string":"(on : String, column_name = \"full_text_vector\", catalog = \"pg_catalog.english\", trigger_name = nil, function_name = nil)","args_html":"(on : String, column_name = "full_text_vector", catalog = "pg_catalog.english", trigger_name = nil, function_name = nil)","location":{"filename":"src/clear/extensions/full_text_searchable/migration.cr","line_number":122,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/full_text_searchable/migration.cr#L122"},"def":{"name":"full_text_searchable","args":[{"name":"on","external_name":"on","restriction":"String"},{"name":"column_name","default_value":"\"full_text_vector\"","external_name":"column_name","restriction":""},{"name":"catalog","default_value":"\"pg_catalog.english\"","external_name":"catalog","restriction":""},{"name":"trigger_name","default_value":"nil","external_name":"trigger_name","restriction":""},{"name":"function_name","default_value":"nil","external_name":"function_name","restriction":""}],"visibility":"Public","body":"full_text_searchable([{on, 'C'}], column_name, catalog, trigger_name, function_name)"}},{"html_id":"full_text_searchable(on:Array(String),column_name=\"full_text_vector\",catalog=\"pg_catalog.english\",trigger_name=nil,function_name=nil)-instance-method","name":"full_text_searchable","abstract":false,"args":[{"name":"on","external_name":"on","restriction":"Array(String)"},{"name":"column_name","default_value":"\"full_text_vector\"","external_name":"column_name","restriction":""},{"name":"catalog","default_value":"\"pg_catalog.english\"","external_name":"catalog","restriction":""},{"name":"trigger_name","default_value":"nil","external_name":"trigger_name","restriction":""},{"name":"function_name","default_value":"nil","external_name":"function_name","restriction":""}],"args_string":"(on : Array(String), column_name = \"full_text_vector\", catalog = \"pg_catalog.english\", trigger_name = nil, function_name = nil)","args_html":"(on : Array(String), column_name = "full_text_vector", catalog = "pg_catalog.english", trigger_name = nil, function_name = nil)","location":{"filename":"src/clear/extensions/full_text_searchable/migration.cr","line_number":128,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/full_text_searchable/migration.cr#L128"},"def":{"name":"full_text_searchable","args":[{"name":"on","external_name":"on","restriction":"Array(String)"},{"name":"column_name","default_value":"\"full_text_vector\"","external_name":"column_name","restriction":""},{"name":"catalog","default_value":"\"pg_catalog.english\"","external_name":"catalog","restriction":""},{"name":"trigger_name","default_value":"nil","external_name":"trigger_name","restriction":""},{"name":"function_name","default_value":"nil","external_name":"function_name","restriction":""}],"visibility":"Public","body":"if on.empty?\n raise(\"cannot implement tsv_searchable because empty array was given\")\nend\nfields = on.map do |name|\n {name, 'C'}\nend\nfull_text_searchable(fields, column_name, catalog, trigger_name, function_name)\n"}}]},{"html_id":"clear/Clear/Migration/Helper","path":"Clear/Migration/Helper.html","kind":"module","full_name":"Clear::Migration::Helper","name":"Helper","abstract":false,"ancestors":[{"html_id":"clear/Clear/Migration/FullTextSearchableHelpers","kind":"module","full_name":"Clear::Migration::FullTextSearchableHelpers","name":"FullTextSearchableHelpers"}],"locations":[{"filename":"src/clear/extensions/enum/migration.cr","line_number":38,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/enum/migration.cr#L38"},{"filename":"src/clear/extensions/full_text_searchable/full_text_searchable.cr","line_number":12,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/full_text_searchable/full_text_searchable.cr#L12"},{"filename":"src/clear/migration/migration.cr","line_number":67,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/migration.cr#L67"},{"filename":"src/clear/migration/operation/columns.cr","line_number":95,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/columns.cr#L95"},{"filename":"src/clear/migration/operation/indexes.cr","line_number":48,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/indexes.cr#L48"},{"filename":"src/clear/migration/operation/table.cr","line_number":229,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L229"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"TYPE_MAPPING","name":"TYPE_MAPPING","value":"{\"string\" => \"text\", \"int32\" => \"int\", \"int64\" => \"bigint\", \"long\" => \"bigint\", \"bigdecimal\" => \"numeric\", \"datetime\" => \"timestamp without time zone\"}"}],"included_modules":[{"html_id":"clear/Clear/Migration/FullTextSearchableHelpers","kind":"module","full_name":"Clear::Migration::FullTextSearchableHelpers","name":"FullTextSearchableHelpers"}],"including_types":[{"html_id":"clear/Clear/Migration","kind":"module","full_name":"Clear::Migration","name":"Migration"}],"namespace":{"html_id":"clear/Clear/Migration","kind":"module","full_name":"Clear::Migration","name":"Migration"},"class_methods":[{"html_id":"datatype(type:String)-class-method","name":"datatype","doc":"Replace some common type to their equivalent in postgresql\nif the type is not found in the correspondance table, then return\nitself","summary":"

Replace some common type to their equivalent in postgresql if the type is not found in the correspondance table, then return itself

","abstract":false,"args":[{"name":"type","external_name":"type","restriction":"String"}],"args_string":"(type : String)","args_html":"(type : String)","location":{"filename":"src/clear/migration/migration.cr","line_number":82,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/migration.cr#L82"},"def":{"name":"datatype","args":[{"name":"type","external_name":"type","restriction":"String"}],"visibility":"Public","body":"ts = type\nTYPE_MAPPING[type]? || ts\n"}}],"instance_methods":[{"html_id":"add_column(table,column,datatype,nullable=false,constraint=nil,default=nil,with_values=false)-instance-method","name":"add_column","doc":"Add a column to a specific table","summary":"

Add a column to a specific table

","abstract":false,"args":[{"name":"table","external_name":"table","restriction":""},{"name":"column","external_name":"column","restriction":""},{"name":"datatype","external_name":"datatype","restriction":""},{"name":"nullable","default_value":"false","external_name":"nullable","restriction":""},{"name":"constraint","default_value":"nil","external_name":"constraint","restriction":""},{"name":"default","default_value":"nil","external_name":"default","restriction":""},{"name":"with_values","default_value":"false","external_name":"with_values","restriction":""}],"args_string":"(table, column, datatype, nullable = false, constraint = nil, default = nil, with_values = false)","args_html":"(table, column, datatype, nullable = false, constraint = nil, default = nil, with_values = false)","location":{"filename":"src/clear/migration/operation/columns.cr","line_number":97,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/columns.cr#L97"},"def":{"name":"add_column","args":[{"name":"table","external_name":"table","restriction":""},{"name":"column","external_name":"column","restriction":""},{"name":"datatype","external_name":"datatype","restriction":""},{"name":"nullable","default_value":"false","external_name":"nullable","restriction":""},{"name":"constraint","default_value":"nil","external_name":"constraint","restriction":""},{"name":"default","default_value":"nil","external_name":"default","restriction":""},{"name":"with_values","default_value":"false","external_name":"with_values","restriction":""}],"visibility":"Public","body":"add_operation(Clear::Migration::AddColumn.new(table, column, datatype, nullable, constraint, default, with_values))"}},{"html_id":"add_operation(op:Operation)-instance-method","name":"add_operation","abstract":false,"args":[{"name":"op","external_name":"op","restriction":"Operation"}],"args_string":"(op : Operation)","args_html":"(op : Operation)","location":{"filename":"src/clear/migration/migration.cr","line_number":95,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/migration.cr#L95"},"def":{"name":"add_operation","args":[{"name":"op","external_name":"op","restriction":"Operation"}],"visibility":"Public","body":"op.migration = self\n@operations << op\n"}},{"html_id":"apply(dir:Direction=Clear::Migration::Direction::Up)-instance-method","name":"apply","doc":"This will apply the migration in a given direction (up or down)","summary":"

This will apply the migration in a given direction (up or down)

","abstract":false,"args":[{"name":"dir","default_value":"Clear::Migration::Direction::Up","external_name":"dir","restriction":"Direction"}],"args_string":"(dir : Direction = Clear::Migration::Direction::Up)","args_html":"(dir : Direction = Clear::Migration::Direction::Up)","location":{"filename":"src/clear/migration/migration.cr","line_number":103,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/migration.cr#L103"},"def":{"name":"apply","args":[{"name":"dir","default_value":"Clear::Migration::Direction::Up","external_name":"dir","restriction":"Direction"}],"visibility":"Public","body":"Clear::Migration::Manager.instance.ensure_ready\nClear::SQL.transaction do\n Log.info do\n \"[#{dir}] #{self.class.name}\"\n end\n @operations.clear\n change(dir)\n dir.up do\n @operations.each do |op|\n op.up.each do |x|\n Clear::SQL.execute(x.as(String))\n end\n end\n (SQL.insert(\"__clear_metadatas\", {metatype: \"migration\", value: uid.to_s})).execute\n end\n dir.down do\n @operations.reverse_each do |op|\n op.down.each do |x|\n Clear::SQL.execute(x.as(String))\n end\n end\n ((SQL.delete(\"__clear_metadatas\")).where({metatype: \"migration\", value: uid.to_s})).execute\n end\n self\nend\n"}},{"html_id":"change(dir)-instance-method","name":"change","abstract":true,"args":[{"name":"dir","external_name":"dir","restriction":""}],"args_string":"(dir)","args_html":"(dir)","location":{"filename":"src/clear/migration/migration.cr","line_number":100,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/migration.cr#L100"},"def":{"name":"change","args":[{"name":"dir","external_name":"dir","restriction":""}],"visibility":"Public","body":""}},{"html_id":"change_column_type(table,column,from,to)-instance-method","name":"change_column_type","abstract":false,"args":[{"name":"table","external_name":"table","restriction":""},{"name":"column","external_name":"column","restriction":""},{"name":"from","external_name":"from","restriction":""},{"name":"to","external_name":"to","restriction":""}],"args_string":"(table, column, from, to)","args_html":"(table, column, from, to)","location":{"filename":"src/clear/migration/operation/columns.cr","line_number":110,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/columns.cr#L110"},"def":{"name":"change_column_type","args":[{"name":"table","external_name":"table","restriction":""},{"name":"column","external_name":"column","restriction":""},{"name":"from","external_name":"from","restriction":""},{"name":"to","external_name":"to","restriction":""}],"visibility":"Public","body":"add_operation(Clear::Migration::ChangeColumnType.new(table, column, from, to))"}},{"html_id":"create_enum(name,arr:Enumerable(T))forallT-instance-method","name":"create_enum","abstract":false,"args":[{"name":"name","external_name":"name","restriction":""},{"name":"arr","external_name":"arr","restriction":"Enumerable(T)"}],"args_string":"(name, arr : Enumerable(T)) forall T","args_html":"(name, arr : Enumerable(T)) forall T","location":{"filename":"src/clear/extensions/enum/migration.cr","line_number":39,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/enum/migration.cr#L39"},"def":{"name":"create_enum","args":[{"name":"name","external_name":"name","restriction":""},{"name":"arr","external_name":"arr","restriction":"Enumerable(T)"}],"visibility":"Public","body":"add_operation(CreateEnum.new(name.to_s, arr.map(&.to_s)))"}},{"html_id":"create_enum(name,e)-instance-method","name":"create_enum","abstract":false,"args":[{"name":"name","external_name":"name","restriction":""},{"name":"e","external_name":"e","restriction":""}],"args_string":"(name, e)","args_html":"(name, e)","location":{"filename":"src/clear/extensions/enum/migration.cr","line_number":47,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/enum/migration.cr#L47"},"def":{"name":"create_enum","args":[{"name":"name","external_name":"name","restriction":""},{"name":"e","external_name":"e","restriction":""}],"visibility":"Public","body":"add_operation(CreateEnum.new(name.to_s, e.authorized_values))"}},{"html_id":"create_index(table,columns:Array(String),name=nil,using=nil,unique=false)-instance-method","name":"create_index","abstract":false,"args":[{"name":"table","external_name":"table","restriction":""},{"name":"columns","external_name":"columns","restriction":"Array(String)"},{"name":"name","default_value":"nil","external_name":"name","restriction":""},{"name":"using","default_value":"nil","external_name":"using","restriction":""},{"name":"unique","default_value":"false","external_name":"unique","restriction":""}],"args_string":"(table, columns : Array(String), name = nil, using = nil, unique = false)","args_html":"(table, columns : Array(String), name = nil, using = nil, unique = false)","location":{"filename":"src/clear/migration/operation/indexes.cr","line_number":56,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/indexes.cr#L56"},"def":{"name":"create_index","args":[{"name":"table","external_name":"table","restriction":""},{"name":"columns","external_name":"columns","restriction":"Array(String)"},{"name":"name","default_value":"nil","external_name":"name","restriction":""},{"name":"using","default_value":"nil","external_name":"using","restriction":""},{"name":"unique","default_value":"false","external_name":"unique","restriction":""}],"visibility":"Public","body":"add_operation(Clear::Migration::CreateIndex.new(table, fields: columns, name: name, using: using, unique: unique))"}},{"html_id":"create_index(table,column,name=nil,using=nil,unique=false)-instance-method","name":"create_index","doc":"Add a column to a specific table","summary":"

Add a column to a specific table

","abstract":false,"args":[{"name":"table","external_name":"table","restriction":""},{"name":"column","external_name":"column","restriction":""},{"name":"name","default_value":"nil","external_name":"name","restriction":""},{"name":"using","default_value":"nil","external_name":"using","restriction":""},{"name":"unique","default_value":"false","external_name":"unique","restriction":""}],"args_string":"(table, column, name = nil, using = nil, unique = false)","args_html":"(table, column, name = nil, using = nil, unique = false)","location":{"filename":"src/clear/migration/operation/indexes.cr","line_number":50,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/indexes.cr#L50"},"def":{"name":"create_index","args":[{"name":"table","external_name":"table","restriction":""},{"name":"column","external_name":"column","restriction":""},{"name":"name","default_value":"nil","external_name":"name","restriction":""},{"name":"using","default_value":"nil","external_name":"using","restriction":""},{"name":"unique","default_value":"false","external_name":"unique","restriction":""}],"visibility":"Public","body":"add_operation(Clear::Migration::CreateIndex.new(table, fields: [column], name: name, using: using, unique: unique))"}},{"html_id":"create_table(name,id:Symbol|Bool=true,schema=\"public\",&)-instance-method","name":"create_table","doc":"\nHelper used in migration to create a new table.\n\nUsage:\n\n```\ncreate_table(:users) do |t|\n t.column :first_name, :string\n t.column :last_name, :string\n t.column :email, :string, unique: true\n t.timestamps\nend\n```\n\nBy default, a column `id` of type `integer` will be created as primary key of the table.\nThis can be prevented using `primary: false`\n\n```\ncreate_table(:users, id: false) do |t|\n t.column :user_id, :integer, primary: true # Use custom name for the primary key\n t.column :first_name, :string\n t.column :last_name, :string\n t.column :email, :string, unique: true\n t.timestamps\nend\n```\n","summary":"

Helper used in migration to create a new table.

","abstract":false,"args":[{"name":"name","external_name":"name","restriction":""},{"name":"id","default_value":"true","external_name":"id","restriction":"Symbol | Bool"},{"name":"schema","default_value":"\"public\"","external_name":"schema","restriction":""}],"args_string":"(name, id : Symbol | Bool = true, schema = \"public\", &)","args_html":"(name, id : Symbol | Bool = true, schema = "public", &)","location":{"filename":"src/clear/migration/operation/table.cr","line_number":257,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L257"},"def":{"name":"create_table","args":[{"name":"name","external_name":"name","restriction":""},{"name":"id","default_value":"true","external_name":"id","restriction":"Symbol | Bool"},{"name":"schema","default_value":"\"public\"","external_name":"schema","restriction":""}],"yields":1,"block_arity":1,"visibility":"Public","body":"table = Table.new(name.to_s, schema.to_s, is_create: true)\nadd_operation(table)\ncase id\nwhen true, :bigserial\n table.column(\"id\", \"bigserial\", primary: true, null: false)\nwhen :serial\n table.column(\"id\", \"serial\", primary: true, null: false)\nwhen :uuid\n table.column(\"id\", \"uuid\", primary: true, null: false)\nwhen false\nelse\n raise(\"Unknown key type while try to create new table: `#{id}`. Candidates are :bigserial, :serial and :uuid\" + \"Please proceed with `id: false` and add the column manually\")\nend\nyield(table)\n"}},{"html_id":"drop_column(table,column,type)-instance-method","name":"drop_column","abstract":false,"args":[{"name":"table","external_name":"table","restriction":""},{"name":"column","external_name":"column","restriction":""},{"name":"type","external_name":"type","restriction":""}],"args_string":"(table, column, type)","args_html":"(table, column, type)","location":{"filename":"src/clear/migration/operation/columns.cr","line_number":102,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/columns.cr#L102"},"def":{"name":"drop_column","args":[{"name":"table","external_name":"table","restriction":""},{"name":"column","external_name":"column","restriction":""},{"name":"type","external_name":"type","restriction":""}],"visibility":"Public","body":"add_operation(Clear::Migration::RemoveColumn.new(table, column, type))"}},{"html_id":"drop_enum(name,arr:Enumerable(T)|Nil=nil)forallT-instance-method","name":"drop_enum","abstract":false,"args":[{"name":"name","external_name":"name","restriction":""},{"name":"arr","default_value":"nil","external_name":"arr","restriction":"Enumerable(T) | ::Nil"}],"args_string":"(name, arr : Enumerable(T) | Nil = nil) forall T","args_html":"(name, arr : Enumerable(T) | Nil = nil) forall T","location":{"filename":"src/clear/extensions/enum/migration.cr","line_number":43,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/enum/migration.cr#L43"},"def":{"name":"drop_enum","args":[{"name":"name","external_name":"name","restriction":""},{"name":"arr","default_value":"nil","external_name":"arr","restriction":"Enumerable(T) | ::Nil"}],"visibility":"Public","body":"add_operation(DropEnum.new(name.to_s, arr.try(&.map(&.to_s))))"}},{"html_id":"execute(sql:String)-instance-method","name":"execute","abstract":false,"args":[{"name":"sql","external_name":"sql","restriction":"String"}],"args_string":"(sql : String)","args_html":"(sql : String)","location":{"filename":"src/clear/migration/migration.cr","line_number":91,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/migration.cr#L91"},"def":{"name":"execute","args":[{"name":"sql","external_name":"sql","restriction":"String"}],"visibility":"Public","body":"@operations << (Clear::Migration::Execute.new(sql))"}},{"html_id":"irreversible!-instance-method","name":"irreversible!","abstract":false,"location":{"filename":"src/clear/migration/migration.cr","line_number":87,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/migration.cr#L87"},"def":{"name":"irreversible!","visibility":"Public","body":"raise(IrreversibleMigration.new(migration_irreversible(self.class.name)))"}},{"html_id":"rename_column(table,from,to)-instance-method","name":"rename_column","abstract":false,"args":[{"name":"table","external_name":"table","restriction":""},{"name":"from","external_name":"from","restriction":""},{"name":"to","external_name":"to","restriction":""}],"args_string":"(table, from, to)","args_html":"(table, from, to)","location":{"filename":"src/clear/migration/operation/columns.cr","line_number":106,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/columns.cr#L106"},"def":{"name":"rename_column","args":[{"name":"table","external_name":"table","restriction":""},{"name":"from","external_name":"from","restriction":""},{"name":"to","external_name":"to","restriction":""}],"visibility":"Public","body":"add_operation(Clear::Migration::RenameColumn.new(table, from, to))"}}]},{"html_id":"clear/Clear/Migration/IrreversibleMigration","path":"Clear/Migration/IrreversibleMigration.html","kind":"class","full_name":"Clear::Migration::IrreversibleMigration","name":"IrreversibleMigration","abstract":false,"superclass":{"html_id":"clear/Exception","kind":"class","full_name":"Exception","name":"Exception"},"ancestors":[{"html_id":"clear/Exception","kind":"class","full_name":"Exception","name":"Exception"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/migration/migration.cr","line_number":65,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/migration.cr#L65"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Migration","kind":"module","full_name":"Clear::Migration","name":"Migration"},"doc":"This error is throw when you try to revert a migration which is irreversible.","summary":"

This error is throw when you try to revert a migration which is irreversible.

"},{"html_id":"clear/Clear/Migration/Manager","path":"Clear/Migration/Manager.html","kind":"class","full_name":"Clear::Migration::Manager","name":"Manager","abstract":false,"superclass":{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"clear/Clear/ErrorMessages","kind":"module","full_name":"Clear::ErrorMessages","name":"ErrorMessages"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/migration/manager.cr","line_number":11,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/manager.cr#L11"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"METADATA_VERSION","name":"METADATA_VERSION","value":"\"1\"","doc":"Used to migrate between metadata version, in case we need it in the future.","summary":"

Used to migrate between metadata version, in case we need it in the future.

"}],"included_modules":[{"html_id":"clear/Clear/ErrorMessages","kind":"module","full_name":"Clear::ErrorMessages","name":"ErrorMessages"}],"namespace":{"html_id":"clear/Clear/Migration","kind":"module","full_name":"Clear::Migration","name":"Migration"},"doc":"The migration manager is a singleton, it load all the migrations,\ncheck which one are `up` and `down`, and can trigger one or multiple\ndowngrade / upgrade of the database.\n\nThe migration system needs the creation of a table named `__clear_metadatas`\nin your database. This table will be created automatically on the first\ninitialization of the Migration Manager.\n","summary":"

The migration manager is a singleton, it load all the migrations, check which one are #up and #down, and can trigger one or multiple downgrade / upgrade of the database.

","class_methods":[{"html_id":"instance-class-method","name":"instance","doc":"To access to the manager\n\n```\nClear::Migration::Manager.instance\n```","summary":"

To access to the manager

","abstract":false,"location":{"filename":"src/clear/migration/manager.cr","line_number":22,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/manager.cr#L22"},"def":{"name":"instance","visibility":"Public","body":"@@instance || (@@instance = Manager.new)"}}],"instance_methods":[{"html_id":"apply_all-instance-method","name":"apply_all","doc":"Apply all the migrations not yet applied.","summary":"

Apply all the migrations not yet applied.

","abstract":false,"location":{"filename":"src/clear/migration/manager.cr","line_number":141,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/manager.cr#L141"},"def":{"name":"apply_all","visibility":"Public","body":"ensure_ready\nClear::View.apply(:drop)\nlist_of_migrations = @migrations.sort do |a, b|\n a.uid <=> b.uid\nend\nlist_of_migrations.reject! do |x|\n @migrations_up.includes?(x.uid)\nend\nlist_of_migrations.each do |migration|\n migration.apply\n @migrations_up.add(migration.uid)\nend\nClear::View.apply(:create)\n"}},{"html_id":"apply_to(version,direction=:both)-instance-method","name":"apply_to","abstract":false,"args":[{"name":"version","external_name":"version","restriction":""},{"name":"direction","default_value":":both","external_name":"direction","restriction":""}],"args_string":"(version, direction = :both)","args_html":"(version, direction = :both)","location":{"filename":"src/clear/migration/manager.cr","line_number":73,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/manager.cr#L73"},"def":{"name":"apply_to","args":[{"name":"version","external_name":"version","restriction":""},{"name":"direction","default_value":":both","external_name":"direction","restriction":""}],"visibility":"Public","body":"ensure_ready\nlist_of_migrations = @migrations.sort do |a, b|\n a.uid <=> b.uid\nend\nversion = compute_version(version, list_of_migrations)\noperations = [] of ::Tuple(Int64, Migration::Direction)\nuid_to_apply = list_of_migrations.map(&.uid).reject(&.>(version)) - @migrations_up.to_a\nuid_to_apply.each do |uid|\n operations << {uid, Migration::Direction::Up}\nend\nuid_to_apply = list_of_migrations.map(&.uid).select(&.>(version)) & @migrations_up.to_a\nuid_to_apply.each do |uid|\n operations << {uid, Migration::Direction::Down}\nend\noperations.sort! do |a, b|\n if a[1].up?\n if b[1].down?\n 1\n else\n a[0] <=> b[0]\n end\n else\n if b[1].down?\n b[0] <=> a[0]\n else\n 0\n end\n end\nend\nif operations.empty?\n Log.info do\n \"Nothing to do.\"\n end\n return\nend\nLog.info do\n \"Migrations will be applied (in this order):\"\nend\noperations.each do |__temp_94|\n uid, d = __temp_94\n Log.info do\n \"#{d.up? ? \"[ UP ]\" : \"[DOWN]\"} #{uid} - #{(find(uid)).class.name}\"\n end\nend\noperations.each do |__temp_95|\n uid, d = __temp_95\n if (direction == (:both)) || (direction == (:up))\n d.up do\n up(uid)\n end\n end\n if (direction == (:both)) || (direction == (:down))\n d.down do\n down(uid)\n end\n end\nend\n"}},{"html_id":"commited?(m:Clear::Migration)-instance-method","name":"commited?","doc":"Return `true` if the migration has been commited (already applied into the database)\nor `false` otherwise","summary":"

Return true if the migration has been commited (already applied into the database) or false otherwise

","abstract":false,"args":[{"name":"m","external_name":"m","restriction":"Clear::Migration"}],"args_string":"(m : Clear::Migration)","args_html":"(m : Clear::Migration)","location":{"filename":"src/clear/migration/manager.cr","line_number":159,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/manager.cr#L159"},"def":{"name":"commited?","args":[{"name":"m","external_name":"m","restriction":"Clear::Migration"}],"visibility":"Public","body":"@migrations_up.includes?(m.uid)"}},{"html_id":"current_version-instance-method","name":"current_version","abstract":false,"location":{"filename":"src/clear/migration/manager.cr","line_number":46,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/manager.cr#L46"},"def":{"name":"current_version","visibility":"Public","body":"ensure_ready\nif @migrations_up.empty?\n return nil\nend\n@migrations_up.max\n"}},{"html_id":"down(number:Int64):Nil-instance-method","name":"down","doc":"Force down a migration; throw error if the mgiration is already down","summary":"

Force down a migration; throw error if the mgiration is already down

","abstract":false,"args":[{"name":"number","external_name":"number","restriction":"Int64"}],"args_string":"(number : Int64) : Nil","args_html":"(number : Int64) : Nil","location":{"filename":"src/clear/migration/manager.cr","line_number":232,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/manager.cr#L232"},"def":{"name":"down","args":[{"name":"number","external_name":"number","restriction":"Int64"}],"return_type":"Nil","visibility":"Public","body":"m = find(number)\nif migrations_up.includes?(number)\nelse\n raise(migration_already_down(number))\nend\nm.apply(Clear::Migration::Direction::Down)\n@migrations_up.delete(m.uid)\n"}},{"html_id":"ensure_ready-instance-method","name":"ensure_ready","doc":"Create if needed the metadata table\nto save the migrations.","summary":"

Create if needed the metadata table to save the migrations.

","abstract":false,"location":{"filename":"src/clear/migration/manager.cr","line_number":165,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/manager.cr#L165"},"def":{"name":"ensure_ready","visibility":"Public","body":"if @loaded\nelse\n Clear::SQL.execute(\" CREATE TABLE IF NOT EXISTS __clear_metadatas ( metatype text NOT NULL, value text NOT NULL );\")\n Clear::SQL.execute(\" CREATE UNIQUE INDEX IF NOT EXISTS __clear_metadatas_idx ON __clear_metadatas (metatype, value);\")\n load_existing_migrations\n ensure_unicity!\n @loaded = true\nend"}},{"html_id":"find(number)-instance-method","name":"find","doc":"Fetch the migration instance with the selected number","summary":"

Fetch the migration instance with the selected number

","abstract":false,"args":[{"name":"number","external_name":"number","restriction":""}],"args_string":"(number)","args_html":"(number)","location":{"filename":"src/clear/migration/manager.cr","line_number":216,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/manager.cr#L216"},"def":{"name":"find","args":[{"name":"number","external_name":"number","restriction":""}],"visibility":"Public","body":"number = Int64.new(number)\n@migrations.find() do |__arg6|\n __arg6.uid == number\nend || (raise(migration_not_found(number)))\n"}},{"html_id":"load_existing_migrations-instance-method","name":"load_existing_migrations","doc":"Fetch all the migrations already activated on the database.","summary":"

Fetch all the migrations already activated on the database.

","abstract":false,"location":{"filename":"src/clear/migration/manager.cr","line_number":203,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/manager.cr#L203"},"def":{"name":"load_existing_migrations","visibility":"Public","body":"@migrations_up.clear\n((Clear::SQL.select(\"*\")).from(\"__clear_metadatas\")).where(metatype: \"migration\").map do |m|\n @migrations_up.add(Int64.new(m[\"value\"].as(String)))\nend\n"}},{"html_id":"max_version-instance-method","name":"max_version","abstract":false,"location":{"filename":"src/clear/migration/manager.cr","line_number":54,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/manager.cr#L54"},"def":{"name":"max_version","visibility":"Public","body":"if @migrations.size > 0\n @migrations.max_of(&.uid)\nelse\n nil\nend"}},{"html_id":"migrations_up-instance-method","name":"migrations_up","abstract":false,"location":{"filename":"src/clear/migration/manager.cr","line_number":33,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/manager.cr#L33"},"def":{"name":"migrations_up","visibility":"Public","body":"ensure_ready\n@migrations_up\n"}},{"html_id":"print_status:String-instance-method","name":"print_status","doc":"Print out the status ( up | down ) of all migrations found by the manager.","summary":"

Print out the status ( up | down ) of all migrations found by the manager.

","abstract":false,"location":{"filename":"src/clear/migration/manager.cr","line_number":242,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/manager.cr#L242"},"def":{"name":"print_status","return_type":"String","visibility":"Public","body":"ensure_ready\n@migrations.sort do |a, b|\n (a.as(Clear::Migration)).uid <=> (b.as(Clear::Migration)).uid\nend.join(\"\\n\") do |m|\n active = @migrations_up.includes?(m.uid)\n \"[#{active ? \"✓\".colorize.green : \"✗\".colorize.red}] #{m.uid} - #{m.class.name}\"\nend\n"}},{"html_id":"refresh-instance-method","name":"refresh","abstract":false,"location":{"filename":"src/clear/migration/manager.cr","line_number":211,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/manager.cr#L211"},"def":{"name":"refresh","visibility":"Public","body":"load_existing_migrations"}},{"html_id":"reinit!-instance-method","name":"reinit!","doc":"Force reloading the migration system\nRecheck all the current up migrations\nand the metadata table.\nThis is useful if you access to the migration process\nthrough another program, or during specs","summary":"

Force reloading the migration system Recheck all the current up migrations and the metadata table.

","abstract":false,"location":{"filename":"src/clear/migration/manager.cr","line_number":187,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/manager.cr#L187"},"def":{"name":"reinit!","visibility":"Public","body":"@loaded = false\nensure_ready\nself\n"}},{"html_id":"up(number:Int64):Nil-instance-method","name":"up","doc":"Force up a migration; throw error if the migration is already up","summary":"

Force up a migration; throw error if the migration is already up

","abstract":false,"args":[{"name":"number","external_name":"number","restriction":"Int64"}],"args_string":"(number : Int64) : Nil","args_html":"(number : Int64) : Nil","location":{"filename":"src/clear/migration/manager.cr","line_number":222,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/manager.cr#L222"},"def":{"name":"up","args":[{"name":"number","external_name":"number","restriction":"Int64"}],"return_type":"Nil","visibility":"Public","body":"m = find(number)\nif migrations_up.includes?(number)\n raise(migration_already_up(number))\nend\nm.apply\n@migrations_up.add(m.uid)\n"}}]},{"html_id":"clear/Clear/Migration/Operation","path":"Clear/Migration/Operation.html","kind":"class","full_name":"Clear::Migration::Operation","name":"Operation","abstract":true,"superclass":{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"clear/Clear/ErrorMessages","kind":"module","full_name":"Clear::ErrorMessages","name":"ErrorMessages"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/migration/operation/operation.cr","line_number":2,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/operation.cr#L2"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"clear/Clear/ErrorMessages","kind":"module","full_name":"Clear::ErrorMessages","name":"ErrorMessages"}],"subclasses":[{"html_id":"clear/Clear/Migration/AddColumn","kind":"class","full_name":"Clear::Migration::AddColumn","name":"AddColumn"},{"html_id":"clear/Clear/Migration/AddTable","kind":"class","full_name":"Clear::Migration::AddTable","name":"AddTable"},{"html_id":"clear/Clear/Migration/ChangeColumnType","kind":"class","full_name":"Clear::Migration::ChangeColumnType","name":"ChangeColumnType"},{"html_id":"clear/Clear/Migration/CreateEnum","kind":"class","full_name":"Clear::Migration::CreateEnum","name":"CreateEnum"},{"html_id":"clear/Clear/Migration/CreateIndex","kind":"class","full_name":"Clear::Migration::CreateIndex","name":"CreateIndex"},{"html_id":"clear/Clear/Migration/DropEnum","kind":"class","full_name":"Clear::Migration::DropEnum","name":"DropEnum"},{"html_id":"clear/Clear/Migration/DropTable","kind":"class","full_name":"Clear::Migration::DropTable","name":"DropTable"},{"html_id":"clear/Clear/Migration/Execute","kind":"class","full_name":"Clear::Migration::Execute","name":"Execute"},{"html_id":"clear/Clear/Migration/FullTextSearchableOperation","kind":"class","full_name":"Clear::Migration::FullTextSearchableOperation","name":"FullTextSearchableOperation"},{"html_id":"clear/Clear/Migration/RemoveColumn","kind":"class","full_name":"Clear::Migration::RemoveColumn","name":"RemoveColumn"},{"html_id":"clear/Clear/Migration/RenameColumn","kind":"class","full_name":"Clear::Migration::RenameColumn","name":"RenameColumn"},{"html_id":"clear/Clear/Migration/Table","kind":"class","full_name":"Clear::Migration::Table","name":"Table"}],"namespace":{"html_id":"clear/Clear/Migration","kind":"module","full_name":"Clear::Migration","name":"Migration"},"instance_methods":[{"html_id":"down:Array(String)-instance-method","name":"down","abstract":true,"location":{"filename":"src/clear/migration/operation/operation.cr","line_number":8,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/operation.cr#L8"},"def":{"name":"down","return_type":"Array(String)","visibility":"Public","body":""}},{"html_id":"irreversible!(operation_name:String|Nil=nil)-instance-method","name":"irreversible!","abstract":false,"args":[{"name":"operation_name","default_value":"nil","external_name":"operation_name","restriction":"String | ::Nil"}],"args_string":"(operation_name : String | Nil = nil)","args_html":"(operation_name : String | Nil = nil)","location":{"filename":"src/clear/migration/operation/operation.cr","line_number":10,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/operation.cr#L10"},"def":{"name":"irreversible!","args":[{"name":"operation_name","default_value":"nil","external_name":"operation_name","restriction":"String | ::Nil"}],"visibility":"Public","body":"operation_name || (operation_name = self.class.name)\nmigration_name = migration ? migration.class.name : nil\nraise(IrreversibleMigration.new(migration_irreversible(migration_name, operation_name)))\n"}},{"html_id":"migration:Clear::Migration|Nil-instance-method","name":"migration","abstract":false,"location":{"filename":"src/clear/migration/operation/operation.cr","line_number":5,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/operation.cr#L5"},"def":{"name":"migration","return_type":"Clear::Migration | ::Nil","visibility":"Public","body":"@migration"}},{"html_id":"migration=(migration:Clear::Migration|Nil)-instance-method","name":"migration=","abstract":false,"args":[{"name":"migration","external_name":"migration","restriction":"Clear::Migration | ::Nil"}],"args_string":"(migration : Clear::Migration | Nil)","args_html":"(migration : Clear::Migration | Nil)","location":{"filename":"src/clear/migration/operation/operation.cr","line_number":5,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/operation.cr#L5"},"def":{"name":"migration=","args":[{"name":"migration","external_name":"migration","restriction":"Clear::Migration | ::Nil"}],"visibility":"Public","body":"@migration = migration"}},{"html_id":"up:Array(String)-instance-method","name":"up","abstract":true,"location":{"filename":"src/clear/migration/operation/operation.cr","line_number":7,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/operation.cr#L7"},"def":{"name":"up","return_type":"Array(String)","visibility":"Public","body":""}}]},{"html_id":"clear/Clear/Migration/RemoveColumn","path":"Clear/Migration/RemoveColumn.html","kind":"class","full_name":"Clear::Migration::RemoveColumn","name":"RemoveColumn","abstract":false,"superclass":{"html_id":"clear/Clear/Migration/Operation","kind":"class","full_name":"Clear::Migration::Operation","name":"Operation"},"ancestors":[{"html_id":"clear/Clear/Migration/Operation","kind":"class","full_name":"Clear::Migration::Operation","name":"Operation"},{"html_id":"clear/Clear/ErrorMessages","kind":"module","full_name":"Clear::ErrorMessages","name":"ErrorMessages"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/migration/operation/columns.cr","line_number":39,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/columns.cr#L39"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Migration","kind":"module","full_name":"Clear::Migration","name":"Migration"},"constructors":[{"html_id":"new(table:String,column:String,datatype)-class-method","name":"new","abstract":false,"args":[{"name":"table","external_name":"table","restriction":"::String"},{"name":"column","external_name":"column","restriction":"::String"},{"name":"datatype","external_name":"datatype","restriction":""}],"args_string":"(table : String, column : String, datatype)","args_html":"(table : String, column : String, datatype)","location":{"filename":"src/clear/migration/operation/columns.cr","line_number":44,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/columns.cr#L44"},"def":{"name":"new","args":[{"name":"table","external_name":"table","restriction":"::String"},{"name":"column","external_name":"column","restriction":"::String"},{"name":"datatype","external_name":"datatype","restriction":""}],"visibility":"Public","body":"_ = allocate\n_.initialize(table, column, datatype)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"down:Array(String)-instance-method","name":"down","abstract":false,"location":{"filename":"src/clear/migration/operation/columns.cr","line_number":52,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/columns.cr#L52"},"def":{"name":"down","return_type":"Array(String)","visibility":"Public","body":"[\"ALTER TABLE #{@table} ADD #{@column} #{@datatype}\"]"}},{"html_id":"up:Array(String)-instance-method","name":"up","abstract":false,"location":{"filename":"src/clear/migration/operation/columns.cr","line_number":48,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/columns.cr#L48"},"def":{"name":"up","return_type":"Array(String)","visibility":"Public","body":"[\"ALTER TABLE #{@table} DROP #{@column}\"]"}}]},{"html_id":"clear/Clear/Migration/RenameColumn","path":"Clear/Migration/RenameColumn.html","kind":"class","full_name":"Clear::Migration::RenameColumn","name":"RenameColumn","abstract":false,"superclass":{"html_id":"clear/Clear/Migration/Operation","kind":"class","full_name":"Clear::Migration::Operation","name":"Operation"},"ancestors":[{"html_id":"clear/Clear/Migration/Operation","kind":"class","full_name":"Clear::Migration::Operation","name":"Operation"},{"html_id":"clear/Clear/ErrorMessages","kind":"module","full_name":"Clear::ErrorMessages","name":"ErrorMessages"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/migration/operation/columns.cr","line_number":57,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/columns.cr#L57"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Migration","kind":"module","full_name":"Clear::Migration","name":"Migration"},"constructors":[{"html_id":"new(table:String,old_column_name:String,new_column_name:String)-class-method","name":"new","abstract":false,"args":[{"name":"table","external_name":"table","restriction":"::String"},{"name":"old_column_name","external_name":"old_column_name","restriction":"::String"},{"name":"new_column_name","external_name":"new_column_name","restriction":"::String"}],"args_string":"(table : String, old_column_name : String, new_column_name : String)","args_html":"(table : String, old_column_name : String, new_column_name : String)","location":{"filename":"src/clear/migration/operation/columns.cr","line_number":62,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/columns.cr#L62"},"def":{"name":"new","args":[{"name":"table","external_name":"table","restriction":"::String"},{"name":"old_column_name","external_name":"old_column_name","restriction":"::String"},{"name":"new_column_name","external_name":"new_column_name","restriction":"::String"}],"visibility":"Public","body":"_ = allocate\n_.initialize(table, old_column_name, new_column_name)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"down:Array(String)-instance-method","name":"down","abstract":false,"location":{"filename":"src/clear/migration/operation/columns.cr","line_number":69,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/columns.cr#L69"},"def":{"name":"down","return_type":"Array(String)","visibility":"Public","body":"[\"ALTER TABLE #{@table} RENAME COLUMN #{@new_column_name} TO #{@old_column_name};\"]"}},{"html_id":"up:Array(String)-instance-method","name":"up","abstract":false,"location":{"filename":"src/clear/migration/operation/columns.cr","line_number":65,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/columns.cr#L65"},"def":{"name":"up","return_type":"Array(String)","visibility":"Public","body":"[\"ALTER TABLE #{@table} RENAME COLUMN #{@old_column_name} TO #{@new_column_name};\"]"}}]},{"html_id":"clear/Clear/Migration/Table","path":"Clear/Migration/Table.html","kind":"class","full_name":"Clear::Migration::Table","name":"Table","abstract":false,"superclass":{"html_id":"clear/Clear/Migration/Operation","kind":"class","full_name":"Clear::Migration::Operation","name":"Operation"},"ancestors":[{"html_id":"clear/Clear/Migration/FullTextSearchableTableHelpers","kind":"module","full_name":"Clear::Migration::FullTextSearchableTableHelpers","name":"FullTextSearchableTableHelpers"},{"html_id":"clear/Clear/Migration/Operation","kind":"class","full_name":"Clear::Migration::Operation","name":"Operation"},{"html_id":"clear/Clear/ErrorMessages","kind":"module","full_name":"Clear::ErrorMessages","name":"ErrorMessages"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/extensions/full_text_searchable/full_text_searchable.cr","line_number":8,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/full_text_searchable/full_text_searchable.cr#L8"},{"filename":"src/clear/migration/operation/table.cr","line_number":3,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L3"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"clear/Clear/Migration/FullTextSearchableTableHelpers","kind":"module","full_name":"Clear::Migration::FullTextSearchableTableHelpers","name":"FullTextSearchableTableHelpers"}],"namespace":{"html_id":"clear/Clear/Migration","kind":"module","full_name":"Clear::Migration","name":"Migration"},"doc":"Reopen Table to add the helpers","summary":"

Reopen Table to add the helpers

","constructors":[{"html_id":"new(name:String,schema:String,is_create:Bool)-class-method","name":"new","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"::String"},{"name":"schema","external_name":"schema","restriction":"::String"},{"name":"is_create","external_name":"is_create","restriction":"::Bool"}],"args_string":"(name : String, schema : String, is_create : Bool)","args_html":"(name : String, schema : String, is_create : Bool)","location":{"filename":"src/clear/migration/operation/table.cr","line_number":23,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L23"},"def":{"name":"new","args":[{"name":"name","external_name":"name","restriction":"::String"},{"name":"schema","external_name":"schema","restriction":"::String"},{"name":"is_create","external_name":"is_create","restriction":"::Bool"}],"visibility":"Public","body":"_ = allocate\n_.initialize(name, schema, is_create)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"add_column(column,type,default=nil,null=true,primary=false,index=false,unique=false,array=false)-instance-method","name":"add_column","doc":"Add/alter a column for this table.","summary":"

Add/alter a column for this table.

","abstract":false,"args":[{"name":"column","external_name":"column","restriction":""},{"name":"type","external_name":"type","restriction":""},{"name":"default","default_value":"nil","external_name":"default","restriction":""},{"name":"null","default_value":"true","external_name":"null","restriction":""},{"name":"primary","default_value":"false","external_name":"primary","restriction":""},{"name":"index","default_value":"false","external_name":"index","restriction":""},{"name":"unique","default_value":"false","external_name":"unique","restriction":""},{"name":"array","default_value":"false","external_name":"array","restriction":""}],"args_string":"(column, type, default = nil, null = true, primary = false, index = false, unique = false, array = false)","args_html":"(column, type, default = nil, null = true, primary = false, index = false, unique = false, array = false)","location":{"filename":"src/clear/migration/operation/table.cr","line_number":52,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L52"},"def":{"name":"add_column","args":[{"name":"column","external_name":"column","restriction":""},{"name":"type","external_name":"type","restriction":""},{"name":"default","default_value":"nil","external_name":"default","restriction":""},{"name":"null","default_value":"true","external_name":"null","restriction":""},{"name":"primary","default_value":"false","external_name":"primary","restriction":""},{"name":"index","default_value":"false","external_name":"index","restriction":""},{"name":"unique","default_value":"false","external_name":"unique","restriction":""},{"name":"array","default_value":"false","external_name":"array","restriction":""}],"visibility":"Public","body":"self.column_operations << ColumnOperation.new(column: column.to_s, type: type.to_s, default: default, null: null, primary: primary, array: array)\nif unique\n add_index(fields: [column.to_s], unique: true)\nelse\n if index\n if index.is_a?(Bool)\n add_index(fields: [column.to_s], unique: false)\n else\n add_index(fields: [column.to_s], unique: false, using: index)\n end\n end\nend\n"}},{"html_id":"add_fkey(fields:Array(String),table:String,foreign_fields:Array(String),on_delete:String,primary:Bool)-instance-method","name":"add_fkey","abstract":false,"args":[{"name":"fields","external_name":"fields","restriction":"Array(String)"},{"name":"table","external_name":"table","restriction":"String"},{"name":"foreign_fields","external_name":"foreign_fields","restriction":"Array(String)"},{"name":"on_delete","external_name":"on_delete","restriction":"String"},{"name":"primary","external_name":"primary","restriction":"Bool"}],"args_string":"(fields : Array(String), table : String, foreign_fields : Array(String), on_delete : String, primary : Bool)","args_html":"(fields : Array(String), table : String, foreign_fields : Array(String), on_delete : String, primary : Bool)","location":{"filename":"src/clear/migration/operation/table.cr","line_number":45,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L45"},"def":{"name":"add_fkey","args":[{"name":"fields","external_name":"fields","restriction":"Array(String)"},{"name":"table","external_name":"table","restriction":"String"},{"name":"foreign_fields","external_name":"foreign_fields","restriction":"Array(String)"},{"name":"on_delete","external_name":"on_delete","restriction":"String"},{"name":"primary","external_name":"primary","restriction":"Bool"}],"visibility":"Public","body":"self.fkey_operations << FkeyOperation.new(fields: fields, table: table, foreign_fields: foreign_fields, on_delete: on_delete, primary: primary)"}},{"html_id":"column(name,type,default=nil,null=true,primary=false,index=false,unique=false,array=false)-instance-method","name":"column","abstract":false,"args":[{"name":"name","external_name":"name","restriction":""},{"name":"type","external_name":"type","restriction":""},{"name":"default","default_value":"nil","external_name":"default","restriction":""},{"name":"null","default_value":"true","external_name":"null","restriction":""},{"name":"primary","default_value":"false","external_name":"primary","restriction":""},{"name":"index","default_value":"false","external_name":"index","restriction":""},{"name":"unique","default_value":"false","external_name":"unique","restriction":""},{"name":"array","default_value":"false","external_name":"array","restriction":""}],"args_string":"(name, type, default = nil, null = true, primary = false, index = false, unique = false, array = false)","args_html":"(name, type, default = nil, null = true, primary = false, index = false, unique = false, array = false)","location":{"filename":"src/clear/migration/operation/table.cr","line_number":167,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L167"},"def":{"name":"column","args":[{"name":"name","external_name":"name","restriction":""},{"name":"type","external_name":"type","restriction":""},{"name":"default","default_value":"nil","external_name":"default","restriction":""},{"name":"null","default_value":"true","external_name":"null","restriction":""},{"name":"primary","default_value":"false","external_name":"primary","restriction":""},{"name":"index","default_value":"false","external_name":"index","restriction":""},{"name":"unique","default_value":"false","external_name":"unique","restriction":""},{"name":"array","default_value":"false","external_name":"array","restriction":""}],"visibility":"Public","body":"type = case type.to_s\nwhen \"string\"\n \"text\"\nwhen \"int32\", \"integer\"\n \"integer\"\nwhen \"int64\", \"long\"\n \"bigint\"\nwhen \"bigdecimal\", \"numeric\"\n \"numeric\"\nwhen \"datetime\"\n \"timestamp without time zone\"\nelse\n type.to_s\nend\nadd_column(name.to_s, type: type, default: default, null: null, primary: primary, index: index, unique: unique, array: array)\n"}},{"html_id":"column_operations:Array(ColumnOperation)-instance-method","name":"column_operations","abstract":false,"location":{"filename":"src/clear/migration/operation/table.cr","line_number":19,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L19"},"def":{"name":"column_operations","return_type":"Array(ColumnOperation)","visibility":"Public","body":"@column_operations"}},{"html_id":"down:Array(String)-instance-method","name":"down","abstract":false,"location":{"filename":"src/clear/migration/operation/table.cr","line_number":113,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L113"},"def":{"name":"down","return_type":"Array(String)","visibility":"Public","body":"[(if is_create?\n [\"DROP TABLE\", full_name].join(\" \")\nend)].compact"}},{"html_id":"fkey_operations:Array(FkeyOperation)-instance-method","name":"fkey_operations","abstract":false,"location":{"filename":"src/clear/migration/operation/table.cr","line_number":21,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L21"},"def":{"name":"fkey_operations","return_type":"Array(FkeyOperation)","visibility":"Public","body":"@fkey_operations"}},{"html_id":"full_name-instance-method","name":"full_name","abstract":false,"location":{"filename":"src/clear/migration/operation/table.cr","line_number":68,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L68"},"def":{"name":"full_name","visibility":"Public","body":"{Clear::SQL.escape(@schema), Clear::SQL.escape(@name)}.join(\".\")"}},{"html_id":"index(field:String|Symbol,name=nil,using=nil,unique=false)-instance-method","name":"index","doc":"Add or replace an index for this table.\nAlias for `add_index`","summary":"

Add or replace an index for this table.

","abstract":false,"args":[{"name":"field","external_name":"field","restriction":"String | Symbol"},{"name":"name","default_value":"nil","external_name":"name","restriction":""},{"name":"using","default_value":"nil","external_name":"using","restriction":""},{"name":"unique","default_value":"false","external_name":"unique","restriction":""}],"args_string":"(field : String | Symbol, name = nil, using = nil, unique = false)","args_html":"(field : String | Symbol, name = nil, using = nil, unique = false)","location":{"filename":"src/clear/migration/operation/table.cr","line_number":74,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L74"},"def":{"name":"index","args":[{"name":"field","external_name":"field","restriction":"String | Symbol"},{"name":"name","default_value":"nil","external_name":"name","restriction":""},{"name":"using","default_value":"nil","external_name":"using","restriction":""},{"name":"unique","default_value":"false","external_name":"unique","restriction":""}],"visibility":"Public","body":"add_index(fields: [field.to_s], name: name, using: using, unique: unique)"}},{"html_id":"index(fields:Array,name=nil,using=nil,unique=false)-instance-method","name":"index","abstract":false,"args":[{"name":"fields","external_name":"fields","restriction":"Array"},{"name":"name","default_value":"nil","external_name":"name","restriction":""},{"name":"using","default_value":"nil","external_name":"using","restriction":""},{"name":"unique","default_value":"false","external_name":"unique","restriction":""}],"args_string":"(fields : Array, name = nil, using = nil, unique = false)","args_html":"(fields : Array, name = nil, using = nil, unique = false)","location":{"filename":"src/clear/migration/operation/table.cr","line_number":78,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L78"},"def":{"name":"index","args":[{"name":"fields","external_name":"fields","restriction":"Array"},{"name":"name","default_value":"nil","external_name":"name","restriction":""},{"name":"using","default_value":"nil","external_name":"using","restriction":""},{"name":"unique","default_value":"false","external_name":"unique","restriction":""}],"visibility":"Public","body":"add_index(fields: fields.map(&.to_s), name: name, using: using, unique: unique)"}},{"html_id":"index_operations:Array(IndexOperation)-instance-method","name":"index_operations","abstract":false,"location":{"filename":"src/clear/migration/operation/table.cr","line_number":20,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L20"},"def":{"name":"index_operations","return_type":"Array(IndexOperation)","visibility":"Public","body":"@index_operations"}},{"html_id":"is_create?:Bool-instance-method","name":"is_create?","abstract":false,"location":{"filename":"src/clear/migration/operation/table.cr","line_number":17,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L17"},"def":{"name":"is_create?","return_type":"Bool","visibility":"Public","body":"@is_create"}},{"html_id":"name:String-instance-method","name":"name","abstract":false,"location":{"filename":"src/clear/migration/operation/table.cr","line_number":14,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L14"},"def":{"name":"name","return_type":"String","visibility":"Public","body":"@name"}},{"html_id":"references(to,name:String|Nil=nil,on_delete=\"restrict\",type=\"bigint\",null=false,foreign_key=\"id\",primary=false)-instance-method","name":"references","abstract":false,"args":[{"name":"to","external_name":"to","restriction":""},{"name":"name","default_value":"nil","external_name":"name","restriction":"String | ::Nil"},{"name":"on_delete","default_value":"\"restrict\"","external_name":"on_delete","restriction":""},{"name":"type","default_value":"\"bigint\"","external_name":"type","restriction":""},{"name":"null","default_value":"false","external_name":"null","restriction":""},{"name":"foreign_key","default_value":"\"id\"","external_name":"foreign_key","restriction":""},{"name":"primary","default_value":"false","external_name":"primary","restriction":""}],"args_string":"(to, name : String | Nil = nil, on_delete = \"restrict\", type = \"bigint\", null = false, foreign_key = \"id\", primary = false)","args_html":"(to, name : String | Nil = nil, on_delete = "restrict", type = "bigint", null = false, foreign_key = "id", primary = false)","location":{"filename":"src/clear/migration/operation/table.cr","line_number":35,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L35"},"def":{"name":"references","args":[{"name":"to","external_name":"to","restriction":""},{"name":"name","default_value":"nil","external_name":"name","restriction":"String | ::Nil"},{"name":"on_delete","default_value":"\"restrict\"","external_name":"on_delete","restriction":""},{"name":"type","default_value":"\"bigint\"","external_name":"type","restriction":""},{"name":"null","default_value":"false","external_name":"null","restriction":""},{"name":"foreign_key","default_value":"\"id\"","external_name":"foreign_key","restriction":""},{"name":"primary","default_value":"false","external_name":"primary","restriction":""}],"visibility":"Public","body":"name || (name = to.singularize.underscore + \"_id\")\nadd_column(name, type, null: null, index: true)\nadd_fkey(fields: [name.to_s], table: to.to_s, foreign_fields: [foreign_key.to_s], on_delete: on_delete.to_s, primary: primary)\n"}},{"html_id":"schema:String-instance-method","name":"schema","abstract":false,"location":{"filename":"src/clear/migration/operation/table.cr","line_number":15,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L15"},"def":{"name":"schema","return_type":"String","visibility":"Public","body":"@schema"}},{"html_id":"timestamps(null=false)-instance-method","name":"timestamps","doc":"Add the timestamps to the field.","summary":"

Add the timestamps to the field.

","abstract":false,"args":[{"name":"null","default_value":"false","external_name":"null","restriction":""}],"args_string":"(null = false)","args_html":"(null = false)","location":{"filename":"src/clear/migration/operation/table.cr","line_number":28,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L28"},"def":{"name":"timestamps","args":[{"name":"null","default_value":"false","external_name":"null","restriction":""}],"visibility":"Public","body":"add_column(:created_at, \"timestamp without time zone\", null: null, default: \"NOW()\")\nadd_column(:updated_at, \"timestamp without time zone\", null: null, default: \"NOW()\")\nadd_index([\"created_at\"])\nadd_index([\"updated_at\"])\n"}},{"html_id":"up:Array(String)-instance-method","name":"up","abstract":false,"location":{"filename":"src/clear/migration/operation/table.cr","line_number":97,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L97"},"def":{"name":"up","return_type":"Array(String)","visibility":"Public","body":"columns_and_fkeys = print_columns + print_fkeys\nif columns_and_fkeys.empty?\nelse\n content = \"(#{columns_and_fkeys.join(\", \")})\"\nend\narr = if is_create?\n [[\"CREATE TABLE\", full_name, content].compact.join(\" \")]\nelse\n [] of String\nend\narr + print_indexes\n"}}],"macros":[{"html_id":"method_missing(caller)-macro","name":"method_missing","doc":"DEPRECATED\nMethod missing is used to generate add_column using the method name as\ncolumn type (ActiveRecord's style)","summary":"

DEPRECATED Method missing is used to generate add_column using the method name as column type (ActiveRecord's style)

","abstract":false,"args":[{"name":"caller","external_name":"caller","restriction":""}],"args_string":"(caller)","args_html":"(caller)","location":{"filename":"src/clear/migration/operation/table.cr","line_number":162,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L162"},"def":{"name":"method_missing","args":[{"name":"caller","external_name":"caller","restriction":""}],"visibility":"Public","body":" \n{% raise(\"Migration: usage of Table##{caller.name} is deprecated.\\n\" + \"Tip: use instead `self.column(NAME, \\\"#{caller.name}\\\", ...)`\") %}\n\n \n"}}],"types":[{"html_id":"clear/Clear/Migration/Table/ColumnOperation","path":"Clear/Migration/Table/ColumnOperation.html","kind":"struct","full_name":"Clear::Migration::Table::ColumnOperation","name":"ColumnOperation","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/migration/operation/table.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L4"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Migration/Table","kind":"class","full_name":"Clear::Migration::Table","name":"Table"},"constructors":[{"html_id":"new(column:String,type:String,null:Bool=false,default:SQL::Any=nil,primary:Bool=false,array:Bool=false)-class-method","name":"new","abstract":false,"args":[{"name":"column","external_name":"column","restriction":"String"},{"name":"type","external_name":"type","restriction":"String"},{"name":"null","default_value":"false","external_name":"null","restriction":"Bool"},{"name":"default","default_value":"nil","external_name":"default","restriction":"SQL::Any"},{"name":"primary","default_value":"false","external_name":"primary","restriction":"Bool"},{"name":"array","default_value":"false","external_name":"array","restriction":"Bool"}],"args_string":"(column : String, type : String, null : Bool = false, default : SQL::Any = nil, primary : Bool = false, array : Bool = false)","args_html":"(column : String, type : String, null : Bool = false, default : SQL::Any = nil, primary : Bool = false, array : Bool = false)","location":{"filename":"src/clear/migration/operation/table.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L4"},"def":{"name":"new","args":[{"name":"column","external_name":"column","restriction":"String"},{"name":"type","external_name":"type","restriction":"String"},{"name":"null","default_value":"false","external_name":"null","restriction":"Bool"},{"name":"default","default_value":"nil","external_name":"default","restriction":"SQL::Any"},{"name":"primary","default_value":"false","external_name":"primary","restriction":"Bool"},{"name":"array","default_value":"false","external_name":"array","restriction":"Bool"}],"visibility":"Public","body":"_ = allocate\n_.initialize(column, type, null, default, primary, array)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"array:Bool-instance-method","name":"array","abstract":false,"def":{"name":"array","return_type":"Bool","visibility":"Public","body":"@array"}},{"html_id":"clone-instance-method","name":"clone","abstract":false,"location":{"filename":"src/clear/migration/operation/table.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L4"},"def":{"name":"clone","visibility":"Public","body":"self.class.new(@column.clone, @type.clone, @null.clone, @default.clone, @primary.clone, @array.clone)"}},{"html_id":"column:String-instance-method","name":"column","abstract":false,"def":{"name":"column","return_type":"String","visibility":"Public","body":"@column"}},{"html_id":"copy_with(column_column=@column,type_type=@type,null_null=@null,default_default=@default,primary_primary=@primary,array_array=@array)-instance-method","name":"copy_with","abstract":false,"args":[{"name":"_column","default_value":"@column","external_name":"column","restriction":""},{"name":"_type","default_value":"@type","external_name":"type","restriction":""},{"name":"_null","default_value":"@null","external_name":"null","restriction":""},{"name":"_default","default_value":"@default","external_name":"default","restriction":""},{"name":"_primary","default_value":"@primary","external_name":"primary","restriction":""},{"name":"_array","default_value":"@array","external_name":"array","restriction":""}],"args_string":"(column _column = @column, type _type = @type, null _null = @null, default _default = @default, primary _primary = @primary, array _array = @array)","args_html":"(column _column = @column, type _type = @type, null _null = @null, default _default = @default, primary _primary = @primary, array _array = @array)","location":{"filename":"src/clear/migration/operation/table.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L4"},"def":{"name":"copy_with","args":[{"name":"_column","default_value":"@column","external_name":"column","restriction":""},{"name":"_type","default_value":"@type","external_name":"type","restriction":""},{"name":"_null","default_value":"@null","external_name":"null","restriction":""},{"name":"_default","default_value":"@default","external_name":"default","restriction":""},{"name":"_primary","default_value":"@primary","external_name":"primary","restriction":""},{"name":"_array","default_value":"@array","external_name":"array","restriction":""}],"visibility":"Public","body":"self.class.new(_column, _type, _null, _default, _primary, _array)"}},{"html_id":"default:SQL::Any-instance-method","name":"default","abstract":false,"def":{"name":"default","return_type":"SQL::Any","visibility":"Public","body":"@default"}},{"html_id":"null:Bool-instance-method","name":"null","abstract":false,"def":{"name":"null","return_type":"Bool","visibility":"Public","body":"@null"}},{"html_id":"primary:Bool-instance-method","name":"primary","abstract":false,"def":{"name":"primary","return_type":"Bool","visibility":"Public","body":"@primary"}},{"html_id":"type:String-instance-method","name":"type","abstract":false,"def":{"name":"type","return_type":"String","visibility":"Public","body":"@type"}}]},{"html_id":"clear/Clear/Migration/Table/FkeyOperation","path":"Clear/Migration/Table/FkeyOperation.html","kind":"struct","full_name":"Clear::Migration::Table::FkeyOperation","name":"FkeyOperation","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/migration/operation/table.cr","line_number":11,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L11"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Migration/Table","kind":"class","full_name":"Clear::Migration::Table","name":"Table"},"constructors":[{"html_id":"new(fields:Array(String),table:String,foreign_fields:Array(String),on_delete:String,primary:Bool)-class-method","name":"new","abstract":false,"args":[{"name":"fields","external_name":"fields","restriction":"Array(String)"},{"name":"table","external_name":"table","restriction":"String"},{"name":"foreign_fields","external_name":"foreign_fields","restriction":"Array(String)"},{"name":"on_delete","external_name":"on_delete","restriction":"String"},{"name":"primary","external_name":"primary","restriction":"Bool"}],"args_string":"(fields : Array(String), table : String, foreign_fields : Array(String), on_delete : String, primary : Bool)","args_html":"(fields : Array(String), table : String, foreign_fields : Array(String), on_delete : String, primary : Bool)","location":{"filename":"src/clear/migration/operation/table.cr","line_number":11,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L11"},"def":{"name":"new","args":[{"name":"fields","external_name":"fields","restriction":"Array(String)"},{"name":"table","external_name":"table","restriction":"String"},{"name":"foreign_fields","external_name":"foreign_fields","restriction":"Array(String)"},{"name":"on_delete","external_name":"on_delete","restriction":"String"},{"name":"primary","external_name":"primary","restriction":"Bool"}],"visibility":"Public","body":"_ = allocate\n_.initialize(fields, table, foreign_fields, on_delete, primary)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"clone-instance-method","name":"clone","abstract":false,"location":{"filename":"src/clear/migration/operation/table.cr","line_number":11,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L11"},"def":{"name":"clone","visibility":"Public","body":"self.class.new(@fields.clone, @table.clone, @foreign_fields.clone, @on_delete.clone, @primary.clone)"}},{"html_id":"copy_with(fields_fields=@fields,table_table=@table,foreign_fields_foreign_fields=@foreign_fields,on_delete_on_delete=@on_delete,primary_primary=@primary)-instance-method","name":"copy_with","abstract":false,"args":[{"name":"_fields","default_value":"@fields","external_name":"fields","restriction":""},{"name":"_table","default_value":"@table","external_name":"table","restriction":""},{"name":"_foreign_fields","default_value":"@foreign_fields","external_name":"foreign_fields","restriction":""},{"name":"_on_delete","default_value":"@on_delete","external_name":"on_delete","restriction":""},{"name":"_primary","default_value":"@primary","external_name":"primary","restriction":""}],"args_string":"(fields _fields = @fields, table _table = @table, foreign_fields _foreign_fields = @foreign_fields, on_delete _on_delete = @on_delete, primary _primary = @primary)","args_html":"(fields _fields = @fields, table _table = @table, foreign_fields _foreign_fields = @foreign_fields, on_delete _on_delete = @on_delete, primary _primary = @primary)","location":{"filename":"src/clear/migration/operation/table.cr","line_number":11,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L11"},"def":{"name":"copy_with","args":[{"name":"_fields","default_value":"@fields","external_name":"fields","restriction":""},{"name":"_table","default_value":"@table","external_name":"table","restriction":""},{"name":"_foreign_fields","default_value":"@foreign_fields","external_name":"foreign_fields","restriction":""},{"name":"_on_delete","default_value":"@on_delete","external_name":"on_delete","restriction":""},{"name":"_primary","default_value":"@primary","external_name":"primary","restriction":""}],"visibility":"Public","body":"self.class.new(_fields, _table, _foreign_fields, _on_delete, _primary)"}},{"html_id":"fields:Array(String)-instance-method","name":"fields","abstract":false,"def":{"name":"fields","return_type":"Array(String)","visibility":"Public","body":"@fields"}},{"html_id":"foreign_fields:Array(String)-instance-method","name":"foreign_fields","abstract":false,"def":{"name":"foreign_fields","return_type":"Array(String)","visibility":"Public","body":"@foreign_fields"}},{"html_id":"on_delete:String-instance-method","name":"on_delete","abstract":false,"def":{"name":"on_delete","return_type":"String","visibility":"Public","body":"@on_delete"}},{"html_id":"primary:Bool-instance-method","name":"primary","abstract":false,"def":{"name":"primary","return_type":"Bool","visibility":"Public","body":"@primary"}},{"html_id":"table:String-instance-method","name":"table","abstract":false,"def":{"name":"table","return_type":"String","visibility":"Public","body":"@table"}}]},{"html_id":"clear/Clear/Migration/Table/IndexOperation","path":"Clear/Migration/Table/IndexOperation.html","kind":"struct","full_name":"Clear::Migration::Table::IndexOperation","name":"IndexOperation","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/migration/operation/table.cr","line_number":8,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L8"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Migration/Table","kind":"class","full_name":"Clear::Migration::Table","name":"Table"},"constructors":[{"html_id":"new(fields:Array(String),name:String,using:String|Nil=nil,unique:Bool=false)-class-method","name":"new","abstract":false,"args":[{"name":"fields","external_name":"fields","restriction":"Array(String)"},{"name":"name","external_name":"name","restriction":"String"},{"name":"using","default_value":"nil","external_name":"using","restriction":"String | ::Nil"},{"name":"unique","default_value":"false","external_name":"unique","restriction":"Bool"}],"args_string":"(fields : Array(String), name : String, using : String | Nil = nil, unique : Bool = false)","args_html":"(fields : Array(String), name : String, using : String | Nil = nil, unique : Bool = false)","location":{"filename":"src/clear/migration/operation/table.cr","line_number":8,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L8"},"def":{"name":"new","args":[{"name":"fields","external_name":"fields","restriction":"Array(String)"},{"name":"name","external_name":"name","restriction":"String"},{"name":"using","default_value":"nil","external_name":"using","restriction":"String | ::Nil"},{"name":"unique","default_value":"false","external_name":"unique","restriction":"Bool"}],"visibility":"Public","body":"_ = allocate\n_.initialize(fields, name, using, unique)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"clone-instance-method","name":"clone","abstract":false,"location":{"filename":"src/clear/migration/operation/table.cr","line_number":8,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L8"},"def":{"name":"clone","visibility":"Public","body":"self.class.new(@fields.clone, @name.clone, @using.clone, @unique.clone)"}},{"html_id":"copy_with(fields_fields=@fields,name_name=@name,using_using=@using,unique_unique=@unique)-instance-method","name":"copy_with","abstract":false,"args":[{"name":"_fields","default_value":"@fields","external_name":"fields","restriction":""},{"name":"_name","default_value":"@name","external_name":"name","restriction":""},{"name":"_using","default_value":"@using","external_name":"using","restriction":""},{"name":"_unique","default_value":"@unique","external_name":"unique","restriction":""}],"args_string":"(fields _fields = @fields, name _name = @name, using _using = @using, unique _unique = @unique)","args_html":"(fields _fields = @fields, name _name = @name, using _using = @using, unique _unique = @unique)","location":{"filename":"src/clear/migration/operation/table.cr","line_number":8,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L8"},"def":{"name":"copy_with","args":[{"name":"_fields","default_value":"@fields","external_name":"fields","restriction":""},{"name":"_name","default_value":"@name","external_name":"name","restriction":""},{"name":"_using","default_value":"@using","external_name":"using","restriction":""},{"name":"_unique","default_value":"@unique","external_name":"unique","restriction":""}],"visibility":"Public","body":"self.class.new(_fields, _name, _using, _unique)"}},{"html_id":"fields:Array(String)-instance-method","name":"fields","abstract":false,"def":{"name":"fields","return_type":"Array(String)","visibility":"Public","body":"@fields"}},{"html_id":"name:String-instance-method","name":"name","abstract":false,"def":{"name":"name","return_type":"String","visibility":"Public","body":"@name"}},{"html_id":"unique:Bool-instance-method","name":"unique","abstract":false,"def":{"name":"unique","return_type":"Bool","visibility":"Public","body":"@unique"}},{"html_id":"using:String|Nil-instance-method","name":"using","abstract":false,"def":{"name":"using","return_type":"String | ::Nil","visibility":"Public","body":"@using"}}]}]}]},{"html_id":"clear/Clear/Model","path":"Clear/Model.html","kind":"module","full_name":"Clear::Model","name":"Model","abstract":false,"ancestors":[{"html_id":"clear/Clear/Model/FullTextSearchable","kind":"module","full_name":"Clear::Model::FullTextSearchable","name":"FullTextSearchable"},{"html_id":"clear/Clear/Model/JSONDeserialize","kind":"module","full_name":"Clear::Model::JSONDeserialize","name":"JSONDeserialize"},{"html_id":"clear/Clear/Model/Initializer","kind":"module","full_name":"Clear::Model::Initializer","name":"Initializer"},{"html_id":"clear/Clear/Model/HasFactory","kind":"module","full_name":"Clear::Model::HasFactory","name":"HasFactory"},{"html_id":"clear/Clear/Model/ClassMethods","kind":"module","full_name":"Clear::Model::ClassMethods","name":"ClassMethods"},{"html_id":"clear/Clear/Model/HasScope","kind":"module","full_name":"Clear::Model::HasScope","name":"HasScope"},{"html_id":"clear/Clear/Model/HasRelations","kind":"module","full_name":"Clear::Model::HasRelations","name":"HasRelations"},{"html_id":"clear/Clear/Model/HasValidation","kind":"module","full_name":"Clear::Model::HasValidation","name":"HasValidation"},{"html_id":"clear/Clear/Validation/Helper","kind":"module","full_name":"Clear::Validation::Helper","name":"Helper"},{"html_id":"clear/Clear/Model/HasSaving","kind":"module","full_name":"Clear::Model::HasSaving","name":"HasSaving"},{"html_id":"clear/Clear/Model/HasSerialPkey","kind":"module","full_name":"Clear::Model::HasSerialPkey","name":"HasSerialPkey"},{"html_id":"clear/Clear/Model/HasTimestamps","kind":"module","full_name":"Clear::Model::HasTimestamps","name":"HasTimestamps"},{"html_id":"clear/Clear/Model/HasColumns","kind":"module","full_name":"Clear::Model::HasColumns","name":"HasColumns"},{"html_id":"clear/Clear/Model/HasHooks","kind":"module","full_name":"Clear::Model::HasHooks","name":"HasHooks"},{"html_id":"clear/Clear/Model/Connection","kind":"module","full_name":"Clear::Model::Connection","name":"Connection"},{"html_id":"clear/Clear/ErrorMessages","kind":"module","full_name":"Clear::ErrorMessages","name":"ErrorMessages"}],"locations":[{"filename":"src/clear/extensions/full_text_searchable/full_text_searchable.cr","line_number":3,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/full_text_searchable/full_text_searchable.cr#L3"},{"filename":"src/clear/model/collection.cr","line_number":158,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L158"},{"filename":"src/clear/model/errors.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/errors.cr#L1"},{"filename":"src/clear/model/model.cr","line_number":9,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/model.cr#L9"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"clear/Clear/ErrorMessages","kind":"module","full_name":"Clear::ErrorMessages","name":"ErrorMessages"},{"html_id":"clear/Clear/Model/ClassMethods","kind":"module","full_name":"Clear::Model::ClassMethods","name":"ClassMethods"},{"html_id":"clear/Clear/Model/Connection","kind":"module","full_name":"Clear::Model::Connection","name":"Connection"},{"html_id":"clear/Clear/Model/FullTextSearchable","kind":"module","full_name":"Clear::Model::FullTextSearchable","name":"FullTextSearchable"},{"html_id":"clear/Clear/Model/HasColumns","kind":"module","full_name":"Clear::Model::HasColumns","name":"HasColumns"},{"html_id":"clear/Clear/Model/HasFactory","kind":"module","full_name":"Clear::Model::HasFactory","name":"HasFactory"},{"html_id":"clear/Clear/Model/HasHooks","kind":"module","full_name":"Clear::Model::HasHooks","name":"HasHooks"},{"html_id":"clear/Clear/Model/HasRelations","kind":"module","full_name":"Clear::Model::HasRelations","name":"HasRelations"},{"html_id":"clear/Clear/Model/HasSaving","kind":"module","full_name":"Clear::Model::HasSaving","name":"HasSaving"},{"html_id":"clear/Clear/Model/HasScope","kind":"module","full_name":"Clear::Model::HasScope","name":"HasScope"},{"html_id":"clear/Clear/Model/HasSerialPkey","kind":"module","full_name":"Clear::Model::HasSerialPkey","name":"HasSerialPkey"},{"html_id":"clear/Clear/Model/HasTimestamps","kind":"module","full_name":"Clear::Model::HasTimestamps","name":"HasTimestamps"},{"html_id":"clear/Clear/Model/HasValidation","kind":"module","full_name":"Clear::Model::HasValidation","name":"HasValidation"},{"html_id":"clear/Clear/Model/Initializer","kind":"module","full_name":"Clear::Model::Initializer","name":"Initializer"},{"html_id":"clear/Clear/Model/JSONDeserialize","kind":"module","full_name":"Clear::Model::JSONDeserialize","name":"JSONDeserialize"}],"including_types":[{"html_id":"clear/Clear/Reflection/Column","kind":"class","full_name":"Clear::Reflection::Column","name":"Column"},{"html_id":"clear/Clear/Reflection/Table","kind":"class","full_name":"Clear::Reflection::Table","name":"Table"}],"namespace":{"html_id":"clear/Clear","kind":"module","full_name":"Clear","name":"Clear"},"doc":"Model definition is made by adding the `Clear::Model` mixin in your class.\n## Simple Model\n\n```\nclass MyModel\n include Clear::Model\n\n column my_column : String\nend\n```\n\nWe just created a new model, linked to your database, mapping the column `my_column` of type String (`text` in postgres).\n\nNow, you can play with your model:\n\n```\nrow = MyModel.new # create an empty row\nrow.my_column = \"This is a content\"\nrow.save! # insert the new row in the database !\n```\n\nBy convention, the table name will follow an underscore, plural version of your model: `my_models`.\nA model into a module will prepend the module name before, so `Logistic::MyModel` will check for `logistic_my_models` in your database.\nYou can force a specific table name using:\n\n```\nclass MyModel\n include Clear::Model\n self.table = \"another_table_name\"\nend\n```\n\n## Presence validation\n\nUnlike many ORM around, Clear carry about non-nullable pattern in crystal. Meaning `column my_column : String` assume than a call to `row.my_column` will return a String.\n\nBut it exists cases where the column is not yet initialized:\n- When the object is built with constructor without providing the value (See above).\n- When an object is semi-fetched through the database query. This is useful to ignore some large fields non-interesting in the body of the current operation.\n\nFor example, this code will compile:\n\n```\nrow = MyModel.new # create an empty row\nputs row.my_column\n```\n\nHowever, it will throw a runtime exception `You cannot access to the field 'my_column' because it never has been initialized`\n\nSame way, trying to save the object will raise an error:\n\n```\nrow.save # Will return false\npp row.errors # Will tell you than `my_column` presence is mandatory.\n```\n\nThanks to expressiveness of the Crystal language, we can handle presence validation by simply using the `Nilable` type in crystal:\n\n```\nclass MyModel\n include Clear::Model\n\n column my_column : String? # Now, the column can be NULL or text in postgres.\nend\n```\n\nThis time, the code above will works; in case of no value, my_column will be `nil` by default.\n\n## Querying your code\n\nWhenever you want to fetch data from your database, you must create a new collection query:\n\n`MyModel.query #Will setup a vanilla 'SELECT * FROM my_models'`\n\nQueries are fetchable using `each`:\n\n```\nMyModel.query.each do |model|\n # Do something with your model here.\nend\n```\n\n## Refining your query\n\nA collection query offers a lot of functionalities. You can read the [API](https://anykeyh.github.io/clear/Clear/Model/CollectionBase.html) for more informations.\n\n## Column type\n\nBy default, Clear map theses columns types:\n\n- `String` => `text`\n- `Numbers` (any from 8 to 64 bits, float, double, big number, big float) => `int, large int etc... (depends of your choice)`\n- `Bool` => `text or bool`\n- `Time` => `timestamp without timezone or text`\n- `JSON::Any` => `json and jsonb`\n- `Nilable` => `NULL` (treated as special !)\n\n_NOTE_: The `crystal-pg` gems map also some structures like GIS coordinates, but their implementation is not tested in Clear. Use them at your own risk. Tell me if it's working 😉\n\nIf you need to map special structure, see [Mapping Your Data](Mapping) guides for more informations.\n\n## Primary key\n\nPrimary key is essential for relational mapping. Currently Clear support only one column primary key.\n\nA model without primary key can work in sort of degraded mode, throwing error in case of using some methods on them:\n- `collection#first` will be throwing error if no `order_by` has been setup\n\nTo setup a primary key, you can add the modifier `primary: true` to the column:\n\n```\nclass MyModel\n include Clear::Model\n\n column id : Int32, primary: true, presence: false\n column my_column : String?\nend\n```\n\nNote the flag `presence: false` added to the column. This tells Clear than presence checking on save is not mandatory. Usually this happens if you setup a default value in postgres. In the case of our primary key `id`, we use a serial auto-increment default value.\nTherefore, saving the model without primary key will works. The id will be fetched after insertion:\n\n```\nm = MyModel\nm.save!\nm.id # Now the id value is setup.\n```\n\n## Helpers\n\nClear provides various built-in helpers to facilitate your life:\n\n### Timestamps\n\n```\nclass MyModel\n include Clear::Model\n timestamps # Will map the two columns 'created_at' and 'updated_at', and map some hooks to update their values.\nend\n```\n\nTheses fields are automatically updated whenever you call `save` methods, and works as Rails ActiveRecord.\n\n### With Serial Pkey\n\n```\nclass MyModel\n include Clear::Model\n primary_key \"my_primary_key\"\nend\n```\n\nBasically rewrite `column id : UInt64, primary: true, presence: false`\n\nArgument is optional (default = id)","summary":"

Model definition is made by adding the Clear::Model mixin in your class.

","instance_methods":[{"html_id":"__pkey__-instance-method","name":"__pkey__","doc":"Alias method for primary key.\n\nIf `Model#id` IS the primary key, then calling `Model#__pkey__` is exactly the same as `Model#id`.\n\nThis method exists to tremendously simplify the meta-programming code.\nIf no primary key has been setup to this model, raise an exception.","summary":"

Alias method for primary key.

","abstract":false,"location":{"filename":"src/clear/model/model.cr","line_number":33,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/model.cr#L33"},"def":{"name":"__pkey__","visibility":"Public","body":"raise(lack_of_primary_key(self.class.name))"}},{"html_id":"cache:Clear::Model::QueryCache|Nil-instance-method","name":"cache","abstract":false,"location":{"filename":"src/clear/model/model.cr","line_number":25,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/model.cr#L25"},"def":{"name":"cache","return_type":"Clear::Model::QueryCache | ::Nil","visibility":"Public","body":"@cache"}}],"macros":[{"html_id":"scope(name,&block)-macro","name":"scope","doc":"A scope allow you to filter in a very human way a set of data.\n\nUsage:\n\n```\nscope(\"admin\") { where({role: \"admin\"}) }\n```\n\nfor example, instead of writing:\n\n```\nUser.query.where { (role == \"admin\") & (active == true) }\n```\n\nYou can write:\n\n```\nUser.admin.active\n```\n\nScope can be used for other purpose than just filter (e.g. ordering),\nbut I would not recommend it.","summary":"

A scope allow you to filter in a very human way a set of data.

","abstract":false,"args":[{"name":"name","external_name":"name","restriction":""}],"args_string":"(name, &block)","args_html":"(name, &block)","location":{"filename":"src/clear/model/model.cr","line_number":19,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/model.cr#L19"},"def":{"name":"scope","args":[{"name":"name","external_name":"name","restriction":""}],"block_arg":{"name":"block","external_name":"block","restriction":""},"visibility":"Public","body":" \n{% parameters = \"\" %}\n\n \n{% for arg, idx in block.args %}\n {% if (block.splat_index && (idx == block.splat_index))\n parameters = parameters + \"*\"\nend %}\n {% parameters = parameters + \"#{arg}\" %}\n {% unless (idx == (block.args.size - 1))\n parameters = parameters + \", \"\nend %}\n {% end %}\n\n \n{% parameters = parameters.id %}\n\n\n def self.\n{{ name.id }}\n(\n{{ parameters }}\n)\n query.\n{{ name.id }}\n(\n{{ parameters }}\n)\n \nend\n\n class Collection < Clear::Model::CollectionBase(\n{{ @type }}\n);\n def \n{{ name.id }}\n(\n{{ parameters }}\n)\n \n{{ yield }}\n\n\n return self\n \nend\n \nend\n \n"}}],"types":[{"html_id":"clear/Clear/Model/ClassMethods","path":"Clear/Model/ClassMethods.html","kind":"module","full_name":"Clear::Model::ClassMethods","name":"ClassMethods","abstract":false,"locations":[{"filename":"src/clear/model/modules/class_methods.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/class_methods.cr#L1"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"clear/Clear/Model","kind":"module","full_name":"Clear::Model","name":"Model"}],"namespace":{"html_id":"clear/Clear/Model","kind":"module","full_name":"Clear::Model","name":"Model"}},{"html_id":"clear/Clear/Model/CollectionBase","path":"Clear/Model/CollectionBase.html","kind":"class","full_name":"Clear::Model::CollectionBase(T)","name":"CollectionBase","abstract":false,"superclass":{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"clear/Clear/SQL/SelectBuilder","kind":"module","full_name":"Clear::SQL::SelectBuilder","name":"SelectBuilder"},{"html_id":"clear/Clear/SQL/Query/WithPagination","kind":"module","full_name":"Clear::SQL::Query::WithPagination","name":"WithPagination"},{"html_id":"clear/Clear/SQL/Query/BeforeQuery","kind":"module","full_name":"Clear::SQL::Query::BeforeQuery","name":"BeforeQuery"},{"html_id":"clear/Clear/SQL/Query/Change","kind":"module","full_name":"Clear::SQL::Query::Change","name":"Change"},{"html_id":"clear/Clear/SQL/Query/Connection","kind":"module","full_name":"Clear::SQL::Query::Connection","name":"Connection"},{"html_id":"clear/Clear/SQL/Query/Pluck","kind":"module","full_name":"Clear::SQL::Query::Pluck","name":"Pluck"},{"html_id":"clear/Clear/SQL/Query/Fetch","kind":"module","full_name":"Clear::SQL::Query::Fetch","name":"Fetch"},{"html_id":"clear/Clear/SQL/Query/Execute","kind":"module","full_name":"Clear::SQL::Query::Execute","name":"Execute"},{"html_id":"clear/Clear/SQL/Query/Lock","kind":"module","full_name":"Clear::SQL::Query::Lock","name":"Lock"},{"html_id":"clear/Clear/SQL/Query/Window","kind":"module","full_name":"Clear::SQL::Query::Window","name":"Window"},{"html_id":"clear/Clear/SQL/Query/CTE","kind":"module","full_name":"Clear::SQL::Query::CTE","name":"CTE"},{"html_id":"clear/Clear/SQL/Query/Aggregate","kind":"module","full_name":"Clear::SQL::Query::Aggregate","name":"Aggregate"},{"html_id":"clear/Clear/SQL/Query/OffsetLimit","kind":"module","full_name":"Clear::SQL::Query::OffsetLimit","name":"OffsetLimit"},{"html_id":"clear/Clear/SQL/Query/GroupBy","kind":"module","full_name":"Clear::SQL::Query::GroupBy","name":"GroupBy"},{"html_id":"clear/Clear/SQL/Query/OrderBy","kind":"module","full_name":"Clear::SQL::Query::OrderBy","name":"OrderBy"},{"html_id":"clear/Clear/SQL/Query/Having","kind":"module","full_name":"Clear::SQL::Query::Having","name":"Having"},{"html_id":"clear/Clear/SQL/Query/Where","kind":"module","full_name":"Clear::SQL::Query::Where","name":"Where"},{"html_id":"clear/Clear/SQL/Query/Join","kind":"module","full_name":"Clear::SQL::Query::Join","name":"Join"},{"html_id":"clear/Clear/SQL/Query/From","kind":"module","full_name":"Clear::SQL::Query::From","name":"From"},{"html_id":"clear/Clear/SQL/Query/Select","kind":"module","full_name":"Clear::SQL::Query::Select","name":"Select"},{"html_id":"clear/Enumerable","kind":"module","full_name":"Enumerable","name":"Enumerable"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/model/collection.cr","line_number":168,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L168"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"clear/Clear/SQL/SelectBuilder","kind":"module","full_name":"Clear::SQL::SelectBuilder","name":"SelectBuilder"},{"html_id":"clear/Enumerable","kind":"module","full_name":"Enumerable","name":"Enumerable"}],"subclasses":[{"html_id":"clear/Clear/Reflection/Column/Collection","kind":"class","full_name":"Clear::Reflection::Column::Collection","name":"Collection"},{"html_id":"clear/Clear/Reflection/Table/Collection","kind":"class","full_name":"Clear::Reflection::Table::Collection","name":"Collection"}],"namespace":{"html_id":"clear/Clear/Model","kind":"module","full_name":"Clear::Model","name":"Model"},"doc":"`CollectionBase(T)` is the base class for collection of model.\nCollection of model are a SQL `SELECT` query mapping & building system. They are Enumerable and are\n`Clear::SQL::SelectBuilder` behavior; therefore, they can be used array-like and are working with low-level SQL\nBuilding.\n\nThe `CollectionBase(T)` is extended by each model. For example, generating the model `MyModel` will generate the\nclass `MyModel::Collection` which inherits from `CollectionBase(MyModel)`\n\nCollection are instantiated using `Model.query` method.","summary":"

CollectionBase(T) is the base class for collection of model.

","instance_methods":[{"html_id":"<<(item:T)-instance-method","name":"<<","doc":"Add an item to the current collection.\n\nIf the current collection is not originated from a `has_many` or `has_many through:` relation, calling `<<` over\nthe collection will raise a `Clear::SQL::OperationNotPermittedError`\n\nReturns `self` and therefore can be chained","summary":"

Add an item to the current collection.

","abstract":false,"args":[{"name":"item","external_name":"item","restriction":"T"}],"args_string":"(item : T)","args_html":"(item : T)","location":{"filename":"src/clear/model/collection.cr","line_number":494,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L494"},"def":{"name":"<<","args":[{"name":"item","external_name":"item","restriction":"T"}],"visibility":"Public","body":"append_operation = self.append_operation\nif append_operation\nelse\n raise(\"Operation not permitted on this collection.\")\nend\nappend_operation.call(item)\n@cached_result.try(&.<<(item))\nself\n"}},{"html_id":"[](range:Range(Number,Number),fetch_columns=false):Array(T)-instance-method","name":"[]","doc":"Get a range of models","summary":"

Get a range of models

","abstract":false,"args":[{"name":"range","external_name":"range","restriction":"Range(Number, Number)"},{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"args_string":"(range : Range(Number, Number), fetch_columns = false) : Array(T)","args_html":"(range : Range(Number, Number), fetch_columns = false) : Array(T)","location":{"filename":"src/clear/model/collection.cr","line_number":550,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L550"},"def":{"name":"[]","args":[{"name":"range","external_name":"range","restriction":"Range(Number, Number)"},{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"return_type":"Array(T)","visibility":"Public","body":"((offset(range.begin)).limit(range.end - range.begin)).to_a(fetch_columns)"}},{"html_id":"[](off,fetch_columns=false):T-instance-method","name":"[]","doc":"Basically a fancy way to write `OFFSET x LIMIT 1`","summary":"

Basically a fancy way to write OFFSET x LIMIT 1

","abstract":false,"args":[{"name":"off","external_name":"off","restriction":""},{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"args_string":"(off, fetch_columns = false) : T","args_html":"(off, fetch_columns = false) : T","location":{"filename":"src/clear/model/collection.cr","line_number":540,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L540"},"def":{"name":"[]","args":[{"name":"off","external_name":"off","restriction":""},{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"return_type":"T","visibility":"Public","body":"self[off, fetch_columns]? || (raise(Clear::SQL::RecordNotFoundError.new))"}},{"html_id":"[]?(off,fetch_columns=false):T|Nil-instance-method","name":"[]?","doc":"Basically a fancy way to write `OFFSET x LIMIT 1`","summary":"

Basically a fancy way to write OFFSET x LIMIT 1

","abstract":false,"args":[{"name":"off","external_name":"off","restriction":""},{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"args_string":"(off, fetch_columns = false) : T | Nil","args_html":"(off, fetch_columns = false) : T | Nil","location":{"filename":"src/clear/model/collection.cr","line_number":545,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L545"},"def":{"name":"[]?","args":[{"name":"off","external_name":"off","restriction":""},{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"return_type":"T | ::Nil","visibility":"Public","body":"(offset(off)).first(fetch_columns)"}},{"html_id":"add(item:T)-instance-method","name":"add","doc":"Alias for `Collection#<<`","summary":"

Alias for Collection#<<

","abstract":false,"args":[{"name":"item","external_name":"item","restriction":"T"}],"args_string":"(item : T)","args_html":"(item : T)","location":{"filename":"src/clear/model/collection.cr","line_number":506,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L506"},"def":{"name":"add","args":[{"name":"item","external_name":"item","restriction":"T"}],"visibility":"Public","body":"self << item"}},{"html_id":"any?-instance-method","name":"any?","doc":"Check whether the query return any row.","summary":"

Check whether the query return any row.

","abstract":false,"location":{"filename":"src/clear/model/collection.cr","line_number":464,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L464"},"def":{"name":"any?","visibility":"Public","body":"cr = @cached_result\nif cr\n return !cr.empty?\nend\n((clear_select.select(\"1\")).limit(1)).fetch do |_|\n return true\nend\nfalse\n"}},{"html_id":"build(x:NamedTuple,&block:T->Nil):T-instance-method","name":"build","doc":"Build a new collection; if the collection comes from a has_many relation\n(e.g. `my_model.associations.build`), the foreign column which store\nthe primary key of `my_model` will be setup by default, preventing you\nto forget it.\nYou can pass extra parameters using a named tuple:\n`my_model.associations.build({a_column: \"value\"}) `","summary":"

Build a new collection; if the collection comes from a has_many relation (e.g.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"args_string":"(x : NamedTuple, &block : T -> Nil) : T","args_html":"(x : NamedTuple, &block : T -> Nil) : T","location":{"filename":"src/clear/model/collection.cr","line_number":405,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L405"},"def":{"name":"build","args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(T -> Nil)"},"return_type":"T","visibility":"Public","body":"build(**x, &block)"}},{"html_id":"build(**tuple,&:T->Nil):T-instance-method","name":"build","doc":"Build a new collection; if the collection comes from a has_many relation\n(e.g. `my_model.associations.build`), the foreign column which store\nthe primary key of `my_model` will be setup by default, preventing you\nto forget it.\nYou can pass extra parameters using a named tuple:\n`my_model.associations.build({a_column: \"value\"}) `","summary":"

Build a new collection; if the collection comes from a has_many relation (e.g.

","abstract":false,"location":{"filename":"src/clear/model/collection.cr","line_number":383,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L383"},"def":{"name":"build","double_splat":{"name":"tuple","external_name":"tuple","restriction":""},"yields":1,"block_arity":1,"block_arg":{"name":"","external_name":"","restriction":"(T -> Nil)"},"return_type":"T","visibility":"Public","body":"str_hash = @tags.dup\ntuple.map do |k, v|\n str_hash[k.to_s] = v\nend\nr = Clear::Model::Factory.build(T, str_hash, persisted: false)\nyield(r)\nr\n"}},{"html_id":"build(x:NamedTuple):T-instance-method","name":"build","doc":"Build a new collection; if the collection comes from a has_many relation\n(e.g. `my_model.associations.build`), the foreign column which store\nthe primary key of `my_model` will be setup by default, preventing you\nto forget it.\nYou can pass extra parameters using a named tuple:\n`my_model.associations.build({a_column: \"value\"}) `","summary":"

Build a new collection; if the collection comes from a has_many relation (e.g.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"args_string":"(x : NamedTuple) : T","args_html":"(x : NamedTuple) : T","location":{"filename":"src/clear/model/collection.cr","line_number":400,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L400"},"def":{"name":"build","args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"return_type":"T","visibility":"Public","body":"build(**x) do\nend"}},{"html_id":"build(**tuple):T-instance-method","name":"build","doc":"Build a new collection; if the collection comes from a has_many relation\n(e.g. `my_model.associations.build`), the foreign column which store\nthe primary key of `my_model` will be setup by default, preventing you\nto forget it.\nYou can pass extra parameters using a named tuple:\n`my_model.associations.build({a_column: \"value\"}) `","summary":"

Build a new collection; if the collection comes from a has_many relation (e.g.

","abstract":false,"location":{"filename":"src/clear/model/collection.cr","line_number":395,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L395"},"def":{"name":"build","double_splat":{"name":"tuple","external_name":"tuple","restriction":""},"return_type":"T","visibility":"Public","body":"build(**tuple) do\nend"}},{"html_id":"count(type:X.class=Int64)forallX-instance-method","name":"count","doc":"Use SQL `COUNT` over your query, and return this number as a Int64","summary":"

Use SQL COUNT over your query, and return this number as a Int64

","abstract":false,"args":[{"name":"type","default_value":"Int64","external_name":"type","restriction":"X.class"}],"args_string":"(type : X.class = Int64) forall X","args_html":"(type : X.class = Int64) forall X","location":{"filename":"src/clear/model/collection.cr","line_number":480,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L480"},"def":{"name":"count","args":[{"name":"type","default_value":"Int64","external_name":"type","restriction":"X.class"}],"visibility":"Public","body":"cr = @cached_result\nif cr.nil?\nelse\n return X.new(cr.size)\nend\nsuper(type)\n"}},{"html_id":"create(x:NamedTuple,&block:T->Nil):T-instance-method","name":"create","doc":"Build a new object and setup\nthe fields like setup in the condition tuple.\nJust after building, save the object.","summary":"

Build a new object and setup the fields like setup in the condition tuple.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"args_string":"(x : NamedTuple, &block : T -> Nil) : T","args_html":"(x : NamedTuple, &block : T -> Nil) : T","location":{"filename":"src/clear/model/collection.cr","line_number":431,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L431"},"def":{"name":"create","args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(T -> Nil)"},"return_type":"T","visibility":"Public","body":"create(**x, &block)"}},{"html_id":"create(**tuple,&:T->Nil):T-instance-method","name":"create","doc":"Build a new object and setup\nthe fields like setup in the condition tuple.\nJust after building, save the object.","summary":"

Build a new object and setup the fields like setup in the condition tuple.

","abstract":false,"location":{"filename":"src/clear/model/collection.cr","line_number":412,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L412"},"def":{"name":"create","double_splat":{"name":"tuple","external_name":"tuple","restriction":""},"yields":1,"block_arity":1,"block_arg":{"name":"","external_name":"","restriction":"(T -> Nil)"},"return_type":"T","visibility":"Public","body":"r = build(**tuple) do |mdl|\n yield(mdl)\nend\nr.save\nr\n"}},{"html_id":"create(x:NamedTuple):T-instance-method","name":"create","doc":"Build a new object and setup\nthe fields like setup in the condition tuple.\nJust after building, save the object.","summary":"

Build a new object and setup the fields like setup in the condition tuple.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"args_string":"(x : NamedTuple) : T","args_html":"(x : NamedTuple) : T","location":{"filename":"src/clear/model/collection.cr","line_number":426,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L426"},"def":{"name":"create","args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"return_type":"T","visibility":"Public","body":"create(**x)"}},{"html_id":"create(**tuple):T-instance-method","name":"create","doc":"Build a new object and setup\nthe fields like setup in the condition tuple.\nJust after building, save the object.","summary":"

Build a new object and setup the fields like setup in the condition tuple.

","abstract":false,"location":{"filename":"src/clear/model/collection.cr","line_number":421,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L421"},"def":{"name":"create","double_splat":{"name":"tuple","external_name":"tuple","restriction":""},"return_type":"T","visibility":"Public","body":"create(**tuple) do\nend"}},{"html_id":"create!(x:NamedTuple,&block:T->Nil):T-instance-method","name":"create!","doc":"Build a new object and setup\nthe fields like setup in the condition tuple.\nJust after building, save the object.\nBut instead of returning self if validation failed,\nraise `Clear::Model::InvalidError` exception","summary":"

Build a new object and setup the fields like setup in the condition tuple.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"args_string":"(x : NamedTuple, &block : T -> Nil) : T","args_html":"(x : NamedTuple, &block : T -> Nil) : T","location":{"filename":"src/clear/model/collection.cr","line_number":459,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L459"},"def":{"name":"create!","args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(T -> Nil)"},"return_type":"T","visibility":"Public","body":"create(**x, &block)"}},{"html_id":"create!(**tuple,&:T->Nil):T-instance-method","name":"create!","doc":"Build a new object and setup\nthe fields like setup in the condition tuple.\nJust after building, save the object.\nBut instead of returning self if validation failed,\nraise `Clear::Model::InvalidError` exception","summary":"

Build a new object and setup the fields like setup in the condition tuple.

","abstract":false,"location":{"filename":"src/clear/model/collection.cr","line_number":440,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L440"},"def":{"name":"create!","double_splat":{"name":"tuple","external_name":"tuple","restriction":""},"yields":1,"block_arity":1,"block_arg":{"name":"","external_name":"","restriction":"(T -> Nil)"},"return_type":"T","visibility":"Public","body":"r = build(**tuple) do |mdl|\n yield(mdl)\nend\nr.save!\nr\n"}},{"html_id":"create!(x:NamedTuple):T-instance-method","name":"create!","doc":"Build a new object and setup\nthe fields like setup in the condition tuple.\nJust after building, save the object.\nBut instead of returning self if validation failed,\nraise `Clear::Model::InvalidError` exception","summary":"

Build a new object and setup the fields like setup in the condition tuple.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"args_string":"(x : NamedTuple) : T","args_html":"(x : NamedTuple) : T","location":{"filename":"src/clear/model/collection.cr","line_number":454,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L454"},"def":{"name":"create!","args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"return_type":"T","visibility":"Public","body":"create(**x)"}},{"html_id":"create!(**tuple):T-instance-method","name":"create!","doc":"Build a new object and setup\nthe fields like setup in the condition tuple.\nJust after building, save the object.\nBut instead of returning self if validation failed,\nraise `Clear::Model::InvalidError` exception","summary":"

Build a new object and setup the fields like setup in the condition tuple.

","abstract":false,"location":{"filename":"src/clear/model/collection.cr","line_number":449,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L449"},"def":{"name":"create!","double_splat":{"name":"tuple","external_name":"tuple","restriction":""},"return_type":"T","visibility":"Public","body":"create!(**tuple) do\nend"}},{"html_id":"delete_all:self-instance-method","name":"delete_all","doc":"Delete all the rows which would have been returned by this collection.\nIs equivalent to `collection.to_delete.execute`","summary":"

Delete all the rows which would have been returned by this collection.

","abstract":false,"location":{"filename":"src/clear/model/collection.cr","line_number":704,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L704"},"def":{"name":"delete_all","return_type":"self","visibility":"Public","body":"to_delete.execute\nchange!\n"}},{"html_id":"dup-instance-method","name":"dup","doc":"Duplicate the query","summary":"

Duplicate the query

","abstract":false,"location":{"filename":"src/clear/model/collection.cr","line_number":220,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L220"},"def":{"name":"dup","visibility":"Public","body":"if (@polymorphic && (polymorphic_key = @polymorphic_key)) && (polymorphic_scope = @polymorphic_scope)\n super().flag_as_polymorphic!(polymorphic_key, polymorphic_scope)\nelse\n super()\nend"}},{"html_id":"each(fetch_columns=false,&:T->):Nil-instance-method","name":"each","doc":"Build the SQL, send the query then iterate through each models\ngathered by the request.","summary":"

Build the SQL, send the query then iterate through each models gathered by the request.

","abstract":false,"args":[{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"args_string":"(fetch_columns = false, & : T -> ) : Nil","args_html":"(fetch_columns = false, & : T -> ) : Nil","location":{"filename":"src/clear/model/collection.cr","line_number":322,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L322"},"def":{"name":"each","args":[{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"yields":1,"block_arity":1,"block_arg":{"name":"","external_name":"","restriction":"(T ->)"},"return_type":"Nil","visibility":"Public","body":"result = @cached_result\nif result\nelse\n result = [] of T\n if @polymorphic\n fetch(fetch_all: false) do |hash|\n type = hash[@polymorphic_key].as(String)\n result << ((Clear::Model::Factory.build(type, hash, persisted: true, fetch_columns: fetch_columns, cache: @cache)).as(T))\n end\n else\n fetch(fetch_all: false) do |hash|\n result << (Clear::Model::Factory.build(T, hash, persisted: true, fetch_columns: fetch_columns, cache: @cache))\n end\n end\nend\nresult.each do |value|\n yield value\nend\n"}},{"html_id":"each_with_cursor(batch=1000,fetch_columns=false,&block:T->)-instance-method","name":"each_with_cursor","doc":"Build the SQL, send the query then iterate through each models\ngathered by the request.\nUse a postgres cursor to avoid memory bloating.\nUseful to fetch millions of rows at once.","summary":"

Build the SQL, send the query then iterate through each models gathered by the request.

","abstract":false,"args":[{"name":"batch","default_value":"1000","external_name":"batch","restriction":""},{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"args_string":"(batch = 1000, fetch_columns = false, &block : T -> )","args_html":"(batch = 1000, fetch_columns = false, &block : T -> )","location":{"filename":"src/clear/model/collection.cr","line_number":358,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L358"},"def":{"name":"each_with_cursor","args":[{"name":"batch","default_value":"1000","external_name":"batch","restriction":""},{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(T ->)"},"visibility":"Public","body":"cr = @cached_result\nif cr\n cr.each(&block)\nelse\n if @polymorphic\n fetch_with_cursor(count: batch) do |hash|\n type = hash[@polymorphic_key].as(String)\n yield((Clear::Model::Factory.build(type, hash, persisted: true, fetch_columns: fetch_columns, cache: @cache)).as(T))\n end\n else\n fetch_with_cursor(count: batch) do |hash|\n yield(Clear::Model::Factory.build(T, hash, persisted: true, fetch_columns: fetch_columns, cache: @cache))\n end\n end\nend\n"}},{"html_id":"empty?-instance-method","name":"empty?","doc":"Inverse of `any?`, return true if the request return no rows.","summary":"

Inverse of #any?, return true if the request return no rows.

","abstract":false,"location":{"filename":"src/clear/model/collection.cr","line_number":475,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L475"},"def":{"name":"empty?","visibility":"Public","body":"!any?"}},{"html_id":"find(fetch_columns=false,&):T|Nil-instance-method","name":"find","doc":"A convenient way to write `where { condition }.first(fetch_columns)`","summary":"

A convenient way to write where { condition }.first(fetch_columns)

","abstract":false,"args":[{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"args_string":"(fetch_columns = false, &) : T | Nil","args_html":"(fetch_columns = false, &) : T | Nil","location":{"filename":"src/clear/model/collection.cr","line_number":555,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L555"},"def":{"name":"find","args":[{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"yields":0,"block_arity":0,"return_type":"T | ::Nil","visibility":"Public","body":"x = Clear::Expression.ensure_node!(with Clear::Expression.new yield)\n(where(x)).first(fetch_columns)\n"}},{"html_id":"find(tuple:NamedTuple,fetch_columns=false):T|Nil-instance-method","name":"find","doc":"A convenient way to write `where({any_column: \"any_value\"}).first(fetch_columns)`","summary":"

A convenient way to write where({any_column: "any_value"}).first(fetch_columns)

","abstract":false,"args":[{"name":"tuple","external_name":"tuple","restriction":"NamedTuple"},{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"args_string":"(tuple : NamedTuple, fetch_columns = false) : T | Nil","args_html":"(tuple : NamedTuple, fetch_columns = false) : T | Nil","location":{"filename":"src/clear/model/collection.cr","line_number":562,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L562"},"def":{"name":"find","args":[{"name":"tuple","external_name":"tuple","restriction":"NamedTuple"},{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"return_type":"T | ::Nil","visibility":"Public","body":"(where(tuple)).first(fetch_columns)"}},{"html_id":"find(**tuple):T|Nil-instance-method","name":"find","doc":"A convenient way to write `where({any_column: \"any_value\"}).first`","summary":"

A convenient way to write where({any_column: "any_value"}).first

","abstract":false,"location":{"filename":"src/clear/model/collection.cr","line_number":567,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L567"},"def":{"name":"find","double_splat":{"name":"tuple","external_name":"tuple","restriction":""},"return_type":"T | ::Nil","visibility":"Public","body":"(where(tuple)).first"}},{"html_id":"find!(fetch_columns=false,&):T-instance-method","name":"find!","doc":"A convenient way to write `where { condition }.first!(fetch_columns)`","summary":"

A convenient way to write where { condition }.first!(fetch_columns)

","abstract":false,"args":[{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"args_string":"(fetch_columns = false, &) : T","args_html":"(fetch_columns = false, &) : T","location":{"filename":"src/clear/model/collection.cr","line_number":572,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L572"},"def":{"name":"find!","args":[{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"yields":0,"block_arity":0,"return_type":"T","visibility":"Public","body":"x = Clear::Expression.ensure_node!(with Clear::Expression.new yield)\n(where(x)).first!(fetch_columns)\n"}},{"html_id":"find!(tuple:NamedTuple,fetch_columns=false):T-instance-method","name":"find!","doc":"A convenient way to write `where({any_column: \"any_value\"}).first!(fetch_columns)`","summary":"

A convenient way to write where({any_column: "any_value"}).first!(fetch_columns)

","abstract":false,"args":[{"name":"tuple","external_name":"tuple","restriction":"NamedTuple"},{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"args_string":"(tuple : NamedTuple, fetch_columns = false) : T","args_html":"(tuple : NamedTuple, fetch_columns = false) : T","location":{"filename":"src/clear/model/collection.cr","line_number":579,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L579"},"def":{"name":"find!","args":[{"name":"tuple","external_name":"tuple","restriction":"NamedTuple"},{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"return_type":"T","visibility":"Public","body":"(where(tuple)).first!(fetch_columns)"}},{"html_id":"find!(**tuple):T-instance-method","name":"find!","doc":"A convenient way to write `where({any_column: \"any_value\"}).first!`","summary":"

A convenient way to write where({any_column: "any_value"}).first!

","abstract":false,"location":{"filename":"src/clear/model/collection.cr","line_number":584,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L584"},"def":{"name":"find!","double_splat":{"name":"tuple","external_name":"tuple","restriction":""},"return_type":"T","visibility":"Public","body":"(where(tuple)).first!"}},{"html_id":"find_or_build(x:NamedTuple,&block:T->Nil):T-instance-method","name":"find_or_build","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"args_string":"(x : NamedTuple, &block : T -> Nil) : T","args_html":"(x : NamedTuple, &block : T -> Nil) : T","location":{"filename":"src/clear/model/collection.cr","line_number":615,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L615"},"def":{"name":"find_or_build","args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(T -> Nil)"},"return_type":"T","visibility":"Public","body":"find_or_build(**x, &block)"}},{"html_id":"find_or_build(**tuple,&:T->Nil):T-instance-method","name":"find_or_build","doc":"Try to fetch a row. If not found, build a new object and setup\nthe fields like setup in the condition tuple.","summary":"

Try to fetch a row.

","abstract":false,"location":{"filename":"src/clear/model/collection.cr","line_number":590,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L590"},"def":{"name":"find_or_build","double_splat":{"name":"tuple","external_name":"tuple","restriction":""},"yields":1,"block_arity":1,"block_arg":{"name":"","external_name":"","restriction":"(T -> Nil)"},"return_type":"T","visibility":"Public","body":"if tuple.size == 0\nelse\n where(tuple)\nend\nr = first\nif r\n return r\nend\nstr_hash = @tags.dup\ntuple.map do |k, v|\n str_hash[k.to_s] = v\nend\nr = Clear::Model::Factory.build(T, str_hash)\nyield(r)\nr\n"}},{"html_id":"find_or_build(x:NamedTuple):T-instance-method","name":"find_or_build","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"args_string":"(x : NamedTuple) : T","args_html":"(x : NamedTuple) : T","location":{"filename":"src/clear/model/collection.cr","line_number":610,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L610"},"def":{"name":"find_or_build","args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"return_type":"T","visibility":"Public","body":"find_or_build(**x)"}},{"html_id":"find_or_build(**tuple):T-instance-method","name":"find_or_build","abstract":false,"location":{"filename":"src/clear/model/collection.cr","line_number":605,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L605"},"def":{"name":"find_or_build","double_splat":{"name":"tuple","external_name":"tuple","restriction":""},"return_type":"T","visibility":"Public","body":"find_or_build(**tuple) do\nend"}},{"html_id":"find_or_create(x:NamedTuple,&block:T->Nil):T-instance-method","name":"find_or_create","doc":"Try to fetch a row. If not found, build a new object and setup\nthe fields like setup in the condition tuple.\nJust after building, save the object.","summary":"

Try to fetch a row.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"args_string":"(x : NamedTuple, &block : T -> Nil) : T","args_html":"(x : NamedTuple, &block : T -> Nil) : T","location":{"filename":"src/clear/model/collection.cr","line_number":641,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L641"},"def":{"name":"find_or_create","args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(T -> Nil)"},"return_type":"T","visibility":"Public","body":"find_or_create(**x, &block)"}},{"html_id":"find_or_create(**tuple,&:T->Nil):T-instance-method","name":"find_or_create","doc":"Try to fetch a row. If not found, build a new object and setup\nthe fields like setup in the condition tuple.\nJust after building, save the object.","summary":"

Try to fetch a row.

","abstract":false,"location":{"filename":"src/clear/model/collection.cr","line_number":622,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L622"},"def":{"name":"find_or_create","double_splat":{"name":"tuple","external_name":"tuple","restriction":""},"yields":1,"block_arity":1,"block_arg":{"name":"","external_name":"","restriction":"(T -> Nil)"},"return_type":"T","visibility":"Public","body":"r = find_or_build(**tuple) do |mdl|\n yield(mdl)\nend\nr.save!\nr\n"}},{"html_id":"find_or_create(x:NamedTuple):T-instance-method","name":"find_or_create","doc":"Try to fetch a row. If not found, build a new object and setup\nthe fields like setup in the condition tuple.\nJust after building, save the object.","summary":"

Try to fetch a row.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"args_string":"(x : NamedTuple) : T","args_html":"(x : NamedTuple) : T","location":{"filename":"src/clear/model/collection.cr","line_number":636,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L636"},"def":{"name":"find_or_create","args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"return_type":"T","visibility":"Public","body":"find_or_create(**x)"}},{"html_id":"find_or_create(**tuple):T-instance-method","name":"find_or_create","doc":"Try to fetch a row. If not found, build a new object and setup\nthe fields like setup in the condition tuple.\nJust after building, save the object.","summary":"

Try to fetch a row.

","abstract":false,"location":{"filename":"src/clear/model/collection.cr","line_number":631,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L631"},"def":{"name":"find_or_create","double_splat":{"name":"tuple","external_name":"tuple","restriction":""},"return_type":"T","visibility":"Public","body":"find_or_create(**tuple) do\nend"}},{"html_id":"first(fetch_columns=false):T|Nil-instance-method","name":"first","doc":"Get the first row from the collection query.\nif not found, return `nil`","summary":"

Get the first row from the collection query.

","abstract":false,"args":[{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"args_string":"(fetch_columns = false) : T | Nil","args_html":"(fetch_columns = false) : T | Nil","location":{"filename":"src/clear/model/collection.cr","line_number":647,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L647"},"def":{"name":"first","args":[{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"return_type":"T | ::Nil","visibility":"Public","body":"if T.__pkey__ || order_bys.empty?\n order_by(Clear::SQL.escape(\"#{T.__pkey__}\"), :asc)\nend\n(limit(1)).fetch do |hash|\n return Clear::Model::Factory.build(T, hash, persisted: true, cache: @cache, fetch_columns: fetch_columns)\nend\nnil\n"}},{"html_id":"first!(fetch_columns=false):T-instance-method","name":"first!","doc":"Get the first row from the collection query.\nif not found, throw an error","summary":"

Get the first row from the collection query.

","abstract":false,"args":[{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"args_string":"(fetch_columns = false) : T","args_html":"(fetch_columns = false) : T","location":{"filename":"src/clear/model/collection.cr","line_number":659,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L659"},"def":{"name":"first!","args":[{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"return_type":"T","visibility":"Public","body":"(first(fetch_columns)) || (raise(Clear::SQL::RecordNotFoundError.new))"}},{"html_id":"item_class-instance-method","name":"item_class","doc":"Return the model class for this collection","summary":"

Return the model class for this collection

","abstract":false,"location":{"filename":"src/clear/model/collection.cr","line_number":235,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L235"},"def":{"name":"item_class","visibility":"Public","body":"T"}},{"html_id":"last(fetch_columns=false):T|Nil-instance-method","name":"last","doc":"Get the last row from the collection query.\nif not found, return `nil`","summary":"

Get the last row from the collection query.

","abstract":false,"args":[{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"args_string":"(fetch_columns = false) : T | Nil","args_html":"(fetch_columns = false) : T | Nil","location":{"filename":"src/clear/model/collection.cr","line_number":665,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L665"},"def":{"name":"last","args":[{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"return_type":"T | ::Nil","visibility":"Public","body":"if T.__pkey__ || order_bys.empty?\n order_by(\"#{T.__pkey__}\", :asc)\nend\narr = order_bys.dup\nbegin\n new_order = arr.map do |x|\n Clear::SQL::Query::OrderBy::Record.new(x.op, (x.dir == (:asc) ? :desc : :asc), nil)\n end\n clear_order_bys.order_by(new_order)\n (limit(1)).fetch do |hash|\n return Clear::Model::Factory.build(T, hash, persisted: true, cache: @cache, fetch_columns: fetch_columns)\n end\n nil\nensure\n clear_order_bys.order_by(order_bys)\nend\n"}},{"html_id":"last!(fetch_columns=false):T-instance-method","name":"last!","doc":"Get the last row from the collection query.\nif not found, throw an error","summary":"

Get the last row from the collection query.

","abstract":false,"args":[{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"args_string":"(fetch_columns = false) : T","args_html":"(fetch_columns = false) : T","location":{"filename":"src/clear/model/collection.cr","line_number":690,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L690"},"def":{"name":"last!","args":[{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"return_type":"T","visibility":"Public","body":"(last(fetch_columns)) || (raise(Clear::SQL::RecordNotFoundError.new))"}},{"html_id":"map(fetch_columns=false,&block:T->X):Array(X)forallX-instance-method","name":"map","doc":"Build the SQL, send the query then build and array by applying the\nblock transformation over it.","summary":"

Build the SQL, send the query then build and array by applying the block transformation over it.

","abstract":false,"args":[{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"args_string":"(fetch_columns = false, &block : T -> X) : Array(X) forall X","args_html":"(fetch_columns = false, &block : T -> X) : Array(X) forall X","location":{"filename":"src/clear/model/collection.cr","line_number":347,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L347"},"def":{"name":"map","args":[{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(T -> X)"},"return_type":"Array(X)","visibility":"Public","body":"o = [] of X\neach(fetch_columns) do |mdl|\n o << (block.call(mdl))\nend\no\n"}},{"html_id":"tags-instance-method","name":"tags","abstract":false,"location":{"filename":"src/clear/model/collection.cr","line_number":292,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L292"},"def":{"name":"tags","visibility":"Public","body":"@tags"}},{"html_id":"to_a(fetch_columns=false):Array(T)-instance-method","name":"to_a","doc":"Create an array from the query.","summary":"

Create an array from the query.

","abstract":false,"args":[{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"args_string":"(fetch_columns = false) : Array(T)","args_html":"(fetch_columns = false) : Array(T)","location":{"filename":"src/clear/model/collection.cr","line_number":528,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L528"},"def":{"name":"to_a","args":[{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"return_type":"Array(T)","visibility":"Public","body":"cr = @cached_result\nif cr\n return cr\nend\no = [] of T\neach(fetch_columns: fetch_columns) do |m|\n o << m\nend\no\n"}},{"html_id":"unlink(item:T)-instance-method","name":"unlink","doc":"Unlink the model currently referenced through a relation `has_many through`\n\nIf the current colleciton doesn't come from a `has_many through` relation,\nthis method will throw `Clear::SQL::OperationNotPermittedError`\n\nReturns `true` if unlinking is successful (e.g. one or more rows have been updated), or `false` otherwise","summary":"

Unlink the model currently referenced through a relation has_many through

","abstract":false,"args":[{"name":"item","external_name":"item","restriction":"T"}],"args_string":"(item : T)","args_html":"(item : T)","location":{"filename":"src/clear/model/collection.cr","line_number":516,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L516"},"def":{"name":"unlink","args":[{"name":"item","external_name":"item","restriction":"T"}],"visibility":"Public","body":"unlink_operation = self.unlink_operation\nif unlink_operation\nelse\n raise(\"Operation not permitted on this collection.\")\nend\nunlink_operation.call(item)\n@cached_result.try(&.delete(item))\nself\n"}}]},{"html_id":"clear/Clear/Model/Column","path":"Clear/Model/Column.html","kind":"class","full_name":"Clear::Model::Column(T, C)","name":"Column","abstract":false,"superclass":{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"clear/Clear/ErrorMessages","kind":"module","full_name":"Clear::ErrorMessages","name":"ErrorMessages"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/model/column.cr","line_number":9,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/column.cr#L9"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"UNKNOWN","name":"UNKNOWN","value":"UnknownClass.new"}],"included_modules":[{"html_id":"clear/Clear/ErrorMessages","kind":"module","full_name":"Clear::ErrorMessages","name":"ErrorMessages"}],"namespace":{"html_id":"clear/Clear/Model","kind":"module","full_name":"Clear::Model","name":"Model"},"doc":"A column of a Model\nProvide some methods like:\n - Informations persistance (value before, value changed?)\n - Raise error if we try to access the value of a field\n which is not gathered through the query system (uninitialized column).\n Or use the `get_def` to get with default value","summary":"

A column of a Model Provide some methods like: - Informations persistance (value before, value changed?) - Raise error if we try to access the value of a field which is not gathered through the query system (uninitialized column).

","constructors":[{"html_id":"new(name:String,value:T|UnknownClass=UNKNOWN,has_db_default:Bool=false)-class-method","name":"new","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"String"},{"name":"value","default_value":"UNKNOWN","external_name":"value","restriction":"T | UnknownClass"},{"name":"has_db_default","default_value":"false","external_name":"has_db_default","restriction":"::Bool"}],"args_string":"(name : String, value : T | UnknownClass = UNKNOWN, has_db_default : Bool = false)","args_html":"(name : String, value : T | UnknownClass = UNKNOWN, has_db_default : Bool = false)","location":{"filename":"src/clear/model/column.cr","line_number":24,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/column.cr#L24"},"def":{"name":"new","args":[{"name":"name","external_name":"name","restriction":"String"},{"name":"value","default_value":"UNKNOWN","external_name":"value","restriction":"T | UnknownClass"},{"name":"has_db_default","default_value":"false","external_name":"has_db_default","restriction":"::Bool"}],"visibility":"Public","body":"_ = Column(T, C).allocate\n_.initialize(name, value, has_db_default)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"changed?:Bool-instance-method","name":"changed?","abstract":false,"location":{"filename":"src/clear/model/column.cr","line_number":21,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/column.cr#L21"},"def":{"name":"changed?","return_type":"Bool","visibility":"Public","body":"@changed"}},{"html_id":"clear-instance-method","name":"clear","doc":"Completely clear the column, remove both `value` and `old_value` and turning the column in a non-defined state.","summary":"

Completely clear the column, remove both #value and #old_value and turning the column in a non-defined state.

","abstract":false,"location":{"filename":"src/clear/model/column.cr","line_number":140,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/column.cr#L140"},"def":{"name":"clear","visibility":"Public","body":"self.value = UNKNOWN\n@old_value = UNKNOWN\n@changed = false\nself\n"}},{"html_id":"clear_change_flag-instance-method","name":"clear_change_flag","doc":"Reset `changed?` flag to `false`. See `Column(T)#dirty!` for the counter part.","summary":"

Reset #changed? flag to false.

","abstract":false,"location":{"filename":"src/clear/model/column.cr","line_number":156,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/column.cr#L156"},"def":{"name":"clear_change_flag","visibility":"Public","body":"@changed = false\n@old_value = @value\nself\n"}},{"html_id":"defined?-instance-method","name":"defined?","doc":"Check whether the column is defined or not.","summary":"

Check whether the column is defined or not.

","abstract":false,"location":{"filename":"src/clear/model/column.cr","line_number":128,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/column.cr#L128"},"def":{"name":"defined?","visibility":"Public","body":"UNKNOWN != @value"}},{"html_id":"dirty!-instance-method","name":"dirty!","doc":"Reset `changed?` flag to `true`. See `Column(T)#clear_change_flag` for the counter part.","summary":"

Reset #changed? flag to true.

","abstract":false,"location":{"filename":"src/clear/model/column.cr","line_number":150,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/column.cr#L150"},"def":{"name":"dirty!","visibility":"Public","body":"@changed = true\nself\n"}},{"html_id":"has_db_default?:Bool-instance-method","name":"has_db_default?","abstract":false,"location":{"filename":"src/clear/model/column.cr","line_number":22,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/column.cr#L22"},"def":{"name":"has_db_default?","return_type":"Bool","visibility":"Public","body":"@has_db_default"}},{"html_id":"inspect-instance-method","name":"inspect","doc":"Inspect this column.\nIf a column is not loaded (e.g. not defined once), it will show \"#undef\".\nIf a column is dirty (e.g. change hasn't be saved), it will show a \"*\" after the value.","summary":"

Inspect this column.

","abstract":false,"location":{"filename":"src/clear/model/column.cr","line_number":114,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/column.cr#L114"},"def":{"name":"inspect","visibility":"Public","body":"if defined?\n @value.inspect + (changed? ? \"*\" : \"\")\nelse\n \"#undef\"\nend"}},{"html_id":"name:String-instance-method","name":"name","abstract":false,"location":{"filename":"src/clear/model/column.cr","line_number":20,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/column.cr#L20"},"def":{"name":"name","return_type":"String","visibility":"Public","body":"@name"}},{"html_id":"nilable?-instance-method","name":"nilable?","doc":"Return `true` if the value is an union of a Type with Nilable, `false` otherwise.","summary":"

Return true if the value is an union of a Type with Nilable, false otherwise.

","abstract":false,"location":{"filename":"src/clear/model/column.cr","line_number":107,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/column.cr#L107"},"def":{"name":"nilable?","visibility":"Public","body":"T.nilable?"}},{"html_id":"old_value:T|UnknownClass-instance-method","name":"old_value","abstract":false,"location":{"filename":"src/clear/model/column.cr","line_number":19,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/column.cr#L19"},"def":{"name":"old_value","return_type":"T | UnknownClass","visibility":"Public","body":"@old_value"}},{"html_id":"reset(x:T|Nil)-instance-method","name":"reset","doc":"Reset the current field.\nRestore the `old_value` state to current value.\nReset the flag `changed` to false.","summary":"

Reset the current field.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"T | ::Nil"}],"args_string":"(x : T | Nil)","args_html":"(x : T | Nil)","location":{"filename":"src/clear/model/column.cr","line_number":79,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/column.cr#L79"},"def":{"name":"reset","args":[{"name":"x","external_name":"x","restriction":"T | ::Nil"}],"visibility":"Public","body":"{% if T.nilable? %}\n @value = x.as(T)\n {% else %}\n raise null_column_mapping_error(@name, T) if x.nil?\n @value = x.not_nil!\n {% end %}\n@changed = false\n@old_value = @value\n"}},{"html_id":"reset_convert(x)-instance-method","name":"reset_convert","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x)","args_html":"(x)","location":{"filename":"src/clear/model/column.cr","line_number":55,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/column.cr#L55"},"def":{"name":"reset_convert","args":[{"name":"x","external_name":"x","restriction":""}],"visibility":"Public","body":"reset(C.to_column(x))"}},{"html_id":"revert-instance-method","name":"revert","doc":"If the column is dirty (e.g the value has been changed), return to the previous state.","summary":"

If the column is dirty (e.g the value has been changed), return to the previous state.

","abstract":false,"location":{"filename":"src/clear/model/column.cr","line_number":46,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/column.cr#L46"},"def":{"name":"revert","visibility":"Public","body":"if (@value != @old_value) && (@old_value != UNKNOWN)\n @changed = true\n @value = @old_value\nend\n@value\n"}},{"html_id":"set(x:T|Nil)-instance-method","name":"set","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"T | ::Nil"}],"args_string":"(x : T | Nil)","args_html":"(x : T | Nil)","location":{"filename":"src/clear/model/column.cr","line_number":63,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/column.cr#L63"},"def":{"name":"set","args":[{"name":"x","external_name":"x","restriction":"T | ::Nil"}],"visibility":"Public","body":"old_value = @value\n{% if T.nilable? %}\n @value = x.as(T)\n {% else %}\n raise null_column_mapping_error(@name, T) if x.nil?\n @value = x.not_nil!\n {% end %}\n@old_value = old_value\n@changed = true\n"}},{"html_id":"set_convert(x)-instance-method","name":"set_convert","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x)","args_html":"(x)","location":{"filename":"src/clear/model/column.cr","line_number":59,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/column.cr#L59"},"def":{"name":"set_convert","args":[{"name":"x","external_name":"x","restriction":""}],"visibility":"Public","body":"set(C.to_column(x))"}},{"html_id":"to_sql_value(default=nil):Clear::SQL::Any-instance-method","name":"to_sql_value","doc":"Return the database converted value using the converter","summary":"

Return the database converted value using the converter

","abstract":false,"args":[{"name":"default","default_value":"nil","external_name":"default","restriction":""}],"args_string":"(default = nil) : Clear::SQL::Any","args_html":"(default = nil) : Clear::SQL::Any","location":{"filename":"src/clear/model/column.cr","line_number":36,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/column.cr#L36"},"def":{"name":"to_sql_value","args":[{"name":"default","default_value":"nil","external_name":"default","restriction":""}],"return_type":"Clear::SQL::Any","visibility":"Public","body":"C.to_db(value(default))"}},{"html_id":"value(default:X):T|XforallX-instance-method","name":"value","doc":"Returns the current value of this column or `default` if the value is undefined.","summary":"

Returns the current value of this column or default if the value is undefined.

","abstract":false,"args":[{"name":"default","external_name":"default","restriction":"X"}],"args_string":"(default : X) : T | X forall X","args_html":"(default : X) : T | X forall X","location":{"filename":"src/clear/model/column.cr","line_number":41,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/column.cr#L41"},"def":{"name":"value","args":[{"name":"default","external_name":"default","restriction":"X"}],"return_type":"T | X","visibility":"Public","body":"defined? ? @value.as(T) : default"}},{"html_id":"value:T-instance-method","name":"value","doc":"Returns the current value of this column.\nIf the value has never been initialized, throw an exception","summary":"

Returns the current value of this column.

","abstract":false,"location":{"filename":"src/clear/model/column.cr","line_number":30,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/column.cr#L30"},"def":{"name":"value","return_type":"T","visibility":"Public","body":"if defined?\nelse\n raise(illegal_setter_access_to_undefined_column(@name))\nend\n@value.as(T)\n"}},{"html_id":"value=(x:T)-instance-method","name":"value=","doc":"Set the value of the column to the value `x`. If `x` is not equal to the old value, then the column `changed?`\nflag is set to `true`.","summary":"

Set the value of the column to the value x.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"T"}],"args_string":"(x : T)","args_html":"(x : T)","location":{"filename":"src/clear/model/column.cr","line_number":101,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/column.cr#L101"},"def":{"name":"value=","args":[{"name":"x","external_name":"x","restriction":"T"}],"visibility":"Public","body":"@changed = (@old_value != x)\n@value = x\n"}}],"types":[{"html_id":"clear/Clear/Model/Column/UnknownClass","path":"Clear/Model/Column/UnknownClass.html","kind":"struct","full_name":"Clear::Model::Column::UnknownClass","name":"UnknownClass","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/model/column.cr","line_number":12,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/column.cr#L12"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Model/Column","kind":"class","full_name":"Clear::Model::Column(T, C)","name":"Column"},"constructors":[{"html_id":"new-class-method","name":"new","abstract":false,"location":{"filename":"src/clear/model/column.cr","line_number":12,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/column.cr#L12"},"def":{"name":"new","visibility":"Public","body":"x = allocate\nif x.responds_to?(:finalize)\n ::GC.add_finalizer(x)\nend\nx\n"}}],"instance_methods":[{"html_id":"initialize-instance-method","name":"initialize","abstract":false,"location":{"filename":"src/clear/model/column.cr","line_number":12,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/column.cr#L12"},"def":{"name":"initialize","visibility":"Public","body":""}}]}]},{"html_id":"clear/Clear/Model/Connection","path":"Clear/Model/Connection.html","kind":"module","full_name":"Clear::Model::Connection","name":"Connection","abstract":false,"locations":[{"filename":"src/clear/model/modules/connection.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/connection.cr#L1"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"clear/Clear/Model","kind":"module","full_name":"Clear::Model","name":"Model"}],"namespace":{"html_id":"clear/Clear/Model","kind":"module","full_name":"Clear::Model","name":"Model"}},{"html_id":"clear/Clear/Model/Converter","path":"Clear/Model/Converter.html","kind":"module","full_name":"Clear::Model::Converter","name":"Converter","abstract":false,"locations":[{"filename":"src/clear/model/converters/base.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/base.cr#L4"},{"filename":"src/clear/model/converters/number_converters.cr","line_number":3,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/number_converters.cr#L3"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"CONVERTERS","name":"CONVERTERS","value":"{\"Array(Bool)\" => Clear::Model::Converter::ArrayConverterBool, \"Array(Bool | Nil)\" => Clear::Model::Converter::ArrayConverterBool, \"Array(String)\" => Clear::Model::Converter::ArrayConverterString, \"Array(String | Nil)\" => Clear::Model::Converter::ArrayConverterString, \"Array(Float32)\" => Clear::Model::Converter::ArrayConverterFloat32, \"Array(Float32 | Nil)\" => Clear::Model::Converter::ArrayConverterFloat32, \"Array(Float64)\" => Clear::Model::Converter::ArrayConverterFloat64, \"Array(Float64 | Nil)\" => Clear::Model::Converter::ArrayConverterFloat64, \"Array(Int32)\" => Clear::Model::Converter::ArrayConverterInt32, \"Array(Int32 | Nil)\" => Clear::Model::Converter::ArrayConverterInt32, \"Array(Int64)\" => Clear::Model::Converter::ArrayConverterInt64, \"Array(Int64 | Nil)\" => Clear::Model::Converter::ArrayConverterInt64, \"Bool\" => Clear::Model::Converter::BoolConverter, \"JSON::Any\" => Clear::Model::Converter::JSON::AnyConverter, \"Int8\" => ::Clear::Model::Converter::Int8Converter, \"Int16\" => ::Clear::Model::Converter::Int16Converter, \"Int32\" => ::Clear::Model::Converter::Int32Converter, \"Int64\" => ::Clear::Model::Converter::Int64Converter, \"UInt8\" => ::Clear::Model::Converter::UInt8Converter, \"UInt16\" => ::Clear::Model::Converter::UInt16Converter, \"UInt32\" => ::Clear::Model::Converter::UInt32Converter, \"UInt64\" => ::Clear::Model::Converter::UInt64Converter, \"Float32\" => ::Clear::Model::Converter::Float32Converter, \"Float64\" => ::Clear::Model::Converter::Float64Converter, \"BigInt\" => ::Clear::Model::Converter::BigIntConverter, \"BigFloat\" => ::Clear::Model::Converter::BigFloatConverter, \"BigDecimal\" => ::Clear::Model::Converter::BigDecimalConverter, \"String\" => Clear::Model::Converter::StringConverter, \"Time\" => Clear::Model::Converter::TimeConverter, \"Crypto::Bcrypt::Password\" => Clear::Model::Converter::BcryptPasswordConverter, \"Clear::TSVector\" => Clear::TSVector::Converter, \"Clear::Interval\" => Clear::Interval::Converter, \"Clear::TimeInDay\" => Clear::TimeInDay::Converter, \"UUID\" => Clear::Model::Converter::UUIDConverter} of String => Base.class"}],"namespace":{"html_id":"clear/Clear/Model","kind":"module","full_name":"Clear::Model","name":"Model"},"macros":[{"html_id":"add_converter(name,klazz)-macro","name":"add_converter","abstract":false,"args":[{"name":"name","external_name":"name","restriction":""},{"name":"klazz","external_name":"klazz","restriction":""}],"args_string":"(name, klazz)","args_html":"(name, klazz)","location":{"filename":"src/clear/model/converters/base.cr","line_number":10,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/base.cr#L10"},"def":{"name":"add_converter","args":[{"name":"name","external_name":"name","restriction":""},{"name":"klazz","external_name":"klazz","restriction":""}],"visibility":"Public","body":" \n{% CONVERTERS[name] = klazz %}\n\n \n"}},{"html_id":"to_column(name,value)-macro","name":"to_column","abstract":false,"args":[{"name":"name","external_name":"name","restriction":""},{"name":"value","external_name":"value","restriction":""}],"args_string":"(name, value)","args_html":"(name, value)","location":{"filename":"src/clear/model/converters/base.cr","line_number":14,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/base.cr#L14"},"def":{"name":"to_column","args":[{"name":"name","external_name":"name","restriction":""},{"name":"value","external_name":"value","restriction":""}],"visibility":"Public","body":" \n{% if !name.is_a?(StringLiteral) %}\n {% name = \"#{name}\" %}\n {% end %}\n\n\n \n{% if CONVERTERS[name] == nil %}\n {% raise(\"Unknown converter: #{name}\") %}\n {% end %}\n\n\n \n{{ CONVERTERS[name] }}\n.to_column(\n{{ value }}\n)\n \n"}},{"html_id":"to_db(name,value)-macro","name":"to_db","abstract":false,"args":[{"name":"name","external_name":"name","restriction":""},{"name":"value","external_name":"value","restriction":""}],"args_string":"(name, value)","args_html":"(name, value)","location":{"filename":"src/clear/model/converters/base.cr","line_number":26,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/base.cr#L26"},"def":{"name":"to_db","args":[{"name":"name","external_name":"name","restriction":""},{"name":"value","external_name":"value","restriction":""}],"visibility":"Public","body":" \n{% if !name.is_a?(StringLiteral) %}\n {% name = \"#{name.resolve}\" %}\n {% end %}\n\n\n \n{% if CONVERTERS[name] == nil %}\n {% raise(\"Unknown converter: #{name}\") %}\n {% end %}\n\n\n \n{{ CONVERTERS[name] }}\n.to_db(\n{{ value }}\n)\n \n"}}],"types":[{"html_id":"clear/Clear/Model/Converter/ArrayConverterBool","path":"Clear/Model/Converter/ArrayConverterBool.html","kind":"module","full_name":"Clear::Model::Converter::ArrayConverterBool","name":"ArrayConverterBool","abstract":false,"locations":[{"filename":"src/clear/model/converters/array_converter.cr","line_number":21,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/array_converter.cr#L21"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Model/Converter","kind":"module","full_name":"Clear::Model::Converter","name":"Converter"},"class_methods":[{"html_id":"to_column(x):Array(Bool)|Nil-class-method","name":"to_column","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x) : Array(Bool) | Nil","args_html":"(x) : Array(Bool) | Nil","location":{"filename":"src/clear/model/converters/array_converter.cr","line_number":21,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/array_converter.cr#L21"},"def":{"name":"to_column","args":[{"name":"x","external_name":"x","restriction":""}],"return_type":"Array(::Bool) | ::Nil","visibility":"Public","body":"case x\nwhen Nil\n nil\nwhen ::Bool\n [x]\nwhen Array(::Bool)\n x\nwhen Array(::PG::BoolArray)\n x.map do |i|\n case i\n when ::Bool\n i\n else\n nil\n end\n end.compact\nwhen Array(::JSON::Any)\n x.map(&.as_bool)\nwhen ::JSON::Any\n if arr = x.as_a?\n arr.map(&.as_bool)\n else\n raise(\"Cannot convert from #{x.class} to Array(Bool) [1]\")\n end\nelse\n raise(\"Cannot convert from #{x.class} to Array(Bool) [2]\")\nend"}},{"html_id":"to_db(x:Array(Bool)|Nil):Clear::SQL::Any-class-method","name":"to_db","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Array(::Bool) | ::Nil"}],"args_string":"(x : Array(Bool) | Nil) : Clear::SQL::Any","args_html":"(x : Array(Bool) | Nil) : Clear::SQL::Any","location":{"filename":"src/clear/model/converters/array_converter.cr","line_number":21,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/array_converter.cr#L21"},"def":{"name":"to_db","args":[{"name":"x","external_name":"x","restriction":"Array(::Bool) | ::Nil"}],"return_type":"Clear::SQL::Any","visibility":"Public","body":"if x\nelse\n return\nend\nClear::Expression.unsafe({\"Array[\", to_string(x), \"]::boolean[]\"}.join)\n"}},{"html_id":"to_string(x):String-class-method","name":"to_string","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x) : String","args_html":"(x) : String","location":{"filename":"src/clear/model/converters/array_converter.cr","line_number":21,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/array_converter.cr#L21"},"def":{"name":"to_string","args":[{"name":"x","external_name":"x","restriction":""}],"return_type":"String","visibility":"Public","body":"case x\nwhen Array\n x.join(\", \") do |it|\n to_string(it)\n end\nelse\n \"\" + Clear::Expression[x]\nend"}}]},{"html_id":"clear/Clear/Model/Converter/ArrayConverterFloat32","path":"Clear/Model/Converter/ArrayConverterFloat32.html","kind":"module","full_name":"Clear::Model::Converter::ArrayConverterFloat32","name":"ArrayConverterFloat32","abstract":false,"locations":[{"filename":"src/clear/model/converters/array_converter.cr","line_number":21,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/array_converter.cr#L21"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Model/Converter","kind":"module","full_name":"Clear::Model::Converter","name":"Converter"},"class_methods":[{"html_id":"to_column(x):Array(Float32)|Nil-class-method","name":"to_column","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x) : Array(Float32) | Nil","args_html":"(x) : Array(Float32) | Nil","location":{"filename":"src/clear/model/converters/array_converter.cr","line_number":21,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/array_converter.cr#L21"},"def":{"name":"to_column","args":[{"name":"x","external_name":"x","restriction":""}],"return_type":"Array(::Float32) | ::Nil","visibility":"Public","body":"case x\nwhen Nil\n nil\nwhen ::Float32\n [x]\nwhen Array(::Float32)\n x\nwhen Array(::PG::Float32Array)\n x.map do |i|\n case i\n when ::Float32\n i\n else\n nil\n end\n end.compact\nwhen Array(::JSON::Any)\n x.map(&.as_f32)\nwhen ::JSON::Any\n if arr = x.as_a?\n arr.map(&.as_f32)\n else\n raise(\"Cannot convert from #{x.class} to Array(Float32) [1]\")\n end\nelse\n raise(\"Cannot convert from #{x.class} to Array(Float32) [2]\")\nend"}},{"html_id":"to_db(x:Array(Float32)|Nil):Clear::SQL::Any-class-method","name":"to_db","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Array(::Float32) | ::Nil"}],"args_string":"(x : Array(Float32) | Nil) : Clear::SQL::Any","args_html":"(x : Array(Float32) | Nil) : Clear::SQL::Any","location":{"filename":"src/clear/model/converters/array_converter.cr","line_number":21,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/array_converter.cr#L21"},"def":{"name":"to_db","args":[{"name":"x","external_name":"x","restriction":"Array(::Float32) | ::Nil"}],"return_type":"Clear::SQL::Any","visibility":"Public","body":"if x\nelse\n return\nend\nClear::Expression.unsafe({\"Array[\", to_string(x), \"]::real[]\"}.join)\n"}},{"html_id":"to_string(x):String-class-method","name":"to_string","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x) : String","args_html":"(x) : String","location":{"filename":"src/clear/model/converters/array_converter.cr","line_number":21,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/array_converter.cr#L21"},"def":{"name":"to_string","args":[{"name":"x","external_name":"x","restriction":""}],"return_type":"String","visibility":"Public","body":"case x\nwhen Array\n x.join(\", \") do |it|\n to_string(it)\n end\nelse\n \"\" + Clear::Expression[x]\nend"}}]},{"html_id":"clear/Clear/Model/Converter/ArrayConverterFloat64","path":"Clear/Model/Converter/ArrayConverterFloat64.html","kind":"module","full_name":"Clear::Model::Converter::ArrayConverterFloat64","name":"ArrayConverterFloat64","abstract":false,"locations":[{"filename":"src/clear/model/converters/array_converter.cr","line_number":21,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/array_converter.cr#L21"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Model/Converter","kind":"module","full_name":"Clear::Model::Converter","name":"Converter"},"class_methods":[{"html_id":"to_column(x):Array(Float64)|Nil-class-method","name":"to_column","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x) : Array(Float64) | Nil","args_html":"(x) : Array(Float64) | Nil","location":{"filename":"src/clear/model/converters/array_converter.cr","line_number":21,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/array_converter.cr#L21"},"def":{"name":"to_column","args":[{"name":"x","external_name":"x","restriction":""}],"return_type":"Array(::Float64) | ::Nil","visibility":"Public","body":"case x\nwhen Nil\n nil\nwhen ::Float64\n [x]\nwhen Array(::Float64)\n x\nwhen Array(::PG::Float64Array)\n x.map do |i|\n case i\n when ::Float64\n i\n else\n nil\n end\n end.compact\nwhen Array(::JSON::Any)\n x.map(&.as_f)\nwhen ::JSON::Any\n if arr = x.as_a?\n arr.map(&.as_f)\n else\n raise(\"Cannot convert from #{x.class} to Array(Float64) [1]\")\n end\nelse\n raise(\"Cannot convert from #{x.class} to Array(Float64) [2]\")\nend"}},{"html_id":"to_db(x:Array(Float64)|Nil):Clear::SQL::Any-class-method","name":"to_db","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Array(::Float64) | ::Nil"}],"args_string":"(x : Array(Float64) | Nil) : Clear::SQL::Any","args_html":"(x : Array(Float64) | Nil) : Clear::SQL::Any","location":{"filename":"src/clear/model/converters/array_converter.cr","line_number":21,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/array_converter.cr#L21"},"def":{"name":"to_db","args":[{"name":"x","external_name":"x","restriction":"Array(::Float64) | ::Nil"}],"return_type":"Clear::SQL::Any","visibility":"Public","body":"if x\nelse\n return\nend\nClear::Expression.unsafe({\"Array[\", to_string(x), \"]::double precision[]\"}.join)\n"}},{"html_id":"to_string(x):String-class-method","name":"to_string","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x) : String","args_html":"(x) : String","location":{"filename":"src/clear/model/converters/array_converter.cr","line_number":21,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/array_converter.cr#L21"},"def":{"name":"to_string","args":[{"name":"x","external_name":"x","restriction":""}],"return_type":"String","visibility":"Public","body":"case x\nwhen Array\n x.join(\", \") do |it|\n to_string(it)\n end\nelse\n \"\" + Clear::Expression[x]\nend"}}]},{"html_id":"clear/Clear/Model/Converter/ArrayConverterInt32","path":"Clear/Model/Converter/ArrayConverterInt32.html","kind":"module","full_name":"Clear::Model::Converter::ArrayConverterInt32","name":"ArrayConverterInt32","abstract":false,"locations":[{"filename":"src/clear/model/converters/array_converter.cr","line_number":21,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/array_converter.cr#L21"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Model/Converter","kind":"module","full_name":"Clear::Model::Converter","name":"Converter"},"class_methods":[{"html_id":"to_column(x):Array(Int32)|Nil-class-method","name":"to_column","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x) : Array(Int32) | Nil","args_html":"(x) : Array(Int32) | Nil","location":{"filename":"src/clear/model/converters/array_converter.cr","line_number":21,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/array_converter.cr#L21"},"def":{"name":"to_column","args":[{"name":"x","external_name":"x","restriction":""}],"return_type":"Array(::Int32) | ::Nil","visibility":"Public","body":"case x\nwhen Nil\n nil\nwhen ::Int32\n [x]\nwhen Array(::Int32)\n x\nwhen Array(::PG::Int32Array)\n x.map do |i|\n case i\n when ::Int32\n i\n else\n nil\n end\n end.compact\nwhen Array(::JSON::Any)\n x.map(&.as_i)\nwhen ::JSON::Any\n if arr = x.as_a?\n arr.map(&.as_i)\n else\n raise(\"Cannot convert from #{x.class} to Array(Int32) [1]\")\n end\nelse\n raise(\"Cannot convert from #{x.class} to Array(Int32) [2]\")\nend"}},{"html_id":"to_db(x:Array(Int32)|Nil):Clear::SQL::Any-class-method","name":"to_db","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Array(::Int32) | ::Nil"}],"args_string":"(x : Array(Int32) | Nil) : Clear::SQL::Any","args_html":"(x : Array(Int32) | Nil) : Clear::SQL::Any","location":{"filename":"src/clear/model/converters/array_converter.cr","line_number":21,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/array_converter.cr#L21"},"def":{"name":"to_db","args":[{"name":"x","external_name":"x","restriction":"Array(::Int32) | ::Nil"}],"return_type":"Clear::SQL::Any","visibility":"Public","body":"if x\nelse\n return\nend\nClear::Expression.unsafe({\"Array[\", to_string(x), \"]::int[]\"}.join)\n"}},{"html_id":"to_string(x):String-class-method","name":"to_string","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x) : String","args_html":"(x) : String","location":{"filename":"src/clear/model/converters/array_converter.cr","line_number":21,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/array_converter.cr#L21"},"def":{"name":"to_string","args":[{"name":"x","external_name":"x","restriction":""}],"return_type":"String","visibility":"Public","body":"case x\nwhen Array\n x.join(\", \") do |it|\n to_string(it)\n end\nelse\n \"\" + Clear::Expression[x]\nend"}}]},{"html_id":"clear/Clear/Model/Converter/ArrayConverterInt64","path":"Clear/Model/Converter/ArrayConverterInt64.html","kind":"module","full_name":"Clear::Model::Converter::ArrayConverterInt64","name":"ArrayConverterInt64","abstract":false,"locations":[{"filename":"src/clear/model/converters/array_converter.cr","line_number":21,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/array_converter.cr#L21"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Model/Converter","kind":"module","full_name":"Clear::Model::Converter","name":"Converter"},"class_methods":[{"html_id":"to_column(x):Array(Int64)|Nil-class-method","name":"to_column","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x) : Array(Int64) | Nil","args_html":"(x) : Array(Int64) | Nil","location":{"filename":"src/clear/model/converters/array_converter.cr","line_number":21,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/array_converter.cr#L21"},"def":{"name":"to_column","args":[{"name":"x","external_name":"x","restriction":""}],"return_type":"Array(::Int64) | ::Nil","visibility":"Public","body":"case x\nwhen Nil\n nil\nwhen ::Int64\n [x]\nwhen Array(::Int64)\n x\nwhen Array(::PG::Int64Array)\n x.map do |i|\n case i\n when ::Int64\n i\n else\n nil\n end\n end.compact\nwhen Array(::JSON::Any)\n x.map(&.as_i64)\nwhen ::JSON::Any\n if arr = x.as_a?\n arr.map(&.as_i64)\n else\n raise(\"Cannot convert from #{x.class} to Array(Int64) [1]\")\n end\nelse\n raise(\"Cannot convert from #{x.class} to Array(Int64) [2]\")\nend"}},{"html_id":"to_db(x:Array(Int64)|Nil):Clear::SQL::Any-class-method","name":"to_db","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Array(::Int64) | ::Nil"}],"args_string":"(x : Array(Int64) | Nil) : Clear::SQL::Any","args_html":"(x : Array(Int64) | Nil) : Clear::SQL::Any","location":{"filename":"src/clear/model/converters/array_converter.cr","line_number":21,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/array_converter.cr#L21"},"def":{"name":"to_db","args":[{"name":"x","external_name":"x","restriction":"Array(::Int64) | ::Nil"}],"return_type":"Clear::SQL::Any","visibility":"Public","body":"if x\nelse\n return\nend\nClear::Expression.unsafe({\"Array[\", to_string(x), \"]::bigint[]\"}.join)\n"}},{"html_id":"to_string(x):String-class-method","name":"to_string","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x) : String","args_html":"(x) : String","location":{"filename":"src/clear/model/converters/array_converter.cr","line_number":21,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/array_converter.cr#L21"},"def":{"name":"to_string","args":[{"name":"x","external_name":"x","restriction":""}],"return_type":"String","visibility":"Public","body":"case x\nwhen Array\n x.join(\", \") do |it|\n to_string(it)\n end\nelse\n \"\" + Clear::Expression[x]\nend"}}]},{"html_id":"clear/Clear/Model/Converter/ArrayConverterString","path":"Clear/Model/Converter/ArrayConverterString.html","kind":"module","full_name":"Clear::Model::Converter::ArrayConverterString","name":"ArrayConverterString","abstract":false,"locations":[{"filename":"src/clear/model/converters/array_converter.cr","line_number":21,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/array_converter.cr#L21"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Model/Converter","kind":"module","full_name":"Clear::Model::Converter","name":"Converter"},"class_methods":[{"html_id":"to_column(x):Array(String)|Nil-class-method","name":"to_column","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x) : Array(String) | Nil","args_html":"(x) : Array(String) | Nil","location":{"filename":"src/clear/model/converters/array_converter.cr","line_number":21,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/array_converter.cr#L21"},"def":{"name":"to_column","args":[{"name":"x","external_name":"x","restriction":""}],"return_type":"Array(::String) | ::Nil","visibility":"Public","body":"case x\nwhen Nil\n nil\nwhen ::String\n [x]\nwhen Array(::String)\n x\nwhen Array(::PG::StringArray)\n x.map do |i|\n case i\n when ::String\n i\n else\n nil\n end\n end.compact\nwhen Array(::JSON::Any)\n x.map(&.as_s)\nwhen ::JSON::Any\n if arr = x.as_a?\n arr.map(&.as_s)\n else\n raise(\"Cannot convert from #{x.class} to Array(String) [1]\")\n end\nelse\n raise(\"Cannot convert from #{x.class} to Array(String) [2]\")\nend"}},{"html_id":"to_db(x:Array(String)|Nil):Clear::SQL::Any-class-method","name":"to_db","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Array(::String) | ::Nil"}],"args_string":"(x : Array(String) | Nil) : Clear::SQL::Any","args_html":"(x : Array(String) | Nil) : Clear::SQL::Any","location":{"filename":"src/clear/model/converters/array_converter.cr","line_number":21,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/array_converter.cr#L21"},"def":{"name":"to_db","args":[{"name":"x","external_name":"x","restriction":"Array(::String) | ::Nil"}],"return_type":"Clear::SQL::Any","visibility":"Public","body":"if x\nelse\n return\nend\nClear::Expression.unsafe({\"Array[\", to_string(x), \"]::text[]\"}.join)\n"}},{"html_id":"to_string(x):String-class-method","name":"to_string","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x) : String","args_html":"(x) : String","location":{"filename":"src/clear/model/converters/array_converter.cr","line_number":21,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/array_converter.cr#L21"},"def":{"name":"to_string","args":[{"name":"x","external_name":"x","restriction":""}],"return_type":"String","visibility":"Public","body":"case x\nwhen Array\n x.join(\", \") do |it|\n to_string(it)\n end\nelse\n \"\" + Clear::Expression[x]\nend"}}]},{"html_id":"clear/Clear/Model/Converter/Base","path":"Clear/Model/Converter/Base.html","kind":"class","full_name":"Clear::Model::Converter::Base","name":"Base","abstract":true,"superclass":{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/model/converters/base.cr","line_number":5,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/base.cr#L5"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Model/Converter","kind":"module","full_name":"Clear::Model::Converter","name":"Converter"}},{"html_id":"clear/Clear/Model/Converter/BcryptPasswordConverter","path":"Clear/Model/Converter/BcryptPasswordConverter.html","kind":"module","full_name":"Clear::Model::Converter::BcryptPasswordConverter","name":"BcryptPasswordConverter","abstract":false,"locations":[{"filename":"src/clear/extensions/bcrypt/bcrypt.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/bcrypt/bcrypt.cr#L1"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Model/Converter","kind":"module","full_name":"Clear::Model::Converter","name":"Converter"},"class_methods":[{"html_id":"to_column(x):Crypto::Bcrypt::Password|Nil-class-method","name":"to_column","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x) : Crypto::Bcrypt::Password | Nil","args_html":"(x) : Crypto::Bcrypt::Password | Nil","location":{"filename":"src/clear/extensions/bcrypt/bcrypt.cr","line_number":2,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/bcrypt/bcrypt.cr#L2"},"def":{"name":"to_column","args":[{"name":"x","external_name":"x","restriction":""}],"return_type":"::Crypto::Bcrypt::Password | ::Nil","visibility":"Public","body":"case x\nwhen String\n ::Crypto::Bcrypt::Password.new(x)\nwhen ::Crypto::Bcrypt::Password\n x\nwhen Nil\n nil\nelse\n raise(Clear::ErrorMessages.converter_error(x.class.name, \"Crypto::Bcrypt::Password\"))\nend"}},{"html_id":"to_db(x:Crypto::Bcrypt::Password|Nil)-class-method","name":"to_db","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"::Crypto::Bcrypt::Password | ::Nil"}],"args_string":"(x : Crypto::Bcrypt::Password | Nil)","args_html":"(x : Crypto::Bcrypt::Password | Nil)","location":{"filename":"src/clear/extensions/bcrypt/bcrypt.cr","line_number":15,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/bcrypt/bcrypt.cr#L15"},"def":{"name":"to_db","args":[{"name":"x","external_name":"x","restriction":"::Crypto::Bcrypt::Password | ::Nil"}],"visibility":"Public","body":"case x\nwhen ::Union(::Crypto::Bcrypt::Password, ::Nil)\n x.to_s\nwhen Nil\n nil\nend"}}]},{"html_id":"clear/Clear/Model/Converter/BigDecimalConverter","path":"Clear/Model/Converter/BigDecimalConverter.html","kind":"class","full_name":"Clear::Model::Converter::BigDecimalConverter","name":"BigDecimalConverter","abstract":false,"superclass":{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/model/converters/number_converters.cr","line_number":43,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/number_converters.cr#L43"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Model/Converter","kind":"module","full_name":"Clear::Model::Converter","name":"Converter"},"doc":"Convert from and to BigDecimal","summary":"

Convert from and to BigDecimal

","class_methods":[{"html_id":"to_column(x):BigDecimal|Nil-class-method","name":"to_column","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x) : BigDecimal | Nil","args_html":"(x) : BigDecimal | Nil","location":{"filename":"src/clear/model/converters/number_converters.cr","line_number":43,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/number_converters.cr#L43"},"def":{"name":"to_column","args":[{"name":"x","external_name":"x","restriction":""}],"return_type":"BigDecimal | ::Nil","visibility":"Public","body":"case x\nwhen Nil\n nil\nwhen Number\n BigDecimal.new(x)\nelse\n BigDecimal.new(x.to_s)\nend"}},{"html_id":"to_db(x:BigDecimal|Nil)-class-method","name":"to_db","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"BigDecimal | ::Nil"}],"args_string":"(x : BigDecimal | Nil)","args_html":"(x : BigDecimal | Nil)","location":{"filename":"src/clear/model/converters/number_converters.cr","line_number":43,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/number_converters.cr#L43"},"def":{"name":"to_db","args":[{"name":"x","external_name":"x","restriction":"BigDecimal | ::Nil"}],"visibility":"Public","body":"x"}}]},{"html_id":"clear/Clear/Model/Converter/BigFloatConverter","path":"Clear/Model/Converter/BigFloatConverter.html","kind":"class","full_name":"Clear::Model::Converter::BigFloatConverter","name":"BigFloatConverter","abstract":false,"superclass":{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/model/converters/number_converters.cr","line_number":42,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/number_converters.cr#L42"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Model/Converter","kind":"module","full_name":"Clear::Model::Converter","name":"Converter"},"doc":"Convert from and to BigFloat","summary":"

Convert from and to BigFloat

","class_methods":[{"html_id":"to_column(x):BigFloat|Nil-class-method","name":"to_column","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x) : BigFloat | Nil","args_html":"(x) : BigFloat | Nil","location":{"filename":"src/clear/model/converters/number_converters.cr","line_number":42,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/number_converters.cr#L42"},"def":{"name":"to_column","args":[{"name":"x","external_name":"x","restriction":""}],"return_type":"BigFloat | ::Nil","visibility":"Public","body":"case x\nwhen Nil\n nil\nwhen Number\n BigFloat.new(x)\nelse\n BigFloat.new(x.to_s)\nend"}},{"html_id":"to_db(x:BigFloat|Nil)-class-method","name":"to_db","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"BigFloat | ::Nil"}],"args_string":"(x : BigFloat | Nil)","args_html":"(x : BigFloat | Nil)","location":{"filename":"src/clear/model/converters/number_converters.cr","line_number":42,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/number_converters.cr#L42"},"def":{"name":"to_db","args":[{"name":"x","external_name":"x","restriction":"BigFloat | ::Nil"}],"visibility":"Public","body":"x"}}]},{"html_id":"clear/Clear/Model/Converter/BigIntConverter","path":"Clear/Model/Converter/BigIntConverter.html","kind":"class","full_name":"Clear::Model::Converter::BigIntConverter","name":"BigIntConverter","abstract":false,"superclass":{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/model/converters/number_converters.cr","line_number":41,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/number_converters.cr#L41"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Model/Converter","kind":"module","full_name":"Clear::Model::Converter","name":"Converter"},"doc":"Convert from and to BigInt","summary":"

Convert from and to BigInt

","class_methods":[{"html_id":"to_column(x):BigInt|Nil-class-method","name":"to_column","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x) : BigInt | Nil","args_html":"(x) : BigInt | Nil","location":{"filename":"src/clear/model/converters/number_converters.cr","line_number":41,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/number_converters.cr#L41"},"def":{"name":"to_column","args":[{"name":"x","external_name":"x","restriction":""}],"return_type":"BigInt | ::Nil","visibility":"Public","body":"case x\nwhen Nil\n nil\nwhen Number\n BigInt.new(x)\nelse\n BigInt.new(x.to_s)\nend"}},{"html_id":"to_db(x:BigInt|Nil)-class-method","name":"to_db","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"BigInt | ::Nil"}],"args_string":"(x : BigInt | Nil)","args_html":"(x : BigInt | Nil)","location":{"filename":"src/clear/model/converters/number_converters.cr","line_number":41,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/number_converters.cr#L41"},"def":{"name":"to_db","args":[{"name":"x","external_name":"x","restriction":"BigInt | ::Nil"}],"visibility":"Public","body":"x"}}]},{"html_id":"clear/Clear/Model/Converter/BoolConverter","path":"Clear/Model/Converter/BoolConverter.html","kind":"module","full_name":"Clear::Model::Converter::BoolConverter","name":"BoolConverter","abstract":false,"locations":[{"filename":"src/clear/model/converters/bool_converter.cr","line_number":11,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/bool_converter.cr#L11"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Model/Converter","kind":"module","full_name":"Clear::Model::Converter","name":"Converter"},"doc":"Convert the column to a boolean\nIf value is not boolean (e.g. string or number), rules of `falsey`\nvalue is used:\n\nfalsey's values are:\n`false`, `nil`, `0`, `\"0\"`, `\"\"` (empty string), `\"false\"`, `\"f\"`\n\nAnything else is considered `true`","summary":"

Convert the column to a boolean If value is not boolean (e.g.

","class_methods":[{"html_id":"to_column(x):Bool|Nil-class-method","name":"to_column","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x) : Bool | Nil","args_html":"(x) : Bool | Nil","location":{"filename":"src/clear/model/converters/bool_converter.cr","line_number":12,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/bool_converter.cr#L12"},"def":{"name":"to_column","args":[{"name":"x","external_name":"x","restriction":""}],"return_type":"Bool | ::Nil","visibility":"Public","body":"case x\nwhen Nil\n nil\nwhen Bool\n x\nwhen Number\n x != 0\nwhen String\n x = x.downcase\n (((x != \"f\") && (x != \"false\")) && (x != \"\")) && (x != \"0\")\nelse\n true\nend"}},{"html_id":"to_db(x:Bool|Nil)-class-method","name":"to_db","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Bool | ::Nil"}],"args_string":"(x : Bool | Nil)","args_html":"(x : Bool | Nil)","location":{"filename":"src/clear/model/converters/bool_converter.cr","line_number":28,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/bool_converter.cr#L28"},"def":{"name":"to_db","args":[{"name":"x","external_name":"x","restriction":"Bool | ::Nil"}],"visibility":"Public","body":"x.nil? ? nil : (x ? \"t\" : \"f\")"}}]},{"html_id":"clear/Clear/Model/Converter/Float32Converter","path":"Clear/Model/Converter/Float32Converter.html","kind":"class","full_name":"Clear::Model::Converter::Float32Converter","name":"Float32Converter","abstract":false,"superclass":{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/model/converters/number_converters.cr","line_number":38,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/number_converters.cr#L38"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Model/Converter","kind":"module","full_name":"Clear::Model::Converter","name":"Converter"},"doc":"Convert from and to Float32","summary":"

Convert from and to Float32

","class_methods":[{"html_id":"to_column(x):Float32|Nil-class-method","name":"to_column","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x) : Float32 | Nil","args_html":"(x) : Float32 | Nil","location":{"filename":"src/clear/model/converters/number_converters.cr","line_number":38,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/number_converters.cr#L38"},"def":{"name":"to_column","args":[{"name":"x","external_name":"x","restriction":""}],"return_type":"Float32 | ::Nil","visibility":"Public","body":"case x\nwhen Nil\n nil\nwhen Number\n Float32.new(x)\nelse\n Float32.new(x.to_s)\nend"}},{"html_id":"to_db(x:Float32|Nil)-class-method","name":"to_db","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Float32 | ::Nil"}],"args_string":"(x : Float32 | Nil)","args_html":"(x : Float32 | Nil)","location":{"filename":"src/clear/model/converters/number_converters.cr","line_number":38,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/number_converters.cr#L38"},"def":{"name":"to_db","args":[{"name":"x","external_name":"x","restriction":"Float32 | ::Nil"}],"visibility":"Public","body":"x"}}]},{"html_id":"clear/Clear/Model/Converter/Float64Converter","path":"Clear/Model/Converter/Float64Converter.html","kind":"class","full_name":"Clear::Model::Converter::Float64Converter","name":"Float64Converter","abstract":false,"superclass":{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/model/converters/number_converters.cr","line_number":39,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/number_converters.cr#L39"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Model/Converter","kind":"module","full_name":"Clear::Model::Converter","name":"Converter"},"doc":"Convert from and to Float64","summary":"

Convert from and to Float64

","class_methods":[{"html_id":"to_column(x):Float64|Nil-class-method","name":"to_column","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x) : Float64 | Nil","args_html":"(x) : Float64 | Nil","location":{"filename":"src/clear/model/converters/number_converters.cr","line_number":39,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/number_converters.cr#L39"},"def":{"name":"to_column","args":[{"name":"x","external_name":"x","restriction":""}],"return_type":"Float64 | ::Nil","visibility":"Public","body":"case x\nwhen Nil\n nil\nwhen Number\n Float64.new(x)\nelse\n Float64.new(x.to_s)\nend"}},{"html_id":"to_db(x:Float64|Nil)-class-method","name":"to_db","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Float64 | ::Nil"}],"args_string":"(x : Float64 | Nil)","args_html":"(x : Float64 | Nil)","location":{"filename":"src/clear/model/converters/number_converters.cr","line_number":39,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/number_converters.cr#L39"},"def":{"name":"to_db","args":[{"name":"x","external_name":"x","restriction":"Float64 | ::Nil"}],"visibility":"Public","body":"x"}}]},{"html_id":"clear/Clear/Model/Converter/Int16Converter","path":"Clear/Model/Converter/Int16Converter.html","kind":"class","full_name":"Clear::Model::Converter::Int16Converter","name":"Int16Converter","abstract":false,"superclass":{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/model/converters/number_converters.cr","line_number":29,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/number_converters.cr#L29"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Model/Converter","kind":"module","full_name":"Clear::Model::Converter","name":"Converter"},"doc":"Convert from and to Int16","summary":"

Convert from and to Int16

","class_methods":[{"html_id":"to_column(x):Int16|Nil-class-method","name":"to_column","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x) : Int16 | Nil","args_html":"(x) : Int16 | Nil","location":{"filename":"src/clear/model/converters/number_converters.cr","line_number":29,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/number_converters.cr#L29"},"def":{"name":"to_column","args":[{"name":"x","external_name":"x","restriction":""}],"return_type":"Int16 | ::Nil","visibility":"Public","body":"case x\nwhen Nil\n nil\nwhen Number\n Int16.new(x)\nelse\n Int16.new(x.to_s)\nend"}},{"html_id":"to_db(x:Int16|Nil)-class-method","name":"to_db","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Int16 | ::Nil"}],"args_string":"(x : Int16 | Nil)","args_html":"(x : Int16 | Nil)","location":{"filename":"src/clear/model/converters/number_converters.cr","line_number":29,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/number_converters.cr#L29"},"def":{"name":"to_db","args":[{"name":"x","external_name":"x","restriction":"Int16 | ::Nil"}],"visibility":"Public","body":"x"}}]},{"html_id":"clear/Clear/Model/Converter/Int32Converter","path":"Clear/Model/Converter/Int32Converter.html","kind":"class","full_name":"Clear::Model::Converter::Int32Converter","name":"Int32Converter","abstract":false,"superclass":{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/model/converters/number_converters.cr","line_number":30,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/number_converters.cr#L30"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Model/Converter","kind":"module","full_name":"Clear::Model::Converter","name":"Converter"},"doc":"Convert from and to Int32","summary":"

Convert from and to Int32

","class_methods":[{"html_id":"to_column(x):Int32|Nil-class-method","name":"to_column","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x) : Int32 | Nil","args_html":"(x) : Int32 | Nil","location":{"filename":"src/clear/model/converters/number_converters.cr","line_number":30,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/number_converters.cr#L30"},"def":{"name":"to_column","args":[{"name":"x","external_name":"x","restriction":""}],"return_type":"Int32 | ::Nil","visibility":"Public","body":"case x\nwhen Nil\n nil\nwhen Number\n Int32.new(x)\nelse\n Int32.new(x.to_s)\nend"}},{"html_id":"to_db(x:Int32|Nil)-class-method","name":"to_db","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Int32 | ::Nil"}],"args_string":"(x : Int32 | Nil)","args_html":"(x : Int32 | Nil)","location":{"filename":"src/clear/model/converters/number_converters.cr","line_number":30,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/number_converters.cr#L30"},"def":{"name":"to_db","args":[{"name":"x","external_name":"x","restriction":"Int32 | ::Nil"}],"visibility":"Public","body":"x"}}]},{"html_id":"clear/Clear/Model/Converter/Int64Converter","path":"Clear/Model/Converter/Int64Converter.html","kind":"class","full_name":"Clear::Model::Converter::Int64Converter","name":"Int64Converter","abstract":false,"superclass":{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/model/converters/number_converters.cr","line_number":31,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/number_converters.cr#L31"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Model/Converter","kind":"module","full_name":"Clear::Model::Converter","name":"Converter"},"doc":"Convert from and to Int64","summary":"

Convert from and to Int64

","class_methods":[{"html_id":"to_column(x):Int64|Nil-class-method","name":"to_column","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x) : Int64 | Nil","args_html":"(x) : Int64 | Nil","location":{"filename":"src/clear/model/converters/number_converters.cr","line_number":31,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/number_converters.cr#L31"},"def":{"name":"to_column","args":[{"name":"x","external_name":"x","restriction":""}],"return_type":"Int64 | ::Nil","visibility":"Public","body":"case x\nwhen Nil\n nil\nwhen Number\n Int64.new(x)\nelse\n Int64.new(x.to_s)\nend"}},{"html_id":"to_db(x:Int64|Nil)-class-method","name":"to_db","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Int64 | ::Nil"}],"args_string":"(x : Int64 | Nil)","args_html":"(x : Int64 | Nil)","location":{"filename":"src/clear/model/converters/number_converters.cr","line_number":31,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/number_converters.cr#L31"},"def":{"name":"to_db","args":[{"name":"x","external_name":"x","restriction":"Int64 | ::Nil"}],"visibility":"Public","body":"x"}}]},{"html_id":"clear/Clear/Model/Converter/Int8Converter","path":"Clear/Model/Converter/Int8Converter.html","kind":"class","full_name":"Clear::Model::Converter::Int8Converter","name":"Int8Converter","abstract":false,"superclass":{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/model/converters/number_converters.cr","line_number":28,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/number_converters.cr#L28"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Model/Converter","kind":"module","full_name":"Clear::Model::Converter","name":"Converter"},"doc":"Convert from and to Int8","summary":"

Convert from and to Int8

","class_methods":[{"html_id":"to_column(x):Int8|Nil-class-method","name":"to_column","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x) : Int8 | Nil","args_html":"(x) : Int8 | Nil","location":{"filename":"src/clear/model/converters/number_converters.cr","line_number":28,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/number_converters.cr#L28"},"def":{"name":"to_column","args":[{"name":"x","external_name":"x","restriction":""}],"return_type":"Int8 | ::Nil","visibility":"Public","body":"case x\nwhen Nil\n nil\nwhen Number\n Int8.new(x)\nelse\n Int8.new(x.to_s)\nend"}},{"html_id":"to_db(x:Int8|Nil)-class-method","name":"to_db","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Int8 | ::Nil"}],"args_string":"(x : Int8 | Nil)","args_html":"(x : Int8 | Nil)","location":{"filename":"src/clear/model/converters/number_converters.cr","line_number":28,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/number_converters.cr#L28"},"def":{"name":"to_db","args":[{"name":"x","external_name":"x","restriction":"Int8 | ::Nil"}],"visibility":"Public","body":"x"}}]},{"html_id":"clear/Clear/Model/Converter/JSON","path":"Clear/Model/Converter/JSON.html","kind":"module","full_name":"Clear::Model::Converter::JSON","name":"JSON","abstract":false,"locations":[{"filename":"src/clear/model/converters/json_any_converter.cr","line_number":3,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/json_any_converter.cr#L3"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Model/Converter","kind":"module","full_name":"Clear::Model::Converter","name":"Converter"},"types":[{"html_id":"clear/Clear/Model/Converter/JSON/AnyConverter","path":"Clear/Model/Converter/JSON/AnyConverter.html","kind":"module","full_name":"Clear::Model::Converter::JSON::AnyConverter","name":"AnyConverter","abstract":false,"locations":[{"filename":"src/clear/model/converters/json_any_converter.cr","line_number":3,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/json_any_converter.cr#L3"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Model/Converter/JSON","kind":"module","full_name":"Clear::Model::Converter::JSON","name":"JSON"},"class_methods":[{"html_id":"to_column(x):::JSON::Any|Nil-class-method","name":"to_column","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x) : ::JSON::Any | Nil","args_html":"(x) : ::JSON::Any | Nil","location":{"filename":"src/clear/model/converters/json_any_converter.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/json_any_converter.cr#L4"},"def":{"name":"to_column","args":[{"name":"x","external_name":"x","restriction":""}],"return_type":"::JSON::Any | ::Nil","visibility":"Public","body":"case x\nwhen Nil\n nil\nwhen ::JSON::Any\n x\nwhen ::JSON::PullParser\n ::JSON::Any.new(x)\nelse\n ::JSON.parse(x.to_s)\nend"}},{"html_id":"to_db(x:::JSON::Any|Nil)-class-method","name":"to_db","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"::JSON::Any | ::Nil"}],"args_string":"(x : ::JSON::Any | Nil)","args_html":"(x : ::JSON::Any | Nil)","location":{"filename":"src/clear/model/converters/json_any_converter.cr","line_number":17,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/json_any_converter.cr#L17"},"def":{"name":"to_db","args":[{"name":"x","external_name":"x","restriction":"::JSON::Any | ::Nil"}],"visibility":"Public","body":"x.to_json"}}]}]},{"html_id":"clear/Clear/Model/Converter/StringConverter","path":"Clear/Model/Converter/StringConverter.html","kind":"class","full_name":"Clear::Model::Converter::StringConverter","name":"StringConverter","abstract":false,"superclass":{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/model/converters/string_converter.cr","line_number":3,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/string_converter.cr#L3"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Model/Converter","kind":"module","full_name":"Clear::Model::Converter","name":"Converter"},"class_methods":[{"html_id":"to_column(x):String|Nil-class-method","name":"to_column","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x) : String | Nil","args_html":"(x) : String | Nil","location":{"filename":"src/clear/model/converters/string_converter.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/string_converter.cr#L4"},"def":{"name":"to_column","args":[{"name":"x","external_name":"x","restriction":""}],"return_type":"String | ::Nil","visibility":"Public","body":"case x\nwhen Nil\n nil\nwhen Slice(UInt8)\n String.new(x)\nelse\n x.to_s\nend"}},{"html_id":"to_db(x:String|Nil)-class-method","name":"to_db","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"String | ::Nil"}],"args_string":"(x : String | Nil)","args_html":"(x : String | Nil)","location":{"filename":"src/clear/model/converters/string_converter.cr","line_number":15,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/string_converter.cr#L15"},"def":{"name":"to_db","args":[{"name":"x","external_name":"x","restriction":"String | ::Nil"}],"visibility":"Public","body":"x"}}]},{"html_id":"clear/Clear/Model/Converter/TimeConverter","path":"Clear/Model/Converter/TimeConverter.html","kind":"class","full_name":"Clear::Model::Converter::TimeConverter","name":"TimeConverter","abstract":false,"superclass":{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/model/converters/time_converter.cr","line_number":3,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/time_converter.cr#L3"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Model/Converter","kind":"module","full_name":"Clear::Model::Converter","name":"Converter"},"class_methods":[{"html_id":"to_column(x):Time|Nil-class-method","name":"to_column","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x) : Time | Nil","args_html":"(x) : Time | Nil","location":{"filename":"src/clear/model/converters/time_converter.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/time_converter.cr#L4"},"def":{"name":"to_column","args":[{"name":"x","external_name":"x","restriction":""}],"return_type":"Time | ::Nil","visibility":"Public","body":"case x\nwhen Nil\n nil\nwhen Time\n x.to_local\nelse\n time = x.to_s\n case time\n when /[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]+/\n Time.parse_local(x.to_s, \"%F %X.%L\")\n else\n Time::Format::RFC_3339.parse(time)\n end\nend"}},{"html_id":"to_db(x:Time|Nil)-class-method","name":"to_db","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Time | ::Nil"}],"args_string":"(x : Time | Nil)","args_html":"(x : Time | Nil)","location":{"filename":"src/clear/model/converters/time_converter.cr","line_number":21,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/time_converter.cr#L21"},"def":{"name":"to_db","args":[{"name":"x","external_name":"x","restriction":"Time | ::Nil"}],"visibility":"Public","body":"case x\nwhen Nil\n nil\nelse\n x.to_utc.to_s(Clear::Expression::DATABASE_DATE_TIME_FORMAT)\nend"}}]},{"html_id":"clear/Clear/Model/Converter/UInt16Converter","path":"Clear/Model/Converter/UInt16Converter.html","kind":"class","full_name":"Clear::Model::Converter::UInt16Converter","name":"UInt16Converter","abstract":false,"superclass":{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/model/converters/number_converters.cr","line_number":34,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/number_converters.cr#L34"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Model/Converter","kind":"module","full_name":"Clear::Model::Converter","name":"Converter"},"doc":"Convert from and to UInt16","summary":"

Convert from and to UInt16

","class_methods":[{"html_id":"to_column(x):UInt16|Nil-class-method","name":"to_column","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x) : UInt16 | Nil","args_html":"(x) : UInt16 | Nil","location":{"filename":"src/clear/model/converters/number_converters.cr","line_number":34,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/number_converters.cr#L34"},"def":{"name":"to_column","args":[{"name":"x","external_name":"x","restriction":""}],"return_type":"UInt16 | ::Nil","visibility":"Public","body":"case x\nwhen Nil\n nil\nwhen Number\n UInt16.new(x)\nelse\n UInt16.new(x.to_s)\nend"}},{"html_id":"to_db(x:UInt16|Nil)-class-method","name":"to_db","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"UInt16 | ::Nil"}],"args_string":"(x : UInt16 | Nil)","args_html":"(x : UInt16 | Nil)","location":{"filename":"src/clear/model/converters/number_converters.cr","line_number":34,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/number_converters.cr#L34"},"def":{"name":"to_db","args":[{"name":"x","external_name":"x","restriction":"UInt16 | ::Nil"}],"visibility":"Public","body":"x"}}]},{"html_id":"clear/Clear/Model/Converter/UInt32Converter","path":"Clear/Model/Converter/UInt32Converter.html","kind":"class","full_name":"Clear::Model::Converter::UInt32Converter","name":"UInt32Converter","abstract":false,"superclass":{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/model/converters/number_converters.cr","line_number":35,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/number_converters.cr#L35"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Model/Converter","kind":"module","full_name":"Clear::Model::Converter","name":"Converter"},"doc":"Convert from and to UInt32","summary":"

Convert from and to UInt32

","class_methods":[{"html_id":"to_column(x):UInt32|Nil-class-method","name":"to_column","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x) : UInt32 | Nil","args_html":"(x) : UInt32 | Nil","location":{"filename":"src/clear/model/converters/number_converters.cr","line_number":35,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/number_converters.cr#L35"},"def":{"name":"to_column","args":[{"name":"x","external_name":"x","restriction":""}],"return_type":"UInt32 | ::Nil","visibility":"Public","body":"case x\nwhen Nil\n nil\nwhen Number\n UInt32.new(x)\nelse\n UInt32.new(x.to_s)\nend"}},{"html_id":"to_db(x:UInt32|Nil)-class-method","name":"to_db","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"UInt32 | ::Nil"}],"args_string":"(x : UInt32 | Nil)","args_html":"(x : UInt32 | Nil)","location":{"filename":"src/clear/model/converters/number_converters.cr","line_number":35,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/number_converters.cr#L35"},"def":{"name":"to_db","args":[{"name":"x","external_name":"x","restriction":"UInt32 | ::Nil"}],"visibility":"Public","body":"x"}}]},{"html_id":"clear/Clear/Model/Converter/UInt64Converter","path":"Clear/Model/Converter/UInt64Converter.html","kind":"class","full_name":"Clear::Model::Converter::UInt64Converter","name":"UInt64Converter","abstract":false,"superclass":{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/model/converters/number_converters.cr","line_number":36,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/number_converters.cr#L36"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Model/Converter","kind":"module","full_name":"Clear::Model::Converter","name":"Converter"},"doc":"Convert from and to UInt64","summary":"

Convert from and to UInt64

","class_methods":[{"html_id":"to_column(x):UInt64|Nil-class-method","name":"to_column","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x) : UInt64 | Nil","args_html":"(x) : UInt64 | Nil","location":{"filename":"src/clear/model/converters/number_converters.cr","line_number":36,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/number_converters.cr#L36"},"def":{"name":"to_column","args":[{"name":"x","external_name":"x","restriction":""}],"return_type":"UInt64 | ::Nil","visibility":"Public","body":"case x\nwhen Nil\n nil\nwhen Number\n UInt64.new(x)\nelse\n UInt64.new(x.to_s)\nend"}},{"html_id":"to_db(x:UInt64|Nil)-class-method","name":"to_db","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"UInt64 | ::Nil"}],"args_string":"(x : UInt64 | Nil)","args_html":"(x : UInt64 | Nil)","location":{"filename":"src/clear/model/converters/number_converters.cr","line_number":36,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/number_converters.cr#L36"},"def":{"name":"to_db","args":[{"name":"x","external_name":"x","restriction":"UInt64 | ::Nil"}],"visibility":"Public","body":"x"}}]},{"html_id":"clear/Clear/Model/Converter/UInt8Converter","path":"Clear/Model/Converter/UInt8Converter.html","kind":"class","full_name":"Clear::Model::Converter::UInt8Converter","name":"UInt8Converter","abstract":false,"superclass":{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/model/converters/number_converters.cr","line_number":33,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/number_converters.cr#L33"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Model/Converter","kind":"module","full_name":"Clear::Model::Converter","name":"Converter"},"doc":"Convert from and to UInt8","summary":"

Convert from and to UInt8

","class_methods":[{"html_id":"to_column(x):UInt8|Nil-class-method","name":"to_column","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x) : UInt8 | Nil","args_html":"(x) : UInt8 | Nil","location":{"filename":"src/clear/model/converters/number_converters.cr","line_number":33,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/number_converters.cr#L33"},"def":{"name":"to_column","args":[{"name":"x","external_name":"x","restriction":""}],"return_type":"UInt8 | ::Nil","visibility":"Public","body":"case x\nwhen Nil\n nil\nwhen Number\n UInt8.new(x)\nelse\n UInt8.new(x.to_s)\nend"}},{"html_id":"to_db(x:UInt8|Nil)-class-method","name":"to_db","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"UInt8 | ::Nil"}],"args_string":"(x : UInt8 | Nil)","args_html":"(x : UInt8 | Nil)","location":{"filename":"src/clear/model/converters/number_converters.cr","line_number":33,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/number_converters.cr#L33"},"def":{"name":"to_db","args":[{"name":"x","external_name":"x","restriction":"UInt8 | ::Nil"}],"visibility":"Public","body":"x"}}]},{"html_id":"clear/Clear/Model/Converter/UUIDConverter","path":"Clear/Model/Converter/UUIDConverter.html","kind":"class","full_name":"Clear::Model::Converter::UUIDConverter","name":"UUIDConverter","abstract":false,"superclass":{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/extensions/uuid/uuid.cr","line_number":8,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/uuid/uuid.cr#L8"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Model/Converter","kind":"module","full_name":"Clear::Model::Converter","name":"Converter"},"doc":"Convert from UUID column to Crystal's UUID","summary":"

Convert from UUID column to Crystal's UUID

","class_methods":[{"html_id":"to_column(x):UUID|Nil-class-method","name":"to_column","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x) : UUID | Nil","args_html":"(x) : UUID | Nil","location":{"filename":"src/clear/extensions/uuid/uuid.cr","line_number":9,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/uuid/uuid.cr#L9"},"def":{"name":"to_column","args":[{"name":"x","external_name":"x","restriction":""}],"return_type":"UUID | ::Nil","visibility":"Public","body":"case x\nwhen String\n UUID.new(x)\nwhen Slice(UInt8)\n UUID.new(x)\nwhen UUID\n x\nwhen Nil\n nil\nelse\n raise(Clear::ErrorMessages.converter_error(x.class.name, \"UUID\"))\nend"}},{"html_id":"to_db(x:UUID|Nil)-class-method","name":"to_db","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"UUID | ::Nil"}],"args_string":"(x : UUID | Nil)","args_html":"(x : UUID | Nil)","location":{"filename":"src/clear/extensions/uuid/uuid.cr","line_number":24,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/uuid/uuid.cr#L24"},"def":{"name":"to_db","args":[{"name":"x","external_name":"x","restriction":"UUID | ::Nil"}],"visibility":"Public","body":"if x.nil?\n nil\nelse\n x.to_s\nend"}}]}]},{"html_id":"clear/Clear/Model/Error","path":"Clear/Model/Error.html","kind":"class","full_name":"Clear::Model::Error","name":"Error","abstract":false,"superclass":{"html_id":"clear/Exception","kind":"class","full_name":"Exception","name":"Exception"},"ancestors":[{"html_id":"clear/Exception","kind":"class","full_name":"Exception","name":"Exception"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/model/errors.cr","line_number":2,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/errors.cr#L2"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"subclasses":[{"html_id":"clear/Clear/Model/InvalidError","kind":"class","full_name":"Clear::Model::InvalidError","name":"InvalidError"},{"html_id":"clear/Clear/Model/ReadOnlyError","kind":"class","full_name":"Clear::Model::ReadOnlyError","name":"ReadOnlyError"}],"namespace":{"html_id":"clear/Clear/Model","kind":"module","full_name":"Clear::Model","name":"Model"}},{"html_id":"clear/Clear/Model/EventManager","path":"Clear/Model/EventManager.html","kind":"class","full_name":"Clear::Model::EventManager","name":"EventManager","abstract":false,"superclass":{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/model/event_manager.cr","line_number":5,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/event_manager.cr#L5"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"EVENT_CALLBACKS","name":"EVENT_CALLBACKS","value":"{} of EventKey => Array(HookFunction)"},{"id":"INHERITANCE_MAP","name":"INHERITANCE_MAP","value":"{} of String => String"}],"namespace":{"html_id":"clear/Clear/Model","kind":"module","full_name":"Clear::Model","name":"Model"},"doc":"Global storage for model lifecycle event management\n\nThis class acts as a storage and can trigger events\nThis class a singleton.","summary":"

Global storage for model lifecycle event management

","class_methods":[{"html_id":"add_inheritance(parent,child)-class-method","name":"add_inheritance","doc":"Map the inheritance between models. Events which belongs to parent model are triggered when child model lifecycle\nactions occurs","summary":"

Map the inheritance between models.

","abstract":false,"args":[{"name":"parent","external_name":"parent","restriction":""},{"name":"child","external_name":"child","restriction":""}],"args_string":"(parent, child)","args_html":"(parent, child)","location":{"filename":"src/clear/model/event_manager.cr","line_number":43,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/event_manager.cr#L43"},"def":{"name":"add_inheritance","args":[{"name":"parent","external_name":"parent","restriction":""},{"name":"child","external_name":"child","restriction":""}],"visibility":"Public","body":"INHERITANCE_MAP[child.to_s] = parent.to_s"}},{"html_id":"attach(klazz,direction:Symbol,event:Symbol,block:HookFunction)-class-method","name":"attach","doc":"Add an event for a specific class, to a specific direction (after or before), a specific event Symbol (validate, save, commit...)","summary":"

Add an event for a specific class, to a specific direction (after or before), a specific event Symbol (validate, save, commit...)

","abstract":false,"args":[{"name":"klazz","external_name":"klazz","restriction":""},{"name":"direction","external_name":"direction","restriction":"Symbol"},{"name":"event","external_name":"event","restriction":"Symbol"},{"name":"block","external_name":"block","restriction":"HookFunction"}],"args_string":"(klazz, direction : Symbol, event : Symbol, block : HookFunction)","args_html":"(klazz, direction : Symbol, event : Symbol, block : HookFunction)","location":{"filename":"src/clear/model/event_manager.cr","line_number":48,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/event_manager.cr#L48"},"def":{"name":"attach","args":[{"name":"klazz","external_name":"klazz","restriction":""},{"name":"direction","external_name":"direction","restriction":"Symbol"},{"name":"event","external_name":"event","restriction":"Symbol"},{"name":"block","external_name":"block","restriction":"HookFunction"}],"visibility":"Public","body":"tuple = {klazz.to_s, direction, event}\narr = EVENT_CALLBACKS.fetch(tuple) do\n [] of HookFunction\nend\narr.push(block)\nEVENT_CALLBACKS[tuple] = arr\n"}},{"html_id":"trigger(klazz,direction:Symbol,event:Symbol,mdl:Clear::Model)-class-method","name":"trigger","doc":"Trigger events callback for a specific model.\nDirection can be `:before` and `:after`\nIn case of `:before` direction, the events are called in reverse order:\n\n```\nbefore:\n- Last defined event\n- First defined event\naction\nafter:\n- First defined events\n- Last defined events\n```","summary":"

Trigger events callback for a specific model.

","abstract":false,"args":[{"name":"klazz","external_name":"klazz","restriction":""},{"name":"direction","external_name":"direction","restriction":"Symbol"},{"name":"event","external_name":"event","restriction":"Symbol"},{"name":"mdl","external_name":"mdl","restriction":"Clear::Model"}],"args_string":"(klazz, direction : Symbol, event : Symbol, mdl : Clear::Model)","args_html":"(klazz, direction : Symbol, event : Symbol, mdl : Clear::Model)","location":{"filename":"src/clear/model/event_manager.cr","line_number":25,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/event_manager.cr#L25"},"def":{"name":"trigger","args":[{"name":"klazz","external_name":"klazz","restriction":""},{"name":"direction","external_name":"direction","restriction":"Symbol"},{"name":"event","external_name":"event","restriction":"Symbol"},{"name":"mdl","external_name":"mdl","restriction":"Clear::Model"}],"visibility":"Public","body":"arr = EVENT_CALLBACKS.fetch({klazz.to_s, direction, event}) do\n [] of HookFunction\nend\nparent = INHERITANCE_MAP[klazz.to_s]?\nif direction == (:after)\n arr = arr.reverse\n arr.each(&.call(mdl))\n if parent.nil?\n else\n trigger(parent, direction, event, mdl)\n end\nelse\n if parent.nil?\n else\n trigger(parent, direction, event, mdl)\n end\n arr.each(&.call(mdl))\nend\n"}}],"types":[{"html_id":"clear/Clear/Model/EventManager/EventKey","path":"Clear/Model/EventManager/EventKey.html","kind":"alias","full_name":"Clear::Model::EventManager::EventKey","name":"EventKey","abstract":false,"locations":[{"filename":"src/clear/model/event_manager.cr","line_number":7,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/event_manager.cr#L7"}],"repository_name":"clear","program":false,"enum":false,"alias":true,"aliased":"Tuple(String, Symbol, Symbol)","aliased_html":"{String, Symbol, Symbol}","const":false,"namespace":{"html_id":"clear/Clear/Model/EventManager","kind":"class","full_name":"Clear::Model::EventManager","name":"EventManager"}},{"html_id":"clear/Clear/Model/EventManager/HookFunction","path":"Clear/Model/EventManager/HookFunction.html","kind":"alias","full_name":"Clear::Model::EventManager::HookFunction","name":"HookFunction","abstract":false,"locations":[{"filename":"src/clear/model/event_manager.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/event_manager.cr#L6"}],"repository_name":"clear","program":false,"enum":false,"alias":true,"aliased":"Proc(Clear::Model, Nil)","aliased_html":"Clear::Model -> Nil","const":false,"namespace":{"html_id":"clear/Clear/Model/EventManager","kind":"class","full_name":"Clear::Model::EventManager","name":"EventManager"}}]},{"html_id":"clear/Clear/Model/Factory","path":"Clear/Model/Factory.html","kind":"module","full_name":"Clear::Model::Factory","name":"Factory","abstract":false,"locations":[{"filename":"src/clear/model/factories/base.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/factories/base.cr#L1"},{"filename":"src/clear/model/factories/polymorphic_factory.cr","line_number":3,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/factories/polymorphic_factory.cr#L3"},{"filename":"src/clear/model/factories/simple_factory.cr","line_number":3,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/factories/simple_factory.cr#L3"},{"filename":"src/clear/model/factory.cr","line_number":3,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/factory.cr#L3"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"FACTORIES","name":"FACTORIES","value":"{\"Clear::Reflection::Column\" => ::Clear::Model::Factory::SimpleFactory(Clear::Reflection::Column).new, \"Clear::Reflection::Table\" => ::Clear::Model::Factory::SimpleFactory(Clear::Reflection::Table).new} of String => Clear::Model::Factory::Base"}],"namespace":{"html_id":"clear/Clear/Model","kind":"module","full_name":"Clear::Model","name":"Model"},"class_methods":[{"html_id":"build(type:String,h:Hash,cache:Clear::Model::QueryCache|Nil=nil,persisted=false,fetch_columns=false):Clear::Model-class-method","name":"build","abstract":false,"args":[{"name":"type","external_name":"type","restriction":"String"},{"name":"h","external_name":"h","restriction":"Hash"},{"name":"cache","default_value":"nil","external_name":"cache","restriction":"Clear::Model::QueryCache | ::Nil"},{"name":"persisted","default_value":"false","external_name":"persisted","restriction":""},{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"args_string":"(type : String, h : Hash, cache : Clear::Model::QueryCache | Nil = nil, persisted = false, fetch_columns = false) : Clear::Model","args_html":"(type : String, h : Hash, cache : Clear::Model::QueryCache | Nil = nil, persisted = false, fetch_columns = false) : Clear::Model","location":{"filename":"src/clear/model/factory.cr","line_number":10,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/factory.cr#L10"},"def":{"name":"build","args":[{"name":"type","external_name":"type","restriction":"String"},{"name":"h","external_name":"h","restriction":"Hash"},{"name":"cache","default_value":"nil","external_name":"cache","restriction":"Clear::Model::QueryCache | ::Nil"},{"name":"persisted","default_value":"false","external_name":"persisted","restriction":""},{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"return_type":"Clear::Model","visibility":"Public","body":"factory = FACTORIES[type].as(Base)\nfactory.build(h, cache, persisted, fetch_columns)\n"}},{"html_id":"build(type:T.class,h:Hash,cache:Clear::Model::QueryCache|Nil=nil,persisted=false,fetch_columns=false):TforallT-class-method","name":"build","abstract":false,"args":[{"name":"type","external_name":"type","restriction":"T.class"},{"name":"h","external_name":"h","restriction":"Hash"},{"name":"cache","default_value":"nil","external_name":"cache","restriction":"Clear::Model::QueryCache | ::Nil"},{"name":"persisted","default_value":"false","external_name":"persisted","restriction":""},{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"args_string":"(type : T.class, h : Hash, cache : Clear::Model::QueryCache | Nil = nil, persisted = false, fetch_columns = false) : T forall T","args_html":"(type : T.class, h : Hash, cache : Clear::Model::QueryCache | Nil = nil, persisted = false, fetch_columns = false) : T forall T","location":{"filename":"src/clear/model/factory.cr","line_number":22,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/factory.cr#L22"},"def":{"name":"build","args":[{"name":"type","external_name":"type","restriction":"T.class"},{"name":"h","external_name":"h","restriction":"Hash"},{"name":"cache","default_value":"nil","external_name":"cache","restriction":"Clear::Model::QueryCache | ::Nil"},{"name":"persisted","default_value":"false","external_name":"persisted","restriction":""},{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"return_type":"T","visibility":"Public","body":"(build(T.name, h, cache, persisted, fetch_columns)).as(T)"}}],"macros":[{"html_id":"add(type,factory)-macro","name":"add","abstract":false,"args":[{"name":"type","external_name":"type","restriction":""},{"name":"factory","external_name":"factory","restriction":""}],"args_string":"(type, factory)","args_html":"(type, factory)","location":{"filename":"src/clear/model/factory.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/factory.cr#L6"},"def":{"name":"add","args":[{"name":"type","external_name":"type","restriction":""},{"name":"factory","external_name":"factory","restriction":""}],"visibility":"Public","body":" \n{% Clear::Model::Factory::FACTORIES[type] = factory %}\n\n \n"}}],"types":[{"html_id":"clear/Clear/Model/Factory/Base","path":"Clear/Model/Factory/Base.html","kind":"module","full_name":"Clear::Model::Factory::Base","name":"Base","abstract":false,"locations":[{"filename":"src/clear/model/factories/base.cr","line_number":2,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/factories/base.cr#L2"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"clear/Clear/Model/Factory/PolymorphicFactory","kind":"class","full_name":"Clear::Model::Factory::PolymorphicFactory(T)","name":"PolymorphicFactory"},{"html_id":"clear/Clear/Model/Factory/SimpleFactory","kind":"class","full_name":"Clear::Model::Factory::SimpleFactory(T)","name":"SimpleFactory"}],"namespace":{"html_id":"clear/Clear/Model/Factory","kind":"module","full_name":"Clear::Model::Factory","name":"Factory"},"instance_methods":[{"html_id":"build(h:Hash(String,Clear::SQL::Any),cache:Clear::Model::QueryCache|Nil=nil,persisted:Bool=false,fetch_columns:Bool=false):Clear::Model-instance-method","name":"build","abstract":true,"args":[{"name":"h","external_name":"h","restriction":"Hash(String, ::Clear::SQL::Any)"},{"name":"cache","default_value":"nil","external_name":"cache","restriction":"Clear::Model::QueryCache | ::Nil"},{"name":"persisted","default_value":"false","external_name":"persisted","restriction":"Bool"},{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":"Bool"}],"args_string":"(h : Hash(String, Clear::SQL::Any), cache : Clear::Model::QueryCache | Nil = nil, persisted : Bool = false, fetch_columns : Bool = false) : Clear::Model","args_html":"(h : Hash(String, Clear::SQL::Any), cache : Clear::Model::QueryCache | Nil = nil, persisted : Bool = false, fetch_columns : Bool = false) : Clear::Model","location":{"filename":"src/clear/model/factories/base.cr","line_number":3,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/factories/base.cr#L3"},"def":{"name":"build","args":[{"name":"h","external_name":"h","restriction":"Hash(String, ::Clear::SQL::Any)"},{"name":"cache","default_value":"nil","external_name":"cache","restriction":"Clear::Model::QueryCache | ::Nil"},{"name":"persisted","default_value":"false","external_name":"persisted","restriction":"Bool"},{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":"Bool"}],"return_type":"Clear::Model","visibility":"Public","body":""}}]},{"html_id":"clear/Clear/Model/Factory/PolymorphicFactory","path":"Clear/Model/Factory/PolymorphicFactory.html","kind":"class","full_name":"Clear::Model::Factory::PolymorphicFactory(T)","name":"PolymorphicFactory","abstract":false,"superclass":{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"clear/Clear/Model/Factory/Base","kind":"module","full_name":"Clear::Model::Factory::Base","name":"Base"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/model/factories/polymorphic_factory.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/factories/polymorphic_factory.cr#L4"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"clear/Clear/Model/Factory/Base","kind":"module","full_name":"Clear::Model::Factory::Base","name":"Base"}],"namespace":{"html_id":"clear/Clear/Model/Factory","kind":"module","full_name":"Clear::Model::Factory","name":"Factory"},"constructors":[{"html_id":"new(type_field:String,self_class:String)-class-method","name":"new","abstract":false,"args":[{"name":"type_field","external_name":"type_field","restriction":"::String"},{"name":"self_class","external_name":"self_class","restriction":"::String"}],"args_string":"(type_field : String, self_class : String)","args_html":"(type_field : String, self_class : String)","location":{"filename":"src/clear/model/factories/polymorphic_factory.cr","line_number":9,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/factories/polymorphic_factory.cr#L9"},"def":{"name":"new","args":[{"name":"type_field","external_name":"type_field","restriction":"::String"},{"name":"self_class","external_name":"self_class","restriction":"::String"}],"visibility":"Public","body":"_ = PolymorphicFactory(T).allocate\n_.initialize(type_field, self_class)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"build(h:Hash(String,Clear::SQL::Any),cache:Clear::Model::QueryCache|Nil=nil,persisted:Bool=false,fetch_columns:Bool=false):Clear::Model-instance-method","name":"build","abstract":false,"args":[{"name":"h","external_name":"h","restriction":"Hash(String, ::Clear::SQL::Any)"},{"name":"cache","default_value":"nil","external_name":"cache","restriction":"Clear::Model::QueryCache | ::Nil"},{"name":"persisted","default_value":"false","external_name":"persisted","restriction":"Bool"},{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":"Bool"}],"args_string":"(h : Hash(String, Clear::SQL::Any), cache : Clear::Model::QueryCache | Nil = nil, persisted : Bool = false, fetch_columns : Bool = false) : Clear::Model","args_html":"(h : Hash(String, Clear::SQL::Any), cache : Clear::Model::QueryCache | Nil = nil, persisted : Bool = false, fetch_columns : Bool = false) : Clear::Model","location":{"filename":"src/clear/model/factories/polymorphic_factory.cr","line_number":12,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/factories/polymorphic_factory.cr#L12"},"def":{"name":"build","args":[{"name":"h","external_name":"h","restriction":"Hash(String, ::Clear::SQL::Any)"},{"name":"cache","default_value":"nil","external_name":"cache","restriction":"Clear::Model::QueryCache | ::Nil"},{"name":"persisted","default_value":"false","external_name":"persisted","restriction":"Bool"},{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":"Bool"}],"return_type":"Clear::Model","visibility":"Public","body":"v = h[@type_field]\ncase v\nwhen String\n if v == T.name\n {% if T.abstract? %}\n raise \"Cannot instantiate #{@type_field} because it is abstract class\"\n {% else %}\n T.new(v, h, cache, persisted, fetch_columns).as(Clear::Model)\n {% end %}\n else\n (Clear::Model::Factory.build(v, h, cache, persisted, fetch_columns)).as(Clear::Model)\n end\nwhen Nil\n raise(Clear::ErrorMessages.polymorphic_nil(@type_field))\nelse\n raise(Clear::ErrorMessages.polymorphic_nil(@type_field))\nend\n"}},{"html_id":"self_class:String-instance-method","name":"self_class","abstract":false,"location":{"filename":"src/clear/model/factories/polymorphic_factory.cr","line_number":7,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/factories/polymorphic_factory.cr#L7"},"def":{"name":"self_class","return_type":"String","visibility":"Public","body":"@self_class"}},{"html_id":"self_class=(self_class:String)-instance-method","name":"self_class=","abstract":false,"args":[{"name":"self_class","external_name":"self_class","restriction":"String"}],"args_string":"(self_class : String)","args_html":"(self_class : String)","location":{"filename":"src/clear/model/factories/polymorphic_factory.cr","line_number":7,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/factories/polymorphic_factory.cr#L7"},"def":{"name":"self_class=","args":[{"name":"self_class","external_name":"self_class","restriction":"String"}],"visibility":"Public","body":"@self_class = self_class"}},{"html_id":"type_field:String-instance-method","name":"type_field","abstract":false,"location":{"filename":"src/clear/model/factories/polymorphic_factory.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/factories/polymorphic_factory.cr#L6"},"def":{"name":"type_field","return_type":"String","visibility":"Public","body":"@type_field"}},{"html_id":"type_field=(type_field:String)-instance-method","name":"type_field=","abstract":false,"args":[{"name":"type_field","external_name":"type_field","restriction":"String"}],"args_string":"(type_field : String)","args_html":"(type_field : String)","location":{"filename":"src/clear/model/factories/polymorphic_factory.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/factories/polymorphic_factory.cr#L6"},"def":{"name":"type_field=","args":[{"name":"type_field","external_name":"type_field","restriction":"String"}],"visibility":"Public","body":"@type_field = type_field"}}]},{"html_id":"clear/Clear/Model/Factory/SimpleFactory","path":"Clear/Model/Factory/SimpleFactory.html","kind":"class","full_name":"Clear::Model::Factory::SimpleFactory(T)","name":"SimpleFactory","abstract":false,"superclass":{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"clear/Clear/Model/Factory/Base","kind":"module","full_name":"Clear::Model::Factory::Base","name":"Base"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/model/factories/simple_factory.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/factories/simple_factory.cr#L4"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"clear/Clear/Model/Factory/Base","kind":"module","full_name":"Clear::Model::Factory::Base","name":"Base"}],"namespace":{"html_id":"clear/Clear/Model/Factory","kind":"module","full_name":"Clear::Model::Factory","name":"Factory"},"instance_methods":[{"html_id":"build(h:Hash(String,Clear::SQL::Any),cache:Clear::Model::QueryCache|Nil=nil,persisted:Bool=false,fetch_columns:Bool=false):Clear::Model-instance-method","name":"build","abstract":false,"args":[{"name":"h","external_name":"h","restriction":"Hash(String, ::Clear::SQL::Any)"},{"name":"cache","default_value":"nil","external_name":"cache","restriction":"Clear::Model::QueryCache | ::Nil"},{"name":"persisted","default_value":"false","external_name":"persisted","restriction":"Bool"},{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":"Bool"}],"args_string":"(h : Hash(String, Clear::SQL::Any), cache : Clear::Model::QueryCache | Nil = nil, persisted : Bool = false, fetch_columns : Bool = false) : Clear::Model","args_html":"(h : Hash(String, Clear::SQL::Any), cache : Clear::Model::QueryCache | Nil = nil, persisted : Bool = false, fetch_columns : Bool = false) : Clear::Model","location":{"filename":"src/clear/model/factories/simple_factory.cr","line_number":7,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/factories/simple_factory.cr#L7"},"def":{"name":"build","args":[{"name":"h","external_name":"h","restriction":"Hash(String, ::Clear::SQL::Any)"},{"name":"cache","default_value":"nil","external_name":"cache","restriction":"Clear::Model::QueryCache | ::Nil"},{"name":"persisted","default_value":"false","external_name":"persisted","restriction":"Bool"},{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":"Bool"}],"return_type":"Clear::Model","visibility":"Public","body":"(T.new(h, cache, persisted, fetch_columns)).as(Clear::Model)"}}]}]},{"html_id":"clear/Clear/Model/FullTextSearchable","path":"Clear/Model/FullTextSearchable.html","kind":"module","full_name":"Clear::Model::FullTextSearchable","name":"FullTextSearchable","abstract":false,"locations":[{"filename":"src/clear/extensions/full_text_searchable/model.cr","line_number":87,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/full_text_searchable/model.cr#L87"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"clear/Clear/Model","kind":"module","full_name":"Clear::Model","name":"Model"}],"namespace":{"html_id":"clear/Clear/Model","kind":"module","full_name":"Clear::Model","name":"Model"},"doc":"Full text search plugin offers full integration with `tsvector` capabilities of\nPostgresql.\n\nIt allows you to query models through the text content of one or multiple fields.\n\n### The blog example\n\nLet's assume we have a blog and want to implement full text search over title and content:\n\n```\ncreate_table \"posts\" do |t|\n t.column :title, :string, null: false\n t.column :content, :string, null: false\n\n t.full_text_searchable on: [{\"title\", 'A'}, {\"content\", 'C'}]\nend\n```\n\nThis migration will create a 3rd column named `full_text_vector` of type `tsvector`,\na gin index, a trigger and a function to update automatically this column.\n\nOver the `on` keyword, `'{\"title\", 'A'}'` means it allows search of the content of \"title\", with level of priority (weight) \"A\", which tells postgres than title content is more meaningful than the article content itself.\n\nNow, let's build some models:\n\n```\n\n model Post\n include Clear::Model\n #...\n\n full_text_searchable\n end\n\n Post.create!({title: \"About poney\", content: \"Poney are cool\"})\n Post.create!({title: \"About dog and cat\", content: \"Cat and dog are cool. But not as much as poney\"})\n Post.create!({title: \"You won't believe: She raises her poney like as star!\", content: \"She's cool because poney are cool\"})\n```\n\nSearch is now easily done\n\n```\nPost.query.search(\"poney\") # Return all the articles !\n```\n\nObviously, search call can be chained:\n\n```\nuser = User.find! { email == \"some_email@example.com\" }\nPost.query.from_user(user).search(\"orm\")\n```\n\n### Additional parameters\n\n#### `catalog`\n\nSelect the catalog to use to build the tsquery. By default, `pg_catalog.english` is used.\n\n```\n# in your migration:\nt.full_text_searchable on: [{\"title\", 'A'}, {\"content\", 'C'}], catalog: \"pg_catalog.french\"\n\n# in your model\nfull_text_searchable catalog: \"pg_catalog.french\"\n```\n\nNote: For now, Clear doesn't offers dynamic selection of catalog (for let's say multi-lang service).\nIf your app need this feature, do not hesitate to open an issue.\n\n#### `trigger_name`, `function_name`\n\nIn migration, you can change the name generated for the trigger and the function, using theses two keys.\n\n#### `dest_field`\n\nThe field created in the database, which will contains your ts vector. Default is `full_text_vector`.\n\n```\n# in your migration\nt.full_text_searchable on: [{\"title\", 'A'}, {\"content\", 'C'}], dest_field: \"tsv\"\n\n# in your model\nfull_text_searchable \"tsv\"\n```","summary":"

Full text search plugin offers full integration with tsvector capabilities of Postgresql.

","class_methods":[{"html_id":"to_tsq(text)-class-method","name":"to_tsq","doc":"Parse client side text and generate string ready to be ingested by PG's `to_tsquery`.\n\nAuthor note: pg `to_tsquery` is awesome but can easily fail to parse.\n `search` method use then a wrapper text_to_search used to ensure than\n request is understood and produce ALWAYS legal string for `to_tsquery`\nThis is a good helper then to use with the input of your end-users !\n\nHowever, this helper can be improved, as it doesn't use all the features\nof tsvector (parentesis, OR operator etc...)","summary":"

Parse client side text and generate string ready to be ingested by PG's to_tsquery.

","abstract":false,"args":[{"name":"text","external_name":"text","restriction":""}],"args_string":"(text)","args_html":"(text)","location":{"filename":"src/clear/extensions/full_text_searchable/model.cr","line_number":185,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/full_text_searchable/model.cr#L185"},"def":{"name":"to_tsq","args":[{"name":"text","external_name":"text","restriction":""}],"visibility":"Public","body":"text = text.gsub(/\\+/, \" \")\ntokens = split_to_exp(text)\ntokens.join(\" & \") do |__temp_97|\n modifier, value = __temp_97\n if modifier == (:-)\n \"!\" + Clear::Expression[value]\n else\n Clear::Expression[value]\n end\nend\n"}}],"macros":[{"html_id":"full_text_searchable(through=\"full_text_vector\",catalog=\"pg_catalog.english\",scope_name=\"search\")-macro","name":"full_text_searchable","doc":"Set this model as searchable using tsvector","summary":"

Set this model as searchable using tsvector

","abstract":false,"args":[{"name":"through","default_value":"\"full_text_vector\"","external_name":"through","restriction":""},{"name":"catalog","default_value":"\"pg_catalog.english\"","external_name":"catalog","restriction":""},{"name":"scope_name","default_value":"\"search\"","external_name":"scope_name","restriction":""}],"args_string":"(through = \"full_text_vector\", catalog = \"pg_catalog.english\", scope_name = \"search\")","args_html":"(through = "full_text_vector", catalog = "pg_catalog.english", scope_name = "search")","location":{"filename":"src/clear/extensions/full_text_searchable/model.cr","line_number":89,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/full_text_searchable/model.cr#L89"},"def":{"name":"full_text_searchable","args":[{"name":"through","default_value":"\"full_text_vector\"","external_name":"through","restriction":""},{"name":"catalog","default_value":"\"pg_catalog.english\"","external_name":"catalog","restriction":""},{"name":"scope_name","default_value":"\"search\"","external_name":"scope_name","restriction":""}],"visibility":"Public","body":" column( \n{{ through.id }}\n : Clear::TSVector, presence: false)\n\n scope \"\n{{ scope_name.id }}\n\" do |str|\n table = self.item_class.table\n where \n{\n op(\n var(table, \"\n{{ through.id }}\n\"),\n to_tsquery(\n{{ catalog }}\n, Clear::Model::FullTextSearchable.to_tsq(str)),\n \"@@\"\n )\n }\n \nend\n \n"}}]},{"html_id":"clear/Clear/Model/HasColumns","path":"Clear/Model/HasColumns.html","kind":"module","full_name":"Clear::Model::HasColumns","name":"HasColumns","abstract":false,"locations":[{"filename":"src/clear/model/modules/has_columns.cr","line_number":5,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_columns.cr#L5"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"clear/Clear/Model","kind":"module","full_name":"Clear::Model","name":"Model"}],"namespace":{"html_id":"clear/Clear/Model","kind":"module","full_name":"Clear::Model","name":"Model"},"doc":"This module declare all the methods and macro related to columns in `Clear::Model`","summary":"

This module declare all the methods and macro related to columns in Clear::Model

","instance_methods":[{"html_id":"[](x):Clear::SQL::Any-instance-method","name":"[]","doc":"Access to direct SQL attributes given by the request used to build the model.\nAccess is read only and updating the model columns will not apply change to theses columns.\n\n```\nmodel = Model.query.select(\"MIN(id) as min_id\").first(fetch_columns: true)\nid = model[\"min_id\"].to_i32\n```","summary":"

Access to direct SQL attributes given by the request used to build the model.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x) : Clear::SQL::Any","args_html":"(x) : Clear::SQL::Any","location":{"filename":"src/clear/model/modules/has_columns.cr","line_number":72,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_columns.cr#L72"},"def":{"name":"[]","args":[{"name":"x","external_name":"x","restriction":""}],"return_type":"::Clear::SQL::Any","visibility":"Public","body":"attributes[x]"}},{"html_id":"[]?(x):Clear::SQL::Any-instance-method","name":"[]?","doc":"Access to direct SQL attributes given by the request and used to build the model\nor Nil if not found.\n\nAccess is read only and updating the model columns will not apply change to theses columns.\nYou must set `fetch_column: true` in your model to access the attributes.","summary":"

Access to direct SQL attributes given by the request and used to build the model or Nil if not found.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x) : Clear::SQL::Any","args_html":"(x) : Clear::SQL::Any","location":{"filename":"src/clear/model/modules/has_columns.cr","line_number":81,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_columns.cr#L81"},"def":{"name":"[]?","args":[{"name":"x","external_name":"x","restriction":""}],"return_type":"::Clear::SQL::Any","visibility":"Public","body":"attributes[x]?"}},{"html_id":"reset(h:Hash(String,_))-instance-method","name":"reset","doc":"See `reset(**t : **T)`","summary":"

See #reset(**t : **T)

","abstract":false,"args":[{"name":"h","external_name":"h","restriction":"Hash(String, _)"}],"args_string":"(h : Hash(String, _))","args_html":"(h : Hash(String, _))","location":{"filename":"src/clear/model/modules/has_columns.cr","line_number":35,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_columns.cr#L35"},"def":{"name":"reset","args":[{"name":"h","external_name":"h","restriction":"Hash(String, _)"}],"visibility":"Public","body":""}},{"html_id":"reset(h:Hash(Symbol,_))-instance-method","name":"reset","doc":"See `reset(**t : **T)`","summary":"

See #reset(**t : **T)

","abstract":false,"args":[{"name":"h","external_name":"h","restriction":"Hash(Symbol, _)"}],"args_string":"(h : Hash(Symbol, _))","args_html":"(h : Hash(Symbol, _))","location":{"filename":"src/clear/model/modules/has_columns.cr","line_number":39,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_columns.cr#L39"},"def":{"name":"reset","args":[{"name":"h","external_name":"h","restriction":"Hash(Symbol, _)"}],"visibility":"Public","body":""}},{"html_id":"reset(**t:**T)forallT-instance-method","name":"reset","doc":"Reset one or multiple columns; Reseting set the current value of the column\nto the given value, while the `changed?` flag remains false.\nIf you call save on a persisted model, the reset columns won't be\ncommited in the UPDATE query.","summary":"

Reset one or multiple columns; Reseting set the current value of the column to the given value, while the changed? flag remains false.

","abstract":false,"location":{"filename":"src/clear/model/modules/has_columns.cr","line_number":26,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_columns.cr#L26"},"def":{"name":"reset","double_splat":{"name":"t","external_name":"t","restriction":"**T"},"visibility":"Public","body":""}},{"html_id":"set(h:Hash(String,_))-instance-method","name":"set","doc":"See `set(**t : **T)`","summary":"

See #set(**t : **T)

","abstract":false,"args":[{"name":"h","external_name":"h","restriction":"Hash(String, _)"}],"args_string":"(h : Hash(String, _))","args_html":"(h : Hash(String, _))","location":{"filename":"src/clear/model/modules/has_columns.cr","line_number":58,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_columns.cr#L58"},"def":{"name":"set","args":[{"name":"h","external_name":"h","restriction":"Hash(String, _)"}],"visibility":"Public","body":""}},{"html_id":"set(h:Hash(Symbol,_))-instance-method","name":"set","doc":"See `set(**t : **T)`","summary":"

See #set(**t : **T)

","abstract":false,"args":[{"name":"h","external_name":"h","restriction":"Hash(Symbol, _)"}],"args_string":"(h : Hash(Symbol, _))","args_html":"(h : Hash(Symbol, _))","location":{"filename":"src/clear/model/modules/has_columns.cr","line_number":62,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_columns.cr#L62"},"def":{"name":"set","args":[{"name":"h","external_name":"h","restriction":"Hash(Symbol, _)"}],"visibility":"Public","body":""}},{"html_id":"set(**t:**T)forallT-instance-method","name":"set","doc":"Set one or multiple columns to a specific value\nThis two are equivalents:\n\n```\nmodel.set(a: 1)\nmodel.a = 1\n```","summary":"

Set one or multiple columns to a specific value This two are equivalents:

","abstract":false,"location":{"filename":"src/clear/model/modules/has_columns.cr","line_number":49,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_columns.cr#L49"},"def":{"name":"set","double_splat":{"name":"t","external_name":"t","restriction":"**T"},"visibility":"Public","body":""}},{"html_id":"to_h(full=false)-instance-method","name":"to_h","doc":"Returns the model columns as Hash.\nCalling `to_h` will returns only the defined columns, while settings the optional parameter `full` to `true`\n will return all the column and fill the undefined columns by `nil` values.\nExample:\n\n```\n# Assuming our model has a primary key, a first name and last name and two timestamp columns:\nmodel = Model.query.select(\"first_name, last_name\").first!\nmodel.to_h # => { \"first_name\" => \"Johnny\", \"last_name\" => \"Walker\" }\nmodel.to_h(full: true) # => {\"id\" => nil, \"first_name\" => \"Johnny\", \"last_name\" => \"Walker\", \"created_at\" => nil, \"updated_at\" => nil}\n```","summary":"

Returns the model columns as Hash.

","abstract":false,"args":[{"name":"full","default_value":"false","external_name":"full","restriction":""}],"args_string":"(full = false)","args_html":"(full = false)","location":{"filename":"src/clear/model/modules/has_columns.cr","line_number":110,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_columns.cr#L110"},"def":{"name":"to_h","args":[{"name":"full","default_value":"false","external_name":"full","restriction":""}],"visibility":"Public","body":"{} of String => ::Clear::SQL::Any"}},{"html_id":"update_h-instance-method","name":"update_h","doc":"Returns the current hash of the modified values:\n\n```\nmodel = Model.query.first!\nmodel.update_h # => {}\nmodel.first_name = \"hello\"\nmodel.update_h # => { \"first_name\" => \"hello\" }\nmodel.save!\nmodel.update_h # => {}\n```","summary":"

Returns the current hash of the modified values:

","abstract":false,"location":{"filename":"src/clear/model/modules/has_columns.cr","line_number":95,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_columns.cr#L95"},"def":{"name":"update_h","visibility":"Public","body":"{} of String => ::Clear::SQL::Any"}}],"macros":[{"html_id":"column(name,primary=false,converter=nil,column_name=nil,presence=true,mass_assign=true)-macro","name":"column","doc":"Bind a column to the model.\n\nSimple example:\n\n```\nclass MyModel\n include Clear::Model\n\n column some_id : Int32, primary: true\n column nullable_column : String?\nend\n```\noptions:\n\n* `primary : Bool`: Let Clear ORM know which column is the primary key.\nCurrently compound primary key are not compatible with Clear ORM.\n\n* `converter : Class | Module`: Use this class to convert the data from the\nSQL. This class must possess the class methods\n`to_column(::Clear::SQL::Any) : T` and `to_db(T) : ::Clear::SQL::Any`\nwith `T` the type of the column.\n\n* `column_name : String`: If the name of the column in the model doesn't fit the name of the\n column in the SQL, you can use the parameter `column_name` to tell Clear about\n which db column is linked to current field.\n\n* `presence : Bool (default = true)`: Use this option to let know Clear that\n your column is not nullable but with default value generated by the database\n on insert (e.g. serial)\nDuring validation before saving, the presence will not be checked on this field\n and Clear will try to insert without the field value.\n\n* `mass_assign : Bool (default = true)`: Use this option to turn on/ off mass assignment\n when instantiating or updating a new model from json through `.from_json` methods from\n the `Clear::Model::JSONDeserialize` module.\n","summary":"

Bind a column to the model.

","abstract":false,"args":[{"name":"name","external_name":"name","restriction":""},{"name":"primary","default_value":"false","external_name":"primary","restriction":""},{"name":"converter","default_value":"nil","external_name":"converter","restriction":""},{"name":"column_name","default_value":"nil","external_name":"column_name","restriction":""},{"name":"presence","default_value":"true","external_name":"presence","restriction":""},{"name":"mass_assign","default_value":"true","external_name":"mass_assign","restriction":""}],"args_string":"(name, primary = false, converter = nil, column_name = nil, presence = true, mass_assign = true)","args_html":"(name, primary = false, converter = nil, column_name = nil, presence = true, mass_assign = true)","location":{"filename":"src/clear/model/modules/has_columns.cr","line_number":150,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_columns.cr#L150"},"def":{"name":"column","args":[{"name":"name","external_name":"name","restriction":""},{"name":"primary","default_value":"false","external_name":"primary","restriction":""},{"name":"converter","default_value":"nil","external_name":"converter","restriction":""},{"name":"column_name","default_value":"nil","external_name":"column_name","restriction":""},{"name":"presence","default_value":"true","external_name":"presence","restriction":""},{"name":"mass_assign","default_value":"true","external_name":"mass_assign","restriction":""}],"visibility":"Public","body":" \n{% _type = name.type %}\n\n \n{% unless converter\n if _type.is_a?(Path)\n if _type.resolve.stringify =~ (/\\(/)\n converter = _type.stringify\n else\n converter = _type.resolve.stringify\n end\n else\n if _type.is_a?(Generic)\n if _type.name.stringify == \"::Union\"\n converter = (_type.type_vars.map(&.resolve).map(&.stringify).sort.reject do |x|\n (x == \"Nil\") || (x == \"::Nil\")\n end.join(\"\")).id.stringify\n else\n converter = _type.resolve.stringify\n end\n else\n if _type.is_a?(Union)\n converter = (_type.types.map(&.resolve).map(&.stringify).sort.reject do |x|\n (x == \"Nil\") || (x == \"::Nil\")\n end.join(\"\")).id.stringify\n else\n raise(\"Unknown: #{_type}, #{_type.class}\")\n end\n end\n end\nend %}\n\n\n \n{% db_column_name = column_name == nil ? name.var : column_name.id\nCOLUMNS[\"#{db_column_name.id}\"] = {type: _type, primary: primary, converter: converter, db_column_name: \"#{db_column_name.id}\", crystal_variable_name: name.var, presence: presence, mass_assign: mass_assign}\n %}\n\n \n"}}]},{"html_id":"clear/Clear/Model/HasFactory","path":"Clear/Model/HasFactory.html","kind":"module","full_name":"Clear::Model::HasFactory","name":"HasFactory","abstract":false,"locations":[{"filename":"src/clear/model/modules/has_factory.cr","line_number":3,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_factory.cr#L3"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"clear/Clear/Model","kind":"module","full_name":"Clear::Model","name":"Model"}],"namespace":{"html_id":"clear/Clear/Model","kind":"module","full_name":"Clear::Model","name":"Model"},"macros":[{"html_id":"polymorphic(through=\"type\")-macro","name":"polymorphic","doc":"Define a polymorphic factory, if the model is tagged as polymorphic","summary":"

Define a polymorphic factory, if the model is tagged as polymorphic

","abstract":false,"args":[{"name":"through","default_value":"\"type\"","external_name":"through","restriction":""}],"args_string":"(through = \"type\")","args_html":"(through = "type")","location":{"filename":"src/clear/model/modules/has_factory.cr","line_number":36,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_factory.cr#L36"},"def":{"name":"polymorphic","args":[{"name":"through","default_value":"\"type\"","external_name":"through","restriction":""}],"visibility":"Public","body":" \n{% POLYMORPHISM_SETTINGS[:has_factory] = true %}\n\n\n column \n{{ through.id }}\n : String\n\n before(:validate) do |model|\n model = model.as(self)\n model.\n{{ through.id }}\n = model.class.name\n \nend\n\n \n# Subclasses are refined using a default scope\n\n \n# to filter by type.\n\n macro inherited\n class Collection < Clear::Model::CollectionBase(\n\\{\n{@type}}); \nend\n\n def self.query\n Collection.new.from(table).where \n{ \n{{ through.id }}\n == self.name }\n \nend\n \nend\n\n \n# Base class can be refined too, only if the baseclass is not abstract.\n\n \n{% if @type.abstract? %}{% else %}\n def self.query\n Collection.new.from(table).where { {{ through.id }} == self.name }\n end\n {% end %}\n\n\n def self.polymorphic?\n true\n \nend\n\n Clear::Model::Factory.add(\n \"\n{{ @type }}\n\",\n Clear::Model::Factory::PolymorphicFactory(\n{{ @type }}\n).new(\n{{ through.id.stringify }}\n, \"\n{{ @type }}\n\")\n )\n\n macro inherited\n Clear::Model::Factory.add(\n \"\n\\{\n{@type}}\",\n Clear::Model::Factory::SimpleFactory(\n\\{\n{@type}}).new\n )\n \nend\n \n"}}]},{"html_id":"clear/Clear/Model/HasHooks","path":"Clear/Model/HasHooks.html","kind":"module","full_name":"Clear::Model::HasHooks","name":"HasHooks","abstract":false,"locations":[{"filename":"src/clear/model/modules/has_hooks.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_hooks.cr#L1"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"clear/Clear/Model","kind":"module","full_name":"Clear::Model","name":"Model"}],"namespace":{"html_id":"clear/Clear/Model","kind":"module","full_name":"Clear::Model","name":"Model"},"instance_methods":[{"html_id":"trigger_after_events(event_name)-instance-method","name":"trigger_after_events","doc":"Triggers the events hooked after `event_name`","summary":"

Triggers the events hooked after event_name

","abstract":false,"args":[{"name":"event_name","external_name":"event_name","restriction":""}],"args_string":"(event_name)","args_html":"(event_name)","location":{"filename":"src/clear/model/modules/has_hooks.cr","line_number":30,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_hooks.cr#L30"},"def":{"name":"trigger_after_events","args":[{"name":"event_name","external_name":"event_name","restriction":""}],"visibility":"Public","body":"Clear::Model::EventManager.trigger(self.class, :after, event_name, self)"}},{"html_id":"trigger_before_events(event_name)-instance-method","name":"trigger_before_events","doc":"Triggers the events hooked before `event_name`","summary":"

Triggers the events hooked before event_name

","abstract":false,"args":[{"name":"event_name","external_name":"event_name","restriction":""}],"args_string":"(event_name)","args_html":"(event_name)","location":{"filename":"src/clear/model/modules/has_hooks.cr","line_number":25,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_hooks.cr#L25"},"def":{"name":"trigger_before_events","args":[{"name":"event_name","external_name":"event_name","restriction":""}],"visibility":"Public","body":"Clear::Model::EventManager.trigger(self.class, :before, event_name, self)"}},{"html_id":"with_triggers(event_name,&)-instance-method","name":"with_triggers","doc":"This performs theses operations:\n\n- Call triggers `before` the event\n- Yield the given block\n- Call triggers `after` the event\n\n```\nmodel.with_triggers(\"email_sent\") do |m|\n model.send_email\nend\n```\n\nReturns `self`","summary":"

This performs theses operations:

","abstract":false,"args":[{"name":"event_name","external_name":"event_name","restriction":""}],"args_string":"(event_name, &)","args_html":"(event_name, &)","location":{"filename":"src/clear/model/modules/has_hooks.cr","line_number":15,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_hooks.cr#L15"},"def":{"name":"with_triggers","args":[{"name":"event_name","external_name":"event_name","restriction":""}],"yields":1,"block_arity":1,"visibility":"Public","body":"Clear::SQL.transaction do |cnx|\n trigger_before_events(event_name)\n yield(cnx)\n trigger_after_events(event_name)\nend\nself\n"}}],"macros":[{"html_id":"after(event_name,method_name)-macro","name":"after","abstract":false,"args":[{"name":"event_name","external_name":"event_name","restriction":""},{"name":"method_name","external_name":"method_name","restriction":""}],"args_string":"(event_name, method_name)","args_html":"(event_name, method_name)","location":{"filename":"src/clear/model/modules/has_hooks.cr","line_number":50,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_hooks.cr#L50"},"def":{"name":"after","args":[{"name":"event_name","external_name":"event_name","restriction":""},{"name":"method_name","external_name":"method_name","restriction":""}],"visibility":"Public","body":" after(\n{{ event_name }}\n) \n{ |mdl|\n mdl.as(\n{{ @type }}\n).\n{{ method_name.id }}\n\n }\n \n"}},{"html_id":"before(event_name,method_name)-macro","name":"before","abstract":false,"args":[{"name":"event_name","external_name":"event_name","restriction":""},{"name":"method_name","external_name":"method_name","restriction":""}],"args_string":"(event_name, method_name)","args_html":"(event_name, method_name)","location":{"filename":"src/clear/model/modules/has_hooks.cr","line_number":44,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_hooks.cr#L44"},"def":{"name":"before","args":[{"name":"event_name","external_name":"event_name","restriction":""},{"name":"method_name","external_name":"method_name","restriction":""}],"visibility":"Public","body":" before(\n{{ event_name }}\n) \n{ |mdl|\n mdl.as(\n{{ @type }}\n).\n{{ method_name.id }}\n\n }\n \n"}}],"types":[{"html_id":"clear/Clear/Model/HasHooks/ClassMethods","path":"Clear/Model/HasHooks/ClassMethods.html","kind":"module","full_name":"Clear::Model::HasHooks::ClassMethods","name":"ClassMethods","abstract":false,"locations":[{"filename":"src/clear/model/modules/has_hooks.cr","line_number":34,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_hooks.cr#L34"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Model/HasHooks","kind":"module","full_name":"Clear::Model::HasHooks","name":"HasHooks"},"instance_methods":[{"html_id":"after(event_name:Symbol,&block:Clear::Model->Nil)-instance-method","name":"after","abstract":false,"args":[{"name":"event_name","external_name":"event_name","restriction":"Symbol"}],"args_string":"(event_name : Symbol, &block : Clear::Model -> Nil)","args_html":"(event_name : Symbol, &block : Clear::Model -> Nil)","location":{"filename":"src/clear/model/modules/has_hooks.cr","line_number":39,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_hooks.cr#L39"},"def":{"name":"after","args":[{"name":"event_name","external_name":"event_name","restriction":"Symbol"}],"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Clear::Model -> Nil)"},"visibility":"Public","body":"Clear::Model::EventManager.attach(self, :after, event_name, block)"}},{"html_id":"before(event_name:Symbol,&block:Clear::Model->Nil)-instance-method","name":"before","abstract":false,"args":[{"name":"event_name","external_name":"event_name","restriction":"Symbol"}],"args_string":"(event_name : Symbol, &block : Clear::Model -> Nil)","args_html":"(event_name : Symbol, &block : Clear::Model -> Nil)","location":{"filename":"src/clear/model/modules/has_hooks.cr","line_number":35,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_hooks.cr#L35"},"def":{"name":"before","args":[{"name":"event_name","external_name":"event_name","restriction":"Symbol"}],"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Clear::Model -> Nil)"},"visibility":"Public","body":"Clear::Model::EventManager.attach(self, :before, event_name, block)"}}]}]},{"html_id":"clear/Clear/Model/HasRelations","path":"Clear/Model/HasRelations.html","kind":"module","full_name":"Clear::Model::HasRelations","name":"HasRelations","abstract":false,"locations":[{"filename":"src/clear/model/modules/has_relations.cr","line_number":13,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_relations.cr#L13"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"clear/Clear/Model","kind":"module","full_name":"Clear::Model","name":"Model"}],"namespace":{"html_id":"clear/Clear/Model","kind":"module","full_name":"Clear::Model","name":"Model"},"doc":"```\nclass Model\n include Clear::Model\n\n has_many posts : Post, foreign_key: Model.underscore_name + \"_id\", no_cache : false\n\n has_one passport : Passport\n has_many posts\nend\n```","summary":"
","macros":[{"html_id":"belongs_to(name,foreign_key=nil,no_cache=false,primary=false,foreign_key_type=Int64)-macro","name":"belongs_to","doc":"```\nclass Model\n include Clear::Model\n\n belongs_to user : User, foreign_key: \"the_user_id\"\nend\n```","summary":"
","abstract":false,"args":[{"name":"name","external_name":"name","restriction":""},{"name":"foreign_key","default_value":"nil","external_name":"foreign_key","restriction":""},{"name":"no_cache","default_value":"false","external_name":"no_cache","restriction":""},{"name":"primary","default_value":"false","external_name":"primary","restriction":""},{"name":"foreign_key_type","default_value":"Int64","external_name":"foreign_key_type","restriction":""}],"args_string":"(name, foreign_key = nil, no_cache = false, primary = false, foreign_key_type = Int64)","args_html":"(name, foreign_key = nil, no_cache = false, primary = false, foreign_key_type = Int64)","location":{"filename":"src/clear/model/modules/has_relations.cr","line_number":120,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_relations.cr#L120"},"def":{"name":"belongs_to","args":[{"name":"name","external_name":"name","restriction":""},{"name":"foreign_key","default_value":"nil","external_name":"foreign_key","restriction":""},{"name":"no_cache","default_value":"false","external_name":"no_cache","restriction":""},{"name":"primary","default_value":"false","external_name":"primary","restriction":""},{"name":"foreign_key_type","default_value":"Int64","external_name":"foreign_key_type","restriction":""}],"visibility":"Public","body":" \n{% if foreign_key.is_a?(SymbolLiteral) || foreign_key.is_a?(StringLiteral)\n foreign_key = foreign_key.id\nend\nnilable = false\nif name.type.is_a?(Union)\n types = name.type.types.map do |x|\n \"#{x.id}\"\n end\n nilable = types.includes?(\"Nil\")\n type = name.type.types.first\nelse\n type = name.type\nend\nif nilable\n unless foreign_key_type.resolve.nilable?\n foreign_key_type = \"#{foreign_key_type.id}?\".id\n end\nend\nRELATIONS[name.var.id] = {relation_type: :belongs_to, type: type, foreign_key: foreign_key, nilable: nilable, primary: primary, no_cache: no_cache, foreign_key_type: foreign_key_type}\n %}\n\n \n"}},{"html_id":"has_many(name,through=nil,foreign_key=nil,own_key=nil,primary_key=nil,no_cache=false,polymorphic=false,foreign_key_type=nil)-macro","name":"has_many","doc":"Has Many and Has One are the relations where the model share its primary key into a foreign table. In our example above, we can assume than a User has many Post as author.\n\nBasically, for each `belongs_to` declaration, you must have a `has_many` or `has_one` declaration on the other model.\n\nWhile `has_many` relation returns a list of models, `has_one` returns only one model when called.\n\nExample:\n\n```\nclass User\n include Clear::Model\n\n has_many posts : Post, foreign_key: \"author_id\"\nend\n```","summary":"

Has Many and Has One are the relations where the model share its primary key into a foreign table.

","abstract":false,"args":[{"name":"name","external_name":"name","restriction":""},{"name":"through","default_value":"nil","external_name":"through","restriction":""},{"name":"foreign_key","default_value":"nil","external_name":"foreign_key","restriction":""},{"name":"own_key","default_value":"nil","external_name":"own_key","restriction":""},{"name":"primary_key","default_value":"nil","external_name":"primary_key","restriction":""},{"name":"no_cache","default_value":"false","external_name":"no_cache","restriction":""},{"name":"polymorphic","default_value":"false","external_name":"polymorphic","restriction":""},{"name":"foreign_key_type","default_value":"nil","external_name":"foreign_key_type","restriction":""}],"args_string":"(name, through = nil, foreign_key = nil, own_key = nil, primary_key = nil, no_cache = false, polymorphic = false, foreign_key_type = nil)","args_html":"(name, through = nil, foreign_key = nil, own_key = nil, primary_key = nil, no_cache = false, polymorphic = false, foreign_key_type = nil)","location":{"filename":"src/clear/model/modules/has_relations.cr","line_number":72,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_relations.cr#L72"},"def":{"name":"has_many","args":[{"name":"name","external_name":"name","restriction":""},{"name":"through","default_value":"nil","external_name":"through","restriction":""},{"name":"foreign_key","default_value":"nil","external_name":"foreign_key","restriction":""},{"name":"own_key","default_value":"nil","external_name":"own_key","restriction":""},{"name":"primary_key","default_value":"nil","external_name":"primary_key","restriction":""},{"name":"no_cache","default_value":"false","external_name":"no_cache","restriction":""},{"name":"polymorphic","default_value":"false","external_name":"polymorphic","restriction":""},{"name":"foreign_key_type","default_value":"nil","external_name":"foreign_key_type","restriction":""}],"visibility":"Public","body":" \n{% if through != nil\n if through.is_a?(SymbolLiteral) || through.is_a?(StringLiteral)\n through = through.id\n end\n if own_key.is_a?(SymbolLiteral) || own_key.is_a?(StringLiteral)\n own_key = own_key.id\n end\n if foreign_key.is_a?(SymbolLiteral) || foreign_key.is_a?(StringLiteral)\n foreign_key = foreign_key.id\n end\n if foreign_key_type.is_a?(SymbolLiteral) || foreign_key_type.is_a?(StringLiteral)\n foreign_key_type = foreign_key_type.id\n end\n RELATIONS[name.var.id] = {relation_type: :has_many_through, type: name.type, through: through, own_key: own_key, foreign_key: foreign_key, foreign_key_type: foreign_key_type, polymorphic: polymorphic}\nelse\n if foreign_key.is_a?(SymbolLiteral) || foreign_key.is_a?(StringLiteral)\n foreign_key = foreign_key.id\n end\n if primary_key.is_a?(SymbolLiteral) || primary_key.is_a?(StringLiteral)\n primary_key = primary_key.id\n end\n if foreign_key_type.is_a?(SymbolLiteral) || foreign_key_type.is_a?(StringLiteral)\n foreign_key_type = foreign_key_type.id\n end\n RELATIONS[name.var.id] = {relation_type: :has_many, type: name.type, foreign_key: foreign_key, primary_key: primary_key, foreign_key_type: foreign_key_type, no_cache: no_cache, polymorphic: polymorphic}\nend %}\n\n \n"}},{"html_id":"has_one(name,foreign_key=nil,primary_key=nil,no_cache=false,polymorphic=false,foreign_key_type=nil)-macro","name":"has_one","doc":"The method `has_one` declare a relation 1 to [0,1]\nwhere the current model primary key is stored in the foreign table.\n`primary_key` method (default: `self#__pkey__`) and `foreign_key` method\n(default: table_name in singular, plus \"_id\" appended)\ncan be redefined\n\nExample:\n\n```\nmodel Passport\n column id : Int32, primary : true\n has_one user : User It assumes the table `users` have a column `passport_id`\nend\n\nmodel Passport\n column id : Int32, primary : true\n has_one owner : User # It assumes the table `users` have a column `passport_id`\nend\n```","summary":"

The method has_one declare a relation 1 to [0,1] where the current model primary key is stored in the foreign table.

","abstract":false,"args":[{"name":"name","external_name":"name","restriction":""},{"name":"foreign_key","default_value":"nil","external_name":"foreign_key","restriction":""},{"name":"primary_key","default_value":"nil","external_name":"primary_key","restriction":""},{"name":"no_cache","default_value":"false","external_name":"no_cache","restriction":""},{"name":"polymorphic","default_value":"false","external_name":"polymorphic","restriction":""},{"name":"foreign_key_type","default_value":"nil","external_name":"foreign_key_type","restriction":""}],"args_string":"(name, foreign_key = nil, primary_key = nil, no_cache = false, polymorphic = false, foreign_key_type = nil)","args_html":"(name, foreign_key = nil, primary_key = nil, no_cache = false, polymorphic = false, foreign_key_type = nil)","location":{"filename":"src/clear/model/modules/has_relations.cr","line_number":40,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_relations.cr#L40"},"def":{"name":"has_one","args":[{"name":"name","external_name":"name","restriction":""},{"name":"foreign_key","default_value":"nil","external_name":"foreign_key","restriction":""},{"name":"primary_key","default_value":"nil","external_name":"primary_key","restriction":""},{"name":"no_cache","default_value":"false","external_name":"no_cache","restriction":""},{"name":"polymorphic","default_value":"false","external_name":"polymorphic","restriction":""},{"name":"foreign_key_type","default_value":"nil","external_name":"foreign_key_type","restriction":""}],"visibility":"Public","body":" \n{% if foreign_key.is_a?(SymbolLiteral) || foreign_key.is_a?(StringLiteral)\n foreign_key = foreign_key.id\nend\nif primary_key.is_a?(SymbolLiteral) || primary_key.is_a?(StringLiteral)\n primary_key = primary_key.id\nend\nRELATIONS[name.var.id] = {relation_type: :has_one, type: name.type, foreign_key: foreign_key, primary_key: primary_key, no_cache: no_cache}\n %}\n\n \n"}}]},{"html_id":"clear/Clear/Model/HasSaving","path":"Clear/Model/HasSaving.html","kind":"module","full_name":"Clear::Model::HasSaving","name":"HasSaving","abstract":false,"locations":[{"filename":"src/clear/model/modules/has_saving.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_saving.cr#L1"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"clear/Clear/Model","kind":"module","full_name":"Clear::Model","name":"Model"}],"namespace":{"html_id":"clear/Clear/Model","kind":"module","full_name":"Clear::Model","name":"Model"},"instance_methods":[{"html_id":"delete-instance-method","name":"delete","doc":" Delete the model by building and executing a `DELETE` query.\n A deleted model is not persisted anymore, and can be saved again.\n Clear will do `INSERT` instead of `UPDATE` then\n Return `true` if the model has been successfully deleted, and `false` otherwise.","summary":"

Delete the model by building and executing a DELETE query.

","abstract":false,"location":{"filename":"src/clear/model/modules/has_saving.cr","line_number":184,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_saving.cr#L184"},"def":{"name":"delete","visibility":"Public","body":"if persisted?\nelse\n return false\nend\nwith_triggers(:delete) do\n (Clear::SQL::DeleteQuery.new.from(self.class.full_table_name)).where do\n (var(\"#{self.class.__pkey__}\")) == __pkey__\n end.execute(@@connection)\n @persisted = false\n clear_change_flags\nend\ntrue\n"}},{"html_id":"persisted?:Bool-instance-method","name":"persisted?","abstract":false,"location":{"filename":"src/clear/model/modules/has_saving.cr","line_number":51,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_saving.cr#L51"},"def":{"name":"persisted?","return_type":"Bool","visibility":"Public","body":"@persisted"}},{"html_id":"reload:self-instance-method","name":"reload","abstract":false,"location":{"filename":"src/clear/model/modules/has_saving.cr","line_number":168,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_saving.cr#L168"},"def":{"name":"reload","return_type":"self","visibility":"Public","body":"set(self.class.query.where do\n (var(\"#{self.class.__pkey__}\")) == __pkey__\nend.fetch_first!)\ninvalidate_caching\n@attributes.clear\nclear_change_flags\n@persisted = true\nself\n"}},{"html_id":"save(on_conflict:Clear::SQL::InsertQuery->|Nil=nil)-instance-method","name":"save","doc":"Save the model. If the model is already persisted, will call `UPDATE` query.\nIf the model is not persisted, will call `INSERT`\n\nOptionally, you can pass a `Proc` to refine the `INSERT` with on conflict\nresolution functions.\n\nReturn `false` if the model cannot be saved (validation issue)\nReturn `true` if the model has been correctly saved.\n\nExample:\n\n```\nu = User.new\nif u.save\n puts \"User correctly saved !\"\nelse\n puts \"There was a problem during save: \"\n # do something with `u.errors`\nend\n```\n\n## `on_conflict` optional parameter\n\nExample:\n\n```\nu = User.new id: 123, email: \"email@example.com\"\nu.save(-> (qry) { qry.on_conflict.do_update { |u| u.set(email: \"email@example.com\") } #update\n# IMPORTANT NOTICE: user may not be saved, but will be still detected as persisted !\n```\n\nYou may want to use a block for `on_conflict` optional parameter:\n\n```\nu = User.new id: 123, email: \"email@example.com\"\nu.save do |qry|\n qry.on_conflict.do_update { |u| u.set(email: \"email@example.com\")\nend\n```\n","summary":"

Save the model.

","abstract":false,"args":[{"name":"on_conflict","default_value":"nil","external_name":"on_conflict","restriction":"(Clear::SQL::InsertQuery ->) | ::Nil"}],"args_string":"(on_conflict : Clear::SQL::InsertQuery -> | Nil = nil)","args_html":"(on_conflict : Clear::SQL::InsertQuery -> | Nil = nil)","location":{"filename":"src/clear/model/modules/has_saving.cr","line_number":93,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_saving.cr#L93"},"def":{"name":"save","args":[{"name":"on_conflict","default_value":"nil","external_name":"on_conflict","restriction":"(Clear::SQL::InsertQuery ->) | ::Nil"}],"visibility":"Public","body":"if self.class.read_only?\n return false\nend\nwith_triggers(:save) do\n if valid?\n if persisted?\n h = update_h\n if h.empty?\n else\n with_triggers(:update) do\n ((Clear::SQL.update(self.class.full_table_name)).set(update_h)).where do\n (var(\"#{self.class.__pkey__}\")) == __pkey__\n end.execute(@@connection)\n end\n end\n else\n with_triggers(:create) do\n query = (Clear::SQL.insert_into(self.class.full_table_name, to_h)).returning(\"*\")\n if on_conflict\n on_conflict.call(query)\n end\n hash = query.execute(@@connection)\n reset(hash)\n @persisted = true\n end\n end\n clear_change_flags\n return true\n else\n return false\n end\nend\n"}},{"html_id":"save(&block)-instance-method","name":"save","abstract":false,"location":{"filename":"src/clear/model/modules/has_saving.cr","line_number":125,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_saving.cr#L125"},"def":{"name":"save","yields":0,"block_arity":0,"block_arg":{"name":"block","external_name":"block","restriction":""},"visibility":"Public","body":"save(on_conflict: block)"}},{"html_id":"save!(on_conflict:Clear::SQL::InsertQuery->|Nil=nil)-instance-method","name":"save!","doc":"Performs `save` call, but instead of returning `false` if validation failed,\nraise `Clear::Model::InvalidError` exception","summary":"

Performs #save call, but instead of returning false if validation failed, raise Clear::Model::InvalidError exception

","abstract":false,"args":[{"name":"on_conflict","default_value":"nil","external_name":"on_conflict","restriction":"(Clear::SQL::InsertQuery ->) | ::Nil"}],"args_string":"(on_conflict : Clear::SQL::InsertQuery -> | Nil = nil)","args_html":"(on_conflict : Clear::SQL::InsertQuery -> | Nil = nil)","location":{"filename":"src/clear/model/modules/has_saving.cr","line_number":131,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_saving.cr#L131"},"def":{"name":"save!","args":[{"name":"on_conflict","default_value":"nil","external_name":"on_conflict","restriction":"(Clear::SQL::InsertQuery ->) | ::Nil"}],"visibility":"Public","body":"if self.class.read_only?\n raise(Clear::Model::ReadOnlyError.new(self))\nend\nif save(on_conflict)\nelse\n raise(Clear::Model::InvalidError.new(self))\nend\nself\n"}},{"html_id":"save!(&block:Clear::SQL::InsertQuery->)-instance-method","name":"save!","doc":"Pass the `on_conflict` optional parameter via block.","summary":"

Pass the on_conflict optional parameter via block.

","abstract":false,"location":{"filename":"src/clear/model/modules/has_saving.cr","line_number":140,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_saving.cr#L140"},"def":{"name":"save!","yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Clear::SQL::InsertQuery ->)"},"visibility":"Public","body":"save!(block)"}},{"html_id":"update(**args)-instance-method","name":"update","doc":"Set the fields passed as argument and call `save` on the object","summary":"

Set the fields passed as argument and call #save on the object

","abstract":false,"location":{"filename":"src/clear/model/modules/has_saving.cr","line_number":145,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_saving.cr#L145"},"def":{"name":"update","double_splat":{"name":"args","external_name":"args","restriction":""},"visibility":"Public","body":"set(**args)\nsave\n"}},{"html_id":"update!(**args)-instance-method","name":"update!","doc":"Set the fields passed as argument and call `save!` on the object","summary":"

Set the fields passed as argument and call #save! on the object

","abstract":false,"location":{"filename":"src/clear/model/modules/has_saving.cr","line_number":151,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_saving.cr#L151"},"def":{"name":"update!","double_splat":{"name":"args","external_name":"args","restriction":""},"visibility":"Public","body":"set(**args)\nsave!\n"}}]},{"html_id":"clear/Clear/Model/HasScope","path":"Clear/Model/HasScope.html","kind":"module","full_name":"Clear::Model::HasScope","name":"HasScope","abstract":false,"locations":[{"filename":"src/clear/model/modules/has_scope.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_scope.cr#L1"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"clear/Clear/Model","kind":"module","full_name":"Clear::Model","name":"Model"}],"namespace":{"html_id":"clear/Clear/Model","kind":"module","full_name":"Clear::Model","name":"Model"}},{"html_id":"clear/Clear/Model/HasSerialPkey","path":"Clear/Model/HasSerialPkey.html","kind":"module","full_name":"Clear::Model::HasSerialPkey","name":"HasSerialPkey","abstract":false,"locations":[{"filename":"src/clear/model/modules/has_serial_pkey.cr","line_number":3,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_serial_pkey.cr#L3"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"PKEY_TYPE","name":"PKEY_TYPE","value":"{\"bigserial\" => \"column(__name__ : Int64, primary: true, presence: false)\", \"serial\" => \"column(__name__ : Int32, primary: true, presence: false)\", \"text\" => \"column(__name__ : String, primary: true, presence: true)\", \"int\" => \"column(__name__ : Int32, primary: true, presence: true)\", \"bigint\" => \"column(__name__ : Int64, primary: true, presence: true)\", \"uuid\" => \"column(__name__ : UUID, primary: true, presence: true)\\nbefore(:validate) do |m|\\n if !m.persisted? && (m.as(self)).__name___column.value(nil).nil?\\n (m.as(self)).__name__ = UUID.random\\n end\\nend\\n\"} of Nil => Nil"}],"including_types":[{"html_id":"clear/Clear/Model","kind":"module","full_name":"Clear::Model","name":"Model"}],"namespace":{"html_id":"clear/Clear/Model","kind":"module","full_name":"Clear::Model","name":"Model"},"macros":[{"html_id":"add_pkey_type(type,&block)-macro","name":"add_pkey_type","doc":"Add a hook for the `primary_key`\nIn the hook, __name__ will be replaced by the column name required by calling primary_key\n\n## Example\n\n```\nClear::Model::HasSerialPkey.add_pkey_type(\"awesomepkeysystem\") do\n column __name__ : AwesomePkey, primary: true, presence: false\n\n before_validate do\n # ...\n end\nend\n```","summary":"

Add a hook for the primary_key In the hook, name will be replaced by the column name required by calling primary_key

","abstract":false,"args":[{"name":"type","external_name":"type","restriction":""}],"args_string":"(type, &block)","args_html":"(type, &block)","location":{"filename":"src/clear/model/modules/has_serial_pkey.cr","line_number":41,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_serial_pkey.cr#L41"},"def":{"name":"add_pkey_type","args":[{"name":"type","external_name":"type","restriction":""}],"block_arg":{"name":"block","external_name":"block","restriction":""},"visibility":"Public","body":" \n{% PKEY_TYPE[type] = \"#{block.body}\" %}\n\n \n"}},{"html_id":"primary_key(name=\"id\",type=:bigserial)-macro","name":"primary_key","doc":"Macro used to define serializable primary keys.\nCurrently support `bigserial`, `serial` and `uuid`.\n\nFor `bigserial` and `serial`, let to PostgreSQL the handling of sequence numbers.\nFor `uuid`, will generate a new `UUID` number on creation.","summary":"

Macro used to define serializable primary keys.

","abstract":false,"args":[{"name":"name","default_value":"\"id\"","external_name":"name","restriction":""},{"name":"type","default_value":":bigserial","external_name":"type","restriction":""}],"args_string":"(name = \"id\", type = :bigserial)","args_html":"(name = "id", type = :bigserial)","location":{"filename":"src/clear/model/modules/has_serial_pkey.cr","line_number":11,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_serial_pkey.cr#L11"},"def":{"name":"primary_key","args":[{"name":"name","default_value":"\"id\"","external_name":"name","restriction":""},{"name":"type","default_value":":bigserial","external_name":"type","restriction":""}],"visibility":"Public","body":" \n# Transform symbols to string\n\n \n{% name = \"#{name.id}\"\ntype = \"#{type.id}\"\n %}\n\n\n \n{% cb = PKEY_TYPE[type] %}\n\n\n \n{% if cb %}\n {{ (cb.gsub(/__name__/, name)).id }}\n {% else %}\n {% raise(\"Cannot define primary key of type #{type}. Candidates are: #{PKEY_TYPE.keys.join(\", \")}\") %}\n {% end %}\n\n \n"}}]},{"html_id":"clear/Clear/Model/HasTimestamps","path":"Clear/Model/HasTimestamps.html","kind":"module","full_name":"Clear::Model::HasTimestamps","name":"HasTimestamps","abstract":false,"locations":[{"filename":"src/clear/model/modules/has_timestamps.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_timestamps.cr#L1"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"clear/Clear/Model","kind":"module","full_name":"Clear::Model","name":"Model"}],"namespace":{"html_id":"clear/Clear/Model","kind":"module","full_name":"Clear::Model","name":"Model"},"macros":[{"html_id":"timestamps-macro","name":"timestamps","doc":"Generate the columns `updated_at` and `created_at`\nThe two column values are automatically set during insertion\n or update of the model.","summary":"

Generate the columns updated_at and created_at The two column values are automatically set during insertion or update of the model.

","abstract":false,"location":{"filename":"src/clear/model/modules/has_timestamps.cr","line_number":5,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_timestamps.cr#L5"},"def":{"name":"timestamps","visibility":"Public","body":" column(updated_at : Time)\n column(created_at : Time)\n\n before(:validate) do |model|\n model = model.as(self)\n\n unless model.persisted?\n now = Time.local\n model.created_at = now unless model.created_at_column.defined?\n model.updated_at = now unless model.updated_at_column.defined?\n \nend\n \nend\n\n after(:validate) do |model|\n model = model.as(self)\n\n \n# In the case the updated_at has been changed, we do not override.\n\n \n# It happens on first insert, in the before validation setup.\n\n model.updated_at = Time.local if model.changed? && !model.updated_at_column.changed?\n \nend\n\n \n# Saves the record with the updated_at set to the current time.\n\n def touch(now = Time.local) : Clear::Model\n self.updated_at = now\n self.save!\n\n self\n \nend\n \n"}}]},{"html_id":"clear/Clear/Model/HasValidation","path":"Clear/Model/HasValidation.html","kind":"module","full_name":"Clear::Model::HasValidation","name":"HasValidation","abstract":false,"ancestors":[{"html_id":"clear/Clear/Validation/Helper","kind":"module","full_name":"Clear::Validation::Helper","name":"Helper"}],"locations":[{"filename":"src/clear/model/modules/has_validation.cr","line_number":3,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_validation.cr#L3"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"clear/Clear/Validation/Helper","kind":"module","full_name":"Clear::Validation::Helper","name":"Helper"}],"including_types":[{"html_id":"clear/Clear/Model","kind":"module","full_name":"Clear::Model","name":"Model"}],"namespace":{"html_id":"clear/Clear/Model","kind":"module","full_name":"Clear::Model","name":"Model"},"instance_methods":[{"html_id":"add_error(column,reason)-instance-method","name":"add_error","doc":"Add validation error related to a specific column","summary":"

Add validation error related to a specific column

","abstract":false,"args":[{"name":"column","external_name":"column","restriction":""},{"name":"reason","external_name":"reason","restriction":""}],"args_string":"(column, reason)","args_html":"(column, reason)","location":{"filename":"src/clear/model/modules/has_validation.cr","line_number":15,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_validation.cr#L15"},"def":{"name":"add_error","args":[{"name":"column","external_name":"column","restriction":""},{"name":"reason","external_name":"reason","restriction":""}],"visibility":"Public","body":"@errors << Error.new(reason: reason, column: column.to_s)"}},{"html_id":"add_error(reason)-instance-method","name":"add_error","doc":"Add validation error not related to a specific column","summary":"

Add validation error not related to a specific column

","abstract":false,"args":[{"name":"reason","external_name":"reason","restriction":""}],"args_string":"(reason)","args_html":"(reason)","location":{"filename":"src/clear/model/modules/has_validation.cr","line_number":10,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_validation.cr#L10"},"def":{"name":"add_error","args":[{"name":"reason","external_name":"reason","restriction":""}],"visibility":"Public","body":"@errors << Error.new(reason: reason, column: nil)"}},{"html_id":"clear_errors-instance-method","name":"clear_errors","doc":"Clear the errors log (if any) of the model and return itself","summary":"

Clear the errors log (if any) of the model and return itself

","abstract":false,"location":{"filename":"src/clear/model/modules/has_validation.cr","line_number":26,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_validation.cr#L26"},"def":{"name":"clear_errors","visibility":"Public","body":"@errors.clear\nself\n"}},{"html_id":"error?-instance-method","name":"error?","doc":"Return `true` if saving has been declined because of validation issues.\nThe error list can be found by calling `Clear::Model#errors`","summary":"

Return true if saving has been declined because of validation issues.

","abstract":false,"location":{"filename":"src/clear/model/modules/has_validation.cr","line_number":21,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_validation.cr#L21"},"def":{"name":"error?","visibility":"Public","body":"!@errors.empty?"}},{"html_id":"errors:Array(Error)-instance-method","name":"errors","doc":"List of errors raised during validation, in case the model hasn't been saved properly.","summary":"

List of errors raised during validation, in case the model hasn't been saved properly.

","abstract":false,"location":{"filename":"src/clear/model/modules/has_validation.cr","line_number":7,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_validation.cr#L7"},"def":{"name":"errors","return_type":"Array(Error)","visibility":"Public","body":"@errors"}},{"html_id":"print_errors-instance-method","name":"print_errors","doc":"Print the errors in string. Useful for debugging or simple error handling.","summary":"

Print the errors in string.

","abstract":false,"location":{"filename":"src/clear/model/modules/has_validation.cr","line_number":33,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_validation.cr#L33"},"def":{"name":"print_errors","visibility":"Public","body":"@errors.group_by(&.column).to_a.sort do |__temp_92, __temp_93|\n f1, _ = __temp_92\n f2, _ = __temp_93\n (f1 || \"\") <=> (f2 || \"\")\nend.join(\"\\n\") do |column, errors|\n [column, errors.join(\", \", &.reason)].compact.join(\": \")\nend"}},{"html_id":"valid!-instance-method","name":"valid!","doc":"Check whether the model is valid. If not, raise `InvalidModelError`.\nReturn the model itself","summary":"

Check whether the model is valid.

","abstract":false,"location":{"filename":"src/clear/model/modules/has_validation.cr","line_number":47,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_validation.cr#L47"},"def":{"name":"valid!","visibility":"Public","body":"if valid?\nelse\n raise(InvalidError.new(self))\nend\nself\n"}},{"html_id":"valid?-instance-method","name":"valid?","doc":"Return `true` if the model","summary":"

Return true if the model

","abstract":false,"location":{"filename":"src/clear/model/modules/has_validation.cr","line_number":54,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_validation.cr#L54"},"def":{"name":"valid?","visibility":"Public","body":"clear_errors\nwith_triggers(:validate) do\n validate\n validate_fields_presence\nend\n!error?\n"}},{"html_id":"validate-instance-method","name":"validate","doc":"This method is called whenever `valid?` or `save` is called.\nBy default, `validate` is empty and must be overriden by your own validation code.","summary":"

This method is called whenever #valid? or save is called.

","abstract":false,"location":{"filename":"src/clear/model/modules/has_validation.cr","line_number":41,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_validation.cr#L41"},"def":{"name":"validate","visibility":"Public","body":""}}],"types":[{"html_id":"clear/Clear/Model/HasValidation/Error","path":"Clear/Model/HasValidation/Error.html","kind":"struct","full_name":"Clear::Model::HasValidation::Error","name":"Error","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/model/modules/has_validation.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_validation.cr#L4"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Model/HasValidation","kind":"module","full_name":"Clear::Model::HasValidation","name":"HasValidation"},"constructors":[{"html_id":"new(reason:String,column:String|Nil)-class-method","name":"new","abstract":false,"args":[{"name":"reason","external_name":"reason","restriction":"String"},{"name":"column","external_name":"column","restriction":"String | ::Nil"}],"args_string":"(reason : String, column : String | Nil)","args_html":"(reason : String, column : String | Nil)","location":{"filename":"src/clear/model/modules/has_validation.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_validation.cr#L4"},"def":{"name":"new","args":[{"name":"reason","external_name":"reason","restriction":"String"},{"name":"column","external_name":"column","restriction":"String | ::Nil"}],"visibility":"Public","body":"_ = allocate\n_.initialize(reason, column)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"clone-instance-method","name":"clone","abstract":false,"location":{"filename":"src/clear/model/modules/has_validation.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_validation.cr#L4"},"def":{"name":"clone","visibility":"Public","body":"self.class.new(@reason.clone, @column.clone)"}},{"html_id":"column:String|Nil-instance-method","name":"column","abstract":false,"def":{"name":"column","return_type":"String | ::Nil","visibility":"Public","body":"@column"}},{"html_id":"copy_with(reason_reason=@reason,column_column=@column)-instance-method","name":"copy_with","abstract":false,"args":[{"name":"_reason","default_value":"@reason","external_name":"reason","restriction":""},{"name":"_column","default_value":"@column","external_name":"column","restriction":""}],"args_string":"(reason _reason = @reason, column _column = @column)","args_html":"(reason _reason = @reason, column _column = @column)","location":{"filename":"src/clear/model/modules/has_validation.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_validation.cr#L4"},"def":{"name":"copy_with","args":[{"name":"_reason","default_value":"@reason","external_name":"reason","restriction":""},{"name":"_column","default_value":"@column","external_name":"column","restriction":""}],"visibility":"Public","body":"self.class.new(_reason, _column)"}},{"html_id":"reason:String-instance-method","name":"reason","abstract":false,"def":{"name":"reason","return_type":"String","visibility":"Public","body":"@reason"}}]}]},{"html_id":"clear/Clear/Model/InvalidError","path":"Clear/Model/InvalidError.html","kind":"class","full_name":"Clear::Model::InvalidError","name":"InvalidError","abstract":false,"superclass":{"html_id":"clear/Clear/Model/Error","kind":"class","full_name":"Clear::Model::Error","name":"Error"},"ancestors":[{"html_id":"clear/Clear/Model/Error","kind":"class","full_name":"Clear::Model::Error","name":"Error"},{"html_id":"clear/Exception","kind":"class","full_name":"Exception","name":"Exception"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/model/errors.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/errors.cr#L4"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Model","kind":"module","full_name":"Clear::Model","name":"Model"},"constructors":[{"html_id":"new(model:Clear::Model)-class-method","name":"new","abstract":false,"args":[{"name":"model","external_name":"model","restriction":"Clear::Model"}],"args_string":"(model : Clear::Model)","args_html":"(model : Clear::Model)","location":{"filename":"src/clear/model/errors.cr","line_number":7,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/errors.cr#L7"},"def":{"name":"new","args":[{"name":"model","external_name":"model","restriction":"Clear::Model"}],"visibility":"Public","body":"_ = allocate\n_.initialize(model)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"model:Clear::Model-instance-method","name":"model","abstract":false,"location":{"filename":"src/clear/model/errors.cr","line_number":5,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/errors.cr#L5"},"def":{"name":"model","return_type":"Clear::Model","visibility":"Public","body":"@model"}}]},{"html_id":"clear/Clear/Model/JSONDeserialize","path":"Clear/Model/JSONDeserialize.html","kind":"module","full_name":"Clear::Model::JSONDeserialize","name":"JSONDeserialize","abstract":false,"locations":[{"filename":"src/clear/model/json_deserialize.cr","line_number":2,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/json_deserialize.cr#L2"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"clear/Clear/Model","kind":"module","full_name":"Clear::Model","name":"Model"}],"namespace":{"html_id":"clear/Clear/Model","kind":"module","full_name":"Clear::Model","name":"Model"},"doc":"This module declare all the methods and macro related to deserializing json in `Clear::Model`","summary":"

This module declare all the methods and macro related to deserializing json in Clear::Model

"},{"html_id":"clear/Clear/Model/QueryCache","path":"Clear/Model/QueryCache.html","kind":"class","full_name":"Clear::Model::QueryCache","name":"QueryCache","abstract":false,"superclass":{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/model/query_cache.cr","line_number":9,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/query_cache.cr#L9"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Model","kind":"module","full_name":"Clear::Model","name":"Model"},"doc":"The Clear::Model::QueryCache\nis a __fire-and-forget__ cache used when caching associations and preventing N+1 queries anti-pattern.\n\nThis is not a global cache: One cache instance exists per collection, and the cache\ndisappear at the same time the Collection is unreferenced.\n\nEach cache can references multiples relations at the same time.\nThis cache use an underlying hash to access to the references keys.","summary":"

The Clear::Model::QueryCache is a fire-and-forget cache used when caching associations and preventing N+1 queries anti-pattern.

","instance_methods":[{"html_id":"active(relation_name)-instance-method","name":"active","doc":"Tell this cache than we active the cache over a specific relation name.\nReturns `self`","summary":"

Tell this cache than we active the cache over a specific relation name.

","abstract":false,"args":[{"name":"relation_name","external_name":"relation_name","restriction":""}],"args_string":"(relation_name)","args_html":"(relation_name)","location":{"filename":"src/clear/model/query_cache.cr","line_number":28,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/query_cache.cr#L28"},"def":{"name":"active","args":[{"name":"relation_name","external_name":"relation_name","restriction":""}],"visibility":"Public","body":"@cache_activation.add(relation_name)\nself\n"}},{"html_id":"active?(relation_name)-instance-method","name":"active?","doc":"Check whether the cache is active on a certain association.\nReturns `true` if `relation_name` is flagged as encached, or `false` otherwise.","summary":"

Check whether the cache is active on a certain association.

","abstract":false,"args":[{"name":"relation_name","external_name":"relation_name","restriction":""}],"args_string":"(relation_name)","args_html":"(relation_name)","location":{"filename":"src/clear/model/query_cache.cr","line_number":36,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/query_cache.cr#L36"},"def":{"name":"active?","args":[{"name":"relation_name","external_name":"relation_name","restriction":""}],"visibility":"Public","body":"@cache_activation.includes?(relation_name)"}},{"html_id":"clear-instance-method","name":"clear","doc":"Empty the cache and flag all relations has unactive","summary":"

Empty the cache and flag all relations has unactive

","abstract":false,"location":{"filename":"src/clear/model/query_cache.cr","line_number":70,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/query_cache.cr#L70"},"def":{"name":"clear","visibility":"Public","body":"@cache.clear\n@cache_activation.clear\n"}},{"html_id":"fetch-instance-method","name":"fetch","abstract":false,"location":{"filename":"src/clear/model/query_cache.cr","line_number":22,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/query_cache.cr#L22"},"def":{"name":"fetch","visibility":"Public","body":"query"}},{"html_id":"hit(relation_name,relation_value,klass:T.class):Array(T)forallT-instance-method","name":"hit","doc":"Try to hit the cache. If an array is found, it will be returned.\nOtherwise, empty array is returned.\n\nThis methods do not check if a relation flagged as is actively cached or not. Therefore, hitting a non-cached\nrelation will return always an empty-array.","summary":"

Try to hit the cache.

","abstract":false,"args":[{"name":"relation_name","external_name":"relation_name","restriction":""},{"name":"relation_value","external_name":"relation_value","restriction":""},{"name":"klass","external_name":"klass","restriction":"T.class"}],"args_string":"(relation_name, relation_value, klass : T.class) : Array(T) forall T","args_html":"(relation_name, relation_value, klass : T.class) : Array(T) forall T","location":{"filename":"src/clear/model/query_cache.cr","line_number":45,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/query_cache.cr#L45"},"def":{"name":"hit","args":[{"name":"relation_name","external_name":"relation_name","restriction":""},{"name":"relation_value","external_name":"relation_value","restriction":""},{"name":"klass","external_name":"klass","restriction":"T.class"}],"return_type":"Array(T)","visibility":"Public","body":"(@cache.fetch(CacheKey.new(relation_name, relation_value, T.name)) do\n [] of T\nend).unsafe_as(Array(T))"}},{"html_id":"set(relation_name,relation_value,arr:Array(T))forallT-instance-method","name":"set","doc":"Set the cached array for a specific key `{relation_name,relation_value}`","summary":"

Set the cached array for a specific key {relation_name,relation_value}

","abstract":false,"args":[{"name":"relation_name","external_name":"relation_name","restriction":""},{"name":"relation_value","external_name":"relation_value","restriction":""},{"name":"arr","external_name":"arr","restriction":"Array(T)"}],"args_string":"(relation_name, relation_value, arr : Array(T)) forall T","args_html":"(relation_name, relation_value, arr : Array(T)) forall T","location":{"filename":"src/clear/model/query_cache.cr","line_number":52,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/query_cache.cr#L52"},"def":{"name":"set","args":[{"name":"relation_name","external_name":"relation_name","restriction":""},{"name":"relation_value","external_name":"relation_value","restriction":""},{"name":"arr","external_name":"arr","restriction":"Array(T)"}],"visibility":"Public","body":"@cache[CacheKey.new(relation_name, relation_value, T.name)] = arr.unsafe_as(Pointer(Nil))"}},{"html_id":"with_cache(&)-instance-method","name":"with_cache","doc":"Perform some operations with the cache then eventually clear the cache.","summary":"

Perform some operations with the cache then eventually clear the cache.

","abstract":false,"location":{"filename":"src/clear/model/query_cache.cr","line_number":63,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/query_cache.cr#L63"},"def":{"name":"with_cache","yields":0,"block_arity":0,"visibility":"Public","body":"begin\n yield\nensure\n clear\nend"}}]},{"html_id":"clear/Clear/Model/ReadOnlyError","path":"Clear/Model/ReadOnlyError.html","kind":"class","full_name":"Clear::Model::ReadOnlyError","name":"ReadOnlyError","abstract":false,"superclass":{"html_id":"clear/Clear/Model/Error","kind":"class","full_name":"Clear::Model::Error","name":"Error"},"ancestors":[{"html_id":"clear/Clear/Model/Error","kind":"class","full_name":"Clear::Model::Error","name":"Error"},{"html_id":"clear/Exception","kind":"class","full_name":"Exception","name":"Exception"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/model/errors.cr","line_number":12,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/errors.cr#L12"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Model","kind":"module","full_name":"Clear::Model","name":"Model"},"constructors":[{"html_id":"new(model:Clear::Model)-class-method","name":"new","abstract":false,"args":[{"name":"model","external_name":"model","restriction":"Clear::Model"}],"args_string":"(model : Clear::Model)","args_html":"(model : Clear::Model)","location":{"filename":"src/clear/model/errors.cr","line_number":15,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/errors.cr#L15"},"def":{"name":"new","args":[{"name":"model","external_name":"model","restriction":"Clear::Model"}],"visibility":"Public","body":"_ = allocate\n_.initialize(model)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"model:Clear::Model-instance-method","name":"model","abstract":false,"location":{"filename":"src/clear/model/errors.cr","line_number":13,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/errors.cr#L13"},"def":{"name":"model","return_type":"Clear::Model","visibility":"Public","body":"@model"}}]},{"html_id":"clear/Clear/Model/Relations","path":"Clear/Model/Relations.html","kind":"module","full_name":"Clear::Model::Relations","name":"Relations","abstract":false,"locations":[{"filename":"src/clear/model/modules/relations/belongs_to_macro.cr","line_number":2,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/relations/belongs_to_macro.cr#L2"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Model","kind":"module","full_name":"Clear::Model","name":"Model"}}]},{"html_id":"clear/Clear/Reflection","path":"Clear/Reflection.html","kind":"module","full_name":"Clear::Reflection","name":"Reflection","abstract":false,"locations":[{"filename":"src/clear/model/reflection/column.cr","line_number":3,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/column.cr#L3"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear","kind":"module","full_name":"Clear","name":"Clear"},"types":[{"html_id":"clear/Clear/Reflection/Column","path":"Clear/Reflection/Column.html","kind":"class","full_name":"Clear::Reflection::Column","name":"Column","abstract":false,"superclass":{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"clear/Clear/Model","kind":"module","full_name":"Clear::Model","name":"Model"},{"html_id":"clear/Clear/Model/FullTextSearchable","kind":"module","full_name":"Clear::Model::FullTextSearchable","name":"FullTextSearchable"},{"html_id":"clear/Clear/Model/JSONDeserialize","kind":"module","full_name":"Clear::Model::JSONDeserialize","name":"JSONDeserialize"},{"html_id":"clear/Clear/Model/Initializer","kind":"module","full_name":"Clear::Model::Initializer","name":"Initializer"},{"html_id":"clear/Clear/Model/HasFactory","kind":"module","full_name":"Clear::Model::HasFactory","name":"HasFactory"},{"html_id":"clear/Clear/Model/ClassMethods","kind":"module","full_name":"Clear::Model::ClassMethods","name":"ClassMethods"},{"html_id":"clear/Clear/Model/HasScope","kind":"module","full_name":"Clear::Model::HasScope","name":"HasScope"},{"html_id":"clear/Clear/Model/HasRelations","kind":"module","full_name":"Clear::Model::HasRelations","name":"HasRelations"},{"html_id":"clear/Clear/Model/HasValidation","kind":"module","full_name":"Clear::Model::HasValidation","name":"HasValidation"},{"html_id":"clear/Clear/Validation/Helper","kind":"module","full_name":"Clear::Validation::Helper","name":"Helper"},{"html_id":"clear/Clear/Model/HasSaving","kind":"module","full_name":"Clear::Model::HasSaving","name":"HasSaving"},{"html_id":"clear/Clear/Model/HasSerialPkey","kind":"module","full_name":"Clear::Model::HasSerialPkey","name":"HasSerialPkey"},{"html_id":"clear/Clear/Model/HasTimestamps","kind":"module","full_name":"Clear::Model::HasTimestamps","name":"HasTimestamps"},{"html_id":"clear/Clear/Model/HasColumns","kind":"module","full_name":"Clear::Model::HasColumns","name":"HasColumns"},{"html_id":"clear/Clear/Model/HasHooks","kind":"module","full_name":"Clear::Model::HasHooks","name":"HasHooks"},{"html_id":"clear/Clear/Model/Connection","kind":"module","full_name":"Clear::Model::Connection","name":"Connection"},{"html_id":"clear/Clear/ErrorMessages","kind":"module","full_name":"Clear::ErrorMessages","name":"ErrorMessages"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/model/reflection/column.cr","line_number":3,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/column.cr#L3"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"COLUMNS","name":"COLUMNS","value":"{\"table_catalog\" => {type: String, primary: false, converter: \"String\", db_column_name: \"table_catalog\", crystal_variable_name: table_catalog, presence: true, mass_assign: true}, \"table_schema\" => {type: String, primary: false, converter: \"String\", db_column_name: \"table_schema\", crystal_variable_name: table_schema, presence: true, mass_assign: true}, \"table_name\" => {type: String, primary: false, converter: \"String\", db_column_name: \"table_name\", crystal_variable_name: table_name, presence: false, mass_assign: true}, \"column_name\" => {type: String, primary: true, converter: \"String\", db_column_name: \"column_name\", crystal_variable_name: column_name, presence: true, mass_assign: true}} of Nil => Nil"},{"id":"POLYMORPHISM_SETTINGS","name":"POLYMORPHISM_SETTINGS","value":"{} of Nil => Nil"}],"included_modules":[{"html_id":"clear/Clear/Model","kind":"module","full_name":"Clear::Model","name":"Model"}],"extended_modules":[{"html_id":"clear/Clear/Model/HasHooks/ClassMethods","kind":"module","full_name":"Clear::Model::HasHooks::ClassMethods","name":"ClassMethods"}],"namespace":{"html_id":"clear/Clear/Reflection","kind":"module","full_name":"Clear::Reflection","name":"Reflection"},"doc":"Reflection of the columns using information_schema in postgreSQL.\nTODO: Usage of view instead of model","summary":"

Reflection of the columns using information_schema in postgreSQL.

","class_methods":[{"html_id":"build(**tuple:**T)forallT-class-method","name":"build","doc":"Build a new empty model and fill the columns using the NamedTuple in argument.\n\nReturns the new model","summary":"

Build a new empty model and fill the columns using the NamedTuple in argument.

","abstract":false,"location":{"filename":"src/clear/model/reflection/column.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/column.cr#L4"},"def":{"name":"build","double_splat":{"name":"tuple","external_name":"tuple","restriction":"**T"},"visibility":"Public","body":"{% if T.size > 0 %}\n self.new(tuple)\n {% else %}\n self.new\n {% end %}"}},{"html_id":"build(**tuple)-class-method","name":"build","doc":"Build a new empty model and fill the columns using the NamedTuple in argument.\n\nReturns the new model","summary":"

Build a new empty model and fill the columns using the NamedTuple in argument.

","abstract":false,"location":{"filename":"src/clear/model/reflection/column.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/column.cr#L4"},"def":{"name":"build","double_splat":{"name":"tuple","external_name":"tuple","restriction":""},"visibility":"Public","body":"build(**tuple) do\nend"}},{"html_id":"build(**tuple,&)-class-method","name":"build","doc":"Build a new empty model and fill the columns using the NamedTuple in argument.\n\nReturns the new model","summary":"

Build a new empty model and fill the columns using the NamedTuple in argument.

","abstract":false,"location":{"filename":"src/clear/model/reflection/column.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/column.cr#L4"},"def":{"name":"build","double_splat":{"name":"tuple","external_name":"tuple","restriction":""},"yields":1,"block_arity":1,"visibility":"Public","body":"r = build(**tuple)\nyield(r)\nr\n"}},{"html_id":"columns-class-method","name":"columns","abstract":false,"location":{"filename":"src/clear/model/reflection/column.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/column.cr#L4"},"def":{"name":"columns","visibility":"Public","body":"@@columns"}},{"html_id":"connection:String-class-method","name":"connection","doc":"Define on which connection the model is living. Useful in case of models living in different databases.\n\nIs set to \"default\" by default.\n\nSee `Clear::SQL#init(URI, *opts)` for more information about multi-connections.\n\nExample:\n\n```\nClear::SQL.init(\"postgres://postgres@localhost/database_1\")\nClear::SQL.init(\"secondary\", \"postgres://postgres@localhost/database_2\")\n\nclass ModelA\n include Clear::Model\n\n # Performs all the queries on `database_1`\n # self.connection = \"default\"\n column id : Int32, primary: true, presence: false\n column title : String\nend\n\nclass ModelB\n include Clear::Model\n\n # Performs all the queries on `database_2`\n self.connection = \"secondary\"\n\n column id : Int32, primary: true, presence: false\nend\n```","summary":"

Define on which connection the model is living.

","abstract":false,"def":{"name":"connection","return_type":"String","visibility":"Public","body":"@@connection"}},{"html_id":"connection=(connection:String)-class-method","name":"connection=","doc":"Define on which connection the model is living. Useful in case of models living in different databases.\n\nIs set to \"default\" by default.\n\nSee `Clear::SQL#init(URI, *opts)` for more information about multi-connections.\n\nExample:\n\n```\nClear::SQL.init(\"postgres://postgres@localhost/database_1\")\nClear::SQL.init(\"secondary\", \"postgres://postgres@localhost/database_2\")\n\nclass ModelA\n include Clear::Model\n\n # Performs all the queries on `database_1`\n # self.connection = \"default\"\n column id : Int32, primary: true, presence: false\n column title : String\nend\n\nclass ModelB\n include Clear::Model\n\n # Performs all the queries on `database_2`\n self.connection = \"secondary\"\n\n column id : Int32, primary: true, presence: false\nend\n```","summary":"

Define on which connection the model is living.

","abstract":false,"args":[{"name":"connection","external_name":"connection","restriction":"String"}],"args_string":"(connection : String)","args_html":"(connection : String)","def":{"name":"connection=","args":[{"name":"connection","external_name":"connection","restriction":"String"}],"visibility":"Public","body":"@@connection = connection"}},{"html_id":"create_from_json(string_or_io:String|IO,trusted:Bool=false)-class-method","name":"create_from_json","doc":"Create a new model from json and save it. Returns the model.\n\nThe model may not be saved due to validation failure;\ncheck the returned model `errors?` and `persisted?` flags.\nTrusted flag set to true will allow mass assignment without protection, FALSE by default","summary":"

Create a new model from json and save it.

","abstract":false,"args":[{"name":"string_or_io","external_name":"string_or_io","restriction":"String | IO"},{"name":"trusted","default_value":"false","external_name":"trusted","restriction":"Bool"}],"args_string":"(string_or_io : String | IO, trusted : Bool = false)","args_html":"(string_or_io : String | IO, trusted : Bool = false)","def":{"name":"create_from_json","args":[{"name":"string_or_io","external_name":"string_or_io","restriction":"String | IO"},{"name":"trusted","default_value":"false","external_name":"trusted","restriction":"Bool"}],"visibility":"Public","body":"mdl = self.from_json(string_or_io, trusted)\nmdl.save\nmdl\n"}},{"html_id":"create_from_json!(string_or_io:String|IO,trusted:Bool=false)-class-method","name":"create_from_json!","doc":"Create a new model from json and save it. Returns the model.\n\nReturns the newly inserted model\nRaises an exception if validation failed during the saving process.\nTrusted flag set to true will allow mass assignment without protection, FALSE by default","summary":"

Create a new model from json and save it.

","abstract":false,"args":[{"name":"string_or_io","external_name":"string_or_io","restriction":"String | IO"},{"name":"trusted","default_value":"false","external_name":"trusted","restriction":"Bool"}],"args_string":"(string_or_io : String | IO, trusted : Bool = false)","args_html":"(string_or_io : String | IO, trusted : Bool = false)","def":{"name":"create_from_json!","args":[{"name":"string_or_io","external_name":"string_or_io","restriction":"String | IO"},{"name":"trusted","default_value":"false","external_name":"trusted","restriction":"Bool"}],"visibility":"Public","body":"(self.from_json(string_or_io, trusted)).save!"}},{"html_id":"find(x)-class-method","name":"find","doc":"Returns a model using primary key equality\nReturns `nil` if not found.","summary":"

Returns a model using primary key equality Returns nil if not found.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x)","args_html":"(x)","location":{"filename":"src/clear/model/reflection/column.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/column.cr#L4"},"def":{"name":"find","args":[{"name":"x","external_name":"x","restriction":""}],"visibility":"Public","body":"query.where do\n (raw(__pkey__)) == x\nend.first"}},{"html_id":"find!(x)-class-method","name":"find!","doc":"Returns a model using primary key equality.\nRaises error if the model is not found.","summary":"

Returns a model using primary key equality.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x)","args_html":"(x)","location":{"filename":"src/clear/model/reflection/column.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/column.cr#L4"},"def":{"name":"find!","args":[{"name":"x","external_name":"x","restriction":""}],"visibility":"Public","body":"(find(x)) || (raise(Clear::SQL::RecordNotFoundError.new))"}},{"html_id":"from_json(string_or_io:String|IO,trusted:Bool=false)-class-method","name":"from_json","doc":"Create a new empty model and fill the columns from json. Returns the new model\n\nTrusted flag set to true will allow mass assignment without protection, FALSE by default","summary":"

Create a new empty model and fill the columns from json.

","abstract":false,"args":[{"name":"string_or_io","external_name":"string_or_io","restriction":"String | IO"},{"name":"trusted","default_value":"false","external_name":"trusted","restriction":"Bool"}],"args_string":"(string_or_io : String | IO, trusted : Bool = false)","args_html":"(string_or_io : String | IO, trusted : Bool = false)","def":{"name":"from_json","args":[{"name":"string_or_io","external_name":"string_or_io","restriction":"String | IO"},{"name":"trusted","default_value":"false","external_name":"trusted","restriction":"Bool"}],"visibility":"Public","body":"(Assigner.from_json(string_or_io)).create(trusted)"}},{"html_id":"full_table_name-class-method","name":"full_table_name","doc":"returns the fully qualified and escaped name for this table.\nadd schema if schema is different from 'public' (default schema)\n\nex: \"schema\".\"table\"","summary":"

returns the fully qualified and escaped name for this table.

","abstract":false,"location":{"filename":"src/clear/model/reflection/column.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/column.cr#L4"},"def":{"name":"full_table_name","visibility":"Public","body":"if s = schema\n {schema, table}.map do |x|\n Clear::SQL.escape(x.to_s)\n end.join(\".\")\nelse\n Clear::SQL.escape(table)\nend"}},{"html_id":"import(array:Enumerable(self),on_conflict:Clear::SQL::InsertQuery->|Nil=nil)-class-method","name":"import","doc":"Import a bulk of models in one SQL insert query.\nEach model must be non-persisted.\n\n`on_conflict` callback can be optionnaly turned on\nto manage constraints of the database.\n\nNote: Old models are not modified. This method return a copy of the\nmodels as saved in the database.\n\n## Example:\n\n```\nusers = [User.new(id: 1), User.new(id: 2), User.new(id: 3)]\nusers = User.import(users)\n```","summary":"

Import a bulk of models in one SQL insert query.

","abstract":false,"args":[{"name":"array","external_name":"array","restriction":"Enumerable(self)"},{"name":"on_conflict","default_value":"nil","external_name":"on_conflict","restriction":"(Clear::SQL::InsertQuery ->) | ::Nil"}],"args_string":"(array : Enumerable(self), on_conflict : Clear::SQL::InsertQuery -> | Nil = nil)","args_html":"(array : Enumerable(self), on_conflict : Clear::SQL::InsertQuery -> | Nil = nil)","location":{"filename":"src/clear/model/reflection/column.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/column.cr#L4"},"def":{"name":"import","args":[{"name":"array","external_name":"array","restriction":"Enumerable(self)"},{"name":"on_conflict","default_value":"nil","external_name":"on_conflict","restriction":"(Clear::SQL::InsertQuery ->) | ::Nil"}],"visibility":"Public","body":"array.each do |item|\n if item.persisted?\n raise(\"One of your model is persisted while calling import\")\n end\nend\nhashes = array.map do |item|\n item.trigger_before_events(:save)\n if item.valid?\n else\n raise(\"import: Validation failed for `#{item}`\")\n end\n item.trigger_before_events(:create)\n item.to_h\nend\nquery = (Clear::SQL.insert_into(self.table, hashes)).returning(\"*\")\nif on_conflict\n on_conflict.call(query)\nend\no = [] of self\nquery.fetch(@@connection) do |hash|\n o << ((Clear::Model::Factory.build(self.name, hash, persisted: true, fetch_columns: false, cache: nil)).as(self))\nend\no.each(&.trigger_after_events(:create))\no.each(&.trigger_after_events(:save))\no\n"}},{"html_id":"polymorphic?:Bool-class-method","name":"polymorphic?","abstract":false,"def":{"name":"polymorphic?","return_type":"Bool","visibility":"Public","body":"@@polymorphic"}},{"html_id":"query-class-method","name":"query","doc":"Return a new empty query `SELECT * FROM [my_model_table]`. Can be refined after that.","summary":"

Return a new empty query SELECT * FROM [my_model_table].

","abstract":false,"location":{"filename":"src/clear/model/reflection/column.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/column.cr#L4"},"def":{"name":"query","visibility":"Public","body":"(Collection.new.use_connection(connection)).from(self.full_table_name)"}},{"html_id":"read_only=(read_only:Bool)-class-method","name":"read_only=","abstract":false,"args":[{"name":"read_only","external_name":"read_only","restriction":"Bool"}],"args_string":"(read_only : Bool)","args_html":"(read_only : Bool)","def":{"name":"read_only=","args":[{"name":"read_only","external_name":"read_only","restriction":"Bool"}],"visibility":"Public","body":"@@read_only = read_only"}},{"html_id":"read_only?:Bool-class-method","name":"read_only?","abstract":false,"def":{"name":"read_only?","return_type":"Bool","visibility":"Public","body":"@@read_only"}},{"html_id":"schema:Clear::SQL::Symbolic|Nil-class-method","name":"schema","doc":"Define the current schema used in PostgreSQL. The value is `nil` by default, which lead to non-specified\n schema during the querying, and usage of \"public\" by PostgreSQL.\n\nThis property can be redefined on initialization. Example:\n\n```\nclass MyModel\n include Clear::Model\n\n self.schema = \"my_schema\"\nend\nMyModel.query.to_sql # SELECT * FROM \"my_schema\".\"my_models\"\n```","summary":"

Define the current schema used in PostgreSQL.

","abstract":false,"def":{"name":"schema","return_type":"Clear::SQL::Symbolic | ::Nil","visibility":"Public","body":"@@schema"}},{"html_id":"schema=(schema:Clear::SQL::Symbolic|Nil)-class-method","name":"schema=","doc":"Define the current schema used in PostgreSQL. The value is `nil` by default, which lead to non-specified\n schema during the querying, and usage of \"public\" by PostgreSQL.\n\nThis property can be redefined on initialization. Example:\n\n```\nclass MyModel\n include Clear::Model\n\n self.schema = \"my_schema\"\nend\nMyModel.query.to_sql # SELECT * FROM \"my_schema\".\"my_models\"\n```","summary":"

Define the current schema used in PostgreSQL.

","abstract":false,"args":[{"name":"schema","external_name":"schema","restriction":"Clear::SQL::Symbolic | ::Nil"}],"args_string":"(schema : Clear::SQL::Symbolic | Nil)","args_html":"(schema : Clear::SQL::Symbolic | Nil)","def":{"name":"schema=","args":[{"name":"schema","external_name":"schema","restriction":"Clear::SQL::Symbolic | ::Nil"}],"visibility":"Public","body":"@@schema = schema"}},{"html_id":"table:Clear::SQL::Symbolic-class-method","name":"table","doc":"Return the table name setup for this model.\nBy convention, the class name is by default equals to the pluralized underscored string form of the model name.\nExample:\n\n```\nMyModel => \"my_models\"\nPerson => \"people\"\nProject::Info => \"project_infos\"\n```\n\nThe property can be updated at initialization to a custom table name:\n\n```\nclass MyModel\n include Clear::Model\n\n self.table = \"another_table_name\"\nend\nMyModel.query.to_sql # SELECT * FROM \"another_table_name\"\n```","summary":"

Return the table name setup for this model.

","abstract":false,"def":{"name":"table","return_type":"Clear::SQL::Symbolic","visibility":"Public","body":"@@table"}},{"html_id":"table=(table:Clear::SQL::Symbolic)-class-method","name":"table=","doc":"Return the table name setup for this model.\nBy convention, the class name is by default equals to the pluralized underscored string form of the model name.\nExample:\n\n```\nMyModel => \"my_models\"\nPerson => \"people\"\nProject::Info => \"project_infos\"\n```\n\nThe property can be updated at initialization to a custom table name:\n\n```\nclass MyModel\n include Clear::Model\n\n self.table = \"another_table_name\"\nend\nMyModel.query.to_sql # SELECT * FROM \"another_table_name\"\n```","summary":"

Return the table name setup for this model.

","abstract":false,"args":[{"name":"table","external_name":"table","restriction":"Clear::SQL::Symbolic"}],"args_string":"(table : Clear::SQL::Symbolic)","args_html":"(table : Clear::SQL::Symbolic)","def":{"name":"table=","args":[{"name":"table","external_name":"table","restriction":"Clear::SQL::Symbolic"}],"visibility":"Public","body":"@@table = table"}}],"constructors":[{"html_id":"build(x:NamedTuple):self-class-method","name":"build","doc":"Build a new empty model and fill the columns using the NamedTuple in argument.\n\nReturns the new model","summary":"

Build a new empty model and fill the columns using the NamedTuple in argument.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"args_string":"(x : NamedTuple) : self","args_html":"(x : NamedTuple) : self","location":{"filename":"src/clear/model/reflection/column.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/column.cr#L4"},"def":{"name":"build","args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"return_type":"self","visibility":"Public","body":"build(**x) do\nend"}},{"html_id":"build(x:NamedTuple,&block:self->Nil):self-class-method","name":"build","doc":"Build a new empty model and fill the columns using the NamedTuple in argument.\n\nReturns the new model","summary":"

Build a new empty model and fill the columns using the NamedTuple in argument.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"args_string":"(x : NamedTuple, &block : self -> Nil) : self","args_html":"(x : NamedTuple, &block : self -> Nil) : self","location":{"filename":"src/clear/model/reflection/column.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/column.cr#L4"},"def":{"name":"build","args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(self -> Nil)"},"return_type":"self","visibility":"Public","body":"build(**x, &block)"}},{"html_id":"create(x:NamedTuple,&block:self->Nil):self-class-method","name":"create","doc":"Build and new model and save it. Returns the model.\n\nThe model may not be saved due to validation failure;\ncheck the returned model `errors?` and `persisted?` flags.","summary":"

Build and new model and save it.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"args_string":"(x : NamedTuple, &block : self -> Nil) : self","args_html":"(x : NamedTuple, &block : self -> Nil) : self","location":{"filename":"src/clear/model/reflection/column.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/column.cr#L4"},"def":{"name":"create","args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(self -> Nil)"},"return_type":"self","visibility":"Public","body":"create(**x, &block)"}},{"html_id":"create(**tuple,&block:self->Nil):self-class-method","name":"create","doc":"Build and new model and save it. Returns the model.\n\nThe model may not be saved due to validation failure;\ncheck the returned model `errors?` and `persisted?` flags.","summary":"

Build and new model and save it.

","abstract":false,"location":{"filename":"src/clear/model/reflection/column.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/column.cr#L4"},"def":{"name":"create","double_splat":{"name":"tuple","external_name":"tuple","restriction":""},"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(self -> Nil)"},"return_type":"self","visibility":"Public","body":"r = build(**tuple) do |mdl|\n yield(mdl)\nend\nr.save\nr\n"}},{"html_id":"create(x:NamedTuple):self-class-method","name":"create","doc":"Build and new model and save it. Returns the model.\n\nThe model may not be saved due to validation failure;\ncheck the returned model `errors?` and `persisted?` flags.","summary":"

Build and new model and save it.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"args_string":"(x : NamedTuple) : self","args_html":"(x : NamedTuple) : self","location":{"filename":"src/clear/model/reflection/column.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/column.cr#L4"},"def":{"name":"create","args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"return_type":"self","visibility":"Public","body":"create(**x) do\nend"}},{"html_id":"create(**tuple):self-class-method","name":"create","doc":"Build and new model and save it. Returns the model.\n\nThe model may not be saved due to validation failure;\ncheck the returned model `errors?` and `persisted?` flags.","summary":"

Build and new model and save it.

","abstract":false,"location":{"filename":"src/clear/model/reflection/column.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/column.cr#L4"},"def":{"name":"create","double_splat":{"name":"tuple","external_name":"tuple","restriction":""},"return_type":"self","visibility":"Public","body":"create(**tuple) do\nend"}},{"html_id":"create!(x:NamedTuple,&block:self->Nil):self-class-method","name":"create!","doc":"Build and new model and save it. Returns the model.\n\nReturns the newly inserted model\nRaises an exception if validation failed during the saving process.","summary":"

Build and new model and save it.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"args_string":"(x : NamedTuple, &block : self -> Nil) : self","args_html":"(x : NamedTuple, &block : self -> Nil) : self","location":{"filename":"src/clear/model/reflection/column.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/column.cr#L4"},"def":{"name":"create!","args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(self -> Nil)"},"return_type":"self","visibility":"Public","body":"create!(**x, &block)"}},{"html_id":"create!(**tuple,&block:self->Nil):self-class-method","name":"create!","doc":"Build and new model and save it. Returns the model.\n\nReturns the newly inserted model\nRaises an exception if validation failed during the saving process.","summary":"

Build and new model and save it.

","abstract":false,"location":{"filename":"src/clear/model/reflection/column.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/column.cr#L4"},"def":{"name":"create!","double_splat":{"name":"tuple","external_name":"tuple","restriction":""},"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(self -> Nil)"},"return_type":"self","visibility":"Public","body":"r = build(**tuple) do |mdl|\n yield(mdl)\nend\nr.save!\nr\n"}},{"html_id":"create!(x:NamedTuple):self-class-method","name":"create!","doc":"Build and new model and save it. Returns the model.\n\nReturns the newly inserted model\nRaises an exception if validation failed during the saving process.","summary":"

Build and new model and save it.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"args_string":"(x : NamedTuple) : self","args_html":"(x : NamedTuple) : self","location":{"filename":"src/clear/model/reflection/column.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/column.cr#L4"},"def":{"name":"create!","args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"return_type":"self","visibility":"Public","body":"create!(**x) do\nend"}},{"html_id":"create!(**tuple):self-class-method","name":"create!","doc":"Build and new model and save it. Returns the model.\n\nReturns the newly inserted model\nRaises an exception if validation failed during the saving process.","summary":"

Build and new model and save it.

","abstract":false,"location":{"filename":"src/clear/model/reflection/column.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/column.cr#L4"},"def":{"name":"create!","double_splat":{"name":"tuple","external_name":"tuple","restriction":""},"return_type":"self","visibility":"Public","body":"create!(**tuple) do\nend"}},{"html_id":"new(h:Hash(String,_),cache:Clear::Model::QueryCache|Nil=nil,persisted=false,fetch_columns=false)-class-method","name":"new","abstract":false,"args":[{"name":"h","external_name":"h","restriction":"Hash(String, _)"},{"name":"cache","default_value":"nil","external_name":"cache","restriction":"Clear::Model::QueryCache | ::Nil"},{"name":"persisted","default_value":"false","external_name":"persisted","restriction":""},{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"args_string":"(h : Hash(String, _), cache : Clear::Model::QueryCache | Nil = nil, persisted = false, fetch_columns = false)","args_html":"(h : Hash(String, _), cache : Clear::Model::QueryCache | Nil = nil, persisted = false, fetch_columns = false)","location":{"filename":"src/clear/model/reflection/column.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/column.cr#L4"},"def":{"name":"new","args":[{"name":"h","external_name":"h","restriction":"Hash(String, _)"},{"name":"cache","default_value":"nil","external_name":"cache","restriction":"Clear::Model::QueryCache | ::Nil"},{"name":"persisted","default_value":"false","external_name":"persisted","restriction":""},{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"visibility":"Public","body":"_ = allocate\n_.initialize(h, cache, persisted, fetch_columns)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new(json:JSON::Any,cache:Clear::Model::QueryCache|Nil=nil,persisted=false)-class-method","name":"new","abstract":false,"args":[{"name":"json","external_name":"json","restriction":"::JSON::Any"},{"name":"cache","default_value":"nil","external_name":"cache","restriction":"Clear::Model::QueryCache | ::Nil"},{"name":"persisted","default_value":"false","external_name":"persisted","restriction":""}],"args_string":"(json : JSON::Any, cache : Clear::Model::QueryCache | Nil = nil, persisted = false)","args_html":"(json : JSON::Any, cache : Clear::Model::QueryCache | Nil = nil, persisted = false)","location":{"filename":"src/clear/model/reflection/column.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/column.cr#L4"},"def":{"name":"new","args":[{"name":"json","external_name":"json","restriction":"::JSON::Any"},{"name":"cache","default_value":"nil","external_name":"cache","restriction":"Clear::Model::QueryCache | ::Nil"},{"name":"persisted","default_value":"false","external_name":"persisted","restriction":""}],"visibility":"Public","body":"_ = allocate\n_.initialize(json, cache, persisted)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new(t:NamedTuple,persisted=false)-class-method","name":"new","abstract":false,"args":[{"name":"t","external_name":"t","restriction":"NamedTuple"},{"name":"persisted","default_value":"false","external_name":"persisted","restriction":""}],"args_string":"(t : NamedTuple, persisted = false)","args_html":"(t : NamedTuple, persisted = false)","location":{"filename":"src/clear/model/reflection/column.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/column.cr#L4"},"def":{"name":"new","args":[{"name":"t","external_name":"t","restriction":"NamedTuple"},{"name":"persisted","default_value":"false","external_name":"persisted","restriction":""}],"visibility":"Public","body":"_ = allocate\n_.initialize(t, persisted)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new-class-method","name":"new","abstract":false,"location":{"filename":"src/clear/model/reflection/column.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/column.cr#L4"},"def":{"name":"new","visibility":"Public","body":"_ = allocate\n_.initialize\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"_cached_table:Clear::Reflection::Table|Nil-instance-method","name":"_cached_table","abstract":false,"def":{"name":"_cached_table","return_type":"Clear::Reflection::Table | ::Nil","visibility":"Public","body":"@_cached_table"}},{"html_id":"attributes:Hash(String,Clear::SQL::Any)-instance-method","name":"attributes","doc":"Attributes, used when fetch_columns is true","summary":"

Attributes, used when fetch_columns is true

","abstract":false,"def":{"name":"attributes","return_type":"Hash(String, ::Clear::SQL::Any)","visibility":"Public","body":"@attributes"}},{"html_id":"cache:Clear::Model::QueryCache|Nil-instance-method","name":"cache","abstract":false,"def":{"name":"cache","return_type":"Clear::Model::QueryCache | ::Nil","visibility":"Public","body":"@cache"}},{"html_id":"changed?-instance-method","name":"changed?","doc":"Return `true` if the model is dirty (e.g. one or more fields\n have been changed.). Return `false` otherwise.","summary":"

Return true if the model is dirty (e.g.

","abstract":false,"def":{"name":"changed?","visibility":"Public","body":"if @table_catalog_column.changed?\n return true\nend\nif @table_schema_column.changed?\n return true\nend\nif @table_name_column.changed?\n return true\nend\nif @column_name_column.changed?\n return true\nend\nreturn false\n"}},{"html_id":"clear_change_flags-instance-method","name":"clear_change_flags","doc":"Reset the `changed?` flag on all columns\n\nThe model behave like its not dirty anymore\nand call to save would apply no changes.\n\nReturns `self`","summary":"

Reset the #changed? flag on all columns

","abstract":false,"def":{"name":"clear_change_flags","visibility":"Public","body":"@table_catalog_column.clear_change_flag\n@table_schema_column.clear_change_flag\n@table_name_column.clear_change_flag\n@column_name_column.clear_change_flag\nself\n"}},{"html_id":"column_name:String-instance-method","name":"column_name","doc":"Returns the value of `column_name` column or throw an exception if the column is not defined.","summary":"

Returns the value of #column_name column or throw an exception if the column is not defined.

","abstract":false,"def":{"name":"column_name","return_type":"String","visibility":"Public","body":"@column_name_column.value"}},{"html_id":"column_name=(x:String)-instance-method","name":"column_name=","doc":"Setter for `column_name` column.","summary":"

Setter for #column_name column.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"String"}],"args_string":"(x : String)","args_html":"(x : String)","def":{"name":"column_name=","args":[{"name":"x","external_name":"x","restriction":"String"}],"visibility":"Public","body":"@column_name_column.value = x"}},{"html_id":"column_name_column:Clear::Model::Column(String,Clear::Model::Converter::StringConverter)-instance-method","name":"column_name_column","doc":"Returns the column object used to manage `column_name` field\n\nSee `Clear::Model::Column`","summary":"

Returns the column object used to manage #column_name field

","abstract":false,"def":{"name":"column_name_column","return_type":"Clear::Model::Column(String, Clear::Model::Converter::StringConverter)","visibility":"Public","body":"@column_name_column"}},{"html_id":"reset(h:Hash(Symbol,_))-instance-method","name":"reset","doc":"Set the columns from hash","summary":"

Set the columns from hash

","abstract":false,"args":[{"name":"h","external_name":"h","restriction":"Hash(Symbol, _)"}],"args_string":"(h : Hash(Symbol, _))","args_html":"(h : Hash(Symbol, _))","def":{"name":"reset","args":[{"name":"h","external_name":"h","restriction":"Hash(Symbol, _)"}],"visibility":"Public","body":"super(h)\n{% for name, settings in COLUMNS %}\n v = h.fetch(:\\{{settings[:db_column_name]}}) { Clear::Model::Column::UNKNOWN }\n @{{ settings[:crystal_variable_name] }}_column.reset_convert(v) unless v.is_a?(Clear::Model::Column::UnknownClass)\n {% end %}\nself\n"}},{"html_id":"reset(h:Hash(String,_))-instance-method","name":"reset","doc":"Set the model fields from hash","summary":"

Set the model fields from hash

","abstract":false,"args":[{"name":"h","external_name":"h","restriction":"Hash(String, _)"}],"args_string":"(h : Hash(String, _))","args_html":"(h : Hash(String, _))","def":{"name":"reset","args":[{"name":"h","external_name":"h","restriction":"Hash(String, _)"}],"visibility":"Public","body":"super(h)\n{% for name, settings in COLUMNS %}\n v = h.fetch({{ settings[:db_column_name] }}) { Clear::Model::Column::UNKNOWN }\n @{{ settings[:crystal_variable_name] }}_column.reset_convert(v) unless v.is_a?(Clear::Model::Column::UnknownClass)\n {% end %}\nself\n"}},{"html_id":"reset(t:NamedTuple)-instance-method","name":"reset","abstract":false,"args":[{"name":"t","external_name":"t","restriction":"NamedTuple"}],"args_string":"(t : NamedTuple)","args_html":"(t : NamedTuple)","def":{"name":"reset","args":[{"name":"t","external_name":"t","restriction":"NamedTuple"}],"visibility":"Public","body":"reset(**t)"}},{"html_id":"reset(from_json:JSON::Any)-instance-method","name":"reset","abstract":false,"args":[{"name":"from_json","external_name":"from_json","restriction":"JSON::Any"}],"args_string":"(from_json : JSON::Any)","args_html":"(from_json : JSON::Any)","def":{"name":"reset","args":[{"name":"from_json","external_name":"from_json","restriction":"JSON::Any"}],"visibility":"Public","body":"reset(from_json.as_h)"}},{"html_id":"reset(**t:**T)forallT-instance-method","name":"reset","doc":"reset flavors","summary":"

reset flavors

","abstract":false,"def":{"name":"reset","double_splat":{"name":"t","external_name":"t","restriction":"**T"},"visibility":"Public","body":"super(**t)\n{% for name, typ in T %}\n\n {% if settings = COLUMNS[\"#{name}\"] %}\n @{{ settings[:crystal_variable_name] }}_column.reset_convert(t[:{{ name }}])\n {% else %}\n {% if !(@type.has_method?(\"#{name}=\")) %}\n {% raise(\"Cannot find the column `#{name}` of the model `#{@type}`\") %}\n {% end %}\n self.{{ name }} = t[:{{ name }}]\n {% end %}\n {% end %}\nself\n"}},{"html_id":"set(h:Hash(Symbol,_))-instance-method","name":"set","doc":"Set the columns from hash","summary":"

Set the columns from hash

","abstract":false,"args":[{"name":"h","external_name":"h","restriction":"Hash(Symbol, _)"}],"args_string":"(h : Hash(Symbol, _))","args_html":"(h : Hash(Symbol, _))","def":{"name":"set","args":[{"name":"h","external_name":"h","restriction":"Hash(Symbol, _)"}],"visibility":"Public","body":"super(h)\n{% for name, settings in COLUMNS %}\n v = h.fetch(:{{ settings[:db_column_name] }}) { Clear::Model::Column::UNKNOWN }\n @{{ settings[:crystal_variable_name] }}_column.set_convert(v) unless v.is_a?(Clear::Model::Column::UnknownClass)\n {% end %}\nself\n"}},{"html_id":"set(h:Hash(String,_))-instance-method","name":"set","doc":"Set the model fields from hash","summary":"

Set the model fields from hash

","abstract":false,"args":[{"name":"h","external_name":"h","restriction":"Hash(String, _)"}],"args_string":"(h : Hash(String, _))","args_html":"(h : Hash(String, _))","def":{"name":"set","args":[{"name":"h","external_name":"h","restriction":"Hash(String, _)"}],"visibility":"Public","body":"super(h)\n{% for name, settings in COLUMNS %}\n v = h.fetch({{ settings[:db_column_name] }}) { Clear::Model::Column::UNKNOWN }\n @{{ settings[:crystal_variable_name] }}_column.set_convert(v) unless v.is_a?(Clear::Model::Column::UnknownClass)\n {% end %}\nself\n"}},{"html_id":"set(t:NamedTuple)-instance-method","name":"set","abstract":false,"args":[{"name":"t","external_name":"t","restriction":"NamedTuple"}],"args_string":"(t : NamedTuple)","args_html":"(t : NamedTuple)","def":{"name":"set","args":[{"name":"t","external_name":"t","restriction":"NamedTuple"}],"visibility":"Public","body":"set(**t)"}},{"html_id":"set(from_json:JSON::Any)-instance-method","name":"set","abstract":false,"args":[{"name":"from_json","external_name":"from_json","restriction":"JSON::Any"}],"args_string":"(from_json : JSON::Any)","args_html":"(from_json : JSON::Any)","def":{"name":"set","args":[{"name":"from_json","external_name":"from_json","restriction":"JSON::Any"}],"visibility":"Public","body":"set(from_json.as_h)"}},{"html_id":"set(**t:**T)forallT-instance-method","name":"set","doc":"Set one or multiple columns to a specific value\nThis two are equivalents:\n\n```\nmodel.set(a: 1)\nmodel.a = 1\n```","summary":"

Set one or multiple columns to a specific value This two are equivalents:

","abstract":false,"def":{"name":"set","double_splat":{"name":"t","external_name":"t","restriction":"**T"},"visibility":"Public","body":"super(**t)\n{% for name, typ in T %}\n {% if settings = COLUMNS[\"#{name}\".id] %}\n @{{ settings[:crystal_variable_name] }}_column.set_convert(t[:{{ name }}])\n {% else %}\n {% if !(@type.has_method?(\"#{name}=\")) %}\n {% raise(\"No method #{@type}##{name}= while trying to set value of #{name}\") %}\n {% end %}\n self.{{ name }} = t[:{{ name }}]\n {% end %}\n {% end %}\nself\n"}},{"html_id":"set_from_json(string_or_io:String|IO,trusted:Bool=false)-instance-method","name":"set_from_json","doc":"Set the fields from json passed as argument\nTrusted flag set to true will allow mass assignment without protection, FALSE by default","summary":"

Set the fields from json passed as argument Trusted flag set to true will allow mass assignment without protection, FALSE by default

","abstract":false,"args":[{"name":"string_or_io","external_name":"string_or_io","restriction":"String | IO"},{"name":"trusted","default_value":"false","external_name":"trusted","restriction":"Bool"}],"args_string":"(string_or_io : String | IO, trusted : Bool = false)","args_html":"(string_or_io : String | IO, trusted : Bool = false)","def":{"name":"set_from_json","args":[{"name":"string_or_io","external_name":"string_or_io","restriction":"String | IO"},{"name":"trusted","default_value":"false","external_name":"trusted","restriction":"Bool"}],"visibility":"Public","body":"(Assigner.from_json(string_or_io)).update(self, trusted)"}},{"html_id":"table:Clear::Reflection::Table-instance-method","name":"table","doc":"The method table is a `belongs_to` relation to Clear::Reflection::Table","summary":"

The method table is a belongs_to relation to Clear::Reflection::Table

","abstract":false,"def":{"name":"table","return_type":"Clear::Reflection::Table","visibility":"Public","body":"if cached = @_cached_table\n cached\nelse\n cache = @cache\n if cache && (cache.active?(\"table\"))\n @_cached_table = (cache.hit(\"table\", self.table_name_column.to_sql_value, Clear::Reflection::Table)).first? || (raise(Clear::SQL::RecordNotFoundError.new))\n else\n @_cached_table = Clear::Reflection::Table.query.where do\n (raw(Clear::Reflection::Table.__pkey__)) == self.table_name\n end.first!\n end\nend"}},{"html_id":"table=(model:Clear::Reflection::Table)-instance-method","name":"table=","abstract":false,"args":[{"name":"model","external_name":"model","restriction":"Clear::Reflection::Table"}],"args_string":"(model : Clear::Reflection::Table)","args_html":"(model : Clear::Reflection::Table)","def":{"name":"table=","args":[{"name":"model","external_name":"model","restriction":"Clear::Reflection::Table"}],"visibility":"Public","body":"if model.persisted?\n if model.__pkey_column__.defined?\n else\n raise(\"#{model.__pkey_column__.name} must be defined when assigning a belongs_to relation.\")\n end\n @table_name_column.value = model.__pkey__\nend\n@_cached_table = model\n"}},{"html_id":"table_catalog:String-instance-method","name":"table_catalog","doc":"Returns the value of `table_catalog` column or throw an exception if the column is not defined.","summary":"

Returns the value of #table_catalog column or throw an exception if the column is not defined.

","abstract":false,"def":{"name":"table_catalog","return_type":"String","visibility":"Public","body":"@table_catalog_column.value"}},{"html_id":"table_catalog=(x:String)-instance-method","name":"table_catalog=","doc":"Setter for `table_catalog` column.","summary":"

Setter for #table_catalog column.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"String"}],"args_string":"(x : String)","args_html":"(x : String)","def":{"name":"table_catalog=","args":[{"name":"x","external_name":"x","restriction":"String"}],"visibility":"Public","body":"@table_catalog_column.value = x"}},{"html_id":"table_catalog_column:Clear::Model::Column(String,Clear::Model::Converter::StringConverter)-instance-method","name":"table_catalog_column","doc":"Returns the column object used to manage `table_catalog` field\n\nSee `Clear::Model::Column`","summary":"

Returns the column object used to manage #table_catalog field

","abstract":false,"def":{"name":"table_catalog_column","return_type":"Clear::Model::Column(String, Clear::Model::Converter::StringConverter)","visibility":"Public","body":"@table_catalog_column"}},{"html_id":"table_name:String-instance-method","name":"table_name","doc":"Returns the value of `table_name` column or throw an exception if the column is not defined.","summary":"

Returns the value of #table_name column or throw an exception if the column is not defined.

","abstract":false,"def":{"name":"table_name","return_type":"String","visibility":"Public","body":"@table_name_column.value"}},{"html_id":"table_name=(x:String)-instance-method","name":"table_name=","doc":"Setter for `table_name` column.","summary":"

Setter for #table_name column.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"String"}],"args_string":"(x : String)","args_html":"(x : String)","def":{"name":"table_name=","args":[{"name":"x","external_name":"x","restriction":"String"}],"visibility":"Public","body":"@table_name_column.value = x"}},{"html_id":"table_name_column:Clear::Model::Column(String,Clear::Model::Converter::StringConverter)-instance-method","name":"table_name_column","doc":"Returns the column object used to manage `table_name` field\n\nSee `Clear::Model::Column`","summary":"

Returns the column object used to manage #table_name field

","abstract":false,"def":{"name":"table_name_column","return_type":"Clear::Model::Column(String, Clear::Model::Converter::StringConverter)","visibility":"Public","body":"@table_name_column"}},{"html_id":"table_schema:String-instance-method","name":"table_schema","doc":"Returns the value of `table_schema` column or throw an exception if the column is not defined.","summary":"

Returns the value of #table_schema column or throw an exception if the column is not defined.

","abstract":false,"def":{"name":"table_schema","return_type":"String","visibility":"Public","body":"@table_schema_column.value"}},{"html_id":"table_schema=(x:String)-instance-method","name":"table_schema=","doc":"Setter for `table_schema` column.","summary":"

Setter for #table_schema column.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"String"}],"args_string":"(x : String)","args_html":"(x : String)","def":{"name":"table_schema=","args":[{"name":"x","external_name":"x","restriction":"String"}],"visibility":"Public","body":"@table_schema_column.value = x"}},{"html_id":"table_schema_column:Clear::Model::Column(String,Clear::Model::Converter::StringConverter)-instance-method","name":"table_schema_column","doc":"Returns the column object used to manage `table_schema` field\n\nSee `Clear::Model::Column`","summary":"

Returns the column object used to manage #table_schema field

","abstract":false,"def":{"name":"table_schema_column","return_type":"Clear::Model::Column(String, Clear::Model::Converter::StringConverter)","visibility":"Public","body":"@table_schema_column"}},{"html_id":"to_h(full=false):Hash(String,Clear::SQL::Any)-instance-method","name":"to_h","doc":"Return a hash version of the columns of this model.","summary":"

Return a hash version of the columns of this model.

","abstract":false,"args":[{"name":"full","default_value":"false","external_name":"full","restriction":""}],"args_string":"(full = false) : Hash(String, Clear::SQL::Any)","args_html":"(full = false) : Hash(String, Clear::SQL::Any)","def":{"name":"to_h","args":[{"name":"full","default_value":"false","external_name":"full","restriction":""}],"return_type":"Hash(String, ::Clear::SQL::Any)","visibility":"Public","body":"out = super(full)\nif full || @table_catalog_column.defined?\n out[\"table_catalog\"] = @table_catalog_column.to_sql_value(nil)\nend\nif full || @table_schema_column.defined?\n out[\"table_schema\"] = @table_schema_column.to_sql_value(nil)\nend\nif full || @table_name_column.defined?\n out[\"table_name\"] = @table_name_column.to_sql_value(nil)\nend\nif full || @column_name_column.defined?\n out[\"column_name\"] = @column_name_column.to_sql_value(nil)\nend\nout\n"}},{"html_id":"to_json(emit_nulls:Bool=false)-instance-method","name":"to_json","abstract":false,"args":[{"name":"emit_nulls","default_value":"false","external_name":"emit_nulls","restriction":"Bool"}],"args_string":"(emit_nulls : Bool = false)","args_html":"(emit_nulls : Bool = false)","def":{"name":"to_json","args":[{"name":"emit_nulls","default_value":"false","external_name":"emit_nulls","restriction":"Bool"}],"visibility":"Public","body":"JSON.build do |json|\n to_json(json, emit_nulls)\nend"}},{"html_id":"to_json(json,emit_nulls=false)-instance-method","name":"to_json","abstract":false,"args":[{"name":"json","external_name":"json","restriction":""},{"name":"emit_nulls","default_value":"false","external_name":"emit_nulls","restriction":""}],"args_string":"(json, emit_nulls = false)","args_html":"(json, emit_nulls = false)","def":{"name":"to_json","args":[{"name":"json","external_name":"json","restriction":""},{"name":"emit_nulls","default_value":"false","external_name":"emit_nulls","restriction":""}],"visibility":"Public","body":"json.object do\n if emit_nulls || @table_catalog_column.defined?\n json.field(\"table_catalog\") do\n (@table_catalog_column.value(nil)).to_json(json)\n end\n end\n if emit_nulls || @table_schema_column.defined?\n json.field(\"table_schema\") do\n (@table_schema_column.value(nil)).to_json(json)\n end\n end\n if emit_nulls || @table_name_column.defined?\n json.field(\"table_name\") do\n (@table_name_column.value(nil)).to_json(json)\n end\n end\n if emit_nulls || @column_name_column.defined?\n json.field(\"column_name\") do\n (@column_name_column.value(nil)).to_json(json)\n end\n end\nend"}},{"html_id":"update_from_json(string_or_io:String|IO,trusted:Bool=false)-instance-method","name":"update_from_json","doc":"Set the fields from json passed as argument and call `save` on the object\nTrusted flag set to true will allow mass assignment without protection, FALSE by default","summary":"

Set the fields from json passed as argument and call save on the object Trusted flag set to true will allow mass assignment without protection, FALSE by default

","abstract":false,"args":[{"name":"string_or_io","external_name":"string_or_io","restriction":"String | IO"},{"name":"trusted","default_value":"false","external_name":"trusted","restriction":"Bool"}],"args_string":"(string_or_io : String | IO, trusted : Bool = false)","args_html":"(string_or_io : String | IO, trusted : Bool = false)","def":{"name":"update_from_json","args":[{"name":"string_or_io","external_name":"string_or_io","restriction":"String | IO"},{"name":"trusted","default_value":"false","external_name":"trusted","restriction":"Bool"}],"visibility":"Public","body":"mdl = set_from_json(string_or_io, trusted)\nmdl.save\nmdl\n"}},{"html_id":"update_from_json!(string_or_io:String|IO,trusted:Bool=false)-instance-method","name":"update_from_json!","doc":"Set the fields from json passed as argument and call `save!` on the object\nTrusted flag set to true will allow mass assignment without protection, FALSE by default","summary":"

Set the fields from json passed as argument and call save! on the object Trusted flag set to true will allow mass assignment without protection, FALSE by default

","abstract":false,"args":[{"name":"string_or_io","external_name":"string_or_io","restriction":"String | IO"},{"name":"trusted","default_value":"false","external_name":"trusted","restriction":"Bool"}],"args_string":"(string_or_io : String | IO, trusted : Bool = false)","args_html":"(string_or_io : String | IO, trusted : Bool = false)","def":{"name":"update_from_json!","args":[{"name":"string_or_io","external_name":"string_or_io","restriction":"String | IO"},{"name":"trusted","default_value":"false","external_name":"trusted","restriction":"Bool"}],"visibility":"Public","body":"(set_from_json(string_or_io, trusted)).save!"}},{"html_id":"update_h:Hash(String,Clear::SQL::Any)-instance-method","name":"update_h","doc":"Generate the hash for update request (like during save)","summary":"

Generate the hash for update request (like during save)

","abstract":false,"def":{"name":"update_h","return_type":"Hash(String, ::Clear::SQL::Any)","visibility":"Public","body":"o = super()\nif @table_catalog_column.defined? && @table_catalog_column.changed?\n o[\"table_catalog\"] = @table_catalog_column.to_sql_value\nend\nif @table_schema_column.defined? && @table_schema_column.changed?\n o[\"table_schema\"] = @table_schema_column.to_sql_value\nend\nif @table_name_column.defined? && @table_name_column.changed?\n o[\"table_name\"] = @table_name_column.to_sql_value\nend\nif @column_name_column.defined? && @column_name_column.changed?\n o[\"column_name\"] = @column_name_column.to_sql_value\nend\no\n"}},{"html_id":"validate_fields_presence-instance-method","name":"validate_fields_presence","doc":"For each column, ensure than when needed the column has present\ninformation into it.\n\nThis method is called on validation.","summary":"

For each column, ensure than when needed the column has present information into it.

","abstract":false,"def":{"name":"validate_fields_presence","visibility":"Public","body":"if persisted?\nelse\n if @table_catalog_column.failed_to_be_present?\n add_error(\"table_catalog\", \"must be present\")\n end\nend\nif persisted?\nelse\n if @table_schema_column.failed_to_be_present?\n add_error(\"table_schema\", \"must be present\")\n end\nend\nif persisted?\nelse\n if @table_name_column.failed_to_be_present?\n add_error(\"table_name\", \"must be present\")\n end\nend\nif persisted?\nelse\n if @column_name_column.failed_to_be_present?\n add_error(\"column_name\", \"must be present\")\n end\nend\n"}}],"types":[{"html_id":"clear/Clear/Reflection/Column/Collection","path":"Clear/Reflection/Column/Collection.html","kind":"class","full_name":"Clear::Reflection::Column::Collection","name":"Collection","abstract":false,"superclass":{"html_id":"clear/Clear/Model/CollectionBase","kind":"class","full_name":"Clear::Model::CollectionBase","name":"CollectionBase"},"ancestors":[{"html_id":"clear/Clear/Model/CollectionBase","kind":"class","full_name":"Clear::Model::CollectionBase","name":"CollectionBase"},{"html_id":"clear/Clear/SQL/SelectBuilder","kind":"module","full_name":"Clear::SQL::SelectBuilder","name":"SelectBuilder"},{"html_id":"clear/Clear/SQL/Query/WithPagination","kind":"module","full_name":"Clear::SQL::Query::WithPagination","name":"WithPagination"},{"html_id":"clear/Clear/SQL/Query/BeforeQuery","kind":"module","full_name":"Clear::SQL::Query::BeforeQuery","name":"BeforeQuery"},{"html_id":"clear/Clear/SQL/Query/Change","kind":"module","full_name":"Clear::SQL::Query::Change","name":"Change"},{"html_id":"clear/Clear/SQL/Query/Connection","kind":"module","full_name":"Clear::SQL::Query::Connection","name":"Connection"},{"html_id":"clear/Clear/SQL/Query/Pluck","kind":"module","full_name":"Clear::SQL::Query::Pluck","name":"Pluck"},{"html_id":"clear/Clear/SQL/Query/Fetch","kind":"module","full_name":"Clear::SQL::Query::Fetch","name":"Fetch"},{"html_id":"clear/Clear/SQL/Query/Execute","kind":"module","full_name":"Clear::SQL::Query::Execute","name":"Execute"},{"html_id":"clear/Clear/SQL/Query/Lock","kind":"module","full_name":"Clear::SQL::Query::Lock","name":"Lock"},{"html_id":"clear/Clear/SQL/Query/Window","kind":"module","full_name":"Clear::SQL::Query::Window","name":"Window"},{"html_id":"clear/Clear/SQL/Query/CTE","kind":"module","full_name":"Clear::SQL::Query::CTE","name":"CTE"},{"html_id":"clear/Clear/SQL/Query/Aggregate","kind":"module","full_name":"Clear::SQL::Query::Aggregate","name":"Aggregate"},{"html_id":"clear/Clear/SQL/Query/OffsetLimit","kind":"module","full_name":"Clear::SQL::Query::OffsetLimit","name":"OffsetLimit"},{"html_id":"clear/Clear/SQL/Query/GroupBy","kind":"module","full_name":"Clear::SQL::Query::GroupBy","name":"GroupBy"},{"html_id":"clear/Clear/SQL/Query/OrderBy","kind":"module","full_name":"Clear::SQL::Query::OrderBy","name":"OrderBy"},{"html_id":"clear/Clear/SQL/Query/Having","kind":"module","full_name":"Clear::SQL::Query::Having","name":"Having"},{"html_id":"clear/Clear/SQL/Query/Where","kind":"module","full_name":"Clear::SQL::Query::Where","name":"Where"},{"html_id":"clear/Clear/SQL/Query/Join","kind":"module","full_name":"Clear::SQL::Query::Join","name":"Join"},{"html_id":"clear/Clear/SQL/Query/From","kind":"module","full_name":"Clear::SQL::Query::From","name":"From"},{"html_id":"clear/Clear/SQL/Query/Select","kind":"module","full_name":"Clear::SQL::Query::Select","name":"Select"},{"html_id":"clear/Enumerable","kind":"module","full_name":"Enumerable","name":"Enumerable"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/model/reflection/column.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/column.cr#L4"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Reflection/Column","kind":"class","full_name":"Clear::Reflection::Column","name":"Column"},"doc":":doc:\nClear::Model::Collection\n\nThis is the object managing a `SELECT` request.\nA new collection is created by calling `Clear::Model.query`\n\nCollection are mutable and refining the SQL will mutate the collection.\nYou may want to copy the collection by calling `dup`\n\nSee `Clear::Model::CollectionBase`","summary":"

:doc: Clear::Model::Collection

","instance_methods":[{"html_id":"with_table(fetch_columns=false,&block:Clear::Reflection::Table::Collection->):self-instance-method","name":"with_table","abstract":false,"args":[{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"args_string":"(fetch_columns = false, &block : Clear::Reflection::Table::Collection -> ) : self","args_html":"(fetch_columns = false, &block : Clear::Reflection::Table::Collection -> ) : self","def":{"name":"with_table","args":[{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Clear::Reflection::Table::Collection ->)"},"return_type":"self","visibility":"Public","body":"before_query do\n sub_query = self.dup.clear_select.select(\"#{Clear::Reflection::Column.table}.table_name\")\n cached_qry = Clear::Reflection::Table.query.where do\n (raw(\"#{Clear::Reflection::Table.table}.#{Clear::Reflection::Table.__pkey__}\")).in?(sub_query)\n end\n block.call(cached_qry)\n @cache.active(\"table\")\n cached_qry.each(fetch_columns: fetch_columns) do |mdl|\n @cache.set(\"table\", mdl.__pkey__, [mdl])\n end\nend\nself\n"}},{"html_id":"with_table(fetch_columns=false):self-instance-method","name":"with_table","abstract":false,"args":[{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"args_string":"(fetch_columns = false) : self","args_html":"(fetch_columns = false) : self","def":{"name":"with_table","args":[{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"return_type":"self","visibility":"Public","body":"with_table(fetch_columns) do\nend\nself\n"}}]}]},{"html_id":"clear/Clear/Reflection/Table","path":"Clear/Reflection/Table.html","kind":"class","full_name":"Clear::Reflection::Table","name":"Table","abstract":false,"superclass":{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"clear/Clear/Model","kind":"module","full_name":"Clear::Model","name":"Model"},{"html_id":"clear/Clear/Model/FullTextSearchable","kind":"module","full_name":"Clear::Model::FullTextSearchable","name":"FullTextSearchable"},{"html_id":"clear/Clear/Model/JSONDeserialize","kind":"module","full_name":"Clear::Model::JSONDeserialize","name":"JSONDeserialize"},{"html_id":"clear/Clear/Model/Initializer","kind":"module","full_name":"Clear::Model::Initializer","name":"Initializer"},{"html_id":"clear/Clear/Model/HasFactory","kind":"module","full_name":"Clear::Model::HasFactory","name":"HasFactory"},{"html_id":"clear/Clear/Model/ClassMethods","kind":"module","full_name":"Clear::Model::ClassMethods","name":"ClassMethods"},{"html_id":"clear/Clear/Model/HasScope","kind":"module","full_name":"Clear::Model::HasScope","name":"HasScope"},{"html_id":"clear/Clear/Model/HasRelations","kind":"module","full_name":"Clear::Model::HasRelations","name":"HasRelations"},{"html_id":"clear/Clear/Model/HasValidation","kind":"module","full_name":"Clear::Model::HasValidation","name":"HasValidation"},{"html_id":"clear/Clear/Validation/Helper","kind":"module","full_name":"Clear::Validation::Helper","name":"Helper"},{"html_id":"clear/Clear/Model/HasSaving","kind":"module","full_name":"Clear::Model::HasSaving","name":"HasSaving"},{"html_id":"clear/Clear/Model/HasSerialPkey","kind":"module","full_name":"Clear::Model::HasSerialPkey","name":"HasSerialPkey"},{"html_id":"clear/Clear/Model/HasTimestamps","kind":"module","full_name":"Clear::Model::HasTimestamps","name":"HasTimestamps"},{"html_id":"clear/Clear/Model/HasColumns","kind":"module","full_name":"Clear::Model::HasColumns","name":"HasColumns"},{"html_id":"clear/Clear/Model/HasHooks","kind":"module","full_name":"Clear::Model::HasHooks","name":"HasHooks"},{"html_id":"clear/Clear/Model/Connection","kind":"module","full_name":"Clear::Model::Connection","name":"Connection"},{"html_id":"clear/Clear/ErrorMessages","kind":"module","full_name":"Clear::ErrorMessages","name":"ErrorMessages"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/model/reflection/table.cr","line_number":3,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/table.cr#L3"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"COLUMNS","name":"COLUMNS","value":"{\"table_catalog\" => {type: String, primary: false, converter: \"String\", db_column_name: \"table_catalog\", crystal_variable_name: table_catalog, presence: true, mass_assign: true}, \"table_schema\" => {type: String, primary: false, converter: \"String\", db_column_name: \"table_schema\", crystal_variable_name: table_schema, presence: true, mass_assign: true}, \"table_name\" => {type: String, primary: true, converter: \"String\", db_column_name: \"table_name\", crystal_variable_name: table_name, presence: true, mass_assign: true}, \"table_type\" => {type: String, primary: false, converter: \"String\", db_column_name: \"table_type\", crystal_variable_name: table_type, presence: true, mass_assign: true}} of Nil => Nil"},{"id":"POLYMORPHISM_SETTINGS","name":"POLYMORPHISM_SETTINGS","value":"{} of Nil => Nil"}],"included_modules":[{"html_id":"clear/Clear/Model","kind":"module","full_name":"Clear::Model","name":"Model"}],"extended_modules":[{"html_id":"clear/Clear/Model/HasHooks/ClassMethods","kind":"module","full_name":"Clear::Model::HasHooks::ClassMethods","name":"ClassMethods"}],"namespace":{"html_id":"clear/Clear/Reflection","kind":"module","full_name":"Clear::Reflection","name":"Reflection"},"doc":"Reflection of the tables using information_schema in postgreSQL.\nTODO: Usage of view instead of model","summary":"

Reflection of the tables using information_schema in postgreSQL.

","class_methods":[{"html_id":"build(**tuple:**T)forallT-class-method","name":"build","doc":"Build a new empty model and fill the columns using the NamedTuple in argument.\n\nReturns the new model","summary":"

Build a new empty model and fill the columns using the NamedTuple in argument.

","abstract":false,"location":{"filename":"src/clear/model/reflection/table.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/table.cr#L4"},"def":{"name":"build","double_splat":{"name":"tuple","external_name":"tuple","restriction":"**T"},"visibility":"Public","body":"{% if T.size > 0 %}\n self.new(tuple)\n {% else %}\n self.new\n {% end %}"}},{"html_id":"build(**tuple)-class-method","name":"build","doc":"Build a new empty model and fill the columns using the NamedTuple in argument.\n\nReturns the new model","summary":"

Build a new empty model and fill the columns using the NamedTuple in argument.

","abstract":false,"location":{"filename":"src/clear/model/reflection/table.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/table.cr#L4"},"def":{"name":"build","double_splat":{"name":"tuple","external_name":"tuple","restriction":""},"visibility":"Public","body":"build(**tuple) do\nend"}},{"html_id":"build(**tuple,&)-class-method","name":"build","doc":"Build a new empty model and fill the columns using the NamedTuple in argument.\n\nReturns the new model","summary":"

Build a new empty model and fill the columns using the NamedTuple in argument.

","abstract":false,"location":{"filename":"src/clear/model/reflection/table.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/table.cr#L4"},"def":{"name":"build","double_splat":{"name":"tuple","external_name":"tuple","restriction":""},"yields":1,"block_arity":1,"visibility":"Public","body":"r = build(**tuple)\nyield(r)\nr\n"}},{"html_id":"columns-class-method","name":"columns","abstract":false,"location":{"filename":"src/clear/model/reflection/table.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/table.cr#L4"},"def":{"name":"columns","visibility":"Public","body":"@@columns"}},{"html_id":"connection:String-class-method","name":"connection","doc":"Define on which connection the model is living. Useful in case of models living in different databases.\n\nIs set to \"default\" by default.\n\nSee `Clear::SQL#init(URI, *opts)` for more information about multi-connections.\n\nExample:\n\n```\nClear::SQL.init(\"postgres://postgres@localhost/database_1\")\nClear::SQL.init(\"secondary\", \"postgres://postgres@localhost/database_2\")\n\nclass ModelA\n include Clear::Model\n\n # Performs all the queries on `database_1`\n # self.connection = \"default\"\n column id : Int32, primary: true, presence: false\n column title : String\nend\n\nclass ModelB\n include Clear::Model\n\n # Performs all the queries on `database_2`\n self.connection = \"secondary\"\n\n column id : Int32, primary: true, presence: false\nend\n```","summary":"

Define on which connection the model is living.

","abstract":false,"def":{"name":"connection","return_type":"String","visibility":"Public","body":"@@connection"}},{"html_id":"connection=(connection:String)-class-method","name":"connection=","doc":"Define on which connection the model is living. Useful in case of models living in different databases.\n\nIs set to \"default\" by default.\n\nSee `Clear::SQL#init(URI, *opts)` for more information about multi-connections.\n\nExample:\n\n```\nClear::SQL.init(\"postgres://postgres@localhost/database_1\")\nClear::SQL.init(\"secondary\", \"postgres://postgres@localhost/database_2\")\n\nclass ModelA\n include Clear::Model\n\n # Performs all the queries on `database_1`\n # self.connection = \"default\"\n column id : Int32, primary: true, presence: false\n column title : String\nend\n\nclass ModelB\n include Clear::Model\n\n # Performs all the queries on `database_2`\n self.connection = \"secondary\"\n\n column id : Int32, primary: true, presence: false\nend\n```","summary":"

Define on which connection the model is living.

","abstract":false,"args":[{"name":"connection","external_name":"connection","restriction":"String"}],"args_string":"(connection : String)","args_html":"(connection : String)","def":{"name":"connection=","args":[{"name":"connection","external_name":"connection","restriction":"String"}],"visibility":"Public","body":"@@connection = connection"}},{"html_id":"create_from_json(string_or_io:String|IO,trusted:Bool=false)-class-method","name":"create_from_json","doc":"Create a new model from json and save it. Returns the model.\n\nThe model may not be saved due to validation failure;\ncheck the returned model `errors?` and `persisted?` flags.\nTrusted flag set to true will allow mass assignment without protection, FALSE by default","summary":"

Create a new model from json and save it.

","abstract":false,"args":[{"name":"string_or_io","external_name":"string_or_io","restriction":"String | IO"},{"name":"trusted","default_value":"false","external_name":"trusted","restriction":"Bool"}],"args_string":"(string_or_io : String | IO, trusted : Bool = false)","args_html":"(string_or_io : String | IO, trusted : Bool = false)","def":{"name":"create_from_json","args":[{"name":"string_or_io","external_name":"string_or_io","restriction":"String | IO"},{"name":"trusted","default_value":"false","external_name":"trusted","restriction":"Bool"}],"visibility":"Public","body":"mdl = self.from_json(string_or_io, trusted)\nmdl.save\nmdl\n"}},{"html_id":"create_from_json!(string_or_io:String|IO,trusted:Bool=false)-class-method","name":"create_from_json!","doc":"Create a new model from json and save it. Returns the model.\n\nReturns the newly inserted model\nRaises an exception if validation failed during the saving process.\nTrusted flag set to true will allow mass assignment without protection, FALSE by default","summary":"

Create a new model from json and save it.

","abstract":false,"args":[{"name":"string_or_io","external_name":"string_or_io","restriction":"String | IO"},{"name":"trusted","default_value":"false","external_name":"trusted","restriction":"Bool"}],"args_string":"(string_or_io : String | IO, trusted : Bool = false)","args_html":"(string_or_io : String | IO, trusted : Bool = false)","def":{"name":"create_from_json!","args":[{"name":"string_or_io","external_name":"string_or_io","restriction":"String | IO"},{"name":"trusted","default_value":"false","external_name":"trusted","restriction":"Bool"}],"visibility":"Public","body":"(self.from_json(string_or_io, trusted)).save!"}},{"html_id":"find(x)-class-method","name":"find","doc":"Returns a model using primary key equality\nReturns `nil` if not found.","summary":"

Returns a model using primary key equality Returns nil if not found.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x)","args_html":"(x)","location":{"filename":"src/clear/model/reflection/table.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/table.cr#L4"},"def":{"name":"find","args":[{"name":"x","external_name":"x","restriction":""}],"visibility":"Public","body":"query.where do\n (raw(__pkey__)) == x\nend.first"}},{"html_id":"find!(x)-class-method","name":"find!","doc":"Returns a model using primary key equality.\nRaises error if the model is not found.","summary":"

Returns a model using primary key equality.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x)","args_html":"(x)","location":{"filename":"src/clear/model/reflection/table.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/table.cr#L4"},"def":{"name":"find!","args":[{"name":"x","external_name":"x","restriction":""}],"visibility":"Public","body":"(find(x)) || (raise(Clear::SQL::RecordNotFoundError.new))"}},{"html_id":"from_json(string_or_io:String|IO,trusted:Bool=false)-class-method","name":"from_json","doc":"Create a new empty model and fill the columns from json. Returns the new model\n\nTrusted flag set to true will allow mass assignment without protection, FALSE by default","summary":"

Create a new empty model and fill the columns from json.

","abstract":false,"args":[{"name":"string_or_io","external_name":"string_or_io","restriction":"String | IO"},{"name":"trusted","default_value":"false","external_name":"trusted","restriction":"Bool"}],"args_string":"(string_or_io : String | IO, trusted : Bool = false)","args_html":"(string_or_io : String | IO, trusted : Bool = false)","def":{"name":"from_json","args":[{"name":"string_or_io","external_name":"string_or_io","restriction":"String | IO"},{"name":"trusted","default_value":"false","external_name":"trusted","restriction":"Bool"}],"visibility":"Public","body":"(Assigner.from_json(string_or_io)).create(trusted)"}},{"html_id":"full_table_name-class-method","name":"full_table_name","doc":"returns the fully qualified and escaped name for this table.\nadd schema if schema is different from 'public' (default schema)\n\nex: \"schema\".\"table\"","summary":"

returns the fully qualified and escaped name for this table.

","abstract":false,"location":{"filename":"src/clear/model/reflection/table.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/table.cr#L4"},"def":{"name":"full_table_name","visibility":"Public","body":"if s = schema\n {schema, table}.map do |x|\n Clear::SQL.escape(x.to_s)\n end.join(\".\")\nelse\n Clear::SQL.escape(table)\nend"}},{"html_id":"import(array:Enumerable(self),on_conflict:Clear::SQL::InsertQuery->|Nil=nil)-class-method","name":"import","doc":"Import a bulk of models in one SQL insert query.\nEach model must be non-persisted.\n\n`on_conflict` callback can be optionnaly turned on\nto manage constraints of the database.\n\nNote: Old models are not modified. This method return a copy of the\nmodels as saved in the database.\n\n## Example:\n\n```\nusers = [User.new(id: 1), User.new(id: 2), User.new(id: 3)]\nusers = User.import(users)\n```","summary":"

Import a bulk of models in one SQL insert query.

","abstract":false,"args":[{"name":"array","external_name":"array","restriction":"Enumerable(self)"},{"name":"on_conflict","default_value":"nil","external_name":"on_conflict","restriction":"(Clear::SQL::InsertQuery ->) | ::Nil"}],"args_string":"(array : Enumerable(self), on_conflict : Clear::SQL::InsertQuery -> | Nil = nil)","args_html":"(array : Enumerable(self), on_conflict : Clear::SQL::InsertQuery -> | Nil = nil)","location":{"filename":"src/clear/model/reflection/table.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/table.cr#L4"},"def":{"name":"import","args":[{"name":"array","external_name":"array","restriction":"Enumerable(self)"},{"name":"on_conflict","default_value":"nil","external_name":"on_conflict","restriction":"(Clear::SQL::InsertQuery ->) | ::Nil"}],"visibility":"Public","body":"array.each do |item|\n if item.persisted?\n raise(\"One of your model is persisted while calling import\")\n end\nend\nhashes = array.map do |item|\n item.trigger_before_events(:save)\n if item.valid?\n else\n raise(\"import: Validation failed for `#{item}`\")\n end\n item.trigger_before_events(:create)\n item.to_h\nend\nquery = (Clear::SQL.insert_into(self.table, hashes)).returning(\"*\")\nif on_conflict\n on_conflict.call(query)\nend\no = [] of self\nquery.fetch(@@connection) do |hash|\n o << ((Clear::Model::Factory.build(self.name, hash, persisted: true, fetch_columns: false, cache: nil)).as(self))\nend\no.each(&.trigger_after_events(:create))\no.each(&.trigger_after_events(:save))\no\n"}},{"html_id":"polymorphic?:Bool-class-method","name":"polymorphic?","abstract":false,"def":{"name":"polymorphic?","return_type":"Bool","visibility":"Public","body":"@@polymorphic"}},{"html_id":"public-class-method","name":"public","abstract":false,"location":{"filename":"src/clear/model/reflection/table.cr","line_number":16,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/table.cr#L16"},"def":{"name":"public","visibility":"Public","body":"query.public()"}},{"html_id":"query-class-method","name":"query","doc":"Return a new empty query `SELECT * FROM [my_model_table]`. Can be refined after that.","summary":"

Return a new empty query SELECT * FROM [my_model_table].

","abstract":false,"location":{"filename":"src/clear/model/reflection/table.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/table.cr#L4"},"def":{"name":"query","visibility":"Public","body":"(Collection.new.use_connection(connection)).from(self.full_table_name)"}},{"html_id":"read_only=(read_only:Bool)-class-method","name":"read_only=","abstract":false,"args":[{"name":"read_only","external_name":"read_only","restriction":"Bool"}],"args_string":"(read_only : Bool)","args_html":"(read_only : Bool)","def":{"name":"read_only=","args":[{"name":"read_only","external_name":"read_only","restriction":"Bool"}],"visibility":"Public","body":"@@read_only = read_only"}},{"html_id":"read_only?:Bool-class-method","name":"read_only?","abstract":false,"def":{"name":"read_only?","return_type":"Bool","visibility":"Public","body":"@@read_only"}},{"html_id":"schema:Clear::SQL::Symbolic|Nil-class-method","name":"schema","doc":"Define the current schema used in PostgreSQL. The value is `nil` by default, which lead to non-specified\n schema during the querying, and usage of \"public\" by PostgreSQL.\n\nThis property can be redefined on initialization. Example:\n\n```\nclass MyModel\n include Clear::Model\n\n self.schema = \"my_schema\"\nend\nMyModel.query.to_sql # SELECT * FROM \"my_schema\".\"my_models\"\n```","summary":"

Define the current schema used in PostgreSQL.

","abstract":false,"def":{"name":"schema","return_type":"Clear::SQL::Symbolic | ::Nil","visibility":"Public","body":"@@schema"}},{"html_id":"schema=(schema:Clear::SQL::Symbolic|Nil)-class-method","name":"schema=","doc":"Define the current schema used in PostgreSQL. The value is `nil` by default, which lead to non-specified\n schema during the querying, and usage of \"public\" by PostgreSQL.\n\nThis property can be redefined on initialization. Example:\n\n```\nclass MyModel\n include Clear::Model\n\n self.schema = \"my_schema\"\nend\nMyModel.query.to_sql # SELECT * FROM \"my_schema\".\"my_models\"\n```","summary":"

Define the current schema used in PostgreSQL.

","abstract":false,"args":[{"name":"schema","external_name":"schema","restriction":"Clear::SQL::Symbolic | ::Nil"}],"args_string":"(schema : Clear::SQL::Symbolic | Nil)","args_html":"(schema : Clear::SQL::Symbolic | Nil)","def":{"name":"schema=","args":[{"name":"schema","external_name":"schema","restriction":"Clear::SQL::Symbolic | ::Nil"}],"visibility":"Public","body":"@@schema = schema"}},{"html_id":"table:Clear::SQL::Symbolic-class-method","name":"table","doc":"Return the table name setup for this model.\nBy convention, the class name is by default equals to the pluralized underscored string form of the model name.\nExample:\n\n```\nMyModel => \"my_models\"\nPerson => \"people\"\nProject::Info => \"project_infos\"\n```\n\nThe property can be updated at initialization to a custom table name:\n\n```\nclass MyModel\n include Clear::Model\n\n self.table = \"another_table_name\"\nend\nMyModel.query.to_sql # SELECT * FROM \"another_table_name\"\n```","summary":"

Return the table name setup for this model.

","abstract":false,"def":{"name":"table","return_type":"Clear::SQL::Symbolic","visibility":"Public","body":"@@table"}},{"html_id":"table=(table:Clear::SQL::Symbolic)-class-method","name":"table=","doc":"Return the table name setup for this model.\nBy convention, the class name is by default equals to the pluralized underscored string form of the model name.\nExample:\n\n```\nMyModel => \"my_models\"\nPerson => \"people\"\nProject::Info => \"project_infos\"\n```\n\nThe property can be updated at initialization to a custom table name:\n\n```\nclass MyModel\n include Clear::Model\n\n self.table = \"another_table_name\"\nend\nMyModel.query.to_sql # SELECT * FROM \"another_table_name\"\n```","summary":"

Return the table name setup for this model.

","abstract":false,"args":[{"name":"table","external_name":"table","restriction":"Clear::SQL::Symbolic"}],"args_string":"(table : Clear::SQL::Symbolic)","args_html":"(table : Clear::SQL::Symbolic)","def":{"name":"table=","args":[{"name":"table","external_name":"table","restriction":"Clear::SQL::Symbolic"}],"visibility":"Public","body":"@@table = table"}},{"html_id":"tables_only-class-method","name":"tables_only","abstract":false,"location":{"filename":"src/clear/model/reflection/table.cr","line_number":18,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/table.cr#L18"},"def":{"name":"tables_only","visibility":"Public","body":"query.tables_only()"}},{"html_id":"views_only-class-method","name":"views_only","abstract":false,"location":{"filename":"src/clear/model/reflection/table.cr","line_number":19,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/table.cr#L19"},"def":{"name":"views_only","visibility":"Public","body":"query.views_only()"}}],"constructors":[{"html_id":"build(x:NamedTuple):self-class-method","name":"build","doc":"Build a new empty model and fill the columns using the NamedTuple in argument.\n\nReturns the new model","summary":"

Build a new empty model and fill the columns using the NamedTuple in argument.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"args_string":"(x : NamedTuple) : self","args_html":"(x : NamedTuple) : self","location":{"filename":"src/clear/model/reflection/table.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/table.cr#L4"},"def":{"name":"build","args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"return_type":"self","visibility":"Public","body":"build(**x) do\nend"}},{"html_id":"build(x:NamedTuple,&block:self->Nil):self-class-method","name":"build","doc":"Build a new empty model and fill the columns using the NamedTuple in argument.\n\nReturns the new model","summary":"

Build a new empty model and fill the columns using the NamedTuple in argument.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"args_string":"(x : NamedTuple, &block : self -> Nil) : self","args_html":"(x : NamedTuple, &block : self -> Nil) : self","location":{"filename":"src/clear/model/reflection/table.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/table.cr#L4"},"def":{"name":"build","args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(self -> Nil)"},"return_type":"self","visibility":"Public","body":"build(**x, &block)"}},{"html_id":"create(x:NamedTuple,&block:self->Nil):self-class-method","name":"create","doc":"Build and new model and save it. Returns the model.\n\nThe model may not be saved due to validation failure;\ncheck the returned model `errors?` and `persisted?` flags.","summary":"

Build and new model and save it.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"args_string":"(x : NamedTuple, &block : self -> Nil) : self","args_html":"(x : NamedTuple, &block : self -> Nil) : self","location":{"filename":"src/clear/model/reflection/table.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/table.cr#L4"},"def":{"name":"create","args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(self -> Nil)"},"return_type":"self","visibility":"Public","body":"create(**x, &block)"}},{"html_id":"create(**tuple,&block:self->Nil):self-class-method","name":"create","doc":"Build and new model and save it. Returns the model.\n\nThe model may not be saved due to validation failure;\ncheck the returned model `errors?` and `persisted?` flags.","summary":"

Build and new model and save it.

","abstract":false,"location":{"filename":"src/clear/model/reflection/table.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/table.cr#L4"},"def":{"name":"create","double_splat":{"name":"tuple","external_name":"tuple","restriction":""},"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(self -> Nil)"},"return_type":"self","visibility":"Public","body":"r = build(**tuple) do |mdl|\n yield(mdl)\nend\nr.save\nr\n"}},{"html_id":"create(x:NamedTuple):self-class-method","name":"create","doc":"Build and new model and save it. Returns the model.\n\nThe model may not be saved due to validation failure;\ncheck the returned model `errors?` and `persisted?` flags.","summary":"

Build and new model and save it.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"args_string":"(x : NamedTuple) : self","args_html":"(x : NamedTuple) : self","location":{"filename":"src/clear/model/reflection/table.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/table.cr#L4"},"def":{"name":"create","args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"return_type":"self","visibility":"Public","body":"create(**x) do\nend"}},{"html_id":"create(**tuple):self-class-method","name":"create","doc":"Build and new model and save it. Returns the model.\n\nThe model may not be saved due to validation failure;\ncheck the returned model `errors?` and `persisted?` flags.","summary":"

Build and new model and save it.

","abstract":false,"location":{"filename":"src/clear/model/reflection/table.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/table.cr#L4"},"def":{"name":"create","double_splat":{"name":"tuple","external_name":"tuple","restriction":""},"return_type":"self","visibility":"Public","body":"create(**tuple) do\nend"}},{"html_id":"create!(x:NamedTuple,&block:self->Nil):self-class-method","name":"create!","doc":"Build and new model and save it. Returns the model.\n\nReturns the newly inserted model\nRaises an exception if validation failed during the saving process.","summary":"

Build and new model and save it.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"args_string":"(x : NamedTuple, &block : self -> Nil) : self","args_html":"(x : NamedTuple, &block : self -> Nil) : self","location":{"filename":"src/clear/model/reflection/table.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/table.cr#L4"},"def":{"name":"create!","args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(self -> Nil)"},"return_type":"self","visibility":"Public","body":"create!(**x, &block)"}},{"html_id":"create!(**tuple,&block:self->Nil):self-class-method","name":"create!","doc":"Build and new model and save it. Returns the model.\n\nReturns the newly inserted model\nRaises an exception if validation failed during the saving process.","summary":"

Build and new model and save it.

","abstract":false,"location":{"filename":"src/clear/model/reflection/table.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/table.cr#L4"},"def":{"name":"create!","double_splat":{"name":"tuple","external_name":"tuple","restriction":""},"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(self -> Nil)"},"return_type":"self","visibility":"Public","body":"r = build(**tuple) do |mdl|\n yield(mdl)\nend\nr.save!\nr\n"}},{"html_id":"create!(x:NamedTuple):self-class-method","name":"create!","doc":"Build and new model and save it. Returns the model.\n\nReturns the newly inserted model\nRaises an exception if validation failed during the saving process.","summary":"

Build and new model and save it.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"args_string":"(x : NamedTuple) : self","args_html":"(x : NamedTuple) : self","location":{"filename":"src/clear/model/reflection/table.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/table.cr#L4"},"def":{"name":"create!","args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"return_type":"self","visibility":"Public","body":"create!(**x) do\nend"}},{"html_id":"create!(**tuple):self-class-method","name":"create!","doc":"Build and new model and save it. Returns the model.\n\nReturns the newly inserted model\nRaises an exception if validation failed during the saving process.","summary":"

Build and new model and save it.

","abstract":false,"location":{"filename":"src/clear/model/reflection/table.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/table.cr#L4"},"def":{"name":"create!","double_splat":{"name":"tuple","external_name":"tuple","restriction":""},"return_type":"self","visibility":"Public","body":"create!(**tuple) do\nend"}},{"html_id":"new(h:Hash(String,_),cache:Clear::Model::QueryCache|Nil=nil,persisted=false,fetch_columns=false)-class-method","name":"new","abstract":false,"args":[{"name":"h","external_name":"h","restriction":"Hash(String, _)"},{"name":"cache","default_value":"nil","external_name":"cache","restriction":"Clear::Model::QueryCache | ::Nil"},{"name":"persisted","default_value":"false","external_name":"persisted","restriction":""},{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"args_string":"(h : Hash(String, _), cache : Clear::Model::QueryCache | Nil = nil, persisted = false, fetch_columns = false)","args_html":"(h : Hash(String, _), cache : Clear::Model::QueryCache | Nil = nil, persisted = false, fetch_columns = false)","location":{"filename":"src/clear/model/reflection/table.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/table.cr#L4"},"def":{"name":"new","args":[{"name":"h","external_name":"h","restriction":"Hash(String, _)"},{"name":"cache","default_value":"nil","external_name":"cache","restriction":"Clear::Model::QueryCache | ::Nil"},{"name":"persisted","default_value":"false","external_name":"persisted","restriction":""},{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"visibility":"Public","body":"_ = allocate\n_.initialize(h, cache, persisted, fetch_columns)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new(json:JSON::Any,cache:Clear::Model::QueryCache|Nil=nil,persisted=false)-class-method","name":"new","abstract":false,"args":[{"name":"json","external_name":"json","restriction":"::JSON::Any"},{"name":"cache","default_value":"nil","external_name":"cache","restriction":"Clear::Model::QueryCache | ::Nil"},{"name":"persisted","default_value":"false","external_name":"persisted","restriction":""}],"args_string":"(json : JSON::Any, cache : Clear::Model::QueryCache | Nil = nil, persisted = false)","args_html":"(json : JSON::Any, cache : Clear::Model::QueryCache | Nil = nil, persisted = false)","location":{"filename":"src/clear/model/reflection/table.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/table.cr#L4"},"def":{"name":"new","args":[{"name":"json","external_name":"json","restriction":"::JSON::Any"},{"name":"cache","default_value":"nil","external_name":"cache","restriction":"Clear::Model::QueryCache | ::Nil"},{"name":"persisted","default_value":"false","external_name":"persisted","restriction":""}],"visibility":"Public","body":"_ = allocate\n_.initialize(json, cache, persisted)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new(t:NamedTuple,persisted=false)-class-method","name":"new","abstract":false,"args":[{"name":"t","external_name":"t","restriction":"NamedTuple"},{"name":"persisted","default_value":"false","external_name":"persisted","restriction":""}],"args_string":"(t : NamedTuple, persisted = false)","args_html":"(t : NamedTuple, persisted = false)","location":{"filename":"src/clear/model/reflection/table.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/table.cr#L4"},"def":{"name":"new","args":[{"name":"t","external_name":"t","restriction":"NamedTuple"},{"name":"persisted","default_value":"false","external_name":"persisted","restriction":""}],"visibility":"Public","body":"_ = allocate\n_.initialize(t, persisted)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new-class-method","name":"new","abstract":false,"location":{"filename":"src/clear/model/reflection/table.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/table.cr#L4"},"def":{"name":"new","visibility":"Public","body":"_ = allocate\n_.initialize\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"attributes:Hash(String,Clear::SQL::Any)-instance-method","name":"attributes","doc":"Attributes, used when fetch_columns is true","summary":"

Attributes, used when fetch_columns is true

","abstract":false,"def":{"name":"attributes","return_type":"Hash(String, ::Clear::SQL::Any)","visibility":"Public","body":"@attributes"}},{"html_id":"cache:Clear::Model::QueryCache|Nil-instance-method","name":"cache","abstract":false,"def":{"name":"cache","return_type":"Clear::Model::QueryCache | ::Nil","visibility":"Public","body":"@cache"}},{"html_id":"changed?-instance-method","name":"changed?","doc":"Return `true` if the model is dirty (e.g. one or more fields\n have been changed.). Return `false` otherwise.","summary":"

Return true if the model is dirty (e.g.

","abstract":false,"def":{"name":"changed?","visibility":"Public","body":"if @table_catalog_column.changed?\n return true\nend\nif @table_schema_column.changed?\n return true\nend\nif @table_name_column.changed?\n return true\nend\nif @table_type_column.changed?\n return true\nend\nreturn false\n"}},{"html_id":"clear_change_flags-instance-method","name":"clear_change_flags","doc":"Reset the `changed?` flag on all columns\n\nThe model behave like its not dirty anymore\nand call to save would apply no changes.\n\nReturns `self`","summary":"

Reset the #changed? flag on all columns

","abstract":false,"def":{"name":"clear_change_flags","visibility":"Public","body":"@table_catalog_column.clear_change_flag\n@table_schema_column.clear_change_flag\n@table_name_column.clear_change_flag\n@table_type_column.clear_change_flag\nself\n"}},{"html_id":"columns:Clear::Reflection::Column::Collection-instance-method","name":"columns","doc":"The method columns is a `has_many` relation to Clear::Reflection::Column","summary":"

The method columns is a has_many relation to Clear::Reflection::Column

","abstract":false,"def":{"name":"columns","return_type":"Clear::Reflection::Column::Collection","visibility":"Public","body":"__temp_99 = table_name\n__temp_100 = \"table_name\"\ncache = @cache\nquery = if cache && (cache.active?(\"columns\"))\n arr = cache.hit(\"columns\", self.__pkey_column__.to_sql_value, Clear::Reflection::Column)\n (Clear::Reflection::Column.query.tags({\"#{__temp_100}\" => \"#{__temp_99}\"})).where do\n (raw(__temp_100)) == __temp_99\n end.with_cached_result(arr)\nelse\n (Clear::Reflection::Column.query.tags({\"#{__temp_100}\" => \"#{__temp_99}\"})).where do\n (raw(__temp_100)) == __temp_99\n end\nend\nquery.append_operation = ->(x : Clear::Reflection::Column) do\n x.reset(query.tags)\n x.save!\n x\nend\nquery\n"}},{"html_id":"indexes:Hash(String,Array(String))-instance-method","name":"indexes","doc":"List all the indexes related to the current table.\nreturn an hash where the key is the name of the column\nand the value is an array containing all the indexes related to this specific\nfield.","summary":"

List all the indexes related to the current table.

","abstract":false,"location":{"filename":"src/clear/model/reflection/table.cr","line_number":27,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/table.cr#L27"},"def":{"name":"indexes","return_type":"Hash(String, Array(String))","visibility":"Public","body":"o = {} of String => Array(String)\n((((SQL.select({index_name: \"i.relname\", column_name: \"a.attname\"})).from({t: \"pg_class\", i: \"pg_class\", ix: \"pg_index\", a: \"pg_attribute\"})).where do\n (((((t.oid == ix.indrelid) & (i.oid == ix.indexrelid)) & (a.attrelid == t.oid)) & (a.attnum == (raw(\"ANY(ix.indkey)\")))) & (t.relkind == \"r\")) & (t.relname == self.table_name)\nend.order_by(\"t.relname\")).order_by(\"i.relname\")).fetch do |h|\n col = h[\"column_name\"].to_s\n v = h[\"index_name\"].to_s\n arr = o[col]? ? o[col] : (o[col] = [] of String)\n arr << v\nend\no\n"}},{"html_id":"invalidate_caching:self-instance-method","name":"invalidate_caching","doc":"Force to clean-up the caches for the relations\nconnected to this model.","summary":"

Force to clean-up the caches for the relations connected to this model.

","abstract":false,"location":{"filename":"src/clear/model/reflection/table.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/table.cr#L4"},"def":{"name":"invalidate_caching","return_type":"self","visibility":"Public","body":"@cache = nil\nself\n"}},{"html_id":"reset(h:Hash(Symbol,_))-instance-method","name":"reset","doc":"Set the columns from hash","summary":"

Set the columns from hash

","abstract":false,"args":[{"name":"h","external_name":"h","restriction":"Hash(Symbol, _)"}],"args_string":"(h : Hash(Symbol, _))","args_html":"(h : Hash(Symbol, _))","def":{"name":"reset","args":[{"name":"h","external_name":"h","restriction":"Hash(Symbol, _)"}],"visibility":"Public","body":"super(h)\n{% for name, settings in COLUMNS %}\n v = h.fetch(:\\{{settings[:db_column_name]}}) { Clear::Model::Column::UNKNOWN }\n @{{ settings[:crystal_variable_name] }}_column.reset_convert(v) unless v.is_a?(Clear::Model::Column::UnknownClass)\n {% end %}\nself\n"}},{"html_id":"reset(h:Hash(String,_))-instance-method","name":"reset","doc":"Set the model fields from hash","summary":"

Set the model fields from hash

","abstract":false,"args":[{"name":"h","external_name":"h","restriction":"Hash(String, _)"}],"args_string":"(h : Hash(String, _))","args_html":"(h : Hash(String, _))","def":{"name":"reset","args":[{"name":"h","external_name":"h","restriction":"Hash(String, _)"}],"visibility":"Public","body":"super(h)\n{% for name, settings in COLUMNS %}\n v = h.fetch({{ settings[:db_column_name] }}) { Clear::Model::Column::UNKNOWN }\n @{{ settings[:crystal_variable_name] }}_column.reset_convert(v) unless v.is_a?(Clear::Model::Column::UnknownClass)\n {% end %}\nself\n"}},{"html_id":"reset(t:NamedTuple)-instance-method","name":"reset","abstract":false,"args":[{"name":"t","external_name":"t","restriction":"NamedTuple"}],"args_string":"(t : NamedTuple)","args_html":"(t : NamedTuple)","def":{"name":"reset","args":[{"name":"t","external_name":"t","restriction":"NamedTuple"}],"visibility":"Public","body":"reset(**t)"}},{"html_id":"reset(from_json:JSON::Any)-instance-method","name":"reset","abstract":false,"args":[{"name":"from_json","external_name":"from_json","restriction":"JSON::Any"}],"args_string":"(from_json : JSON::Any)","args_html":"(from_json : JSON::Any)","def":{"name":"reset","args":[{"name":"from_json","external_name":"from_json","restriction":"JSON::Any"}],"visibility":"Public","body":"reset(from_json.as_h)"}},{"html_id":"reset(**t:**T)forallT-instance-method","name":"reset","doc":"reset flavors","summary":"

reset flavors

","abstract":false,"def":{"name":"reset","double_splat":{"name":"t","external_name":"t","restriction":"**T"},"visibility":"Public","body":"super(**t)\n{% for name, typ in T %}\n\n {% if settings = COLUMNS[\"#{name}\"] %}\n @{{ settings[:crystal_variable_name] }}_column.reset_convert(t[:{{ name }}])\n {% else %}\n {% if !(@type.has_method?(\"#{name}=\")) %}\n {% raise(\"Cannot find the column `#{name}` of the model `#{@type}`\") %}\n {% end %}\n self.{{ name }} = t[:{{ name }}]\n {% end %}\n {% end %}\nself\n"}},{"html_id":"set(h:Hash(Symbol,_))-instance-method","name":"set","doc":"Set the columns from hash","summary":"

Set the columns from hash

","abstract":false,"args":[{"name":"h","external_name":"h","restriction":"Hash(Symbol, _)"}],"args_string":"(h : Hash(Symbol, _))","args_html":"(h : Hash(Symbol, _))","def":{"name":"set","args":[{"name":"h","external_name":"h","restriction":"Hash(Symbol, _)"}],"visibility":"Public","body":"super(h)\n{% for name, settings in COLUMNS %}\n v = h.fetch(:{{ settings[:db_column_name] }}) { Clear::Model::Column::UNKNOWN }\n @{{ settings[:crystal_variable_name] }}_column.set_convert(v) unless v.is_a?(Clear::Model::Column::UnknownClass)\n {% end %}\nself\n"}},{"html_id":"set(h:Hash(String,_))-instance-method","name":"set","doc":"Set the model fields from hash","summary":"

Set the model fields from hash

","abstract":false,"args":[{"name":"h","external_name":"h","restriction":"Hash(String, _)"}],"args_string":"(h : Hash(String, _))","args_html":"(h : Hash(String, _))","def":{"name":"set","args":[{"name":"h","external_name":"h","restriction":"Hash(String, _)"}],"visibility":"Public","body":"super(h)\n{% for name, settings in COLUMNS %}\n v = h.fetch({{ settings[:db_column_name] }}) { Clear::Model::Column::UNKNOWN }\n @{{ settings[:crystal_variable_name] }}_column.set_convert(v) unless v.is_a?(Clear::Model::Column::UnknownClass)\n {% end %}\nself\n"}},{"html_id":"set(t:NamedTuple)-instance-method","name":"set","abstract":false,"args":[{"name":"t","external_name":"t","restriction":"NamedTuple"}],"args_string":"(t : NamedTuple)","args_html":"(t : NamedTuple)","def":{"name":"set","args":[{"name":"t","external_name":"t","restriction":"NamedTuple"}],"visibility":"Public","body":"set(**t)"}},{"html_id":"set(from_json:JSON::Any)-instance-method","name":"set","abstract":false,"args":[{"name":"from_json","external_name":"from_json","restriction":"JSON::Any"}],"args_string":"(from_json : JSON::Any)","args_html":"(from_json : JSON::Any)","def":{"name":"set","args":[{"name":"from_json","external_name":"from_json","restriction":"JSON::Any"}],"visibility":"Public","body":"set(from_json.as_h)"}},{"html_id":"set(**t:**T)forallT-instance-method","name":"set","doc":"Set one or multiple columns to a specific value\nThis two are equivalents:\n\n```\nmodel.set(a: 1)\nmodel.a = 1\n```","summary":"

Set one or multiple columns to a specific value This two are equivalents:

","abstract":false,"def":{"name":"set","double_splat":{"name":"t","external_name":"t","restriction":"**T"},"visibility":"Public","body":"super(**t)\n{% for name, typ in T %}\n {% if settings = COLUMNS[\"#{name}\".id] %}\n @{{ settings[:crystal_variable_name] }}_column.set_convert(t[:{{ name }}])\n {% else %}\n {% if !(@type.has_method?(\"#{name}=\")) %}\n {% raise(\"No method #{@type}##{name}= while trying to set value of #{name}\") %}\n {% end %}\n self.{{ name }} = t[:{{ name }}]\n {% end %}\n {% end %}\nself\n"}},{"html_id":"set_from_json(string_or_io:String|IO,trusted:Bool=false)-instance-method","name":"set_from_json","doc":"Set the fields from json passed as argument\nTrusted flag set to true will allow mass assignment without protection, FALSE by default","summary":"

Set the fields from json passed as argument Trusted flag set to true will allow mass assignment without protection, FALSE by default

","abstract":false,"args":[{"name":"string_or_io","external_name":"string_or_io","restriction":"String | IO"},{"name":"trusted","default_value":"false","external_name":"trusted","restriction":"Bool"}],"args_string":"(string_or_io : String | IO, trusted : Bool = false)","args_html":"(string_or_io : String | IO, trusted : Bool = false)","def":{"name":"set_from_json","args":[{"name":"string_or_io","external_name":"string_or_io","restriction":"String | IO"},{"name":"trusted","default_value":"false","external_name":"trusted","restriction":"Bool"}],"visibility":"Public","body":"(Assigner.from_json(string_or_io)).update(self, trusted)"}},{"html_id":"table_catalog:String-instance-method","name":"table_catalog","doc":"Returns the value of `table_catalog` column or throw an exception if the column is not defined.","summary":"

Returns the value of #table_catalog column or throw an exception if the column is not defined.

","abstract":false,"def":{"name":"table_catalog","return_type":"String","visibility":"Public","body":"@table_catalog_column.value"}},{"html_id":"table_catalog=(x:String)-instance-method","name":"table_catalog=","doc":"Setter for `table_catalog` column.","summary":"

Setter for #table_catalog column.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"String"}],"args_string":"(x : String)","args_html":"(x : String)","def":{"name":"table_catalog=","args":[{"name":"x","external_name":"x","restriction":"String"}],"visibility":"Public","body":"@table_catalog_column.value = x"}},{"html_id":"table_catalog_column:Clear::Model::Column(String,Clear::Model::Converter::StringConverter)-instance-method","name":"table_catalog_column","doc":"Returns the column object used to manage `table_catalog` field\n\nSee `Clear::Model::Column`","summary":"

Returns the column object used to manage #table_catalog field

","abstract":false,"def":{"name":"table_catalog_column","return_type":"Clear::Model::Column(String, Clear::Model::Converter::StringConverter)","visibility":"Public","body":"@table_catalog_column"}},{"html_id":"table_name:String-instance-method","name":"table_name","doc":"Returns the value of `table_name` column or throw an exception if the column is not defined.","summary":"

Returns the value of #table_name column or throw an exception if the column is not defined.

","abstract":false,"def":{"name":"table_name","return_type":"String","visibility":"Public","body":"@table_name_column.value"}},{"html_id":"table_name=(x:String)-instance-method","name":"table_name=","doc":"Setter for `table_name` column.","summary":"

Setter for #table_name column.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"String"}],"args_string":"(x : String)","args_html":"(x : String)","def":{"name":"table_name=","args":[{"name":"x","external_name":"x","restriction":"String"}],"visibility":"Public","body":"@table_name_column.value = x"}},{"html_id":"table_name_column:Clear::Model::Column(String,Clear::Model::Converter::StringConverter)-instance-method","name":"table_name_column","doc":"Returns the column object used to manage `table_name` field\n\nSee `Clear::Model::Column`","summary":"

Returns the column object used to manage #table_name field

","abstract":false,"def":{"name":"table_name_column","return_type":"Clear::Model::Column(String, Clear::Model::Converter::StringConverter)","visibility":"Public","body":"@table_name_column"}},{"html_id":"table_schema:String-instance-method","name":"table_schema","doc":"Returns the value of `table_schema` column or throw an exception if the column is not defined.","summary":"

Returns the value of #table_schema column or throw an exception if the column is not defined.

","abstract":false,"def":{"name":"table_schema","return_type":"String","visibility":"Public","body":"@table_schema_column.value"}},{"html_id":"table_schema=(x:String)-instance-method","name":"table_schema=","doc":"Setter for `table_schema` column.","summary":"

Setter for #table_schema column.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"String"}],"args_string":"(x : String)","args_html":"(x : String)","def":{"name":"table_schema=","args":[{"name":"x","external_name":"x","restriction":"String"}],"visibility":"Public","body":"@table_schema_column.value = x"}},{"html_id":"table_schema_column:Clear::Model::Column(String,Clear::Model::Converter::StringConverter)-instance-method","name":"table_schema_column","doc":"Returns the column object used to manage `table_schema` field\n\nSee `Clear::Model::Column`","summary":"

Returns the column object used to manage #table_schema field

","abstract":false,"def":{"name":"table_schema_column","return_type":"Clear::Model::Column(String, Clear::Model::Converter::StringConverter)","visibility":"Public","body":"@table_schema_column"}},{"html_id":"table_type:String-instance-method","name":"table_type","doc":"Returns the value of `table_type` column or throw an exception if the column is not defined.","summary":"

Returns the value of #table_type column or throw an exception if the column is not defined.

","abstract":false,"def":{"name":"table_type","return_type":"String","visibility":"Public","body":"@table_type_column.value"}},{"html_id":"table_type=(x:String)-instance-method","name":"table_type=","doc":"Setter for `table_type` column.","summary":"

Setter for #table_type column.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"String"}],"args_string":"(x : String)","args_html":"(x : String)","def":{"name":"table_type=","args":[{"name":"x","external_name":"x","restriction":"String"}],"visibility":"Public","body":"@table_type_column.value = x"}},{"html_id":"table_type_column:Clear::Model::Column(String,Clear::Model::Converter::StringConverter)-instance-method","name":"table_type_column","doc":"Returns the column object used to manage `table_type` field\n\nSee `Clear::Model::Column`","summary":"

Returns the column object used to manage #table_type field

","abstract":false,"def":{"name":"table_type_column","return_type":"Clear::Model::Column(String, Clear::Model::Converter::StringConverter)","visibility":"Public","body":"@table_type_column"}},{"html_id":"to_h(full=false):Hash(String,Clear::SQL::Any)-instance-method","name":"to_h","doc":"Return a hash version of the columns of this model.","summary":"

Return a hash version of the columns of this model.

","abstract":false,"args":[{"name":"full","default_value":"false","external_name":"full","restriction":""}],"args_string":"(full = false) : Hash(String, Clear::SQL::Any)","args_html":"(full = false) : Hash(String, Clear::SQL::Any)","def":{"name":"to_h","args":[{"name":"full","default_value":"false","external_name":"full","restriction":""}],"return_type":"Hash(String, ::Clear::SQL::Any)","visibility":"Public","body":"out = super(full)\nif full || @table_catalog_column.defined?\n out[\"table_catalog\"] = @table_catalog_column.to_sql_value(nil)\nend\nif full || @table_schema_column.defined?\n out[\"table_schema\"] = @table_schema_column.to_sql_value(nil)\nend\nif full || @table_name_column.defined?\n out[\"table_name\"] = @table_name_column.to_sql_value(nil)\nend\nif full || @table_type_column.defined?\n out[\"table_type\"] = @table_type_column.to_sql_value(nil)\nend\nout\n"}},{"html_id":"to_json(emit_nulls:Bool=false)-instance-method","name":"to_json","abstract":false,"args":[{"name":"emit_nulls","default_value":"false","external_name":"emit_nulls","restriction":"Bool"}],"args_string":"(emit_nulls : Bool = false)","args_html":"(emit_nulls : Bool = false)","def":{"name":"to_json","args":[{"name":"emit_nulls","default_value":"false","external_name":"emit_nulls","restriction":"Bool"}],"visibility":"Public","body":"JSON.build do |json|\n to_json(json, emit_nulls)\nend"}},{"html_id":"to_json(json,emit_nulls=false)-instance-method","name":"to_json","abstract":false,"args":[{"name":"json","external_name":"json","restriction":""},{"name":"emit_nulls","default_value":"false","external_name":"emit_nulls","restriction":""}],"args_string":"(json, emit_nulls = false)","args_html":"(json, emit_nulls = false)","def":{"name":"to_json","args":[{"name":"json","external_name":"json","restriction":""},{"name":"emit_nulls","default_value":"false","external_name":"emit_nulls","restriction":""}],"visibility":"Public","body":"json.object do\n if emit_nulls || @table_catalog_column.defined?\n json.field(\"table_catalog\") do\n (@table_catalog_column.value(nil)).to_json(json)\n end\n end\n if emit_nulls || @table_schema_column.defined?\n json.field(\"table_schema\") do\n (@table_schema_column.value(nil)).to_json(json)\n end\n end\n if emit_nulls || @table_name_column.defined?\n json.field(\"table_name\") do\n (@table_name_column.value(nil)).to_json(json)\n end\n end\n if emit_nulls || @table_type_column.defined?\n json.field(\"table_type\") do\n (@table_type_column.value(nil)).to_json(json)\n end\n end\nend"}},{"html_id":"update_from_json(string_or_io:String|IO,trusted:Bool=false)-instance-method","name":"update_from_json","doc":"Set the fields from json passed as argument and call `save` on the object\nTrusted flag set to true will allow mass assignment without protection, FALSE by default","summary":"

Set the fields from json passed as argument and call save on the object Trusted flag set to true will allow mass assignment without protection, FALSE by default

","abstract":false,"args":[{"name":"string_or_io","external_name":"string_or_io","restriction":"String | IO"},{"name":"trusted","default_value":"false","external_name":"trusted","restriction":"Bool"}],"args_string":"(string_or_io : String | IO, trusted : Bool = false)","args_html":"(string_or_io : String | IO, trusted : Bool = false)","def":{"name":"update_from_json","args":[{"name":"string_or_io","external_name":"string_or_io","restriction":"String | IO"},{"name":"trusted","default_value":"false","external_name":"trusted","restriction":"Bool"}],"visibility":"Public","body":"mdl = set_from_json(string_or_io, trusted)\nmdl.save\nmdl\n"}},{"html_id":"update_from_json!(string_or_io:String|IO,trusted:Bool=false)-instance-method","name":"update_from_json!","doc":"Set the fields from json passed as argument and call `save!` on the object\nTrusted flag set to true will allow mass assignment without protection, FALSE by default","summary":"

Set the fields from json passed as argument and call save! on the object Trusted flag set to true will allow mass assignment without protection, FALSE by default

","abstract":false,"args":[{"name":"string_or_io","external_name":"string_or_io","restriction":"String | IO"},{"name":"trusted","default_value":"false","external_name":"trusted","restriction":"Bool"}],"args_string":"(string_or_io : String | IO, trusted : Bool = false)","args_html":"(string_or_io : String | IO, trusted : Bool = false)","def":{"name":"update_from_json!","args":[{"name":"string_or_io","external_name":"string_or_io","restriction":"String | IO"},{"name":"trusted","default_value":"false","external_name":"trusted","restriction":"Bool"}],"visibility":"Public","body":"(set_from_json(string_or_io, trusted)).save!"}},{"html_id":"update_h:Hash(String,Clear::SQL::Any)-instance-method","name":"update_h","doc":"Generate the hash for update request (like during save)","summary":"

Generate the hash for update request (like during save)

","abstract":false,"def":{"name":"update_h","return_type":"Hash(String, ::Clear::SQL::Any)","visibility":"Public","body":"o = super()\nif @table_catalog_column.defined? && @table_catalog_column.changed?\n o[\"table_catalog\"] = @table_catalog_column.to_sql_value\nend\nif @table_schema_column.defined? && @table_schema_column.changed?\n o[\"table_schema\"] = @table_schema_column.to_sql_value\nend\nif @table_name_column.defined? && @table_name_column.changed?\n o[\"table_name\"] = @table_name_column.to_sql_value\nend\nif @table_type_column.defined? && @table_type_column.changed?\n o[\"table_type\"] = @table_type_column.to_sql_value\nend\no\n"}},{"html_id":"validate_fields_presence-instance-method","name":"validate_fields_presence","doc":"For each column, ensure than when needed the column has present\ninformation into it.\n\nThis method is called on validation.","summary":"

For each column, ensure than when needed the column has present information into it.

","abstract":false,"def":{"name":"validate_fields_presence","visibility":"Public","body":"if persisted?\nelse\n if @table_catalog_column.failed_to_be_present?\n add_error(\"table_catalog\", \"must be present\")\n end\nend\nif persisted?\nelse\n if @table_schema_column.failed_to_be_present?\n add_error(\"table_schema\", \"must be present\")\n end\nend\nif persisted?\nelse\n if @table_name_column.failed_to_be_present?\n add_error(\"table_name\", \"must be present\")\n end\nend\nif persisted?\nelse\n if @table_type_column.failed_to_be_present?\n add_error(\"table_type\", \"must be present\")\n end\nend\n"}}],"types":[{"html_id":"clear/Clear/Reflection/Table/Collection","path":"Clear/Reflection/Table/Collection.html","kind":"class","full_name":"Clear::Reflection::Table::Collection","name":"Collection","abstract":false,"superclass":{"html_id":"clear/Clear/Model/CollectionBase","kind":"class","full_name":"Clear::Model::CollectionBase","name":"CollectionBase"},"ancestors":[{"html_id":"clear/Clear/Model/CollectionBase","kind":"class","full_name":"Clear::Model::CollectionBase","name":"CollectionBase"},{"html_id":"clear/Clear/SQL/SelectBuilder","kind":"module","full_name":"Clear::SQL::SelectBuilder","name":"SelectBuilder"},{"html_id":"clear/Clear/SQL/Query/WithPagination","kind":"module","full_name":"Clear::SQL::Query::WithPagination","name":"WithPagination"},{"html_id":"clear/Clear/SQL/Query/BeforeQuery","kind":"module","full_name":"Clear::SQL::Query::BeforeQuery","name":"BeforeQuery"},{"html_id":"clear/Clear/SQL/Query/Change","kind":"module","full_name":"Clear::SQL::Query::Change","name":"Change"},{"html_id":"clear/Clear/SQL/Query/Connection","kind":"module","full_name":"Clear::SQL::Query::Connection","name":"Connection"},{"html_id":"clear/Clear/SQL/Query/Pluck","kind":"module","full_name":"Clear::SQL::Query::Pluck","name":"Pluck"},{"html_id":"clear/Clear/SQL/Query/Fetch","kind":"module","full_name":"Clear::SQL::Query::Fetch","name":"Fetch"},{"html_id":"clear/Clear/SQL/Query/Execute","kind":"module","full_name":"Clear::SQL::Query::Execute","name":"Execute"},{"html_id":"clear/Clear/SQL/Query/Lock","kind":"module","full_name":"Clear::SQL::Query::Lock","name":"Lock"},{"html_id":"clear/Clear/SQL/Query/Window","kind":"module","full_name":"Clear::SQL::Query::Window","name":"Window"},{"html_id":"clear/Clear/SQL/Query/CTE","kind":"module","full_name":"Clear::SQL::Query::CTE","name":"CTE"},{"html_id":"clear/Clear/SQL/Query/Aggregate","kind":"module","full_name":"Clear::SQL::Query::Aggregate","name":"Aggregate"},{"html_id":"clear/Clear/SQL/Query/OffsetLimit","kind":"module","full_name":"Clear::SQL::Query::OffsetLimit","name":"OffsetLimit"},{"html_id":"clear/Clear/SQL/Query/GroupBy","kind":"module","full_name":"Clear::SQL::Query::GroupBy","name":"GroupBy"},{"html_id":"clear/Clear/SQL/Query/OrderBy","kind":"module","full_name":"Clear::SQL::Query::OrderBy","name":"OrderBy"},{"html_id":"clear/Clear/SQL/Query/Having","kind":"module","full_name":"Clear::SQL::Query::Having","name":"Having"},{"html_id":"clear/Clear/SQL/Query/Where","kind":"module","full_name":"Clear::SQL::Query::Where","name":"Where"},{"html_id":"clear/Clear/SQL/Query/Join","kind":"module","full_name":"Clear::SQL::Query::Join","name":"Join"},{"html_id":"clear/Clear/SQL/Query/From","kind":"module","full_name":"Clear::SQL::Query::From","name":"From"},{"html_id":"clear/Clear/SQL/Query/Select","kind":"module","full_name":"Clear::SQL::Query::Select","name":"Select"},{"html_id":"clear/Enumerable","kind":"module","full_name":"Enumerable","name":"Enumerable"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/model/reflection/table.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/table.cr#L4"},{"filename":"src/clear/model/reflection/table.cr","line_number":16,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/table.cr#L16"},{"filename":"src/clear/model/reflection/table.cr","line_number":18,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/table.cr#L18"},{"filename":"src/clear/model/reflection/table.cr","line_number":19,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/table.cr#L19"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Reflection/Table","kind":"class","full_name":"Clear::Reflection::Table","name":"Table"},"doc":"Addition of the method for eager loading and N+1 avoidance.","summary":"

Addition of the method for eager loading and N+1 avoidance.

","instance_methods":[{"html_id":"public-instance-method","name":"public","abstract":false,"location":{"filename":"src/clear/model/reflection/table.cr","line_number":16,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/table.cr#L16"},"def":{"name":"public","visibility":"Public","body":"where do\n table_schema == \"public\"\nend\nreturn self\n"}},{"html_id":"tables_only-instance-method","name":"tables_only","abstract":false,"location":{"filename":"src/clear/model/reflection/table.cr","line_number":18,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/table.cr#L18"},"def":{"name":"tables_only","visibility":"Public","body":"where do\n table_type == \"BASE TABLE\"\nend\nreturn self\n"}},{"html_id":"views_only-instance-method","name":"views_only","abstract":false,"location":{"filename":"src/clear/model/reflection/table.cr","line_number":19,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/table.cr#L19"},"def":{"name":"views_only","visibility":"Public","body":"where do\n table_type == \"VIEW\"\nend\nreturn self\n"}},{"html_id":"with_columns(fetch_columns=false,&block:Clear::Reflection::Column::Collection->):self-instance-method","name":"with_columns","doc":"Eager load the has many relation columns.\nUse it to avoid N+1 queries.","summary":"

Eager load the has many relation columns.

","abstract":false,"args":[{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"args_string":"(fetch_columns = false, &block : Clear::Reflection::Column::Collection -> ) : self","args_html":"(fetch_columns = false, &block : Clear::Reflection::Column::Collection -> ) : self","def":{"name":"with_columns","args":[{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Clear::Reflection::Column::Collection ->)"},"return_type":"self","visibility":"Public","body":"before_query do\n __temp_99 = table_name\n __temp_100 = \"table_name\"\n sub_query = self.dup.clear_select.select(\"#{Clear::Reflection::Table.table}.#{__temp_99}\")\n qry = Clear::Reflection::Column.query.where do\n (raw(__temp_100)).in?(sub_query)\n end\n block.call(qry)\n @cache.active(\"columns\")\n h = {} of Clear::SQL::Any => Array(Clear::Reflection::Column)\n qry.each(fetch_columns: true) do |mdl|\n if h[mdl.attributes[__temp_100]]?\n else\n h[mdl.attributes[__temp_100]] = [] of Clear::Reflection::Column\n end\n h[mdl.attributes[__temp_100]] << mdl\n end\n h.each do |key, value|\n @cache.set(\"columns\", key, value)\n end\nend\nself\n"}},{"html_id":"with_columns(fetch_columns=false)-instance-method","name":"with_columns","abstract":false,"args":[{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"args_string":"(fetch_columns = false)","args_html":"(fetch_columns = false)","def":{"name":"with_columns","args":[{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"visibility":"Public","body":"with_columns(fetch_columns) do\nend"}}]}]}]},{"html_id":"clear/Clear/SQL","path":"Clear/SQL.html","kind":"module","full_name":"Clear::SQL","name":"SQL","abstract":false,"ancestors":[{"html_id":"clear/Clear/SQL/Transaction","kind":"module","full_name":"Clear::SQL::Transaction","name":"Transaction"},{"html_id":"clear/Clear/SQL/Logger","kind":"module","full_name":"Clear::SQL::Logger","name":"Logger"}],"locations":[{"filename":"src/clear/sql/connection_pool.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/connection_pool.cr#L1"},{"filename":"src/clear/sql/errors.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/errors.cr#L1"},{"filename":"src/clear/sql/fragment/column.cr","line_number":9,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/fragment/column.cr#L9"},{"filename":"src/clear/sql/fragment/fragment.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/fragment/fragment.cr#L1"},{"filename":"src/clear/sql/fragment/from.cr","line_number":3,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/fragment/from.cr#L3"},{"filename":"src/clear/sql/fragment/join.cr","line_number":3,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/fragment/join.cr#L3"},{"filename":"src/clear/sql/lock.cr","line_number":2,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/lock.cr#L2"},{"filename":"src/clear/sql/query/connection.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/connection.cr#L1"},{"filename":"src/clear/sql/query/from.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/from.cr#L1"},{"filename":"src/clear/sql/sql.cr","line_number":50,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/sql.cr#L50"},{"filename":"src/clear/sql/truncate.cr","line_number":2,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/truncate.cr#L2"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"clear/Clear/SQL/Logger","kind":"module","full_name":"Clear::SQL::Logger","name":"Logger"},{"html_id":"clear/Clear/SQL/Transaction","kind":"module","full_name":"Clear::SQL::Transaction","name":"Transaction"}],"extended_modules":[{"html_id":"clear/Clear/SQL","kind":"module","full_name":"Clear::SQL","name":"SQL"}],"namespace":{"html_id":"clear/Clear","kind":"module","full_name":"Clear","name":"Clear"},"doc":"\n## Clear::SQL\n\nClear is made like an onion:\n\n```\n+------------------------------------+\n| THE ORM STACK +\n+------------------------------------+\n| Model | DB Views | Migrations | < High Level Tools\n+---------------+--------------------+\n| Columns | Validation | Converters | < Mapping system\n+---------------+--------------------+\n| Clear::SQL | Clear::Expression | < Low Level SQL Builder\n+------------------------------------+\n| Crystal DB | Crystal PG | < Low Level connection\n+------------------------------------+\n```\n\nOn the bottom stack, Clear offer SQL query building.\nTheses features are then used by top level parts of the engine.\n\nThe SQL module provide a simple API to generate `delete`, `insert`, `select`\nand `update` methods.\n\nEach requests can be duplicated then modified and executed.\n\nNote: Each request object is mutable. Therefore, to update and store a request,\nyou must use manually the `dup` method.\n","summary":"

\n \n \nClear::SQL

","class_methods":[{"html_id":"lock(table:String|Symbol,mode=\"ACCESSEXCLUSIVE\",connection=\"default\",&)-class-method","name":"lock","doc":"Lock completetly a table.\n\n```\nClear::SQL.lock(\"my_table\") do\nend\n```\n\nOptional parameter `mode` allow you to decide over the lock level\nModes are:\n- ACCESS EXCLUSIVE (default)\n- ACCESS SHARE\n- ROW SHARE\n- ROW EXCLUSIVE\n- SHARE UPDATE EXCLUSIVE\n- SHARE\n- SHARE ROW EXCLUSIVE\n- EXCLUSIVE\n\nSee [Official PG documentation for more informations](https://www.postgresql.org/docs/12/explicit-locking.html)\n","summary":"

Lock completetly a table.

","abstract":false,"args":[{"name":"table","external_name":"table","restriction":"String | Symbol"},{"name":"mode","default_value":"\"ACCESS EXCLUSIVE\"","external_name":"mode","restriction":""},{"name":"connection","default_value":"\"default\"","external_name":"connection","restriction":""}],"args_string":"(table : String | Symbol, mode = \"ACCESS EXCLUSIVE\", connection = \"default\", &)","args_html":"(table : String | Symbol, mode = "ACCESS EXCLUSIVE", connection = "default", &)","location":{"filename":"src/clear/sql/lock.cr","line_number":23,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/lock.cr#L23"},"def":{"name":"lock","args":[{"name":"table","external_name":"table","restriction":"String | Symbol"},{"name":"mode","default_value":"\"ACCESS EXCLUSIVE\"","external_name":"mode","restriction":""},{"name":"connection","default_value":"\"default\"","external_name":"connection","restriction":""}],"yields":1,"block_arity":1,"visibility":"Public","body":"Clear::SQL::ConnectionPool.with_connection(connection) do |cnx|\n transaction do\n execute(\"LOCK TABLE #{table} IN #{mode} MODE\")\n return yield(cnx)\n end\nend"}},{"html_id":"truncate(tablename:Clear::Model.class|String|Symbol,restart_sequence:Bool=false,cascade:Bool=false,truncate_inherited:Bool=true,connection_name:String=\"default\")forallT-class-method","name":"truncate","doc":"Truncate a table or a model\n\n```\nUser.query.count # => 200\nClear::SQL.truncate(User) # equivalent to Clear::SQL.truncate(User.table, connection_name: User.connection)\nUser.query.count # => 0\n```\n\nSEE https://www.postgresql.org/docs/current/sql-truncate.html\nfor more information.\n\n- `restart_sequence` set to true will append `RESTART IDENTITY` to the query\n- `cascade` set to true will append `CASCADE` to the query\n- `truncate_inherited` set to false will append `ONLY` to the query\n- `connection_name` will be: `Model.connection` or `default` unless optionally defined.","summary":"

Truncate a table or a model

","abstract":false,"args":[{"name":"tablename","external_name":"tablename","restriction":"Clear::Model.class | String | Symbol"},{"name":"restart_sequence","default_value":"false","external_name":"restart_sequence","restriction":"Bool"},{"name":"cascade","default_value":"false","external_name":"cascade","restriction":"Bool"},{"name":"truncate_inherited","default_value":"true","external_name":"truncate_inherited","restriction":"Bool"},{"name":"connection_name","default_value":"\"default\"","external_name":"connection_name","restriction":"String"}],"args_string":"(tablename : Clear::Model.class | String | Symbol, restart_sequence : Bool = false, cascade : Bool = false, truncate_inherited : Bool = true, connection_name : String = \"default\") forall T","args_html":"(tablename : Clear::Model.class | String | Symbol, restart_sequence : Bool = false, cascade : Bool = false, truncate_inherited : Bool = true, connection_name : String = "default") forall T","location":{"filename":"src/clear/sql/truncate.cr","line_number":18,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/truncate.cr#L18"},"def":{"name":"truncate","args":[{"name":"tablename","external_name":"tablename","restriction":"Clear::Model.class | String | Symbol"},{"name":"restart_sequence","default_value":"false","external_name":"restart_sequence","restriction":"Bool"},{"name":"cascade","default_value":"false","external_name":"cascade","restriction":"Bool"},{"name":"truncate_inherited","default_value":"true","external_name":"truncate_inherited","restriction":"Bool"},{"name":"connection_name","default_value":"\"default\"","external_name":"connection_name","restriction":"String"}],"visibility":"Public","body":"case tablename\nwhen String\nwhen Symbol\n tablename = Clear::SQL.escape(tablename.to_s)\nelse\n connection_name = tablename.connection\n tablename = tablename.full_table_name\nend\nonly = truncate_inherited ? \"\" : \" ONLY \"\nrestart_sequence = restart_sequence ? \" RESTART IDENTITY \" : \"\"\ncascade = cascade ? \" CASCADE \" : \"\"\nexecute(connection_name, {\"TRUNCATE TABLE \", only, tablename, restart_sequence, cascade}.join)\n"}}],"instance_methods":[{"html_id":"add_connection(name:String,url:String)-instance-method","name":"add_connection","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"String"},{"name":"url","external_name":"url","restriction":"String"}],"args_string":"(name : String, url : String)","args_html":"(name : String, url : String)","location":{"filename":"src/clear/sql/sql.cr","line_number":125,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/sql.cr#L125"},"def":{"name":"add_connection","args":[{"name":"name","external_name":"name","restriction":"String"},{"name":"url","external_name":"url","restriction":"String"}],"visibility":"Public","body":"Clear::SQL::ConnectionPool.init(url, name)"}},{"html_id":"delete(table:Symbolic)-instance-method","name":"delete","doc":"Start a DELETE table query","summary":"

Start a DELETE table query

","abstract":false,"args":[{"name":"table","external_name":"table","restriction":"Symbolic"}],"args_string":"(table : Symbolic)","args_html":"(table : Symbolic)","location":{"filename":"src/clear/sql/sql.cr","line_number":185,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/sql.cr#L185"},"def":{"name":"delete","args":[{"name":"table","external_name":"table","restriction":"Symbolic"}],"visibility":"Public","body":"Clear::SQL::DeleteQuery.new.from(table)"}},{"html_id":"escape(x:String|Symbol)-instance-method","name":"escape","doc":"Escape the expression, double quoting it.\n\nIt allows use of reserved keywords as table or column name\nNOTE: Escape is used for escaping postgresql keyword. For example\nif you have a column named order (which is a reserved word), you want\nto escape it by double-quoting it.\n\nFor escaping STRING value, please use Clear::SQL.sanitize","summary":"

Escape the expression, double quoting it.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"String | Symbol"}],"args_string":"(x : String | Symbol)","args_html":"(x : String | Symbol)","location":{"filename":"src/clear/sql/sql.cr","line_number":103,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/sql.cr#L103"},"def":{"name":"escape","args":[{"name":"x","external_name":"x","restriction":"String | Symbol"}],"visibility":"Public","body":"(\"\\\"\" + (x.to_s.gsub(\"\\\"\", \"\\\"\\\"\"))) + \"\\\"\""}},{"html_id":"execute(connection_name:String,sql)-instance-method","name":"execute","doc":"Execute a SQL statement on a specific connection.\n\nUsage:\nClear::SQL.execute(\"seconddatabase\", \"SELECT 1 FROM users\")","summary":"

Execute a SQL statement on a specific connection.

","abstract":false,"args":[{"name":"connection_name","external_name":"connection_name","restriction":"String"},{"name":"sql","external_name":"sql","restriction":""}],"args_string":"(connection_name : String, sql)","args_html":"(connection_name : String, sql)","location":{"filename":"src/clear/sql/sql.cr","line_number":175,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/sql.cr#L175"},"def":{"name":"execute","args":[{"name":"connection_name","external_name":"connection_name","restriction":"String"},{"name":"sql","external_name":"sql","restriction":""}],"visibility":"Public","body":"log_query(sql) do\n Clear::SQL::ConnectionPool.with_connection(connection_name, &.exec_all(sql))\nend"}},{"html_id":"execute(sql)-instance-method","name":"execute","doc":"Execute a SQL statement.\n\nUsage:\nClear::SQL.execute(\"SELECT 1 FROM users\")\n","summary":"

Execute a SQL statement.

","abstract":false,"args":[{"name":"sql","external_name":"sql","restriction":""}],"args_string":"(sql)","args_html":"(sql)","location":{"filename":"src/clear/sql/sql.cr","line_number":167,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/sql.cr#L167"},"def":{"name":"execute","args":[{"name":"sql","external_name":"sql","restriction":""}],"visibility":"Public","body":"execute(\"default\", sql)"}},{"html_id":"init(name:String,url:String)-instance-method","name":"init","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"String"},{"name":"url","external_name":"url","restriction":"String"}],"args_string":"(name : String, url : String)","args_html":"(name : String, url : String)","location":{"filename":"src/clear/sql/sql.cr","line_number":115,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/sql.cr#L115"},"def":{"name":"init","args":[{"name":"name","external_name":"name","restriction":"String"},{"name":"url","external_name":"url","restriction":"String"}],"visibility":"Public","body":"Clear::SQL::ConnectionPool.init(url, name)"}},{"html_id":"init(url:String)-instance-method","name":"init","abstract":false,"args":[{"name":"url","external_name":"url","restriction":"String"}],"args_string":"(url : String)","args_html":"(url : String)","location":{"filename":"src/clear/sql/sql.cr","line_number":111,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/sql.cr#L111"},"def":{"name":"init","args":[{"name":"url","external_name":"url","restriction":"String"}],"visibility":"Public","body":"Clear::SQL::ConnectionPool.init(url, \"default\")"}},{"html_id":"init(connections:Hash(Symbolic,String))-instance-method","name":"init","abstract":false,"args":[{"name":"connections","external_name":"connections","restriction":"Hash(Symbolic, String)"}],"args_string":"(connections : Hash(Symbolic, String))","args_html":"(connections : Hash(Symbolic, String))","location":{"filename":"src/clear/sql/sql.cr","line_number":119,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/sql.cr#L119"},"def":{"name":"init","args":[{"name":"connections","external_name":"connections","restriction":"Hash(Symbolic, String)"}],"visibility":"Public","body":"connections.each do |name, url|\n Clear::SQL::ConnectionPool.init(url, name)\nend"}},{"html_id":"insert(table,args:NamedTuple)-instance-method","name":"insert","abstract":false,"args":[{"name":"table","external_name":"table","restriction":""},{"name":"args","external_name":"args","restriction":"NamedTuple"}],"args_string":"(table, args : NamedTuple)","args_html":"(table, args : NamedTuple)","location":{"filename":"src/clear/sql/sql.cr","line_number":214,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/sql.cr#L214"},"def":{"name":"insert","args":[{"name":"table","external_name":"table","restriction":""},{"name":"args","external_name":"args","restriction":"NamedTuple"}],"visibility":"Public","body":"insert_into(table, args)"}},{"html_id":"insert(table,*args)-instance-method","name":"insert","doc":"Alias of `insert_into`, for hurry developers","summary":"

Alias of #insert_into, for hurry developers

","abstract":false,"args":[{"name":"table","external_name":"table","restriction":""},{"name":"args","external_name":"args","restriction":""}],"args_string":"(table, *args)","args_html":"(table, *args)","location":{"filename":"src/clear/sql/sql.cr","line_number":210,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/sql.cr#L210"},"def":{"name":"insert","args":[{"name":"table","external_name":"table","restriction":""},{"name":"args","external_name":"args","restriction":""}],"splat_index":1,"visibility":"Public","body":"insert_into(table, *args)"}},{"html_id":"insert-instance-method","name":"insert","doc":"Create a new INSERT query","summary":"

Create a new INSERT query

","abstract":false,"location":{"filename":"src/clear/sql/sql.cr","line_number":205,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/sql.cr#L205"},"def":{"name":"insert","visibility":"Public","body":"Clear::SQL::InsertQuery.new"}},{"html_id":"insert_into(table:Symbolic)-instance-method","name":"insert_into","doc":"Prepare a new INSERT INTO table query\n:ditto:","summary":"

Prepare a new INSERT INTO table query :ditto:

","abstract":false,"args":[{"name":"table","external_name":"table","restriction":"Symbolic"}],"args_string":"(table : Symbolic)","args_html":"(table : Symbolic)","location":{"filename":"src/clear/sql/sql.cr","line_number":200,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/sql.cr#L200"},"def":{"name":"insert_into","args":[{"name":"table","external_name":"table","restriction":"Symbolic"}],"visibility":"Public","body":"Clear::SQL::InsertQuery.new(table)"}},{"html_id":"insert_into(table:Symbolic,*args)-instance-method","name":"insert_into","doc":"Start an INSERT INTO table query\n\n```\nClear::SQL.insert_into(\"table\", {id: 1, name: \"hello\"}, {id: 2, name: \"World\"})\n```","summary":"

Start an INSERT INTO table query

","abstract":false,"args":[{"name":"table","external_name":"table","restriction":"Symbolic"},{"name":"args","external_name":"args","restriction":""}],"args_string":"(table : Symbolic, *args)","args_html":"(table : Symbolic, *args)","location":{"filename":"src/clear/sql/sql.cr","line_number":194,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/sql.cr#L194"},"def":{"name":"insert_into","args":[{"name":"table","external_name":"table","restriction":"Symbolic"},{"name":"args","external_name":"args","restriction":""}],"splat_index":1,"visibility":"Public","body":"(Clear::SQL::InsertQuery.new(table)).values(*args)"}},{"html_id":"raw(x,*params)-instance-method","name":"raw","doc":"This provide a fast way to create SQL fragment while escaping items, both with `?` and `:key` system:\n\n```\nquery = Mode.query.select(Clear::SQL.raw(\"CASE WHEN x=:x THEN 1 ELSE 0 END as check\", x: \"blabla\"))\nquery = Mode.query.select(Clear::SQL.raw(\"CASE WHEN x=? THEN 1 ELSE 0 END as check\", \"blabla\"))\n```","summary":"

This provide a fast way to create SQL fragment while escaping items, both with ? and :key system:

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""},{"name":"params","external_name":"params","restriction":""}],"args_string":"(x, *params)","args_html":"(x, *params)","location":{"filename":"src/clear/sql/sql.cr","line_number":81,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/sql.cr#L81"},"def":{"name":"raw","args":[{"name":"x","external_name":"x","restriction":""},{"name":"params","external_name":"params","restriction":""}],"splat_index":1,"visibility":"Public","body":"Clear::Expression.raw(x, *params)"}},{"html_id":"raw(__template,**params)-instance-method","name":"raw","abstract":false,"args":[{"name":"__template","external_name":"__template","restriction":""}],"args_string":"(__template, **params)","args_html":"(__template, **params)","location":{"filename":"src/clear/sql/sql.cr","line_number":91,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/sql.cr#L91"},"def":{"name":"raw","args":[{"name":"__template","external_name":"__template","restriction":""}],"double_splat":{"name":"params","external_name":"params","restriction":""},"visibility":"Public","body":"Clear::Expression.raw(__template, **params)"}},{"html_id":"raw_enum(x,params:Enumerable(T))forallT-instance-method","name":"raw_enum","doc":"See `self.raw`\nCan pass an array to this version","summary":"

See self.raw Can pass an array to this version

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""},{"name":"params","external_name":"params","restriction":"Enumerable(T)"}],"args_string":"(x, params : Enumerable(T)) forall T","args_html":"(x, params : Enumerable(T)) forall T","location":{"filename":"src/clear/sql/sql.cr","line_number":87,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/sql.cr#L87"},"def":{"name":"raw_enum","args":[{"name":"x","external_name":"x","restriction":""},{"name":"params","external_name":"params","restriction":"Enumerable(T)"}],"visibility":"Public","body":"Clear::Expression.raw_enum(x, params)"}},{"html_id":"rollback-instance-method","name":"rollback","doc":"Raise a rollback, in case of transaction","summary":"

Raise a rollback, in case of transaction

","abstract":false,"location":{"filename":"src/clear/sql/sql.cr","line_number":158,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/sql.cr#L158"},"def":{"name":"rollback","visibility":"Public","body":"raise(RollbackError.new)"}},{"html_id":"sanitize(x)-instance-method","name":"sanitize","doc":"Sanitize string and convert some literals (e.g. `Time`)","summary":"

Sanitize string and convert some literals (e.g.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x)","args_html":"(x)","location":{"filename":"src/clear/sql/sql.cr","line_number":71,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/sql.cr#L71"},"def":{"name":"sanitize","args":[{"name":"x","external_name":"x","restriction":""}],"visibility":"Public","body":"Clear::Expression[x]"}},{"html_id":"select(*args)-instance-method","name":"select","doc":"Start a SELECT FROM table query","summary":"

Start a SELECT FROM table query

","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args)","args_html":"(*args)","location":{"filename":"src/clear/sql/sql.cr","line_number":224,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/sql.cr#L224"},"def":{"name":"select","args":[{"name":"args","external_name":"args","restriction":""}],"splat_index":0,"visibility":"Public","body":"if args.size > 0\n Clear::SQL::SelectQuery.new.select(*args)\nelse\n Clear::SQL::SelectQuery.new\nend"}},{"html_id":"unsafe(x)-instance-method","name":"unsafe","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x)","args_html":"(x)","location":{"filename":"src/clear/sql/sql.cr","line_number":107,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/sql.cr#L107"},"def":{"name":"unsafe","args":[{"name":"x","external_name":"x","restriction":""}],"visibility":"Public","body":"Clear::Expression::UnsafeSql.new(x)"}},{"html_id":"update(table)-instance-method","name":"update","doc":"Start a UPDATE table query","summary":"

Start a UPDATE table query

","abstract":false,"args":[{"name":"table","external_name":"table","restriction":""}],"args_string":"(table)","args_html":"(table)","location":{"filename":"src/clear/sql/sql.cr","line_number":219,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/sql.cr#L219"},"def":{"name":"update","args":[{"name":"table","external_name":"table","restriction":""}],"visibility":"Public","body":"Clear::SQL::UpdateQuery.new(table)"}},{"html_id":"with_savepoint(connection_name=\"default\",&)-instance-method","name":"with_savepoint","doc":"Create a transaction, but this one is stackable\nusing savepoints.\n\nExample:\n\n```\nClear::SQL.with_savepoint do\n # do something\n Clear::SQL.with_savepoint do\n rollback # < Rollback only the last `with_savepoint` block\n end\nend\n```","summary":"

Create a transaction, but this one is stackable using savepoints.

","abstract":false,"args":[{"name":"connection_name","default_value":"\"default\"","external_name":"connection_name","restriction":""}],"args_string":"(connection_name = \"default\", &)","args_html":"(connection_name = "default", &)","location":{"filename":"src/clear/sql/sql.cr","line_number":144,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/sql.cr#L144"},"def":{"name":"with_savepoint","args":[{"name":"connection_name","default_value":"\"default\"","external_name":"connection_name","restriction":""}],"yields":0,"block_arity":0,"visibility":"Public","body":"transaction do |cnx|\n sp_name = \"sp_#{@@savepoint_uid = @@savepoint_uid + 1}\"\n begin\n execute(connection_name, \"SAVEPOINT #{sp_name}\")\n yield\n if cnx._clear_in_transaction?\n execute(connection_name, \"RELEASE SAVEPOINT #{sp_name}\")\n end\n rescue e : RollbackError\n if cnx._clear_in_transaction?\n execute(connection_name, \"ROLLBACK TO SAVEPOINT #{sp_name}\")\n end\n end\nend"}}],"types":[{"html_id":"clear/Clear/SQL/Any","path":"Clear/SQL/Any.html","kind":"alias","full_name":"Clear::SQL::Any","name":"Any","abstract":false,"locations":[{"filename":"src/clear/sql/sql.cr","line_number":56,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/sql.cr#L56"}],"repository_name":"clear","program":false,"enum":false,"alias":true,"aliased":"(Array(PG::BoolArray) | Array(PG::CharArray) | Array(PG::Float32Array) | Array(PG::Float64Array) | Array(PG::Int16Array) | Array(PG::Int32Array) | Array(PG::Int64Array) | Array(PG::NumericArray) | Array(PG::StringArray) | Array(PG::TimeArray) | Array(PG::UUIDArray) | BigDecimal | Bool | Char | Clear::Expression::Literal | Crypto::Bcrypt::Password | Float32 | Float64 | Int16 | Int32 | Int64 | Int8 | JSON::Any | JSON::PullParser | PG::Geo::Box | PG::Geo::Circle | PG::Geo::Line | PG::Geo::LineSegment | PG::Geo::Path | PG::Geo::Point | PG::Geo::Polygon | PG::Interval | PG::Numeric | Slice(UInt8) | String | Time | UInt16 | UInt32 | UInt64 | UInt8 | UUID | Nil)","aliased_html":"Array(PG::BoolArray) | Array(PG::CharArray) | Array(PG::Float32Array) | Array(PG::Float64Array) | Array(PG::Int16Array) | Array(PG::Int32Array) | Array(PG::Int64Array) | Array(PG::NumericArray) | Array(PG::StringArray) | Array(PG::TimeArray) | Array(PG::UUIDArray) | BigDecimal | Bool | Char | Clear::Expression::Literal | Crypto::Bcrypt::Password | Float32 | Float64 | Int16 | Int32 | Int64 | Int8 | JSON::Any | JSON::PullParser | PG::Geo::Box | PG::Geo::Circle | PG::Geo::Line | PG::Geo::LineSegment | PG::Geo::Path | PG::Geo::Point | PG::Geo::Polygon | PG::Interval | PG::Numeric | Slice(UInt8) | String | Time | UInt16 | UInt32 | UInt64 | UInt8 | UUID | Nil","const":false,"namespace":{"html_id":"clear/Clear/SQL","kind":"module","full_name":"Clear::SQL","name":"SQL"}},{"html_id":"clear/Clear/SQL/CancelTransactionError","path":"Clear/SQL/CancelTransactionError.html","kind":"class","full_name":"Clear::SQL::CancelTransactionError","name":"CancelTransactionError","abstract":false,"superclass":{"html_id":"clear/Clear/SQL/Error","kind":"class","full_name":"Clear::SQL::Error","name":"Error"},"ancestors":[{"html_id":"clear/Clear/SQL/Error","kind":"class","full_name":"Clear::SQL::Error","name":"Error"},{"html_id":"clear/Exception","kind":"class","full_name":"Exception","name":"Exception"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/sql/errors.cr","line_number":16,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/errors.cr#L16"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/SQL","kind":"module","full_name":"Clear::SQL","name":"SQL"},"doc":"Like rollback, but used into savepoint, it will revert completely the transaction","summary":"

Like rollback, but used into savepoint, it will revert completely the transaction

"},{"html_id":"clear/Clear/SQL/Column","path":"Clear/SQL/Column.html","kind":"struct","full_name":"Clear::SQL::Column","name":"Column","abstract":false,"superclass":{"html_id":"clear/Clear/SQL/Fragment","kind":"struct","full_name":"Clear::SQL::Fragment","name":"Fragment"},"ancestors":[{"html_id":"clear/Clear/SQL/Fragment","kind":"struct","full_name":"Clear::SQL::Fragment","name":"Fragment"},{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/sql/fragment/column.cr","line_number":10,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/fragment/column.cr#L10"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/SQL","kind":"module","full_name":"Clear::SQL","name":"SQL"},"constructors":[{"html_id":"new(value:Clear::SQL::SelectBuilder|String|Symbol,var:String|Symbol|Nil=nil)-class-method","name":"new","abstract":false,"args":[{"name":"value","external_name":"value","restriction":"::Clear::SQL::SelectBuilder | ::String | ::Symbol"},{"name":"var","default_value":"nil","external_name":"var","restriction":"::String | ::Symbol | ::Nil"}],"args_string":"(value : Clear::SQL::SelectBuilder | String | Symbol, var : String | Symbol | Nil = nil)","args_html":"(value : Clear::SQL::SelectBuilder | String | Symbol, var : String | Symbol | Nil = nil)","location":{"filename":"src/clear/sql/fragment/column.cr","line_number":14,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/fragment/column.cr#L14"},"def":{"name":"new","args":[{"name":"value","external_name":"value","restriction":"::Clear::SQL::SelectBuilder | ::String | ::Symbol"},{"name":"var","default_value":"nil","external_name":"var","restriction":"::String | ::Symbol | ::Nil"}],"visibility":"Public","body":"_ = allocate\n_.initialize(value, var)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"to_sql-instance-method","name":"to_sql","abstract":false,"location":{"filename":"src/clear/sql/fragment/column.cr","line_number":17,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/fragment/column.cr#L17"},"def":{"name":"to_sql","visibility":"Public","body":"v = value\ncase v\nwhen String\n [v, @var].compact.join(\" AS \")\nwhen Symbol\n [SQL.escape(v.to_s), @var].compact.join(\" AS \")\nwhen SQL::SelectBuilder\n [\"( #{v.to_sql} )\", @var].compact.join(\" AS \")\nelse\n raise(QueryBuildingError.new(\"Only String and SelectQuery are allowed as column declaration\"))\nend\n"}},{"html_id":"value:Selectable-instance-method","name":"value","abstract":false,"location":{"filename":"src/clear/sql/fragment/column.cr","line_number":11,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/fragment/column.cr#L11"},"def":{"name":"value","return_type":"Selectable","visibility":"Public","body":"@value"}},{"html_id":"value=(value:Selectable)-instance-method","name":"value=","abstract":false,"args":[{"name":"value","external_name":"value","restriction":"Selectable"}],"args_string":"(value : Selectable)","args_html":"(value : Selectable)","location":{"filename":"src/clear/sql/fragment/column.cr","line_number":11,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/fragment/column.cr#L11"},"def":{"name":"value=","args":[{"name":"value","external_name":"value","restriction":"Selectable"}],"visibility":"Public","body":"@value = value"}},{"html_id":"var:Symbolic|Nil-instance-method","name":"var","abstract":false,"location":{"filename":"src/clear/sql/fragment/column.cr","line_number":12,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/fragment/column.cr#L12"},"def":{"name":"var","return_type":"Symbolic | ::Nil","visibility":"Public","body":"@var"}},{"html_id":"var=(var:Symbolic|Nil)-instance-method","name":"var=","abstract":false,"args":[{"name":"var","external_name":"var","restriction":"Symbolic | ::Nil"}],"args_string":"(var : Symbolic | Nil)","args_html":"(var : Symbolic | Nil)","location":{"filename":"src/clear/sql/fragment/column.cr","line_number":12,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/fragment/column.cr#L12"},"def":{"name":"var=","args":[{"name":"var","external_name":"var","restriction":"Symbolic | ::Nil"}],"visibility":"Public","body":"@var = var"}}]},{"html_id":"clear/Clear/SQL/ConnectionPool","path":"Clear/SQL/ConnectionPool.html","kind":"class","full_name":"Clear::SQL::ConnectionPool","name":"ConnectionPool","abstract":false,"superclass":{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/sql/connection_pool.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/connection_pool.cr#L1"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/SQL","kind":"module","full_name":"Clear::SQL","name":"SQL"},"class_methods":[{"html_id":"init(uri,name)-class-method","name":"init","abstract":false,"args":[{"name":"uri","external_name":"uri","restriction":""},{"name":"name","external_name":"name","restriction":""}],"args_string":"(uri, name)","args_html":"(uri, name)","location":{"filename":"src/clear/sql/connection_pool.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/connection_pool.cr#L6"},"def":{"name":"init","args":[{"name":"uri","external_name":"uri","restriction":""},{"name":"name","external_name":"name","restriction":""}],"visibility":"Public","body":"@@databases[name] = DB.open(uri)"}},{"html_id":"with_connection(target:String,&)-class-method","name":"with_connection","doc":"Retrieve a connection from the connection pool, or wait for it.\nIf the current Fiber already has a connection, the connection is returned;\n this strategy provides easy usage of multiple statement connection (like BEGIN/ROLLBACK features).","summary":"

Retrieve a connection from the connection pool, or wait for it.

","abstract":false,"args":[{"name":"target","external_name":"target","restriction":"String"}],"args_string":"(target : String, &)","args_html":"(target : String, &)","location":{"filename":"src/clear/sql/connection_pool.cr","line_number":13,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/connection_pool.cr#L13"},"def":{"name":"with_connection","args":[{"name":"target","external_name":"target","restriction":"String"}],"yields":1,"block_arity":1,"visibility":"Public","body":"fiber_target = {target, Fiber.current}\ndatabase = @@databases.fetch(target) do\n raise(Clear::ErrorMessages.uninitialized_db_connection(target))\nend\ncnx = @@fiber_connections[fiber_target]?\nif cnx\n yield cnx\nelse\n database.using_connection do |new_connection|\n begin\n @@fiber_connections[fiber_target] = new_connection\n yield new_connection\n ensure\n @@fiber_connections.delete(fiber_target)\n end\n end\nend\n"}}]},{"html_id":"clear/Clear/SQL/DeleteQuery","path":"Clear/SQL/DeleteQuery.html","kind":"class","full_name":"Clear::SQL::DeleteQuery","name":"DeleteQuery","abstract":false,"superclass":{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"clear/Clear/SQL/Query/Change","kind":"module","full_name":"Clear::SQL::Query::Change","name":"Change"},{"html_id":"clear/Clear/SQL/Query/Execute","kind":"module","full_name":"Clear::SQL::Query::Execute","name":"Execute"},{"html_id":"clear/Clear/SQL/Query/Where","kind":"module","full_name":"Clear::SQL::Query::Where","name":"Where"},{"html_id":"clear/Clear/SQL/Query/Connection","kind":"module","full_name":"Clear::SQL::Query::Connection","name":"Connection"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/sql/delete_query.cr","line_number":3,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/delete_query.cr#L3"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"clear/Clear/SQL/Query/Change","kind":"module","full_name":"Clear::SQL::Query::Change","name":"Change"},{"html_id":"clear/Clear/SQL/Query/Connection","kind":"module","full_name":"Clear::SQL::Query::Connection","name":"Connection"},{"html_id":"clear/Clear/SQL/Query/Execute","kind":"module","full_name":"Clear::SQL::Query::Execute","name":"Execute"},{"html_id":"clear/Clear/SQL/Query/Where","kind":"module","full_name":"Clear::SQL::Query::Where","name":"Where"}],"namespace":{"html_id":"clear/Clear/SQL","kind":"module","full_name":"Clear::SQL","name":"SQL"},"constructors":[{"html_id":"new(table:String|Symbol|Nil=nil,wheres:Array(Clear::Expression::Node)=[]ofClear::Expression::Node)-class-method","name":"new","abstract":false,"args":[{"name":"table","default_value":"nil","external_name":"table","restriction":"::String | ::Symbol | ::Nil"},{"name":"wheres","default_value":"[] of Clear::Expression::Node","external_name":"wheres","restriction":"::Array(::Clear::Expression::Node)"}],"args_string":"(table : String | Symbol | Nil = nil, wheres : Array(Clear::Expression::Node) = [] of Clear::Expression::Node)","args_html":"(table : String | Symbol | Nil = nil, wheres : Array(Clear::Expression::Node) = [] of Clear::Expression::Node)","location":{"filename":"src/clear/sql/delete_query.cr","line_number":11,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/delete_query.cr#L11"},"def":{"name":"new","args":[{"name":"table","default_value":"nil","external_name":"table","restriction":"::String | ::Symbol | ::Nil"},{"name":"wheres","default_value":"[] of Clear::Expression::Node","external_name":"wheres","restriction":"::Array(::Clear::Expression::Node)"}],"visibility":"Public","body":"_ = allocate\n_.initialize(table, wheres)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"from(table:String|Symbol|Nil)-instance-method","name":"from","abstract":false,"args":[{"name":"table","external_name":"table","restriction":"::String | ::Symbol | ::Nil"}],"args_string":"(table : String | Symbol | Nil)","args_html":"(table : String | Symbol | Nil)","location":{"filename":"src/clear/sql/delete_query.cr","line_number":14,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/delete_query.cr#L14"},"def":{"name":"from","args":[{"name":"table","external_name":"table","restriction":"::String | ::Symbol | ::Nil"}],"visibility":"Public","body":"@table = table\nchange!\n"}},{"html_id":"table:Symbolic|Nil-instance-method","name":"table","abstract":false,"location":{"filename":"src/clear/sql/delete_query.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/delete_query.cr#L4"},"def":{"name":"table","return_type":"Symbolic | ::Nil","visibility":"Public","body":"@table"}},{"html_id":"to_sql-instance-method","name":"to_sql","abstract":false,"location":{"filename":"src/clear/sql/delete_query.cr","line_number":19,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/delete_query.cr#L19"},"def":{"name":"to_sql","visibility":"Public","body":"if table = @table\nelse\n raise(Clear::ErrorMessages.query_building_error(\"Delete Query must have a `from` clause.\"))\nend\ntable = table.is_a?(Symbol) ? SQL.escape(table.to_s) : table\n[\"DELETE FROM\", table, print_wheres].compact.join(\" \")\n"}},{"html_id":"wheres:Array(Clear::Expression::Node)-instance-method","name":"wheres","doc":"Return the list of where clause; each where clause are transformed into\nClear::Expression::Node","summary":"

Return the list of where clause; each where clause are transformed into Clear::Expression::Node

","abstract":false,"def":{"name":"wheres","return_type":"Array(Clear::Expression::Node)","visibility":"Public","body":"@wheres"}}]},{"html_id":"clear/Clear/SQL/Error","path":"Clear/SQL/Error.html","kind":"class","full_name":"Clear::SQL::Error","name":"Error","abstract":false,"superclass":{"html_id":"clear/Exception","kind":"class","full_name":"Exception","name":"Exception"},"ancestors":[{"html_id":"clear/Exception","kind":"class","full_name":"Exception","name":"Exception"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/sql/errors.cr","line_number":2,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/errors.cr#L2"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"subclasses":[{"html_id":"clear/Clear/SQL/CancelTransactionError","kind":"class","full_name":"Clear::SQL::CancelTransactionError","name":"CancelTransactionError"},{"html_id":"clear/Clear/SQL/ExecutionError","kind":"class","full_name":"Clear::SQL::ExecutionError","name":"ExecutionError"},{"html_id":"clear/Clear/SQL/OperationNotPermittedError","kind":"class","full_name":"Clear::SQL::OperationNotPermittedError","name":"OperationNotPermittedError"},{"html_id":"clear/Clear/SQL/QueryBuildingError","kind":"class","full_name":"Clear::SQL::QueryBuildingError","name":"QueryBuildingError"},{"html_id":"clear/Clear/SQL/RecordNotFoundError","kind":"class","full_name":"Clear::SQL::RecordNotFoundError","name":"RecordNotFoundError"},{"html_id":"clear/Clear/SQL/RollbackError","kind":"class","full_name":"Clear::SQL::RollbackError","name":"RollbackError"}],"namespace":{"html_id":"clear/Clear/SQL","kind":"module","full_name":"Clear::SQL","name":"SQL"}},{"html_id":"clear/Clear/SQL/ExecutionError","path":"Clear/SQL/ExecutionError.html","kind":"class","full_name":"Clear::SQL::ExecutionError","name":"ExecutionError","abstract":false,"superclass":{"html_id":"clear/Clear/SQL/Error","kind":"class","full_name":"Clear::SQL::Error","name":"Error"},"ancestors":[{"html_id":"clear/Clear/SQL/Error","kind":"class","full_name":"Clear::SQL::Error","name":"Error"},{"html_id":"clear/Exception","kind":"class","full_name":"Exception","name":"Exception"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/sql/errors.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/errors.cr#L4"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/SQL","kind":"module","full_name":"Clear::SQL","name":"SQL"}},{"html_id":"clear/Clear/SQL/Fragment","path":"Clear/SQL/Fragment.html","kind":"struct","full_name":"Clear::SQL::Fragment","name":"Fragment","abstract":true,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/sql/fragment/fragment.cr","line_number":2,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/fragment/fragment.cr#L2"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"subclasses":[{"html_id":"clear/Clear/SQL/Column","kind":"struct","full_name":"Clear::SQL::Column","name":"Column"},{"html_id":"clear/Clear/SQL/From","kind":"struct","full_name":"Clear::SQL::From","name":"From"},{"html_id":"clear/Clear/SQL/Join","kind":"struct","full_name":"Clear::SQL::Join","name":"Join"}],"namespace":{"html_id":"clear/Clear/SQL","kind":"module","full_name":"Clear::SQL","name":"SQL"},"constructors":[{"html_id":"new-class-method","name":"new","abstract":false,"location":{"filename":"src/clear/sql/fragment/fragment.cr","line_number":2,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/fragment/fragment.cr#L2"},"def":{"name":"new","visibility":"Public","body":"x = allocate\nif x.responds_to?(:finalize)\n ::GC.add_finalizer(x)\nend\nx\n"}}],"instance_methods":[{"html_id":"initialize-instance-method","name":"initialize","abstract":false,"location":{"filename":"src/clear/sql/fragment/fragment.cr","line_number":2,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/fragment/fragment.cr#L2"},"def":{"name":"initialize","visibility":"Public","body":""}},{"html_id":"to_sql-instance-method","name":"to_sql","abstract":true,"location":{"filename":"src/clear/sql/fragment/fragment.cr","line_number":3,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/fragment/fragment.cr#L3"},"def":{"name":"to_sql","visibility":"Public","body":""}}]},{"html_id":"clear/Clear/SQL/From","path":"Clear/SQL/From.html","kind":"struct","full_name":"Clear::SQL::From","name":"From","abstract":false,"superclass":{"html_id":"clear/Clear/SQL/Fragment","kind":"struct","full_name":"Clear::SQL::Fragment","name":"Fragment"},"ancestors":[{"html_id":"clear/Clear/SQL/Fragment","kind":"struct","full_name":"Clear::SQL::Fragment","name":"Fragment"},{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/sql/fragment/from.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/fragment/from.cr#L4"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/SQL","kind":"module","full_name":"Clear::SQL","name":"SQL"},"constructors":[{"html_id":"new(value:Clear::SQL::SelectBuilder|String|Symbol,var:String|Symbol|Nil=nil)-class-method","name":"new","abstract":false,"args":[{"name":"value","external_name":"value","restriction":"::Clear::SQL::SelectBuilder | ::String | ::Symbol"},{"name":"var","default_value":"nil","external_name":"var","restriction":"::String | ::Symbol | ::Nil"}],"args_string":"(value : Clear::SQL::SelectBuilder | String | Symbol, var : String | Symbol | Nil = nil)","args_html":"(value : Clear::SQL::SelectBuilder | String | Symbol, var : String | Symbol | Nil = nil)","location":{"filename":"src/clear/sql/fragment/from.cr","line_number":8,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/fragment/from.cr#L8"},"def":{"name":"new","args":[{"name":"value","external_name":"value","restriction":"::Clear::SQL::SelectBuilder | ::String | ::Symbol"},{"name":"var","default_value":"nil","external_name":"var","restriction":"::String | ::Symbol | ::Nil"}],"visibility":"Public","body":"_ = allocate\n_.initialize(value, var)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"to_sql-instance-method","name":"to_sql","abstract":false,"location":{"filename":"src/clear/sql/fragment/from.cr","line_number":11,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/fragment/from.cr#L11"},"def":{"name":"to_sql","visibility":"Public","body":"v = value\ncase v\nwhen Symbol\n [Clear::SQL.escape(v), @var].compact.join(\" AS \")\nwhen String\n [v, @var].compact.join(\" AS \")\nwhen SQL::SelectBuilder\n if @var.nil?\n raise(Clear::ErrorMessages.query_building_error(\"Subquery `from` clause must have variable name\"))\n end\n [\"(#{v.to_sql})\", @var].compact.join(\" \")\nelse\n raise(Clear::ErrorMessages.query_building_error(\"Only String and SelectQuery objects are allowed as `from` declaration\"))\nend\n"}},{"html_id":"value:Selectable-instance-method","name":"value","abstract":false,"location":{"filename":"src/clear/sql/fragment/from.cr","line_number":5,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/fragment/from.cr#L5"},"def":{"name":"value","return_type":"Selectable","visibility":"Public","body":"@value"}},{"html_id":"value=(value:Selectable)-instance-method","name":"value=","abstract":false,"args":[{"name":"value","external_name":"value","restriction":"Selectable"}],"args_string":"(value : Selectable)","args_html":"(value : Selectable)","location":{"filename":"src/clear/sql/fragment/from.cr","line_number":5,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/fragment/from.cr#L5"},"def":{"name":"value=","args":[{"name":"value","external_name":"value","restriction":"Selectable"}],"visibility":"Public","body":"@value = value"}},{"html_id":"var:Symbolic|Nil-instance-method","name":"var","abstract":false,"location":{"filename":"src/clear/sql/fragment/from.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/fragment/from.cr#L6"},"def":{"name":"var","return_type":"Symbolic | ::Nil","visibility":"Public","body":"@var"}},{"html_id":"var=(var:Symbolic|Nil)-instance-method","name":"var=","abstract":false,"args":[{"name":"var","external_name":"var","restriction":"Symbolic | ::Nil"}],"args_string":"(var : Symbolic | Nil)","args_html":"(var : Symbolic | Nil)","location":{"filename":"src/clear/sql/fragment/from.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/fragment/from.cr#L6"},"def":{"name":"var=","args":[{"name":"var","external_name":"var","restriction":"Symbolic | ::Nil"}],"visibility":"Public","body":"@var = var"}}]},{"html_id":"clear/Clear/SQL/InsertQuery","path":"Clear/SQL/InsertQuery.html","kind":"class","full_name":"Clear::SQL::InsertQuery","name":"InsertQuery","abstract":false,"superclass":{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"clear/Clear/SQL/Query/OnConflict","kind":"module","full_name":"Clear::SQL::Query::OnConflict","name":"OnConflict"},{"html_id":"clear/Clear/SQL/Query/Connection","kind":"module","full_name":"Clear::SQL::Query::Connection","name":"Connection"},{"html_id":"clear/Clear/SQL/Query/Change","kind":"module","full_name":"Clear::SQL::Query::Change","name":"Change"},{"html_id":"clear/Clear/SQL/Query/CTE","kind":"module","full_name":"Clear::SQL::Query::CTE","name":"CTE"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/sql/insert_query.cr","line_number":18,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/insert_query.cr#L18"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"clear/Clear/SQL/Query/Change","kind":"module","full_name":"Clear::SQL::Query::Change","name":"Change"},{"html_id":"clear/Clear/SQL/Query/Connection","kind":"module","full_name":"Clear::SQL::Query::Connection","name":"Connection"},{"html_id":"clear/Clear/SQL/Query/CTE","kind":"module","full_name":"Clear::SQL::Query::CTE","name":"CTE"},{"html_id":"clear/Clear/SQL/Query/OnConflict","kind":"module","full_name":"Clear::SQL::Query::OnConflict","name":"OnConflict"}],"namespace":{"html_id":"clear/Clear/SQL","kind":"module","full_name":"Clear::SQL","name":"SQL"},"doc":"\nAn insert query\n\ncf. postgres documentation\n\n```\n[ WITH [ RECURSIVE ] with_query [, ...] ]\nINSERT INTO table_name [ AS alias ] [ ( column_name [, ...] ) ]\n { DEFAULT VALUES | VALUES ( { expression | DEFAULT } [, ...] ) [, ...] | query }\n [ ON CONFLICT [ conflict_target ] conflict_action ]\n [ RETURNING * | output_expression [ [ AS ] output_name ] [, ...] ]\n```","summary":"

An insert query

","constructors":[{"html_id":"new(table:Symbol|String,values)-class-method","name":"new","abstract":false,"args":[{"name":"table","external_name":"table","restriction":"Symbol | String"},{"name":"values","external_name":"values","restriction":""}],"args_string":"(table : Symbol | String, values)","args_html":"(table : Symbol | String, values)","location":{"filename":"src/clear/sql/insert_query.cr","line_number":33,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/insert_query.cr#L33"},"def":{"name":"new","args":[{"name":"table","external_name":"table","restriction":"Symbol | String"},{"name":"values","external_name":"values","restriction":""}],"visibility":"Public","body":"_ = allocate\n_.initialize(table, values)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new(table:Symbol|String)-class-method","name":"new","abstract":false,"args":[{"name":"table","external_name":"table","restriction":"Symbol | String"}],"args_string":"(table : Symbol | String)","args_html":"(table : Symbol | String)","location":{"filename":"src/clear/sql/insert_query.cr","line_number":30,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/insert_query.cr#L30"},"def":{"name":"new","args":[{"name":"table","external_name":"table","restriction":"Symbol | String"}],"visibility":"Public","body":"_ = allocate\n_.initialize(table)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"clear_values-instance-method","name":"clear_values","abstract":false,"location":{"filename":"src/clear/sql/insert_query.cr","line_number":85,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/insert_query.cr#L85"},"def":{"name":"clear_values","visibility":"Public","body":"@values = [] of Array(Inserable)\nchange!\n"}},{"html_id":"columns(*args:Array(String|Symbol))-instance-method","name":"columns","doc":"Used with values","summary":"

Used with values

","abstract":false,"args":[{"name":"args","external_name":"args","restriction":"::Array(::String | ::Symbol)"}],"args_string":"(*args : Array(String | Symbol))","args_html":"(*args : Array(String | Symbol))","location":{"filename":"src/clear/sql/insert_query.cr","line_number":138,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/insert_query.cr#L138"},"def":{"name":"columns","args":[{"name":"args","external_name":"args","restriction":"::Array(::String | ::Symbol)"}],"splat_index":0,"visibility":"Public","body":"@keys = args\nchange!\n"}},{"html_id":"execute(connection_name:String=\"default\"):Hash(String,Clear::SQL::Any)-instance-method","name":"execute","abstract":false,"args":[{"name":"connection_name","default_value":"\"default\"","external_name":"connection_name","restriction":"String"}],"args_string":"(connection_name : String = \"default\") : Hash(String, Clear::SQL::Any)","args_html":"(connection_name : String = "default") : Hash(String, Clear::SQL::Any)","location":{"filename":"src/clear/sql/insert_query.cr","line_number":71,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/insert_query.cr#L71"},"def":{"name":"execute","args":[{"name":"connection_name","default_value":"\"default\"","external_name":"connection_name","restriction":"String"}],"return_type":"Hash(String, ::Clear::SQL::Any)","visibility":"Public","body":"o = {} of String => ::Clear::SQL::Any\nif @returning.nil?\n s = to_sql\n Clear::SQL.execute(connection_name, s)\nelse\n fetch(connection_name) do |x|\n o = x\n end\nend\no\n"}},{"html_id":"fetch(connection_name:String=\"default\",&:Hash(String,Clear::SQL::Any)->Nil)-instance-method","name":"fetch","abstract":false,"args":[{"name":"connection_name","default_value":"\"default\"","external_name":"connection_name","restriction":"String"}],"args_string":"(connection_name : String = \"default\", & : Hash(String, Clear::SQL::Any) -> Nil)","args_html":"(connection_name : String = "default", & : Hash(String, Clear::SQL::Any) -> Nil)","location":{"filename":"src/clear/sql/insert_query.cr","line_number":40,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/insert_query.cr#L40"},"def":{"name":"fetch","args":[{"name":"connection_name","default_value":"\"default\"","external_name":"connection_name","restriction":"String"}],"yields":1,"block_arity":1,"block_arg":{"name":"","external_name":"","restriction":"(Hash(String, ::Clear::SQL::Any) -> Nil)"},"visibility":"Public","body":"h = {} of String => ::Clear::SQL::Any\nClear::SQL::ConnectionPool.with_connection(connection_name) do |cnx|\n begin\n sql = to_sql\n rs = Clear::SQL.log_query(sql) do\n cnx.query(sql)\n end\n fetch_result_set(h, rs) do |x|\n yield(x)\n end\n ensure\n rs.try(&.close)\n end\nend\n"}},{"html_id":"into(table:Symbol|String)-instance-method","name":"into","abstract":false,"args":[{"name":"table","external_name":"table","restriction":"Symbol | String"}],"args_string":"(table : Symbol | String)","args_html":"(table : Symbol | String)","location":{"filename":"src/clear/sql/insert_query.cr","line_number":37,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/insert_query.cr#L37"},"def":{"name":"into","args":[{"name":"table","external_name":"table","restriction":"Symbol | String"}],"visibility":"Public","body":"@table = table"}},{"html_id":"keys:Array(Symbolic)-instance-method","name":"keys","abstract":false,"location":{"filename":"src/clear/sql/insert_query.cr","line_number":25,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/insert_query.cr#L25"},"def":{"name":"keys","return_type":"Array(Symbolic)","visibility":"Public","body":"@keys"}},{"html_id":"returning(str:String)-instance-method","name":"returning","abstract":false,"args":[{"name":"str","external_name":"str","restriction":"String"}],"args_string":"(str : String)","args_html":"(str : String)","location":{"filename":"src/clear/sql/insert_query.cr","line_number":161,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/insert_query.cr#L161"},"def":{"name":"returning","args":[{"name":"str","external_name":"str","restriction":"String"}],"visibility":"Public","body":"@returning = str\nchange!\n"}},{"html_id":"returning:String|Nil-instance-method","name":"returning","abstract":false,"location":{"filename":"src/clear/sql/insert_query.cr","line_number":28,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/insert_query.cr#L28"},"def":{"name":"returning","return_type":"String | ::Nil","visibility":"Public","body":"@returning"}},{"html_id":"size:Int32-instance-method","name":"size","doc":"Number of rows of this insertion request","summary":"

Number of rows of this insertion request

","abstract":false,"location":{"filename":"src/clear/sql/insert_query.cr","line_number":168,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/insert_query.cr#L168"},"def":{"name":"size","return_type":"Int32","visibility":"Public","body":"v = @values\nv.is_a?(Array) ? v.size : -1\n"}},{"html_id":"table:Symbol|String-instance-method","name":"table","abstract":false,"location":{"filename":"src/clear/sql/insert_query.cr","line_number":27,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/insert_query.cr#L27"},"def":{"name":"table","return_type":"Symbol | String","visibility":"Public","body":"if (__temp_1 = @table).nil?\n ::raise(::NilAssertionError.new(\"Clear::SQL::InsertQuery#table cannot be nil\"))\nelse\n __temp_1\nend"}},{"html_id":"table?:Symbol|String|Nil-instance-method","name":"table?","abstract":false,"location":{"filename":"src/clear/sql/insert_query.cr","line_number":27,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/insert_query.cr#L27"},"def":{"name":"table?","return_type":"Symbol | String | ::Nil","visibility":"Public","body":"@table"}},{"html_id":"to_sql-instance-method","name":"to_sql","abstract":false,"location":{"filename":"src/clear/sql/insert_query.cr","line_number":187,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/insert_query.cr#L187"},"def":{"name":"to_sql","visibility":"Public","body":"if table = @table\nelse\n raise(QueryBuildingError.new(\"You must provide a `into` clause\"))\nend\ntable = table.is_a?(Symbol) ? Clear::SQL.escape(table) : table\no = [print_ctes, \"INSERT INTO\", table, print_keys]\nv = @values\ncase v\nwhen SelectBuilder\n o << ((\"(\" + v.to_sql) + \")\")\nelse\n if v.empty? || ((v.size == 1) && v[0].empty?)\n o << \"DEFAULT VALUES\"\n else\n o << \"VALUES\"\n o << print_values\n end\nend\nprint_on_conflict(o)\nif @returning\n o << \"RETURNING\"\n o << @returning\nend\no.compact.join(\" \")\n"}},{"html_id":"values(row:Hash(Symbolic,Inserable))-instance-method","name":"values","abstract":false,"args":[{"name":"row","external_name":"row","restriction":"Hash(Symbolic, Inserable)"}],"args_string":"(row : Hash(Symbolic, Inserable))","args_html":"(row : Hash(Symbolic, Inserable))","location":{"filename":"src/clear/sql/insert_query.cr","line_number":108,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/insert_query.cr#L108"},"def":{"name":"values","args":[{"name":"row","external_name":"row","restriction":"Hash(Symbolic, Inserable)"}],"visibility":"Public","body":"@keys = row.keys.to_a.map() do |__arg3|\n __arg3.as(Symbolic)\nend\ncase v = @values\nwhen Array(Array(Inserable))\n v << row.values.to_a.map() do |__arg4|\n __arg4.as(Inserable)\n end\nelse\n raise(\"Cannot insert both from SELECT query and from data\")\nend\nchange!\n"}},{"html_id":"values(rows:Array(Hash(Symbolic,Inserable)))-instance-method","name":"values","abstract":false,"args":[{"name":"rows","external_name":"rows","restriction":"Array(Hash(Symbolic, Inserable))"}],"args_string":"(rows : Array(Hash(Symbolic, Inserable)))","args_html":"(rows : Array(Hash(Symbolic, Inserable)))","location":{"filename":"src/clear/sql/insert_query.cr","line_number":129,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/insert_query.cr#L129"},"def":{"name":"values","args":[{"name":"rows","external_name":"rows","restriction":"Array(Hash(Symbolic, Inserable))"}],"visibility":"Public","body":"rows.each do |nt|\n values(nt)\nend\nchange!\n"}},{"html_id":"values(row:NamedTuple)-instance-method","name":"values","doc":"Fast insert system\n\ninsert({field: \"value\"}).into(:table)\n","summary":"

Fast insert system

","abstract":false,"args":[{"name":"row","external_name":"row","restriction":"NamedTuple"}],"args_string":"(row : NamedTuple)","args_html":"(row : NamedTuple)","location":{"filename":"src/clear/sql/insert_query.cr","line_number":95,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/insert_query.cr#L95"},"def":{"name":"values","args":[{"name":"row","external_name":"row","restriction":"NamedTuple"}],"visibility":"Public","body":"@keys = row.keys.to_a.map() do |__arg1|\n __arg1.as(Symbolic)\nend\ncase v = @values\nwhen Array(Array(Inserable))\n v << row.values.to_a.map() do |__arg2|\n __arg2.as(Inserable)\n end\nelse\n raise(\"Cannot insert both from SELECT query and from data\")\nend\nchange!\n"}},{"html_id":"values(rows:Array(NamedTuple))-instance-method","name":"values","abstract":false,"args":[{"name":"rows","external_name":"rows","restriction":"Array(NamedTuple)"}],"args_string":"(rows : Array(NamedTuple))","args_html":"(rows : Array(NamedTuple))","location":{"filename":"src/clear/sql/insert_query.cr","line_number":121,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/insert_query.cr#L121"},"def":{"name":"values","args":[{"name":"rows","external_name":"rows","restriction":"Array(NamedTuple)"}],"visibility":"Public","body":"rows.each do |nt|\n values(nt)\nend\nchange!\n"}},{"html_id":"values(select_query:SelectBuilder)-instance-method","name":"values","doc":"Insert into ... (...) SELECT","summary":"

Insert into ...

","abstract":false,"args":[{"name":"select_query","external_name":"select_query","restriction":"SelectBuilder"}],"args_string":"(select_query : SelectBuilder)","args_html":"(select_query : SelectBuilder)","location":{"filename":"src/clear/sql/insert_query.cr","line_number":151,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/insert_query.cr#L151"},"def":{"name":"values","args":[{"name":"select_query","external_name":"select_query","restriction":"SelectBuilder"}],"visibility":"Public","body":"if @values.is_a?(Array) && (@values.as(Array)).present?\n raise(QueryBuildingError.new(\"Cannot insert both from SELECT and from data\"))\nend\n@values = select_query\nchange!\n"}},{"html_id":"values:SelectBuilder|Array(Array(Inserable))-instance-method","name":"values","abstract":false,"location":{"filename":"src/clear/sql/insert_query.cr","line_number":26,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/insert_query.cr#L26"},"def":{"name":"values","return_type":"SelectBuilder | Array(Array(Inserable))","visibility":"Public","body":"@values"}},{"html_id":"values(*args)-instance-method","name":"values","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args)","args_html":"(*args)","location":{"filename":"src/clear/sql/insert_query.cr","line_number":144,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/insert_query.cr#L144"},"def":{"name":"values","args":[{"name":"args","external_name":"args","restriction":""}],"splat_index":0,"visibility":"Public","body":"@values << args\nchange!\n"}}],"types":[{"html_id":"clear/Clear/SQL/InsertQuery/Inserable","path":"Clear/SQL/InsertQuery/Inserable.html","kind":"alias","full_name":"Clear::SQL::InsertQuery::Inserable","name":"Inserable","abstract":false,"locations":[{"filename":"src/clear/sql/insert_query.cr","line_number":24,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/insert_query.cr#L24"}],"repository_name":"clear","program":false,"enum":false,"alias":true,"aliased":"(Array(PG::BoolArray) | Array(PG::CharArray) | Array(PG::Float32Array) | Array(PG::Float64Array) | Array(PG::Int16Array) | Array(PG::Int32Array) | Array(PG::Int64Array) | Array(PG::NumericArray) | Array(PG::StringArray) | Array(PG::TimeArray) | Array(PG::UUIDArray) | BigDecimal | BigFloat | BigInt | Bool | Char | Clear::Expression::Literal | Crypto::Bcrypt::Password | Float32 | Float64 | Int16 | Int32 | Int64 | Int8 | JSON::Any | JSON::PullParser | PG::Geo::Box | PG::Geo::Circle | PG::Geo::Line | PG::Geo::LineSegment | PG::Geo::Path | PG::Geo::Point | PG::Geo::Polygon | PG::Interval | PG::Numeric | Slice(UInt8) | String | Time | UInt16 | UInt32 | UInt64 | UInt8 | UUID | Nil)","aliased_html":"Array(PG::BoolArray) | Array(PG::CharArray) | Array(PG::Float32Array) | Array(PG::Float64Array) | Array(PG::Int16Array) | Array(PG::Int32Array) | Array(PG::Int64Array) | Array(PG::NumericArray) | Array(PG::StringArray) | Array(PG::TimeArray) | Array(PG::UUIDArray) | BigDecimal | BigFloat | BigInt | Bool | Char | Clear::Expression::Literal | Crypto::Bcrypt::Password | Float32 | Float64 | Int16 | Int32 | Int64 | Int8 | JSON::Any | JSON::PullParser | PG::Geo::Box | PG::Geo::Circle | PG::Geo::Line | PG::Geo::LineSegment | PG::Geo::Path | PG::Geo::Point | PG::Geo::Polygon | PG::Interval | PG::Numeric | Slice(UInt8) | String | Time | UInt16 | UInt32 | UInt64 | UInt8 | UUID | Nil","const":false,"namespace":{"html_id":"clear/Clear/SQL/InsertQuery","kind":"class","full_name":"Clear::SQL::InsertQuery","name":"InsertQuery"}}]},{"html_id":"clear/Clear/SQL/Join","path":"Clear/SQL/Join.html","kind":"struct","full_name":"Clear::SQL::Join","name":"Join","abstract":false,"superclass":{"html_id":"clear/Clear/SQL/Fragment","kind":"struct","full_name":"Clear::SQL::Fragment","name":"Fragment"},"ancestors":[{"html_id":"clear/Clear/SQL/Fragment","kind":"struct","full_name":"Clear::SQL::Fragment","name":"Fragment"},{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/sql/fragment/join.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/fragment/join.cr#L4"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"TYPE","name":"TYPE","value":"{left: \"LEFT JOIN\", inner: \"INNER JOIN\", right: \"RIGHT JOIN\", full_outer: \"FULL OUTER JOIN\", cross: \"CROSS JOIN\"}"}],"namespace":{"html_id":"clear/Clear/SQL","kind":"module","full_name":"Clear::SQL","name":"SQL"},"constructors":[{"html_id":"new(from:Clear::SQL::SelectBuilder|String|Symbol,condition:Clear::Expression::Node|Nil=nil,lateral:Bool=false,type:Symbol=:inner)-class-method","name":"new","abstract":false,"args":[{"name":"from","external_name":"from","restriction":"::Clear::SQL::SelectBuilder | ::String | ::Symbol"},{"name":"condition","default_value":"nil","external_name":"condition","restriction":"::Clear::Expression::Node | ::Nil"},{"name":"lateral","default_value":"false","external_name":"lateral","restriction":"::Bool"},{"name":"type","default_value":":inner","external_name":"type","restriction":"Symbol"}],"args_string":"(from : Clear::SQL::SelectBuilder | String | Symbol, condition : Clear::Expression::Node | Nil = nil, lateral : Bool = false, type : Symbol = :inner)","args_html":"(from : Clear::SQL::SelectBuilder | String | Symbol, condition : Clear::Expression::Node | Nil = nil, lateral : Bool = false, type : Symbol = :inner)","location":{"filename":"src/clear/sql/fragment/join.cr","line_number":16,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/fragment/join.cr#L16"},"def":{"name":"new","args":[{"name":"from","external_name":"from","restriction":"::Clear::SQL::SelectBuilder | ::String | ::Symbol"},{"name":"condition","default_value":"nil","external_name":"condition","restriction":"::Clear::Expression::Node | ::Nil"},{"name":"lateral","default_value":"false","external_name":"lateral","restriction":"::Bool"},{"name":"type","default_value":":inner","external_name":"type","restriction":"Symbol"}],"visibility":"Public","body":"_ = allocate\n_.initialize(from, condition, lateral, type)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"condition:Clear::Expression::Node|Nil-instance-method","name":"condition","abstract":false,"location":{"filename":"src/clear/sql/fragment/join.cr","line_number":13,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/fragment/join.cr#L13"},"def":{"name":"condition","return_type":"Clear::Expression::Node | ::Nil","visibility":"Public","body":"@condition"}},{"html_id":"from:Selectable-instance-method","name":"from","abstract":false,"location":{"filename":"src/clear/sql/fragment/join.cr","line_number":12,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/fragment/join.cr#L12"},"def":{"name":"from","return_type":"Selectable","visibility":"Public","body":"@from"}},{"html_id":"lateral?:Bool-instance-method","name":"lateral?","abstract":false,"location":{"filename":"src/clear/sql/fragment/join.cr","line_number":14,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/fragment/join.cr#L14"},"def":{"name":"lateral?","return_type":"Bool","visibility":"Public","body":"@lateral"}},{"html_id":"to_sql-instance-method","name":"to_sql","abstract":false,"location":{"filename":"src/clear/sql/fragment/join.cr","line_number":20,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/fragment/join.cr#L20"},"def":{"name":"to_sql","visibility":"Public","body":"from = @from\nfrom = case from\nwhen SQL::SelectBuilder\n \"(#{from.to_sql})\"\nelse\n from.to_s\nend\nif c = @condition\n [type, lateral? ? \"LATERAL\" : nil, from, \"ON\", c.resolve].compact.join(\" \")\nelse\n [type, lateral? ? \"LATERAL\" : nil, SQL.sel_str(from)].compact.join(\" \")\nend\n"}},{"html_id":"type:String-instance-method","name":"type","abstract":false,"location":{"filename":"src/clear/sql/fragment/join.cr","line_number":11,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/fragment/join.cr#L11"},"def":{"name":"type","return_type":"String","visibility":"Public","body":"@type"}}]},{"html_id":"clear/Clear/SQL/JSONB","path":"Clear/SQL/JSONB.html","kind":"module","full_name":"Clear::SQL::JSONB","name":"JSONB","abstract":false,"locations":[{"filename":"src/clear/extensions/jsonb/jsonb.cr","line_number":32,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/jsonb/jsonb.cr#L32"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"extended_modules":[{"html_id":"clear/Clear/SQL/JSONB","kind":"module","full_name":"Clear::SQL::JSONB","name":"JSONB"}],"including_types":[{"html_id":"clear/Clear/Expression/Node/JSONB/Equality","kind":"class","full_name":"Clear::Expression::Node::JSONB::Equality","name":"Equality"},{"html_id":"clear/Clear/Expression/Node/JSONB/Field","kind":"class","full_name":"Clear::Expression::Node::JSONB::Field","name":"Field"}],"namespace":{"html_id":"clear/Clear/SQL","kind":"module","full_name":"Clear::SQL","name":"SQL"},"instance_methods":[{"html_id":"jsonb_all_exists?(field,keys:Array(String))-instance-method","name":"jsonb_all_exists?","doc":"jsonb `?&` operator\nDo all of these array strings exist as top-level keys?","summary":"

jsonb ?& operator Do all of these array strings exist as top-level keys?

","abstract":false,"args":[{"name":"field","external_name":"field","restriction":""},{"name":"keys","external_name":"keys","restriction":"Array(String)"}],"args_string":"(field, keys : Array(String))","args_html":"(field, keys : Array(String))","location":{"filename":"src/clear/extensions/jsonb/jsonb.cr","line_number":56,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/jsonb/jsonb.cr#L56"},"def":{"name":"jsonb_all_exists?","args":[{"name":"field","external_name":"field","restriction":""},{"name":"keys","external_name":"keys","restriction":"Array(String)"}],"visibility":"Public","body":"{field, (\"array[\" + (keys.join(\",\") do |x|\n Clear::SQL.sanitize(x)\nend)) + \"]\"}.join(\" ?& \")"}},{"html_id":"jsonb_any_exists?(field,keys:Array(String))-instance-method","name":"jsonb_any_exists?","doc":"jsonb `?|` operator\nDo any of these array strings exist as top-level keys?","summary":"

jsonb ?| operator Do any of these array strings exist as top-level keys?

","abstract":false,"args":[{"name":"field","external_name":"field","restriction":""},{"name":"keys","external_name":"keys","restriction":"Array(String)"}],"args_string":"(field, keys : Array(String))","args_html":"(field, keys : Array(String))","location":{"filename":"src/clear/extensions/jsonb/jsonb.cr","line_number":45,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/jsonb/jsonb.cr#L45"},"def":{"name":"jsonb_any_exists?","args":[{"name":"field","external_name":"field","restriction":""},{"name":"keys","external_name":"keys","restriction":"Array(String)"}],"visibility":"Public","body":"{field, (\"array[\" + (keys.join(\",\") do |x|\n Clear::SQL.sanitize(x)\nend)) + \"]\"}.join(\" ?| \")"}},{"html_id":"jsonb_eq(field,key,value)-instance-method","name":"jsonb_eq","doc":"Test equality using the `@>` operator\n\n```\njsonb_eq(\"data.sub.key\", \"value\")\n```\n\n=> `data @> '{\"sub\": {\"key\": \"value\"}}' `","summary":"

Test equality using the @> operator

","abstract":false,"args":[{"name":"field","external_name":"field","restriction":""},{"name":"key","external_name":"key","restriction":""},{"name":"value","external_name":"value","restriction":""}],"args_string":"(field, key, value)","args_html":"(field, key, value)","location":{"filename":"src/clear/extensions/jsonb/jsonb.cr","line_number":112,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/jsonb/jsonb.cr#L112"},"def":{"name":"jsonb_eq","args":[{"name":"field","external_name":"field","restriction":""},{"name":"key","external_name":"key","restriction":""},{"name":"value","external_name":"value","restriction":""}],"visibility":"Public","body":"arr = jsonb_k2a(key)\nif arr.empty?\n {field, Clear::Expression[value]}.join(\" = \")\nelse\n {field, Clear::Expression[(jsonb_arr2h(arr, value)).to_json]}.join(\" @> \")\nend\n"}},{"html_id":"jsonb_exists?(field,value)-instance-method","name":"jsonb_exists?","doc":"Does the string exist as a top-level key within the JSON value?","summary":"

Does the string exist as a top-level key within the JSON value?

","abstract":false,"args":[{"name":"field","external_name":"field","restriction":""},{"name":"value","external_name":"value","restriction":""}],"args_string":"(field, value)","args_html":"(field, value)","location":{"filename":"src/clear/extensions/jsonb/jsonb.cr","line_number":50,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/jsonb/jsonb.cr#L50"},"def":{"name":"jsonb_exists?","args":[{"name":"field","external_name":"field","restriction":""},{"name":"value","external_name":"value","restriction":""}],"visibility":"Public","body":"{field, Clear::SQL.sanitize(value)}.join(\" ? \")"}},{"html_id":"jsonb_k2h(key:String,value:JSONBKey):JSONBHash-instance-method","name":"jsonb_k2h","doc":"Transform a key to a hash","summary":"

Transform a key to a hash

","abstract":false,"args":[{"name":"key","external_name":"key","restriction":"String"},{"name":"value","external_name":"value","restriction":"JSONBKey"}],"args_string":"(key : String, value : JSONBKey) : JSONBHash","args_html":"(key : String, value : JSONBKey) : JSONBHash","location":{"filename":"src/clear/extensions/jsonb/jsonb.cr","line_number":39,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/jsonb/jsonb.cr#L39"},"def":{"name":"jsonb_k2h","args":[{"name":"key","external_name":"key","restriction":"String"},{"name":"value","external_name":"value","restriction":"JSONBKey"}],"return_type":"JSONBHash","visibility":"Public","body":"jsonb_arr2h(jsonb_k2a(key), value)"}},{"html_id":"jsonb_resolve(field,arr:Array(String),cast=nil):String-instance-method","name":"jsonb_resolve","abstract":false,"args":[{"name":"field","external_name":"field","restriction":""},{"name":"arr","external_name":"arr","restriction":"Array(String)"},{"name":"cast","default_value":"nil","external_name":"cast","restriction":""}],"args_string":"(field, arr : Array(String), cast = nil) : String","args_html":"(field, arr : Array(String), cast = nil) : String","location":{"filename":"src/clear/extensions/jsonb/jsonb.cr","line_number":122,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/jsonb/jsonb.cr#L122"},"def":{"name":"jsonb_resolve","args":[{"name":"field","external_name":"field","restriction":""},{"name":"arr","external_name":"arr","restriction":"Array(String)"},{"name":"cast","default_value":"nil","external_name":"cast","restriction":""}],"return_type":"String","visibility":"Public","body":"if arr.empty?\n return field\nend\no = ([field] + Clear::Expression[arr]).join(\"->\")\nif cast\n o = \"(#{o})::#{cast}\"\nend\no\n"}},{"html_id":"jsonb_resolve(field,key:String,cast=nil)-instance-method","name":"jsonb_resolve","doc":"Return text selector for the field/key :\n\n```\njsonb_text(\"data\", \"sub.key\").like(\"user%\")\n# => \"data->'sub'->>'key' LIKE 'user%'\"\n```","summary":"

Return text selector for the field/key :

","abstract":false,"args":[{"name":"field","external_name":"field","restriction":""},{"name":"key","external_name":"key","restriction":"String"},{"name":"cast","default_value":"nil","external_name":"cast","restriction":""}],"args_string":"(field, key : String, cast = nil)","args_html":"(field, key : String, cast = nil)","location":{"filename":"src/clear/extensions/jsonb/jsonb.cr","line_number":138,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/jsonb/jsonb.cr#L138"},"def":{"name":"jsonb_resolve","args":[{"name":"field","external_name":"field","restriction":""},{"name":"key","external_name":"key","restriction":"String"},{"name":"cast","default_value":"nil","external_name":"cast","restriction":""}],"visibility":"Public","body":"arr = jsonb_k2a(key)\njsonb_resolve(field, arr, cast)\n"}}],"types":[{"html_id":"clear/Clear/SQL/JSONB/JSONBHash","path":"Clear/SQL/JSONB/JSONBHash.html","kind":"alias","full_name":"Clear::SQL::JSONB::JSONBHash","name":"JSONBHash","abstract":false,"locations":[{"filename":"src/clear/extensions/jsonb/jsonb.cr","line_number":36,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/jsonb/jsonb.cr#L36"}],"repository_name":"clear","program":false,"enum":false,"alias":true,"aliased":"Hash(String, Clear::SQL::JSONB::JSONBKey)","aliased_html":"Hash(String, Clear::SQL::JSONB::JSONBKey)","const":false,"namespace":{"html_id":"clear/Clear/SQL/JSONB","kind":"module","full_name":"Clear::SQL::JSONB","name":"JSONB"}},{"html_id":"clear/Clear/SQL/JSONB/JSONBKey","path":"Clear/SQL/JSONB/JSONBKey.html","kind":"alias","full_name":"Clear::SQL::JSONB::JSONBKey","name":"JSONBKey","abstract":false,"locations":[{"filename":"src/clear/extensions/jsonb/jsonb.cr","line_number":35,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/jsonb/jsonb.cr#L35"}],"repository_name":"clear","program":false,"enum":false,"alias":true,"aliased":"(Bool | Clear::Expression::Literal | Float32 | Float64 | Hash(String, Clear::SQL::JSONB::JSONBKey) | Int16 | Int32 | Int64 | Int8 | String | Symbol | Time | UInt16 | UInt32 | UInt64 | UInt8 | Nil)","aliased_html":"Bool | Clear::Expression::Literal | Float32 | Float64 | Hash(String, Clear::SQL::JSONB::JSONBKey) | Int16 | Int32 | Int64 | Int8 | String | Symbol | Time | UInt16 | UInt32 | UInt64 | UInt8 | Nil","const":false,"namespace":{"html_id":"clear/Clear/SQL/JSONB","kind":"module","full_name":"Clear::SQL::JSONB","name":"JSONB"}}]},{"html_id":"clear/Clear/SQL/Logger","path":"Clear/SQL/Logger.html","kind":"module","full_name":"Clear::SQL::Logger","name":"Logger","abstract":false,"locations":[{"filename":"src/clear/sql/logger.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/logger.cr#L4"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"clear/Clear/SQL","kind":"module","full_name":"Clear::SQL","name":"SQL"}],"namespace":{"html_id":"clear/Clear/SQL","kind":"module","full_name":"Clear::SQL","name":"SQL"},"class_methods":[{"html_id":"colorize=(colorize:Bool)-class-method","name":"colorize=","abstract":false,"args":[{"name":"colorize","external_name":"colorize","restriction":"Bool"}],"args_string":"(colorize : Bool)","args_html":"(colorize : Bool)","location":{"filename":"src/clear/sql/logger.cr","line_number":5,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/logger.cr#L5"},"def":{"name":"colorize=","args":[{"name":"colorize","external_name":"colorize","restriction":"Bool"}],"visibility":"Public","body":"@@colorize = colorize"}},{"html_id":"colorize?:Bool-class-method","name":"colorize?","abstract":false,"location":{"filename":"src/clear/sql/logger.cr","line_number":5,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/logger.cr#L5"},"def":{"name":"colorize?","return_type":"Bool","visibility":"Public","body":"@@colorize"}},{"html_id":"colorize_query(qry:String)-class-method","name":"colorize_query","abstract":false,"args":[{"name":"qry","external_name":"qry","restriction":"String"}],"args_string":"(qry : String)","args_html":"(qry : String)","location":{"filename":"src/clear/sql/logger.cr","line_number":21,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/logger.cr#L21"},"def":{"name":"colorize_query","args":[{"name":"qry","external_name":"qry","restriction":"String"}],"visibility":"Public","body":"if @@colorize\nelse\n return qry\nend\no = (qry.to_s.split(/([a-zA-Z0-9_]+)/)).join(\"\") do |word|\n if SQL_KEYWORDS.includes?(word.upcase)\n word.colorize.bold.blue.to_s\n else\n if word =~ (/\\d+/)\n word.colorize.red\n else\n word.colorize.white\n end\n end\nend\no.gsub(/(--.*)$/) do |__arg0|\n __arg0.colorize.dark_gray\nend\n"}},{"html_id":"display_mn_sec(x):String-class-method","name":"display_mn_sec","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x) : String","args_html":"(x) : String","location":{"filename":"src/clear/sql/logger.cr","line_number":37,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/logger.cr#L37"},"def":{"name":"display_mn_sec","args":[{"name":"x","external_name":"x","restriction":""}],"return_type":"String","visibility":"Public","body":"mn = x.to_i / 60\nsc = x.to_i % 60\n({mn > 9 ? mn : \"0#{mn}\", sc > 9 ? sc : \"0#{sc}\"}.join(\"mn\")) + \"s\"\n"}},{"html_id":"display_time(x):String-class-method","name":"display_time","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x) : String","args_html":"(x) : String","location":{"filename":"src/clear/sql/logger.cr","line_number":44,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/logger.cr#L44"},"def":{"name":"display_time","args":[{"name":"x","external_name":"x","restriction":""}],"return_type":"String","visibility":"Public","body":"if x > 60\n display_mn_sec(x)\nelse\n if x > 1\n (\"%.2f\" % x) + \"s\"\n else\n if x > 0.001\n (1000 * x).to_i.to_s + \"ms\"\n else\n (1000000 * x).to_i.to_s + \"µs\"\n end\n end\nend"}}],"instance_methods":[{"html_id":"log_query(sql,&)-instance-method","name":"log_query","abstract":false,"args":[{"name":"sql","external_name":"sql","restriction":""}],"args_string":"(sql, &)","args_html":"(sql, &)","location":{"filename":"src/clear/sql/logger.cr","line_number":56,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/logger.cr#L56"},"def":{"name":"log_query","args":[{"name":"sql","external_name":"sql","restriction":""}],"yields":0,"block_arity":0,"visibility":"Public","body":"begin\n start_time = Time.monotonic\n o = yield\n elapsed_time = Time.monotonic - start_time\n Log.debug do\n (\"[\" + (Clear::SQL::Logger.display_time(elapsed_time.to_f)).colorize.bold.white.to_s) + \"] #{SQL::Logger.colorize_query(sql)}\"\n end\n o\nrescue e\n raise(Clear::SQL::Error.new(message: [e.message, \"Error caught, last query was:\", Clear::SQL::Logger.colorize_query(sql)].compact.join(\"\\n\"), cause: e))\nend"}}]},{"html_id":"clear/Clear/SQL/OperationNotPermittedError","path":"Clear/SQL/OperationNotPermittedError.html","kind":"class","full_name":"Clear::SQL::OperationNotPermittedError","name":"OperationNotPermittedError","abstract":false,"superclass":{"html_id":"clear/Clear/SQL/Error","kind":"class","full_name":"Clear::SQL::Error","name":"Error"},"ancestors":[{"html_id":"clear/Clear/SQL/Error","kind":"class","full_name":"Clear::SQL::Error","name":"Error"},{"html_id":"clear/Exception","kind":"class","full_name":"Exception","name":"Exception"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/sql/errors.cr","line_number":8,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/errors.cr#L8"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/SQL","kind":"module","full_name":"Clear::SQL","name":"SQL"}},{"html_id":"clear/Clear/SQL/Query","path":"Clear/SQL/Query.html","kind":"module","full_name":"Clear::SQL::Query","name":"Query","abstract":false,"locations":[{"filename":"src/clear/sql/query/aggregate.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/aggregate.cr#L1"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/SQL","kind":"module","full_name":"Clear::SQL","name":"SQL"},"types":[{"html_id":"clear/Clear/SQL/Query/Aggregate","path":"Clear/SQL/Query/Aggregate.html","kind":"module","full_name":"Clear::SQL::Query::Aggregate","name":"Aggregate","abstract":false,"locations":[{"filename":"src/clear/sql/query/aggregate.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/aggregate.cr#L1"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"clear/Clear/SQL/SelectBuilder","kind":"module","full_name":"Clear::SQL::SelectBuilder","name":"SelectBuilder"}],"namespace":{"html_id":"clear/Clear/SQL/Query","kind":"module","full_name":"Clear::SQL::Query","name":"Query"},"instance_methods":[{"html_id":"agg(field,x:X.class)forallX-instance-method","name":"agg","doc":"Call an custom aggregation function, like MEDIAN or other:\n\n```\nquery.agg(\"MEDIAN(age)\", Int64)\n```\n\nNote than COUNT, MIN, MAX, SUM and AVG are already conveniently mapped.\n\nThis return only one row, and should not be used with `group_by` (prefer pluck or fetch)","summary":"

Call an custom aggregation function, like MEDIAN or other:

","abstract":false,"args":[{"name":"field","external_name":"field","restriction":""},{"name":"x","external_name":"x","restriction":"X.class"}],"args_string":"(field, x : X.class) forall X","args_html":"(field, x : X.class) forall X","location":{"filename":"src/clear/sql/query/aggregate.cr","line_number":38,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/aggregate.cr#L38"},"def":{"name":"agg","args":[{"name":"field","external_name":"field","restriction":""},{"name":"x","external_name":"x","restriction":"X.class"}],"visibility":"Public","body":"(clear_select.select(field)).scalar(X)"}},{"html_id":"avg(field,x:X.class)forallX-instance-method","name":"avg","doc":"SQL aggregation function \"AVG\":\n\n```\nquery.avg(\"field\", Int64)\n```","summary":"

SQL aggregation function "AVG":

","abstract":false,"args":[{"name":"field","external_name":"field","restriction":""},{"name":"x","external_name":"x","restriction":"X.class"}],"args_string":"(field, x : X.class) forall X","args_html":"(field, x : X.class) forall X","location":{"filename":"src/clear/sql/query/aggregate.cr","line_number":48,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/aggregate.cr#L48"},"def":{"name":"avg","args":[{"name":"field","external_name":"field","restriction":""},{"name":"x","external_name":"x","restriction":"X.class"}],"visibility":"Public","body":"agg(\"AVG(#{field})\", X)"}},{"html_id":"count(type:X.class=Int64)forallX-instance-method","name":"count","doc":"Use SQL `COUNT` over your query, and return this number as a Int64\n\nas count return always a scalar, the usage of `COUNT(*) OVER GROUP BY` can be done by\nusing `pluck` or `select`","summary":"

Use SQL COUNT over your query, and return this number as a Int64

","abstract":false,"args":[{"name":"type","default_value":"Int64","external_name":"type","restriction":"X.class"}],"args_string":"(type : X.class = Int64) forall X","args_html":"(type : X.class = Int64) forall X","location":{"filename":"src/clear/sql/query/aggregate.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/aggregate.cr#L6"},"def":{"name":"count","args":[{"name":"type","default_value":"Int64","external_name":"type","restriction":"X.class"}],"visibility":"Public","body":"columns = @columns.dup\nif (@offset || @limit) || @group_bys\n subquery = is_distinct? ? self : (dup.clear_order_bys.clear_select.use_connection(connection_name)).select(\"1\")\n o = X.new(((Clear::SQL.select(\"COUNT(*)\")).from({query_count: subquery})).scalar(Int64))\nelse\n new_query = dup.clear_select.select(\"COUNT(*)\")\n o = X.new(new_query.scalar(Int64))\nend\n@columns = columns\no\n"}},{"html_id":"max(field,x:X.class)forallX-instance-method","name":"max","doc":"SQL aggregation function \"MAX\":\n\n```\nquery.max(\"field\", Int64)\n```","summary":"

SQL aggregation function "MAX":

","abstract":false,"args":[{"name":"field","external_name":"field","restriction":""},{"name":"x","external_name":"x","restriction":"X.class"}],"args_string":"(field, x : X.class) forall X","args_html":"(field, x : X.class) forall X","location":{"filename":"src/clear/sql/query/aggregate.cr","line_number":48,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/aggregate.cr#L48"},"def":{"name":"max","args":[{"name":"field","external_name":"field","restriction":""},{"name":"x","external_name":"x","restriction":"X.class"}],"visibility":"Public","body":"agg(\"MAX(#{field})\", X)"}},{"html_id":"min(field,x:X.class)forallX-instance-method","name":"min","doc":"SQL aggregation function \"MIN\":\n\n```\nquery.min(\"field\", Int64)\n```","summary":"

SQL aggregation function "MIN":

","abstract":false,"args":[{"name":"field","external_name":"field","restriction":""},{"name":"x","external_name":"x","restriction":"X.class"}],"args_string":"(field, x : X.class) forall X","args_html":"(field, x : X.class) forall X","location":{"filename":"src/clear/sql/query/aggregate.cr","line_number":48,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/aggregate.cr#L48"},"def":{"name":"min","args":[{"name":"field","external_name":"field","restriction":""},{"name":"x","external_name":"x","restriction":"X.class"}],"visibility":"Public","body":"agg(\"MIN(#{field})\", X)"}},{"html_id":"sum(field):Float64-instance-method","name":"sum","doc":"SUM through a field and return a Float64\nNote: This function is not safe injection-wise, so beware !.","summary":"

SUM through a field and return a Float64 Note: This function is not safe injection-wise, so beware !.

","abstract":false,"args":[{"name":"field","external_name":"field","restriction":""}],"args_string":"(field) : Float64","args_html":"(field) : Float64","location":{"filename":"src/clear/sql/query/aggregate.cr","line_number":44,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/aggregate.cr#L44"},"def":{"name":"sum","args":[{"name":"field","external_name":"field","restriction":""}],"return_type":"Float64","visibility":"Public","body":"(agg(\"SUM(#{field})\", Union(Int64 | PG::Numeric | Nil))).try(&.to_f) || 0.0"}}]},{"html_id":"clear/Clear/SQL/Query/BeforeQuery","path":"Clear/SQL/Query/BeforeQuery.html","kind":"module","full_name":"Clear::SQL::Query::BeforeQuery","name":"BeforeQuery","abstract":false,"locations":[{"filename":"src/clear/sql/query/before_query.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/before_query.cr#L1"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"clear/Clear/SQL/SelectBuilder","kind":"module","full_name":"Clear::SQL::SelectBuilder","name":"SelectBuilder"}],"namespace":{"html_id":"clear/Clear/SQL/Query","kind":"module","full_name":"Clear::SQL::Query","name":"Query"}},{"html_id":"clear/Clear/SQL/Query/Change","path":"Clear/SQL/Query/Change.html","kind":"module","full_name":"Clear::SQL::Query::Change","name":"Change","abstract":false,"locations":[{"filename":"src/clear/sql/query/change.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/change.cr#L1"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"clear/Clear/SQL/DeleteQuery","kind":"class","full_name":"Clear::SQL::DeleteQuery","name":"DeleteQuery"},{"html_id":"clear/Clear/SQL/InsertQuery","kind":"class","full_name":"Clear::SQL::InsertQuery","name":"InsertQuery"},{"html_id":"clear/Clear/SQL/SelectBuilder","kind":"module","full_name":"Clear::SQL::SelectBuilder","name":"SelectBuilder"},{"html_id":"clear/Clear/SQL/UpdateQuery","kind":"class","full_name":"Clear::SQL::UpdateQuery","name":"UpdateQuery"}],"namespace":{"html_id":"clear/Clear/SQL/Query","kind":"module","full_name":"Clear::SQL::Query","name":"Query"},"instance_methods":[{"html_id":"change!:self-instance-method","name":"change!","doc":"This method is called everytime the request has been changed\nBy default, this do nothing and return `self`. However, it can be\nreimplemented to change some behavior when the query is changed\n\n(eg. it is by `Clear::Model::Collection`, to discard cache over collection)","summary":"

This method is called everytime the request has been changed By default, this do nothing and return self.

","abstract":false,"location":{"filename":"src/clear/sql/query/change.cr","line_number":7,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/change.cr#L7"},"def":{"name":"change!","return_type":"self","visibility":"Public","body":"self"}}]},{"html_id":"clear/Clear/SQL/Query/Connection","path":"Clear/SQL/Query/Connection.html","kind":"module","full_name":"Clear::SQL::Query::Connection","name":"Connection","abstract":false,"locations":[{"filename":"src/clear/sql/query/connection.cr","line_number":2,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/connection.cr#L2"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"clear/Clear/SQL/DeleteQuery","kind":"class","full_name":"Clear::SQL::DeleteQuery","name":"DeleteQuery"},{"html_id":"clear/Clear/SQL/InsertQuery","kind":"class","full_name":"Clear::SQL::InsertQuery","name":"InsertQuery"},{"html_id":"clear/Clear/SQL/SelectBuilder","kind":"module","full_name":"Clear::SQL::SelectBuilder","name":"SelectBuilder"},{"html_id":"clear/Clear/SQL/UpdateQuery","kind":"class","full_name":"Clear::SQL::UpdateQuery","name":"UpdateQuery"}],"namespace":{"html_id":"clear/Clear/SQL/Query","kind":"module","full_name":"Clear::SQL::Query","name":"Query"},"instance_methods":[{"html_id":"connection_name:String-instance-method","name":"connection_name","doc":"Connection used by the query.\nChange it using `use_connection` method","summary":"

Connection used by the query.

","abstract":false,"location":{"filename":"src/clear/sql/query/connection.cr","line_number":5,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/connection.cr#L5"},"def":{"name":"connection_name","return_type":"String","visibility":"Public","body":"@connection_name"}},{"html_id":"use_connection(connection_name:String)-instance-method","name":"use_connection","doc":"Change the connection used by the query on execution","summary":"

Change the connection used by the query on execution

","abstract":false,"args":[{"name":"connection_name","external_name":"connection_name","restriction":"String"}],"args_string":"(connection_name : String)","args_html":"(connection_name : String)","location":{"filename":"src/clear/sql/query/connection.cr","line_number":8,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/connection.cr#L8"},"def":{"name":"use_connection","args":[{"name":"connection_name","external_name":"connection_name","restriction":"String"}],"visibility":"Public","body":"@connection_name = connection_name\nself\n"}}]},{"html_id":"clear/Clear/SQL/Query/CTE","path":"Clear/SQL/Query/CTE.html","kind":"module","full_name":"Clear::SQL::Query::CTE","name":"CTE","abstract":false,"locations":[{"filename":"src/clear/sql/query/cte.cr","line_number":2,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/cte.cr#L2"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"clear/Clear/SQL/InsertQuery","kind":"class","full_name":"Clear::SQL::InsertQuery","name":"InsertQuery"},{"html_id":"clear/Clear/SQL/SelectBuilder","kind":"module","full_name":"Clear::SQL::SelectBuilder","name":"SelectBuilder"},{"html_id":"clear/Clear/SQL/UpdateQuery","kind":"class","full_name":"Clear::SQL::UpdateQuery","name":"UpdateQuery"}],"namespace":{"html_id":"clear/Clear/SQL/Query","kind":"module","full_name":"Clear::SQL::Query","name":"Query"},"doc":"Allow usage of Common Table Expressions (CTE) in the query building","summary":"

Allow usage of Common Table Expressions (CTE) in the query building

","instance_methods":[{"html_id":"cte:Hash(String,CTEAuthorized)-instance-method","name":"cte","doc":"List the current CTE of the query. The key is the name of the CTE,\nwhile the value is the fragment (string or Sub-select)","summary":"

List the current CTE of the query.

","abstract":false,"location":{"filename":"src/clear/sql/query/cte.cr","line_number":8,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/cte.cr#L8"},"def":{"name":"cte","return_type":"Hash(String, CTEAuthorized)","visibility":"Public","body":"@cte"}},{"html_id":"with_cte(name,request:CTEAuthorized)-instance-method","name":"with_cte","doc":"Add a CTE to the query.\n\n```\nClear::SQL.select.with_cte(\"full_year\",\n \"SELECT DATE(date)\"\n \"FROM generate_series(NOW() - INTERVAL '1 year', NOW(), '1 day'::interval) date\")\n .select(\"*\").from(\"full_year\")\n# WITH full_year AS ( SELECT DATE(date) ... ) SELECT * FROM full_year;\n```","summary":"

Add a CTE to the query.

","abstract":false,"args":[{"name":"name","external_name":"name","restriction":""},{"name":"request","external_name":"request","restriction":"CTEAuthorized"}],"args_string":"(name, request : CTEAuthorized)","args_html":"(name, request : CTEAuthorized)","location":{"filename":"src/clear/sql/query/cte.cr","line_number":19,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/cte.cr#L19"},"def":{"name":"with_cte","args":[{"name":"name","external_name":"name","restriction":""},{"name":"request","external_name":"request","restriction":"CTEAuthorized"}],"visibility":"Public","body":"cte[name] = request\nchange!\n"}},{"html_id":"with_cte(tuple:NamedTuple)-instance-method","name":"with_cte","doc":"Add a CTE to the query. Use NamedTuple convention:\n\n```\nClear::SQL.select.with_cte(cte: \"xxx\")\n# WITH cte AS xxx SELECT...\n```","summary":"

Add a CTE to the query.

","abstract":false,"args":[{"name":"tuple","external_name":"tuple","restriction":"NamedTuple"}],"args_string":"(tuple : NamedTuple)","args_html":"(tuple : NamedTuple)","location":{"filename":"src/clear/sql/query/cte.cr","line_number":30,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/cte.cr#L30"},"def":{"name":"with_cte","args":[{"name":"tuple","external_name":"tuple","restriction":"NamedTuple"}],"visibility":"Public","body":"tuple.each do |k, v|\n cte[k.to_s] = v\nend\nchange!\n"}}]},{"html_id":"clear/Clear/SQL/Query/Execute","path":"Clear/SQL/Query/Execute.html","kind":"module","full_name":"Clear::SQL::Query::Execute","name":"Execute","abstract":false,"locations":[{"filename":"src/clear/sql/query/execute.cr","line_number":3,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/execute.cr#L3"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"clear/Clear/SQL/DeleteQuery","kind":"class","full_name":"Clear::SQL::DeleteQuery","name":"DeleteQuery"},{"html_id":"clear/Clear/SQL/SelectBuilder","kind":"module","full_name":"Clear::SQL::SelectBuilder","name":"SelectBuilder"},{"html_id":"clear/Clear/SQL/UpdateQuery","kind":"class","full_name":"Clear::SQL::UpdateQuery","name":"UpdateQuery"}],"namespace":{"html_id":"clear/Clear/SQL/Query","kind":"module","full_name":"Clear::SQL::Query","name":"Query"},"instance_methods":[{"html_id":"execute(connection_name:String|Nil=nil)-instance-method","name":"execute","doc":"\nExecute an SQL statement which does not return anything.\n\nIf an optional `connection_name` parameter is given, this will\n override the connection used by the query.\n\n```\n%(default secondary).each do |cnx|\n Clear::SQL.select(\"pg_shards('xxx')\").execute(cnx)\nend\n```","summary":"

Execute an SQL statement which does not return anything.

","abstract":false,"args":[{"name":"connection_name","default_value":"nil","external_name":"connection_name","restriction":"String | ::Nil"}],"args_string":"(connection_name : String | Nil = nil)","args_html":"(connection_name : String | Nil = nil)","location":{"filename":"src/clear/sql/query/execute.cr","line_number":15,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/execute.cr#L15"},"def":{"name":"execute","args":[{"name":"connection_name","default_value":"nil","external_name":"connection_name","restriction":"String | ::Nil"}],"visibility":"Public","body":"Clear::SQL.execute(connection_name || self.connection_name, to_sql)"}}]},{"html_id":"clear/Clear/SQL/Query/Fetch","path":"Clear/SQL/Query/Fetch.html","kind":"module","full_name":"Clear::SQL::Query::Fetch","name":"Fetch","abstract":false,"locations":[{"filename":"src/clear/sql/query/fetch.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/fetch.cr#L1"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"clear/Clear/SQL/SelectBuilder","kind":"module","full_name":"Clear::SQL::SelectBuilder","name":"SelectBuilder"}],"namespace":{"html_id":"clear/Clear/SQL/Query","kind":"module","full_name":"Clear::SQL::Query","name":"Query"},"instance_methods":[{"html_id":"fetch(fetch_all=false,&:Hash(String,Clear::SQL::Any)->Nil)-instance-method","name":"fetch","doc":"Fetch the result set row per row\n`fetch_all` optional parameter is helpful in transactional environment, so it stores\nthe result and close the resultset before starting to call yield over the data\npreventing creation of a new connection if you need to call SQL into the\nyielded block.\n\n```\n# This is wrong: The connection is still busy retrieving the users:\nClear::SQL.select.from(\"users\").fetch do |u|\n Clear::SQL.select.from(\"posts\").where { u[\"id\"] == posts.id }\nend\n\n# Instead, use `fetch_all`\n# Clear will store the value of the result set in memory\n# before calling the block, and the connection is now ready to handle\n# another query.\nClear::SQL.select.from(\"users\").fetch(fetch_all: true) do |u|\n Clear::SQL.select.from(\"posts\").where { u[\"id\"] == posts.id }\nend\n```","summary":"

Fetch the result set row per row fetch_all optional parameter is helpful in transactional environment, so it stores the result and close the resultset before starting to call yield over the data preventing creation of a new connection if you need to call SQL into the yielded block.

","abstract":false,"args":[{"name":"fetch_all","default_value":"false","external_name":"fetch_all","restriction":""}],"args_string":"(fetch_all = false, & : Hash(String, Clear::SQL::Any) -> Nil)","args_html":"(fetch_all = false, & : Hash(String, Clear::SQL::Any) -> Nil)","location":{"filename":"src/clear/sql/query/fetch.cr","line_number":125,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/fetch.cr#L125"},"def":{"name":"fetch","args":[{"name":"fetch_all","default_value":"false","external_name":"fetch_all","restriction":""}],"yields":1,"block_arity":1,"block_arg":{"name":"","external_name":"","restriction":"(Hash(String, ::Clear::SQL::Any) -> Nil)"},"visibility":"Public","body":"trigger_before_query\nh = {} of String => ::Clear::SQL::Any\nsql = to_sql\nClear::SQL::ConnectionPool.with_connection(connection_name) do |cnx|\n rs = Clear::SQL.log_query(sql) do\n cnx.query(sql)\n end\n if fetch_all\n o = [] of Hash(String, ::Clear::SQL::Any)\n fetch_result_set(h, rs) do |x|\n o << x.dup\n end\n o.each do |x|\n yield(x)\n end\n else\n fetch_result_set(h, rs) do |x|\n yield(x)\n end\n end\nend\n"}},{"html_id":"fetch_first-instance-method","name":"fetch_first","doc":"Alias for `first` because first is redefined in Collection::Base\nobject to return a model instead.","summary":"

Alias for #first because first is redefined in Collection::Base object to return a model instead.

","abstract":false,"location":{"filename":"src/clear/sql/query/fetch.cr","line_number":75,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/fetch.cr#L75"},"def":{"name":"fetch_first","visibility":"Public","body":"(limit(1)).fetch(fetch_all: true) do |x|\n return x\nend\nnil\n"}},{"html_id":"fetch_first!-instance-method","name":"fetch_first!","abstract":false,"location":{"filename":"src/clear/sql/query/fetch.cr","line_number":81,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/fetch.cr#L81"},"def":{"name":"fetch_first!","visibility":"Public","body":"if o = fetch_first\n o\nelse\n raise(Clear::SQL::RecordNotFoundError.new)\nend"}},{"html_id":"fetch_with_cursor(count=1000,&:Hash(String,Clear::SQL::Any)->Nil)-instance-method","name":"fetch_with_cursor","doc":"Fetch the data using CURSOR.\nThis will prevent Clear to load all the data from the database into memory.\nThis is useful if you need to retrieve and update a large dataset.","summary":"

Fetch the data using CURSOR.

","abstract":false,"args":[{"name":"count","default_value":"1000","external_name":"count","restriction":""}],"args_string":"(count = 1000, & : Hash(String, Clear::SQL::Any) -> Nil)","args_html":"(count = 1000, & : Hash(String, Clear::SQL::Any) -> Nil)","location":{"filename":"src/clear/sql/query/fetch.cr","line_number":24,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/fetch.cr#L24"},"def":{"name":"fetch_with_cursor","args":[{"name":"count","default_value":"1000","external_name":"count","restriction":""}],"yields":1,"block_arity":1,"block_arg":{"name":"","external_name":"","restriction":"(Hash(String, ::Clear::SQL::Any) -> Nil)"},"visibility":"Public","body":"trigger_before_query\nClear::SQL.transaction do |cnx|\n cursor_name = \"__cursor_#{Time.local.to_unix ^ (rand * 268435455).to_i}__\"\n cursor_declaration = \"DECLARE #{cursor_name} CURSOR FOR #{to_sql}\"\n Clear::SQL.log_query(cursor_declaration) do\n cnx.exec(cursor_declaration)\n end\n h = {} of String => ::Clear::SQL::Any\n we_loop = true\n while we_loop\n fetch_query = \"FETCH #{count} FROM #{cursor_name}\"\n rs = Clear::SQL.log_query(fetch_query) do\n cnx.query(fetch_query)\n end\n o = Array(Hash(String, ::Clear::SQL::Any)).new(initial_capacity: count)\n we_loop = fetch_result_set(h, rs) do |x|\n o << x.dup\n end\n o.each do |hash|\n yield(hash)\n end\n end\nend\n"}},{"html_id":"first-instance-method","name":"first","doc":"Return the first line of the query as Hash(String, ::Clear::SQL::Any), or nil\nif not found","summary":"

Return the first line of the query as Hash(String, ::Clear::SQL::Any), or nil if not found

","abstract":false,"location":{"filename":"src/clear/sql/query/fetch.cr","line_number":65,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/fetch.cr#L65"},"def":{"name":"first","visibility":"Public","body":"fetch_first"}},{"html_id":"first!-instance-method","name":"first!","abstract":false,"location":{"filename":"src/clear/sql/query/fetch.cr","line_number":69,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/fetch.cr#L69"},"def":{"name":"first!","visibility":"Public","body":"fetch_first!"}},{"html_id":"scalar(type:T.class)forallT-instance-method","name":"scalar","doc":"Helpers to fetch a SELECT with only one row and one column return.","summary":"

Helpers to fetch a SELECT with only one row and one column return.

","abstract":false,"args":[{"name":"type","external_name":"type","restriction":"T.class"}],"args_string":"(type : T.class) forall T","args_html":"(type : T.class) forall T","location":{"filename":"src/clear/sql/query/fetch.cr","line_number":53,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/fetch.cr#L53"},"def":{"name":"scalar","args":[{"name":"type","external_name":"type","restriction":"T.class"}],"visibility":"Public","body":"trigger_before_query\nsql = to_sql\nClear::SQL.log_query(sql) do\n (Clear::SQL::ConnectionPool.with_connection(connection_name, &.scalar(sql))).as(T)\nend\n"}},{"html_id":"to_a:Array(Hash(String,Clear::SQL::Any))-instance-method","name":"to_a","doc":"Return an array with all the rows fetched.","summary":"

Return an array with all the rows fetched.

","abstract":false,"location":{"filename":"src/clear/sql/query/fetch.cr","line_number":90,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/fetch.cr#L90"},"def":{"name":"to_a","return_type":"Array(Hash(String, ::Clear::SQL::Any))","visibility":"Public","body":"trigger_before_query\nh = {} of String => ::Clear::SQL::Any\nsql = to_sql\nrs = Clear::SQL.log_query(sql) do\n Clear::SQL::ConnectionPool.with_connection(connection_name, &.query(sql))\nend\no = [] of Hash(String, ::Clear::SQL::Any)\nfetch_result_set(h, rs) do |x|\n o << x.dup\nend\no\n"}}]},{"html_id":"clear/Clear/SQL/Query/From","path":"Clear/SQL/Query/From.html","kind":"module","full_name":"Clear::SQL::Query::From","name":"From","abstract":false,"locations":[{"filename":"src/clear/sql/query/from.cr","line_number":2,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/from.cr#L2"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"clear/Clear/SQL/SelectBuilder","kind":"module","full_name":"Clear::SQL::SelectBuilder","name":"SelectBuilder"}],"namespace":{"html_id":"clear/Clear/SQL/Query","kind":"module","full_name":"Clear::SQL::Query","name":"Query"},"instance_methods":[{"html_id":"clear_from-instance-method","name":"clear_from","doc":"Clear the FROM clause and return `self`","summary":"

Clear the FROM clause and return self

","abstract":false,"location":{"filename":"src/clear/sql/query/from.cr","line_number":29,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/from.cr#L29"},"def":{"name":"clear_from","visibility":"Public","body":"@froms.clear\nchange!\n"}},{"html_id":"from(*args)-instance-method","name":"from","doc":"FROM fragment of the SQL query\n\n```\nClear::SQL.select.from(\"airplanes\").to_sql # < SELECT * FROM airplanes\n```","summary":"

FROM fragment of the SQL query

","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args)","args_html":"(*args)","location":{"filename":"src/clear/sql/query/from.cr","line_number":10,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/from.cr#L10"},"def":{"name":"from","args":[{"name":"args","external_name":"args","restriction":""}],"splat_index":0,"visibility":"Public","body":"args.each do |arg|\n case arg\n when NamedTuple\n arg.each do |k, v|\n @froms << (Clear::SQL::From.new(v, k.to_s))\n end\n else\n @froms << (Clear::SQL::From.new(arg))\n end\nend\nchange!\n"}},{"html_id":"from(**tuple)-instance-method","name":"from","abstract":false,"location":{"filename":"src/clear/sql/query/from.cr","line_number":23,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/from.cr#L23"},"def":{"name":"from","double_splat":{"name":"tuple","external_name":"tuple","restriction":""},"visibility":"Public","body":"tuple.each do |k, v|\n @froms << (Clear::SQL::From.new(v, k.to_s))\nend\nchange!\n"}},{"html_id":"froms:Array(SQL::From)-instance-method","name":"froms","abstract":false,"location":{"filename":"src/clear/sql/query/from.cr","line_number":3,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/from.cr#L3"},"def":{"name":"froms","return_type":"Array(SQL::From)","visibility":"Public","body":"@froms"}}]},{"html_id":"clear/Clear/SQL/Query/GroupBy","path":"Clear/SQL/Query/GroupBy.html","kind":"module","full_name":"Clear::SQL::Query::GroupBy","name":"GroupBy","abstract":false,"locations":[{"filename":"src/clear/sql/query/group_by.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/group_by.cr#L1"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"clear/Clear/SQL/SelectBuilder","kind":"module","full_name":"Clear::SQL::SelectBuilder","name":"SelectBuilder"}],"namespace":{"html_id":"clear/Clear/SQL/Query","kind":"module","full_name":"Clear::SQL::Query","name":"Query"},"instance_methods":[{"html_id":"clear_group_bys-instance-method","name":"clear_group_bys","abstract":false,"location":{"filename":"src/clear/sql/query/group_by.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/group_by.cr#L4"},"def":{"name":"clear_group_bys","visibility":"Public","body":"@group_bys.clear\nchange!\n"}},{"html_id":"group_by(column:Symbolic)-instance-method","name":"group_by","abstract":false,"args":[{"name":"column","external_name":"column","restriction":"Symbolic"}],"args_string":"(column : Symbolic)","args_html":"(column : Symbolic)","location":{"filename":"src/clear/sql/query/group_by.cr","line_number":9,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/group_by.cr#L9"},"def":{"name":"group_by","args":[{"name":"column","external_name":"column","restriction":"Symbolic"}],"visibility":"Public","body":"@group_bys << column\nchange!\n"}},{"html_id":"group_bys:Array(Symbolic)-instance-method","name":"group_bys","abstract":false,"location":{"filename":"src/clear/sql/query/group_by.cr","line_number":2,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/group_by.cr#L2"},"def":{"name":"group_bys","return_type":"Array(Symbolic)","visibility":"Public","body":"@group_bys"}}]},{"html_id":"clear/Clear/SQL/Query/Having","path":"Clear/SQL/Query/Having.html","kind":"module","full_name":"Clear::SQL::Query::Having","name":"Having","abstract":false,"locations":[{"filename":"src/clear/sql/query/having.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/having.cr#L1"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"clear/Clear/SQL/SelectBuilder","kind":"module","full_name":"Clear::SQL::SelectBuilder","name":"SelectBuilder"}],"namespace":{"html_id":"clear/Clear/SQL/Query","kind":"module","full_name":"Clear::SQL::Query","name":"Query"},"instance_methods":[{"html_id":"clear_havings-instance-method","name":"clear_havings","doc":"Clear all the having clauses and return `self`","summary":"

Clear all the having clauses and return self

","abstract":false,"location":{"filename":"src/clear/sql/query/having.cr","line_number":172,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/having.cr#L172"},"def":{"name":"clear_havings","visibility":"Public","body":"@havings.clear\nchange!\n"}},{"html_id":"having(node:Clear::Expression::Node)-instance-method","name":"having","doc":"Build SQL `having` condition using a Clear::Expression::Node\n\n```\nquery.having(Clear::Expression::Node::InArray.new(\"id\", ['1', '2', '3', '4']))\n# Note: in this example, InArray node use unsafe strings\n```\n\nIf useful for moving a having clause from a request to another one:\n\n```\nquery1.having { a == b } # having a = b\n```\n\n```\nquery2.having(query1.havings[0]) # HAVING a = b\n```","summary":"

Build SQL #having condition using a Clear::Expression::Node

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Clear::Expression::Node"}],"args_string":"(node : Clear::Expression::Node)","args_html":"(node : Clear::Expression::Node)","location":{"filename":"src/clear/sql/query/having.cr","line_number":22,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/having.cr#L22"},"def":{"name":"having","args":[{"name":"node","external_name":"node","restriction":"Clear::Expression::Node"}],"visibility":"Public","body":"@havings << node\nchange!\n"}},{"html_id":"having(&)-instance-method","name":"having","doc":"Build SQL `having` condition using the Expression engine.\n\n```\nquery.having { id == 1 }\n```","summary":"

Build SQL #having condition using the Expression engine.

","abstract":false,"location":{"filename":"src/clear/sql/query/having.cr","line_number":32,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/having.cr#L32"},"def":{"name":"having","yields":0,"block_arity":0,"visibility":"Public","body":"having(Clear::Expression.ensure_node!(with Clear::Expression.new yield))"}},{"html_id":"having(conditions:NamedTuple|Hash(String,Clear::SQL::Any))-instance-method","name":"having","doc":"Build SQL `having` condition using a NamedTuple.\nthis will use:\n\n- the `=` operator if compared with a literal\n\n```\nquery.having({keyword: \"hello\"}) # having keyword = 'hello'\n```\n\n- the `IN` operator if compared with an array:\n\n```\nquery.having({x: [1, 2]}) # having x in (1, 2)\n```\n\n- the `>=` and `<=` | `<` if compared with a range:\n\n```\nquery.having({x: (1..4)}) # having x >= 1 AND x <= 4\nquery.having({x: (1...4)}) # having x >= 1 AND x < 4\n```\n\n- You also can put another select query as argument:\n\n```\nquery.having({x: another_select}) # having x IN (SELECT ... )\n```","summary":"

Build SQL #having condition using a NamedTuple.

","abstract":false,"args":[{"name":"conditions","external_name":"conditions","restriction":"NamedTuple | Hash(String, Clear::SQL::Any)"}],"args_string":"(conditions : NamedTuple | Hash(String, Clear::SQL::Any))","args_html":"(conditions : NamedTuple | Hash(String, Clear::SQL::Any))","location":{"filename":"src/clear/sql/query/having.cr","line_number":67,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/having.cr#L67"},"def":{"name":"having","args":[{"name":"conditions","external_name":"conditions","restriction":"NamedTuple | Hash(String, Clear::SQL::Any)"}],"visibility":"Public","body":"conditions.each do |k, v|\n k = Clear::Expression::Node::Variable.new(k.to_s)\n @havings << (case v\n when Array\n Clear::Expression::Node::InArray.new(k, v.map do |it|\n Clear::Expression[it]\n end)\n when SelectBuilder\n Clear::Expression::Node::InSelect.new(k, v)\n when Range\n Clear::Expression::Node::InRange.new(k, Clear::Expression[v.begin]..Clear::Expression[v.end], v.exclusive?)\n else\n Clear::Expression::Node::DoubleOperator.new(k, Clear::Expression::Node::Literal.new(v), (v.nil? ? \"IS\" : \"=\"))\n end)\nend\nchange!\n"}},{"html_id":"having(template:String,*args)-instance-method","name":"having","doc":"Build SQL `having` condition using a template string and\ninterpolating `?` characters with parameters given in a tuple or array.\n\n```\nhaving(\"x = ? OR y = ?\", 1, \"l'eau\") # having x = 1 OR y = 'l''eau'\n```\n\nRaise error if there's not enough parameters to cover all the `?` placeholders","summary":"

Build SQL #having condition using a template string and interpolating ? characters with parameters given in a tuple or array.

","abstract":false,"args":[{"name":"template","external_name":"template","restriction":"String"},{"name":"args","external_name":"args","restriction":""}],"args_string":"(template : String, *args)","args_html":"(template : String, *args)","location":{"filename":"src/clear/sql/query/having.cr","line_number":110,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/having.cr#L110"},"def":{"name":"having","args":[{"name":"template","external_name":"template","restriction":"String"},{"name":"args","external_name":"args","restriction":""}],"splat_index":1,"visibility":"Public","body":"having(Clear::Expression::Node::Raw.new(Clear::SQL.raw(template, *args)))"}},{"html_id":"having(template:String,**tuple)-instance-method","name":"having","doc":"Build SQL `having` interpolating `:keyword` with the NamedTuple passed in argument.\n\n```\nhaving(\"id = :id OR date >= :start\", id: 1, start: 1.day.ago)\n# having id = 1 AND date >= '201x-xx-xx ...'\n```","summary":"

Build SQL #having interpolating :keyword with the NamedTuple passed in argument.

","abstract":false,"args":[{"name":"template","external_name":"template","restriction":"String"}],"args_string":"(template : String, **tuple)","args_html":"(template : String, **tuple)","location":{"filename":"src/clear/sql/query/having.cr","line_number":98,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/having.cr#L98"},"def":{"name":"having","args":[{"name":"template","external_name":"template","restriction":"String"}],"double_splat":{"name":"tuple","external_name":"tuple","restriction":""},"visibility":"Public","body":"having(Clear::Expression::Node::Raw.new(Clear::SQL.raw(template, **tuple)))"}},{"html_id":"having(**tuple)-instance-method","name":"having","abstract":false,"location":{"filename":"src/clear/sql/query/having.cr","line_number":36,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/having.cr#L36"},"def":{"name":"having","double_splat":{"name":"tuple","external_name":"tuple","restriction":""},"visibility":"Public","body":"having(conditions: tuple)"}},{"html_id":"or_having(node:Clear::Expression::Node)-instance-method","name":"or_having","doc":"Build SQL `or_having` condition using a Clear::Expression::Node\n\n```\nquery.or_having(Clear::Expression::Node::InArray.new(\"id\", ['1', '2', '3', '4']))\n# Note: in this example, InArray node use unsafe strings\n```\n\nIf useful for moving a having clause from a request to another one:\n\n```\nquery1.or_having { a == b } # having a = b\n```\n\n```\nquery2.or_having(query1.havings[0]) # having a = b\n```","summary":"

Build SQL #or_having condition using a Clear::Expression::Node

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Clear::Expression::Node"}],"args_string":"(node : Clear::Expression::Node)","args_html":"(node : Clear::Expression::Node)","location":{"filename":"src/clear/sql/query/having.cr","line_number":130,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/having.cr#L130"},"def":{"name":"or_having","args":[{"name":"node","external_name":"node","restriction":"Clear::Expression::Node"}],"visibility":"Public","body":"if @havings.empty?\n return having(node)\nend\nif (((@havings.size == 1) && (n = @havings.first)) && n.is_a?(Clear::Expression::Node::NodeArray)) && (n.link == \"OR\")\n n.expression << node\nelse\n if @havings.size == 1\n old_clause = @havings.first\n else\n old_clause = Clear::Expression::Node::NodeArray.new(@havings, \"AND\")\n end\n @havings.clear\n @havings << (Clear::Expression::Node::NodeArray.new([old_clause, node], \"OR\"))\nend\nchange!\n"}},{"html_id":"or_having(template:String,*args)-instance-method","name":"or_having","abstract":false,"args":[{"name":"template","external_name":"template","restriction":"String"},{"name":"args","external_name":"args","restriction":""}],"args_string":"(template : String, *args)","args_html":"(template : String, *args)","location":{"filename":"src/clear/sql/query/having.cr","line_number":158,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/having.cr#L158"},"def":{"name":"or_having","args":[{"name":"template","external_name":"template","restriction":"String"},{"name":"args","external_name":"args","restriction":""}],"splat_index":1,"visibility":"Public","body":"or_having(Clear::Expression::Node::Raw.new(Clear::Expression.raw(\"(#{template})\", *args)))"}},{"html_id":"or_having(template:String,**named_tuple)-instance-method","name":"or_having","abstract":false,"args":[{"name":"template","external_name":"template","restriction":"String"}],"args_string":"(template : String, **named_tuple)","args_html":"(template : String, **named_tuple)","location":{"filename":"src/clear/sql/query/having.cr","line_number":154,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/having.cr#L154"},"def":{"name":"or_having","args":[{"name":"template","external_name":"template","restriction":"String"}],"double_splat":{"name":"named_tuple","external_name":"named_tuple","restriction":""},"visibility":"Public","body":"or_having(Clear::Expression::Node::Raw.new(Clear::Expression.raw(\"(#{template})\", **named_tuple)))"}},{"html_id":"or_having(&)-instance-method","name":"or_having","doc":"Build SQL `having` condition using the Expression engine.\n\n```\nquery.or_having { id == 1 }\n```","summary":"

Build SQL #having condition using the Expression engine.

","abstract":false,"location":{"filename":"src/clear/sql/query/having.cr","line_number":167,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/having.cr#L167"},"def":{"name":"or_having","yields":0,"block_arity":0,"visibility":"Public","body":"or_having(Clear::Expression.ensure_node!(with Clear::Expression.new yield))"}}]},{"html_id":"clear/Clear/SQL/Query/Join","path":"Clear/SQL/Query/Join.html","kind":"module","full_name":"Clear::SQL::Query::Join","name":"Join","abstract":false,"locations":[{"filename":"src/clear/sql/query/join.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/join.cr#L1"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"clear/Clear/SQL/SelectBuilder","kind":"module","full_name":"Clear::SQL::SelectBuilder","name":"SelectBuilder"}],"namespace":{"html_id":"clear/Clear/SQL/Query","kind":"module","full_name":"Clear::SQL::Query","name":"Query"},"instance_methods":[{"html_id":"cross_join(name:Selectable,lateral=false)-instance-method","name":"cross_join","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Selectable"},{"name":"lateral","default_value":"false","external_name":"lateral","restriction":""}],"args_string":"(name : Selectable, lateral = false)","args_html":"(name : Selectable, lateral = false)","location":{"filename":"src/clear/sql/query/join.cr","line_number":26,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/join.cr#L26"},"def":{"name":"cross_join","args":[{"name":"name","external_name":"name","restriction":"Selectable"},{"name":"lateral","default_value":"false","external_name":"lateral","restriction":""}],"visibility":"Public","body":"join(name, :cross, lateral)"}},{"html_id":"full_outer_join(name:Selectable,lateral=false,&)-instance-method","name":"full_outer_join","doc":"Add a \"FULL_OUTER\" JOIN directive to the query","summary":"

Add a "FULL_OUTER" JOIN directive to the query

","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Selectable"},{"name":"lateral","default_value":"false","external_name":"lateral","restriction":""}],"args_string":"(name : Selectable, lateral = false, &)","args_html":"(name : Selectable, lateral = false, &)","location":{"filename":"src/clear/sql/query/join.cr","line_number":30,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/join.cr#L30"},"def":{"name":"full_outer_join","args":[{"name":"name","external_name":"name","restriction":"Selectable"},{"name":"lateral","default_value":"false","external_name":"lateral","restriction":""}],"yields":0,"block_arity":0,"visibility":"Public","body":"join_impl(name, :full_outer, lateral, Clear::Expression.ensure_node!(with Clear::Expression.new yield))"}},{"html_id":"full_outer_join(name:Selectable,condition:String=\"true\",lateral=false)-instance-method","name":"full_outer_join","doc":"Add a \"FULL_OUTER\" JOIN directive to the query","summary":"

Add a "FULL_OUTER" JOIN directive to the query

","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Selectable"},{"name":"condition","default_value":"\"true\"","external_name":"condition","restriction":"String"},{"name":"lateral","default_value":"false","external_name":"lateral","restriction":""}],"args_string":"(name : Selectable, condition : String = \"true\", lateral = false)","args_html":"(name : Selectable, condition : String = "true", lateral = false)","location":{"filename":"src/clear/sql/query/join.cr","line_number":30,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/join.cr#L30"},"def":{"name":"full_outer_join","args":[{"name":"name","external_name":"name","restriction":"Selectable"},{"name":"condition","default_value":"\"true\"","external_name":"condition","restriction":"String"},{"name":"lateral","default_value":"false","external_name":"lateral","restriction":""}],"visibility":"Public","body":"join_impl(name, :full_outer, lateral, Clear::Expression::Node::Raw.new((\"(\" + condition) + \")\"))"}},{"html_id":"inner_join(name:Selectable,lateral=false,&)-instance-method","name":"inner_join","doc":"Add a \"INNER\" JOIN directive to the query","summary":"

Add a "INNER" JOIN directive to the query

","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Selectable"},{"name":"lateral","default_value":"false","external_name":"lateral","restriction":""}],"args_string":"(name : Selectable, lateral = false, &)","args_html":"(name : Selectable, lateral = false, &)","location":{"filename":"src/clear/sql/query/join.cr","line_number":30,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/join.cr#L30"},"def":{"name":"inner_join","args":[{"name":"name","external_name":"name","restriction":"Selectable"},{"name":"lateral","default_value":"false","external_name":"lateral","restriction":""}],"yields":0,"block_arity":0,"visibility":"Public","body":"join_impl(name, :inner, lateral, Clear::Expression.ensure_node!(with Clear::Expression.new yield))"}},{"html_id":"inner_join(name:Selectable,condition:String=\"true\",lateral=false)-instance-method","name":"inner_join","doc":"Add a \"INNER\" JOIN directive to the query","summary":"

Add a "INNER" JOIN directive to the query

","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Selectable"},{"name":"condition","default_value":"\"true\"","external_name":"condition","restriction":"String"},{"name":"lateral","default_value":"false","external_name":"lateral","restriction":""}],"args_string":"(name : Selectable, condition : String = \"true\", lateral = false)","args_html":"(name : Selectable, condition : String = "true", lateral = false)","location":{"filename":"src/clear/sql/query/join.cr","line_number":30,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/join.cr#L30"},"def":{"name":"inner_join","args":[{"name":"name","external_name":"name","restriction":"Selectable"},{"name":"condition","default_value":"\"true\"","external_name":"condition","restriction":"String"},{"name":"lateral","default_value":"false","external_name":"lateral","restriction":""}],"visibility":"Public","body":"join_impl(name, :inner, lateral, Clear::Expression::Node::Raw.new((\"(\" + condition) + \")\"))"}},{"html_id":"join(name:Selectable,type=:inner,lateral=false,&)-instance-method","name":"join","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Selectable"},{"name":"type","default_value":":inner","external_name":"type","restriction":""},{"name":"lateral","default_value":"false","external_name":"lateral","restriction":""}],"args_string":"(name : Selectable, type = :inner, lateral = false, &)","args_html":"(name : Selectable, type = :inner, lateral = false, &)","location":{"filename":"src/clear/sql/query/join.cr","line_number":14,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/join.cr#L14"},"def":{"name":"join","args":[{"name":"name","external_name":"name","restriction":"Selectable"},{"name":"type","default_value":":inner","external_name":"type","restriction":""},{"name":"lateral","default_value":"false","external_name":"lateral","restriction":""}],"yields":0,"block_arity":0,"visibility":"Public","body":"join_impl(name, type, lateral, Clear::Expression.ensure_node!(with Clear::Expression.new yield))"}},{"html_id":"join(name:Selectable,type=:inner,condition:String=\"true\",lateral=false)-instance-method","name":"join","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Selectable"},{"name":"type","default_value":":inner","external_name":"type","restriction":""},{"name":"condition","default_value":"\"true\"","external_name":"condition","restriction":"String"},{"name":"lateral","default_value":"false","external_name":"lateral","restriction":""}],"args_string":"(name : Selectable, type = :inner, condition : String = \"true\", lateral = false)","args_html":"(name : Selectable, type = :inner, condition : String = "true", lateral = false)","location":{"filename":"src/clear/sql/query/join.cr","line_number":18,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/join.cr#L18"},"def":{"name":"join","args":[{"name":"name","external_name":"name","restriction":"Selectable"},{"name":"type","default_value":":inner","external_name":"type","restriction":""},{"name":"condition","default_value":"\"true\"","external_name":"condition","restriction":"String"},{"name":"lateral","default_value":"false","external_name":"lateral","restriction":""}],"visibility":"Public","body":"join_impl(name, type, lateral, Clear::Expression::Node::Raw.new((\"(\" + condition) + \")\"))"}},{"html_id":"join(name:Selectable,type=:inner,lateral=false)-instance-method","name":"join","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Selectable"},{"name":"type","default_value":":inner","external_name":"type","restriction":""},{"name":"lateral","default_value":"false","external_name":"lateral","restriction":""}],"args_string":"(name : Selectable, type = :inner, lateral = false)","args_html":"(name : Selectable, type = :inner, lateral = false)","location":{"filename":"src/clear/sql/query/join.cr","line_number":22,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/join.cr#L22"},"def":{"name":"join","args":[{"name":"name","external_name":"name","restriction":"Selectable"},{"name":"type","default_value":":inner","external_name":"type","restriction":""},{"name":"lateral","default_value":"false","external_name":"lateral","restriction":""}],"visibility":"Public","body":"join_impl(name, type, lateral, nil)"}},{"html_id":"left_join(name:Selectable,lateral=false,&)-instance-method","name":"left_join","doc":"Add a \"LEFT\" JOIN directive to the query","summary":"

Add a "LEFT" JOIN directive to the query

","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Selectable"},{"name":"lateral","default_value":"false","external_name":"lateral","restriction":""}],"args_string":"(name : Selectable, lateral = false, &)","args_html":"(name : Selectable, lateral = false, &)","location":{"filename":"src/clear/sql/query/join.cr","line_number":30,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/join.cr#L30"},"def":{"name":"left_join","args":[{"name":"name","external_name":"name","restriction":"Selectable"},{"name":"lateral","default_value":"false","external_name":"lateral","restriction":""}],"yields":0,"block_arity":0,"visibility":"Public","body":"join_impl(name, :left, lateral, Clear::Expression.ensure_node!(with Clear::Expression.new yield))"}},{"html_id":"left_join(name:Selectable,condition:String=\"true\",lateral=false)-instance-method","name":"left_join","doc":"Add a \"LEFT\" JOIN directive to the query","summary":"

Add a "LEFT" JOIN directive to the query

","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Selectable"},{"name":"condition","default_value":"\"true\"","external_name":"condition","restriction":"String"},{"name":"lateral","default_value":"false","external_name":"lateral","restriction":""}],"args_string":"(name : Selectable, condition : String = \"true\", lateral = false)","args_html":"(name : Selectable, condition : String = "true", lateral = false)","location":{"filename":"src/clear/sql/query/join.cr","line_number":30,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/join.cr#L30"},"def":{"name":"left_join","args":[{"name":"name","external_name":"name","restriction":"Selectable"},{"name":"condition","default_value":"\"true\"","external_name":"condition","restriction":"String"},{"name":"lateral","default_value":"false","external_name":"lateral","restriction":""}],"visibility":"Public","body":"join_impl(name, :left, lateral, Clear::Expression::Node::Raw.new((\"(\" + condition) + \")\"))"}},{"html_id":"right_join(name:Selectable,lateral=false,&)-instance-method","name":"right_join","doc":"Add a \"RIGHT\" JOIN directive to the query","summary":"

Add a "RIGHT" JOIN directive to the query

","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Selectable"},{"name":"lateral","default_value":"false","external_name":"lateral","restriction":""}],"args_string":"(name : Selectable, lateral = false, &)","args_html":"(name : Selectable, lateral = false, &)","location":{"filename":"src/clear/sql/query/join.cr","line_number":30,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/join.cr#L30"},"def":{"name":"right_join","args":[{"name":"name","external_name":"name","restriction":"Selectable"},{"name":"lateral","default_value":"false","external_name":"lateral","restriction":""}],"yields":0,"block_arity":0,"visibility":"Public","body":"join_impl(name, :right, lateral, Clear::Expression.ensure_node!(with Clear::Expression.new yield))"}},{"html_id":"right_join(name:Selectable,condition:String=\"true\",lateral=false)-instance-method","name":"right_join","doc":"Add a \"RIGHT\" JOIN directive to the query","summary":"

Add a "RIGHT" JOIN directive to the query

","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Selectable"},{"name":"condition","default_value":"\"true\"","external_name":"condition","restriction":"String"},{"name":"lateral","default_value":"false","external_name":"lateral","restriction":""}],"args_string":"(name : Selectable, condition : String = \"true\", lateral = false)","args_html":"(name : Selectable, condition : String = "true", lateral = false)","location":{"filename":"src/clear/sql/query/join.cr","line_number":30,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/join.cr#L30"},"def":{"name":"right_join","args":[{"name":"name","external_name":"name","restriction":"Selectable"},{"name":"condition","default_value":"\"true\"","external_name":"condition","restriction":"String"},{"name":"lateral","default_value":"false","external_name":"lateral","restriction":""}],"visibility":"Public","body":"join_impl(name, :right, lateral, Clear::Expression::Node::Raw.new((\"(\" + condition) + \")\"))"}}]},{"html_id":"clear/Clear/SQL/Query/Lock","path":"Clear/SQL/Query/Lock.html","kind":"module","full_name":"Clear::SQL::Query::Lock","name":"Lock","abstract":false,"locations":[{"filename":"src/clear/sql/query/lock.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/lock.cr#L1"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"clear/Clear/SQL/SelectBuilder","kind":"module","full_name":"Clear::SQL::SelectBuilder","name":"SelectBuilder"}],"namespace":{"html_id":"clear/Clear/SQL/Query","kind":"module","full_name":"Clear::SQL::Query","name":"Query"},"instance_methods":[{"html_id":"with_lock(str:String=\"FORUPDATE\")-instance-method","name":"with_lock","abstract":false,"args":[{"name":"str","default_value":"\"FOR UPDATE\"","external_name":"str","restriction":"String"}],"args_string":"(str : String = \"FOR UPDATE\")","args_html":"(str : String = "FOR UPDATE")","location":{"filename":"src/clear/sql/query/lock.cr","line_number":11,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/lock.cr#L11"},"def":{"name":"with_lock","args":[{"name":"str","default_value":"\"FOR UPDATE\"","external_name":"str","restriction":"String"}],"visibility":"Public","body":"@lock = str\nchange!\n"}}]},{"html_id":"clear/Clear/SQL/Query/OffsetLimit","path":"Clear/SQL/Query/OffsetLimit.html","kind":"module","full_name":"Clear::SQL::Query::OffsetLimit","name":"OffsetLimit","abstract":false,"locations":[{"filename":"src/clear/sql/query/offset_limit.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/offset_limit.cr#L1"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"clear/Clear/SQL/SelectBuilder","kind":"module","full_name":"Clear::SQL::SelectBuilder","name":"SelectBuilder"}],"namespace":{"html_id":"clear/Clear/SQL/Query","kind":"module","full_name":"Clear::SQL::Query","name":"Query"},"instance_methods":[{"html_id":"clear_limit-instance-method","name":"clear_limit","abstract":false,"location":{"filename":"src/clear/sql/query/offset_limit.cr","line_number":12,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/offset_limit.cr#L12"},"def":{"name":"clear_limit","visibility":"Public","body":"@limit = nil\nchange!\n"}},{"html_id":"clear_offset-instance-method","name":"clear_offset","abstract":false,"location":{"filename":"src/clear/sql/query/offset_limit.cr","line_number":17,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/offset_limit.cr#L17"},"def":{"name":"clear_offset","visibility":"Public","body":"@offset = nil\nchange!\n"}},{"html_id":"limit(x:Int|Nil)-instance-method","name":"limit","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Int | ::Nil"}],"args_string":"(x : Int | Nil)","args_html":"(x : Int | Nil)","location":{"filename":"src/clear/sql/query/offset_limit.cr","line_number":7,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/offset_limit.cr#L7"},"def":{"name":"limit","args":[{"name":"x","external_name":"x","restriction":"Int | ::Nil"}],"visibility":"Public","body":"@limit = Int64.new(x)\nchange!\n"}},{"html_id":"offset(x:Int|Nil)-instance-method","name":"offset","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Int | ::Nil"}],"args_string":"(x : Int | Nil)","args_html":"(x : Int | Nil)","location":{"filename":"src/clear/sql/query/offset_limit.cr","line_number":22,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/offset_limit.cr#L22"},"def":{"name":"offset","args":[{"name":"x","external_name":"x","restriction":"Int | ::Nil"}],"visibility":"Public","body":"@offset = Int64.new(x)\nchange!\n"}}]},{"html_id":"clear/Clear/SQL/Query/OnConflict","path":"Clear/SQL/Query/OnConflict.html","kind":"module","full_name":"Clear::SQL::Query::OnConflict","name":"OnConflict","abstract":false,"locations":[{"filename":"src/clear/sql/query/on_conflict.cr","line_number":3,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/on_conflict.cr#L3"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"clear/Clear/SQL/InsertQuery","kind":"class","full_name":"Clear::SQL::InsertQuery","name":"InsertQuery"}],"namespace":{"html_id":"clear/Clear/SQL/Query","kind":"module","full_name":"Clear::SQL::Query","name":"Query"},"instance_methods":[{"html_id":"clear_conflict-instance-method","name":"clear_conflict","abstract":false,"location":{"filename":"src/clear/sql/query/on_conflict.cr","line_number":58,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/on_conflict.cr#L58"},"def":{"name":"clear_conflict","visibility":"Public","body":"@on_conflict_condition = false"}},{"html_id":"conflict?-instance-method","name":"conflict?","abstract":false,"location":{"filename":"src/clear/sql/query/on_conflict.cr","line_number":54,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/on_conflict.cr#L54"},"def":{"name":"conflict?","visibility":"Public","body":"!!@on_conflict_condition"}},{"html_id":"do_conflict_action(str)-instance-method","name":"do_conflict_action","abstract":false,"args":[{"name":"str","external_name":"str","restriction":""}],"args_string":"(str)","args_html":"(str)","location":{"filename":"src/clear/sql/query/on_conflict.cr","line_number":23,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/on_conflict.cr#L23"},"def":{"name":"do_conflict_action","args":[{"name":"str","external_name":"str","restriction":""}],"visibility":"Public","body":"@on_conflict_action = \"#{str}\"\nchange!\n"}},{"html_id":"do_nothing-instance-method","name":"do_nothing","abstract":false,"location":{"filename":"src/clear/sql/query/on_conflict.cr","line_number":35,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/on_conflict.cr#L35"},"def":{"name":"do_nothing","visibility":"Public","body":"@on_conflict_action = \"NOTHING\"\nchange!\n"}},{"html_id":"do_update(&)-instance-method","name":"do_update","abstract":false,"location":{"filename":"src/clear/sql/query/on_conflict.cr","line_number":28,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/on_conflict.cr#L28"},"def":{"name":"do_update","yields":1,"block_arity":1,"visibility":"Public","body":"action = Clear::SQL::UpdateQuery.new(nil)\nyield(action)\n@on_conflict_action = action\nchange!\n"}},{"html_id":"on_conflict(constraint:String|Bool|OnConflictWhereClause=true)-instance-method","name":"on_conflict","abstract":false,"args":[{"name":"constraint","default_value":"true","external_name":"constraint","restriction":"String | Bool | OnConflictWhereClause"}],"args_string":"(constraint : String | Bool | OnConflictWhereClause = true)","args_html":"(constraint : String | Bool | OnConflictWhereClause = true)","location":{"filename":"src/clear/sql/query/on_conflict.cr","line_number":40,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/on_conflict.cr#L40"},"def":{"name":"on_conflict","args":[{"name":"constraint","default_value":"true","external_name":"constraint","restriction":"String | Bool | OnConflictWhereClause"}],"visibility":"Public","body":"@on_conflict_condition = constraint\nchange!\n"}},{"html_id":"on_conflict(&)-instance-method","name":"on_conflict","abstract":false,"location":{"filename":"src/clear/sql/query/on_conflict.cr","line_number":45,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/on_conflict.cr#L45"},"def":{"name":"on_conflict","yields":0,"block_arity":0,"visibility":"Public","body":"condition = OnConflictWhereClause.new\ncondition.where(Clear::Expression.ensure_node!(with Clear::Expression.new yield))\n@on_conflict_condition = condition\nchange!\n"}},{"html_id":"on_conflict_action:String|Clear::SQL::UpdateQuery-instance-method","name":"on_conflict_action","abstract":false,"location":{"filename":"src/clear/sql/query/on_conflict.cr","line_number":5,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/on_conflict.cr#L5"},"def":{"name":"on_conflict_action","return_type":"String | Clear::SQL::UpdateQuery","visibility":"Public","body":"@on_conflict_action"}},{"html_id":"on_conflict_condition:String|OnConflictWhereClause|Bool-instance-method","name":"on_conflict_condition","abstract":false,"location":{"filename":"src/clear/sql/query/on_conflict.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/on_conflict.cr#L4"},"def":{"name":"on_conflict_condition","return_type":"String | OnConflictWhereClause | Bool","visibility":"Public","body":"@on_conflict_condition"}}],"types":[{"html_id":"clear/Clear/SQL/Query/OnConflict/OnConflictWhereClause","path":"Clear/SQL/Query/OnConflict/OnConflictWhereClause.html","kind":"class","full_name":"Clear::SQL::Query::OnConflict::OnConflictWhereClause","name":"OnConflictWhereClause","abstract":false,"superclass":{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"clear/Clear/SQL/Query/Where","kind":"module","full_name":"Clear::SQL::Query::Where","name":"Where"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/sql/query/on_conflict.cr","line_number":8,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/on_conflict.cr#L8"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"clear/Clear/SQL/Query/Where","kind":"module","full_name":"Clear::SQL::Query::Where","name":"Where"}],"namespace":{"html_id":"clear/Clear/SQL/Query/OnConflict","kind":"module","full_name":"Clear::SQL::Query::OnConflict","name":"OnConflict"},"doc":"Fragment used when ON CONFLICT WHERE ...","summary":"

Fragment used when ON CONFLICT WHERE ...

","constructors":[{"html_id":"new-class-method","name":"new","abstract":false,"location":{"filename":"src/clear/sql/query/on_conflict.cr","line_number":11,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/on_conflict.cr#L11"},"def":{"name":"new","visibility":"Public","body":"_ = allocate\n_.initialize\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"change!-instance-method","name":"change!","abstract":false,"location":{"filename":"src/clear/sql/query/on_conflict.cr","line_number":19,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/on_conflict.cr#L19"},"def":{"name":"change!","visibility":"Public","body":""}},{"html_id":"to_s-instance-method","name":"to_s","doc":"Returns a nicely readable and concise string representation of this object,\ntypically intended for users.\n\nThis method should usually **not** be overridden. It delegates to\n`#to_s(IO)` which can be overridden for custom implementations.\n\nAlso see `#inspect`.","summary":"

Returns a nicely readable and concise string representation of this object, typically intended for users.

","abstract":false,"location":{"filename":"src/clear/sql/query/on_conflict.cr","line_number":15,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/on_conflict.cr#L15"},"def":{"name":"to_s","visibility":"Public","body":"print_wheres"}},{"html_id":"wheres:Array(Clear::Expression::Node)-instance-method","name":"wheres","doc":"Return the list of where clause; each where clause are transformed into\nClear::Expression::Node","summary":"

Return the list of where clause; each where clause are transformed into Clear::Expression::Node

","abstract":false,"def":{"name":"wheres","return_type":"Array(Clear::Expression::Node)","visibility":"Public","body":"@wheres"}}]}]},{"html_id":"clear/Clear/SQL/Query/OrderBy","path":"Clear/SQL/Query/OrderBy.html","kind":"module","full_name":"Clear::SQL::Query::OrderBy","name":"OrderBy","abstract":false,"locations":[{"filename":"src/clear/sql/query/order_by.cr","line_number":11,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/order_by.cr#L11"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"clear/Clear/SQL/SelectBuilder","kind":"module","full_name":"Clear::SQL::SelectBuilder","name":"SelectBuilder"}],"namespace":{"html_id":"clear/Clear/SQL/Query","kind":"module","full_name":"Clear::SQL::Query","name":"Query"},"doc":"Encode for:\n\n`ORDER BY expression [ASC | DESC | USING operator] [NULLS FIRST | NULLS LAST];`\n\nCurrent implementation:\n\n[x] Multiple Order by clauses\n[x] ASC/DESC\n[x] NULLS FIRST / NULLS LAST\n[ ] NOT IMPLEMENTED: USING OPERATOR","summary":"

Encode for:

","instance_methods":[{"html_id":"clear_order_bys-instance-method","name":"clear_order_bys","doc":"Remove all order by clauses","summary":"

Remove all order by clauses

","abstract":false,"location":{"filename":"src/clear/sql/query/order_by.cr","line_number":19,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/order_by.cr#L19"},"def":{"name":"clear_order_bys","visibility":"Public","body":"@order_bys.clear\nchange!\n"}},{"html_id":"order_by(tuple:NamedTuple)-instance-method","name":"order_by","doc":"Add multiple ORDER BY clause using a tuple:\n\n```\nquery = Clear::SQL.select.from(\"users\").order_by(id: :desc, name: {:asc, :nulls_last})\nquery.to_sql # > SELECT * FROM users ORDER BY \"id\" DESC, \"name\" ASC NULLS LAST\n```\n","summary":"

Add multiple ORDER BY clause using a tuple:

","abstract":false,"args":[{"name":"tuple","external_name":"tuple","restriction":"NamedTuple"}],"args_string":"(tuple : NamedTuple)","args_html":"(tuple : NamedTuple)","location":{"filename":"src/clear/sql/query/order_by.cr","line_number":81,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/order_by.cr#L81"},"def":{"name":"order_by","args":[{"name":"tuple","external_name":"tuple","restriction":"NamedTuple"}],"visibility":"Public","body":"tuple.each do |k, v|\n case v\n when Symbol, String\n order_by(k, v, nil)\n when Tuple\n order_by(k, v[0], v[1])\n else\n raise(\"order_by with namedtuple must be called with value of the tuple as Symbol, String or Tuple describing direction and nulls directive\")\n end\nend\nself\n"}},{"html_id":"order_by(expression:Symbol,direction:Symbol=:asc,nulls:Symbol|Nil=nil)-instance-method","name":"order_by","doc":"Add one ORDER BY clause\n\n```\nquery = Clear::SQL.select.from(\"users\").order_by(:id, :desc, nulls_last)\nquery.to_sql # > SELECT * FROM users ORDER BY \"id\" DESC NULLS LAST\n```","summary":"

Add one ORDER BY clause

","abstract":false,"args":[{"name":"expression","external_name":"expression","restriction":"Symbol"},{"name":"direction","default_value":":asc","external_name":"direction","restriction":"Symbol"},{"name":"nulls","default_value":"nil","external_name":"nulls","restriction":"Symbol | ::Nil"}],"args_string":"(expression : Symbol, direction : Symbol = :asc, nulls : Symbol | Nil = nil)","args_html":"(expression : Symbol, direction : Symbol = :asc, nulls : Symbol | Nil = nil)","location":{"filename":"src/clear/sql/query/order_by.cr","line_number":102,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/order_by.cr#L102"},"def":{"name":"order_by","args":[{"name":"expression","external_name":"expression","restriction":"Symbol"},{"name":"direction","default_value":":asc","external_name":"direction","restriction":"Symbol"},{"name":"nulls","default_value":"nil","external_name":"nulls","restriction":"Symbol | ::Nil"}],"visibility":"Public","body":"@order_bys << (Record.new(SQL.escape(expression.to_s), sanitize_direction(direction), sanitize_nulls(nulls)))\nchange!\n"}},{"html_id":"order_by(expression:String,direction:Symbol=:asc,nulls:Symbol|Nil=nil)-instance-method","name":"order_by","doc":"Add one ORDER BY clause\n\n```\nquery = Clear::SQL.select.from(\"users\").order_by(:id, :desc, nulls_last)\nquery.to_sql # > SELECT * FROM users ORDER BY \"id\" DESC NULLS LAST\n```","summary":"

Add one ORDER BY clause

","abstract":false,"args":[{"name":"expression","external_name":"expression","restriction":"String"},{"name":"direction","default_value":":asc","external_name":"direction","restriction":"Symbol"},{"name":"nulls","default_value":"nil","external_name":"nulls","restriction":"Symbol | ::Nil"}],"args_string":"(expression : String, direction : Symbol = :asc, nulls : Symbol | Nil = nil)","args_html":"(expression : String, direction : Symbol = :asc, nulls : Symbol | Nil = nil)","location":{"filename":"src/clear/sql/query/order_by.cr","line_number":108,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/order_by.cr#L108"},"def":{"name":"order_by","args":[{"name":"expression","external_name":"expression","restriction":"String"},{"name":"direction","default_value":":asc","external_name":"direction","restriction":"Symbol"},{"name":"nulls","default_value":"nil","external_name":"nulls","restriction":"Symbol | ::Nil"}],"visibility":"Public","body":"@order_bys << (Record.new(expression, sanitize_direction(direction), sanitize_nulls(nulls)))\nchange!\n"}},{"html_id":"order_by(**tuple)-instance-method","name":"order_by","doc":"Add multiple ORDER BY clause using a tuple:\n\n```\nquery = Clear::SQL.select.from(\"users\").order_by(id: :desc, name: {:asc, :nulls_last})\nquery.to_sql # > SELECT * FROM users ORDER BY \"id\" DESC, \"name\" ASC NULLS LAST\n```\n","summary":"

Add multiple ORDER BY clause using a tuple:

","abstract":false,"location":{"filename":"src/clear/sql/query/order_by.cr","line_number":76,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/order_by.cr#L76"},"def":{"name":"order_by","double_splat":{"name":"tuple","external_name":"tuple","restriction":""},"visibility":"Public","body":"order_by(tuple)"}},{"html_id":"reverse_order_by-instance-method","name":"reverse_order_by","doc":"Flip over all order bys by switching the ASC direction to DESC and the NULLS FIRST to NULLS LAST\n\n```\nquery = Clear::SQL.select.from(\"users\").order_by(id: :desc, name: :asc, company: {:asc, :nulls_last})\nquery.reverse_order_by\nquery.to_sql # SELECT * FROM users ORDER BY \"id\" ASC, \"name\" DESC, \"company\" DESC NULLS FIRST\n```\n\nreturn `self`","summary":"

Flip over all order bys by switching the ASC direction to DESC and the NULLS FIRST to NULLS LAST

","abstract":false,"location":{"filename":"src/clear/sql/query/order_by.cr","line_number":53,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/order_by.cr#L53"},"def":{"name":"reverse_order_by","visibility":"Public","body":"@order_bys = @order_bys.map do |rec|\n Record.new(rec.op, rec.dir == (:desc) ? :asc : :desc, rec.nulls.try do |n|\n n == (:nulls_last) ? :nulls_first : :nulls_last\n end)\nend\nchange!\n"}}],"types":[{"html_id":"clear/Clear/SQL/Query/OrderBy/Record","path":"Clear/SQL/Query/OrderBy/Record.html","kind":"struct","full_name":"Clear::SQL::Query::OrderBy::Record","name":"Record","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/sql/query/order_by.cr","line_number":12,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/order_by.cr#L12"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/SQL/Query/OrderBy","kind":"module","full_name":"Clear::SQL::Query::OrderBy","name":"OrderBy"},"constructors":[{"html_id":"new(op:String,dir:Symbol,nulls:Symbol|Nil)-class-method","name":"new","abstract":false,"args":[{"name":"op","external_name":"op","restriction":"String"},{"name":"dir","external_name":"dir","restriction":"Symbol"},{"name":"nulls","external_name":"nulls","restriction":"Symbol | ::Nil"}],"args_string":"(op : String, dir : Symbol, nulls : Symbol | Nil)","args_html":"(op : String, dir : Symbol, nulls : Symbol | Nil)","location":{"filename":"src/clear/sql/query/order_by.cr","line_number":12,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/order_by.cr#L12"},"def":{"name":"new","args":[{"name":"op","external_name":"op","restriction":"String"},{"name":"dir","external_name":"dir","restriction":"Symbol"},{"name":"nulls","external_name":"nulls","restriction":"Symbol | ::Nil"}],"visibility":"Public","body":"_ = allocate\n_.initialize(op, dir, nulls)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"clone-instance-method","name":"clone","abstract":false,"location":{"filename":"src/clear/sql/query/order_by.cr","line_number":12,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/order_by.cr#L12"},"def":{"name":"clone","visibility":"Public","body":"self.class.new(@op.clone, @dir.clone, @nulls.clone)"}},{"html_id":"copy_with(op_op=@op,dir_dir=@dir,nulls_nulls=@nulls)-instance-method","name":"copy_with","abstract":false,"args":[{"name":"_op","default_value":"@op","external_name":"op","restriction":""},{"name":"_dir","default_value":"@dir","external_name":"dir","restriction":""},{"name":"_nulls","default_value":"@nulls","external_name":"nulls","restriction":""}],"args_string":"(op _op = @op, dir _dir = @dir, nulls _nulls = @nulls)","args_html":"(op _op = @op, dir _dir = @dir, nulls _nulls = @nulls)","location":{"filename":"src/clear/sql/query/order_by.cr","line_number":12,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/order_by.cr#L12"},"def":{"name":"copy_with","args":[{"name":"_op","default_value":"@op","external_name":"op","restriction":""},{"name":"_dir","default_value":"@dir","external_name":"dir","restriction":""},{"name":"_nulls","default_value":"@nulls","external_name":"nulls","restriction":""}],"visibility":"Public","body":"self.class.new(_op, _dir, _nulls)"}},{"html_id":"dir:Symbol-instance-method","name":"dir","abstract":false,"def":{"name":"dir","return_type":"Symbol","visibility":"Public","body":"@dir"}},{"html_id":"nulls:Symbol|Nil-instance-method","name":"nulls","abstract":false,"def":{"name":"nulls","return_type":"Symbol | ::Nil","visibility":"Public","body":"@nulls"}},{"html_id":"op:String-instance-method","name":"op","abstract":false,"def":{"name":"op","return_type":"String","visibility":"Public","body":"@op"}}]}]},{"html_id":"clear/Clear/SQL/Query/Pluck","path":"Clear/SQL/Query/Pluck.html","kind":"module","full_name":"Clear::SQL::Query::Pluck","name":"Pluck","abstract":false,"locations":[{"filename":"src/clear/sql/query/pluck.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/pluck.cr#L1"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"clear/Clear/SQL/SelectBuilder","kind":"module","full_name":"Clear::SQL::SelectBuilder","name":"SelectBuilder"}],"namespace":{"html_id":"clear/Clear/SQL/Query","kind":"module","full_name":"Clear::SQL::Query","name":"Query"},"instance_methods":[{"html_id":"pluck(fields:Tuple(*T))forallT-instance-method","name":"pluck","doc":"Select specifics columns and return an array of Tuple(*Clear::SQL::Any) containing the columns in the order of the selected\narguments:\n\n```\nUser.query.pluck(\"first_name\", \"last_name\").each do |(first_name, last_name)|\n # ...\nend\n```","summary":"

Select specifics columns and return an array of Tuple(*Clear::SQL::Any) containing the columns in the order of the selected arguments:

","abstract":false,"args":[{"name":"fields","external_name":"fields","restriction":"Tuple(*T)"}],"args_string":"(fields : Tuple(*T)) forall T","args_html":"(fields : Tuple(*T)) forall T","location":{"filename":"src/clear/sql/query/pluck.cr","line_number":77,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/pluck.cr#L77"},"def":{"name":"pluck","args":[{"name":"fields","external_name":"fields","restriction":"Tuple(*T)"}],"visibility":"Public","body":"select_clause = fields.join(\", \") do |f|\n f.is_a?(Symbol) ? Clear::SQL.escape(f) : f.to_s\nend\nsql = (clear_select.select(select_clause)).to_sql\nClear::SQL::ConnectionPool.with_connection(connection_name) do |cnx|\n begin\n rs = Clear::SQL.log_query(sql) do\n cnx.query(sql)\n end\n {% if true %}\n o = [] of Tuple({% for t in T %}Clear::SQL::Any,{% end %})\n\n while rs.move_next\n o << { {% for t in T %} rs.read.as(Clear::SQL::Any), {% end %} }\n end\n o\n {% end %}\n ensure\n rs.try(&.close)\n end\nend\n"}},{"html_id":"pluck(*fields)-instance-method","name":"pluck","doc":"Select specifics columns and return an array of Tuple(*Clear::SQL::Any) containing the columns in the order of the selected\narguments:\n\n```\nUser.query.pluck(\"first_name\", \"last_name\").each do |(first_name, last_name)|\n # ...\nend\n```","summary":"

Select specifics columns and return an array of Tuple(*Clear::SQL::Any) containing the columns in the order of the selected arguments:

","abstract":false,"args":[{"name":"fields","external_name":"fields","restriction":""}],"args_string":"(*fields)","args_html":"(*fields)","location":{"filename":"src/clear/sql/query/pluck.cr","line_number":72,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/pluck.cr#L72"},"def":{"name":"pluck","args":[{"name":"fields","external_name":"fields","restriction":""}],"splat_index":0,"visibility":"Public","body":"pluck(fields)"}},{"html_id":"pluck(**fields:**T)forallT-instance-method","name":"pluck","doc":"Select specifics columns and returns on array of tuple of type of the named tuple passed as parameter:\n\n```\nUser.query.pluck(id: Int64, \"UPPER(last_name)\": String).each do #...\n```","summary":"

Select specifics columns and returns on array of tuple of type of the named tuple passed as parameter:

","abstract":false,"location":{"filename":"src/clear/sql/query/pluck.cr","line_number":102,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/pluck.cr#L102"},"def":{"name":"pluck","double_splat":{"name":"fields","external_name":"fields","restriction":"**T"},"visibility":"Public","body":"sql = (clear_select.select(fields.keys.join(\", \"))).to_sql\nClear::SQL::ConnectionPool.with_connection(connection_name) do |cnx|\n begin\n rs = Clear::SQL.log_query(sql) do\n cnx.query(sql)\n end\n {% if true %}\n o = [] of Tuple({% for k, v in T %}{{ v.instance }},{% end %})\n\n while rs.move_next\n o << { {% for k, v in T %} rs.read({{ v.instance }}), {% end %}}\n end\n o\n {% end %}\n ensure\n rs.try(&.close)\n end\nend\n"}},{"html_id":"pluck_col(field:Clear::SQL::Symbolic,type:T.class)forallT-instance-method","name":"pluck_col","doc":"Select a specific column of your SQL query, execute the query\nand return an array containing this field.\n\n```\nUser.query.pluck_col(\"id\") # [1,2,3,4...]\n```\n\nNote: It returns an array of `Clear::SQL::Any`. Therefore, you may want to use `pluck_col(str, Type)` to return\n an array of `Type`:\n\n```\nUser.query.pluck_col(\"id\", Int64)\n```\n\nThe field argument is a SQL fragment; it's not escaped (beware SQL injection) and allow call to functions\nand aggregate methods:\n\n```\n# ...\nUser.query.pluck_col(\"CASE WHEN id % 2 = 0 THEN id ELSE NULL END AS id\").each do\n# ...\n```","summary":"

Select a specific column of your SQL query, execute the query and return an array containing this field.

","abstract":false,"args":[{"name":"field","external_name":"field","restriction":"Clear::SQL::Symbolic"},{"name":"type","external_name":"type","restriction":"T.class"}],"args_string":"(field : Clear::SQL::Symbolic, type : T.class) forall T","args_html":"(field : Clear::SQL::Symbolic, type : T.class) forall T","location":{"filename":"src/clear/sql/query/pluck.cr","line_number":44,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/pluck.cr#L44"},"def":{"name":"pluck_col","args":[{"name":"field","external_name":"field","restriction":"Clear::SQL::Symbolic"},{"name":"type","external_name":"type","restriction":"T.class"}],"visibility":"Public","body":"if field.is_a?(Symbol)\n field = Clear::SQL.escape(field)\nend\nsql = (clear_select.select(field)).to_sql\nClear::SQL::ConnectionPool.with_connection(connection_name) do |cnx|\n begin\n rs = Clear::SQL.log_query(sql) do\n cnx.query(sql)\n end\n o = [] of T\n while rs.move_next\n o << (rs.read(T))\n end\n o\n ensure\n rs.try(&.close)\n end\nend\n"}},{"html_id":"pluck_col(field:Clear::SQL::Symbolic)-instance-method","name":"pluck_col","doc":"Select a specific column of your SQL query, execute the query\nand return an array containing this field.\n\n```\nUser.query.pluck_col(\"id\") # [1,2,3,4...]\n```\n\nNote: It returns an array of `Clear::SQL::Any`. Therefore, you may want to use `pluck_col(str, Type)` to return\n an array of `Type`:\n\n```\nUser.query.pluck_col(\"id\", Int64)\n```\n\nThe field argument is a SQL fragment; it's not escaped (beware SQL injection) and allow call to functions\nand aggregate methods:\n\n```\n# ...\nUser.query.pluck_col(\"CASE WHEN id % 2 = 0 THEN id ELSE NULL END AS id\").each do\n# ...\n```","summary":"

Select a specific column of your SQL query, execute the query and return an array containing this field.

","abstract":false,"args":[{"name":"field","external_name":"field","restriction":"Clear::SQL::Symbolic"}],"args_string":"(field : Clear::SQL::Symbolic)","args_html":"(field : Clear::SQL::Symbolic)","location":{"filename":"src/clear/sql/query/pluck.cr","line_number":24,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/pluck.cr#L24"},"def":{"name":"pluck_col","args":[{"name":"field","external_name":"field","restriction":"Clear::SQL::Symbolic"}],"visibility":"Public","body":"if field.is_a?(Symbol)\n field = Clear::SQL.escape(field)\nend\nsql = (clear_select.select(field)).to_sql\nClear::SQL::ConnectionPool.with_connection(connection_name) do |cnx|\n begin\n rs = Clear::SQL.log_query(sql) do\n cnx.query(sql)\n end\n o = [] of Clear::SQL::Any\n while rs.move_next\n o << (rs.read.as(Clear::SQL::Any))\n end\n o\n ensure\n rs.try(&.close)\n end\nend\n"}}]},{"html_id":"clear/Clear/SQL/Query/Select","path":"Clear/SQL/Query/Select.html","kind":"module","full_name":"Clear::SQL::Query::Select","name":"Select","abstract":false,"locations":[{"filename":"src/clear/sql/query/select.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/select.cr#L1"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"clear/Clear/SQL/SelectBuilder","kind":"module","full_name":"Clear::SQL::SelectBuilder","name":"SelectBuilder"}],"namespace":{"html_id":"clear/Clear/SQL/Query","kind":"module","full_name":"Clear::SQL::Query","name":"Query"},"instance_methods":[{"html_id":"clear_distinct-instance-method","name":"clear_distinct","doc":"Remove distinct","summary":"

Remove distinct

","abstract":false,"location":{"filename":"src/clear/sql/query/select.cr","line_number":43,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/select.cr#L43"},"def":{"name":"clear_distinct","visibility":"Public","body":"distinct(nil)"}},{"html_id":"clear_select-instance-method","name":"clear_select","abstract":false,"location":{"filename":"src/clear/sql/query/select.cr","line_number":66,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/select.cr#L66"},"def":{"name":"clear_select","visibility":"Public","body":"@columns.clear\nchange!\n"}},{"html_id":"default_wildcard_table=(table:String|Nil=nil)-instance-method","name":"default_wildcard_table=","doc":"In some case you want you query to return `table.*` instead of `*`\n if no select parameters has been set. This occurs in the case of joins\n between models.","summary":"

In some case you want you query to return table.* instead of * if no select parameters has been set.

","abstract":false,"args":[{"name":"table","default_value":"nil","external_name":"table","restriction":"String | ::Nil"}],"args_string":"(table : String | Nil = nil)","args_html":"(table : String | Nil = nil)","location":{"filename":"src/clear/sql/query/select.cr","line_number":17,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/select.cr#L17"},"def":{"name":"default_wildcard_table=","args":[{"name":"table","default_value":"nil","external_name":"table","restriction":"String | ::Nil"}],"visibility":"Public","body":"@default_wildcard_table = table\nchange!\n"}},{"html_id":"distinct(on:String|Nil=\"\")-instance-method","name":"distinct","doc":"Add DISTINCT to the SELECT part of the query\n\n- If `on` is blank (empty string, default), will call a simple `SELECT DISTINCT ...`\n- If `on` is nil, will remove the distinct (see `clear_distinct`)\n- If `on` is a non empty string, will call `SELECT DISTINCT ON (on) ...`\n","summary":"

Add DISTINCT to the SELECT part of the query

","abstract":false,"args":[{"name":"on","default_value":"\"\"","external_name":"on","restriction":"String | ::Nil"}],"args_string":"(on : String | Nil = \"\")","args_html":"(on : String | Nil = "")","location":{"filename":"src/clear/sql/query/select.cr","line_number":37,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/select.cr#L37"},"def":{"name":"distinct","args":[{"name":"on","default_value":"\"\"","external_name":"on","restriction":"String | ::Nil"}],"visibility":"Public","body":"@distinct_value = on\nchange!\n"}},{"html_id":"distinct_value:String|Nil-instance-method","name":"distinct_value","abstract":false,"location":{"filename":"src/clear/sql/query/select.cr","line_number":12,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/select.cr#L12"},"def":{"name":"distinct_value","return_type":"String | ::Nil","visibility":"Public","body":"@distinct_value"}},{"html_id":"select(c:Column)-instance-method","name":"select","doc":"def select(name : Symbolic, var = nil)\n @columns << Column.new(name, var)\n self\nend","summary":"

def select(name : Symbolic, var = nil) @columns << Column.new(name, var) self end

","abstract":false,"args":[{"name":"c","external_name":"c","restriction":"Column"}],"args_string":"(c : Column)","args_html":"(c : Column)","location":{"filename":"src/clear/sql/query/select.cr","line_number":26,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/select.cr#L26"},"def":{"name":"select","args":[{"name":"c","external_name":"c","restriction":"Column"}],"visibility":"Public","body":"@columns << c\nchange!\n"}},{"html_id":"select(*args)-instance-method","name":"select","doc":"Add field(s) to selection from tuple\n\n```\nselect({user_id: \"uid\", updated_at: \"updated_at\"})\n# => Output \"SELECT user_id as uid, updated_at as updated_at\"\n```","summary":"

Add field(s) to selection from tuple

","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args)","args_html":"(*args)","location":{"filename":"src/clear/sql/query/select.cr","line_number":53,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/select.cr#L53"},"def":{"name":"select","args":[{"name":"args","external_name":"args","restriction":""}],"splat_index":0,"visibility":"Public","body":"args.each do |arg|\n case arg\n when NamedTuple\n arg.each do |k, v|\n @columns << (Column.new(v, k.to_s))\n end\n else\n @columns << (Column.new(arg))\n end\nend\nchange!\n"}}]},{"html_id":"clear/Clear/SQL/Query/Where","path":"Clear/SQL/Query/Where.html","kind":"module","full_name":"Clear::SQL::Query::Where","name":"Where","abstract":false,"locations":[{"filename":"src/clear/sql/query/where.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/where.cr#L6"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"clear/Clear/SQL/DeleteQuery","kind":"class","full_name":"Clear::SQL::DeleteQuery","name":"DeleteQuery"},{"html_id":"clear/Clear/SQL/Query/OnConflict/OnConflictWhereClause","kind":"class","full_name":"Clear::SQL::Query::OnConflict::OnConflictWhereClause","name":"OnConflictWhereClause"},{"html_id":"clear/Clear/SQL/SelectBuilder","kind":"module","full_name":"Clear::SQL::SelectBuilder","name":"SelectBuilder"},{"html_id":"clear/Clear/SQL/UpdateQuery","kind":"class","full_name":"Clear::SQL::UpdateQuery","name":"UpdateQuery"}],"namespace":{"html_id":"clear/Clear/SQL/Query","kind":"module","full_name":"Clear::SQL::Query","name":"Query"},"doc":"Feature WHERE clause building.\neach call to where method stack where clause.\nTheses clauses are then combined together using the `AND` operator.\nTherefore, `query.where(\"a\").where(\"b\")` will return `a AND b`\n","summary":"

Feature WHERE clause building.

","instance_methods":[{"html_id":"clear_wheres-instance-method","name":"clear_wheres","doc":"Clear all the where clauses and return `self`","summary":"

Clear all the where clauses and return self

","abstract":false,"location":{"filename":"src/clear/sql/query/where.cr","line_number":190,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/where.cr#L190"},"def":{"name":"clear_wheres","visibility":"Public","body":"@wheres.clear\nchange!\n"}},{"html_id":"or_where(node:Clear::Expression::Node)-instance-method","name":"or_where","doc":"Build SQL `or_where` condition using a Clear::Expression::Node\n\n```\nquery.or_where(Clear::Expression::Node::InArray.new(\"id\", ['1', '2', '3', '4']))\n# Note: in this example, InArray node use unsafe strings\n```\n\nIf useful for moving a where clause from a request to another one:\n\n```\nquery1.or_where { a == b } # WHERE a = b\n```\n\n```\nquery2.or_where(query1.wheres[0]) # WHERE a = b\n```","summary":"

Build SQL #or_where condition using a Clear::Expression::Node

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Clear::Expression::Node"}],"args_string":"(node : Clear::Expression::Node)","args_html":"(node : Clear::Expression::Node)","location":{"filename":"src/clear/sql/query/where.cr","line_number":148,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/where.cr#L148"},"def":{"name":"or_where","args":[{"name":"node","external_name":"node","restriction":"Clear::Expression::Node"}],"visibility":"Public","body":"if @wheres.empty?\n return where(node)\nend\nif (((@wheres.size == 1) && (n = @wheres.first)) && n.is_a?(Clear::Expression::Node::NodeArray)) && (n.link == \"OR\")\n n.expression << node\nelse\n if @wheres.size == 1\n old_clause = @wheres.first\n else\n old_clause = Clear::Expression::Node::NodeArray.new(@wheres, \"AND\")\n end\n @wheres.clear\n @wheres << (Clear::Expression::Node::NodeArray.new([old_clause, node], \"OR\"))\nend\nchange!\n"}},{"html_id":"or_where(template:String,*args)-instance-method","name":"or_where","abstract":false,"args":[{"name":"template","external_name":"template","restriction":"String"},{"name":"args","external_name":"args","restriction":""}],"args_string":"(template : String, *args)","args_html":"(template : String, *args)","location":{"filename":"src/clear/sql/query/where.cr","line_number":176,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/where.cr#L176"},"def":{"name":"or_where","args":[{"name":"template","external_name":"template","restriction":"String"},{"name":"args","external_name":"args","restriction":""}],"splat_index":1,"visibility":"Public","body":"or_where(Clear::Expression::Node::Raw.new(Clear::Expression.raw(\"(#{template})\", *args)))"}},{"html_id":"or_where(template:String,**tuple)-instance-method","name":"or_where","abstract":false,"args":[{"name":"template","external_name":"template","restriction":"String"}],"args_string":"(template : String, **tuple)","args_html":"(template : String, **tuple)","location":{"filename":"src/clear/sql/query/where.cr","line_number":172,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/where.cr#L172"},"def":{"name":"or_where","args":[{"name":"template","external_name":"template","restriction":"String"}],"double_splat":{"name":"tuple","external_name":"tuple","restriction":""},"visibility":"Public","body":"or_where(Clear::Expression::Node::Raw.new(Clear::Expression.raw(\"(#{template})\", **tuple)))"}},{"html_id":"or_where(&)-instance-method","name":"or_where","doc":"Build SQL `where` condition using the Expression engine.\n\n```\nquery.or_where { id == 1 }\n```","summary":"

Build SQL #where condition using the Expression engine.

","abstract":false,"location":{"filename":"src/clear/sql/query/where.cr","line_number":185,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/where.cr#L185"},"def":{"name":"or_where","yields":0,"block_arity":0,"visibility":"Public","body":"or_where(Clear::Expression.ensure_node!(with Clear::Expression.new yield))"}},{"html_id":"where(node:Clear::Expression::Node)-instance-method","name":"where","doc":"Build SQL `where` condition using a Clear::Expression::Node\n\n```\nquery.where(Clear::Expression::Node::InArray.new(\"id\", ['1', '2', '3', '4']))\n# Note: in this example, InArray node use unsafe strings\n```\n\nIf useful for moving a where clause from a request to another one:\n\n```\nquery1.where { a == b } # WHERE a = b\n```\n\n```\nquery2.where(query1.wheres[0]) # WHERE a = b\n```","summary":"

Build SQL #where condition using a Clear::Expression::Node

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Clear::Expression::Node"}],"args_string":"(node : Clear::Expression::Node)","args_html":"(node : Clear::Expression::Node)","location":{"filename":"src/clear/sql/query/where.cr","line_number":29,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/where.cr#L29"},"def":{"name":"where","args":[{"name":"node","external_name":"node","restriction":"Clear::Expression::Node"}],"visibility":"Public","body":"@wheres << node\nchange!\n"}},{"html_id":"where(&)-instance-method","name":"where","doc":"Build SQL `where` condition using the Expression engine.\n\n```\nquery.where { id == 1 }\n```","summary":"

Build SQL #where condition using the Expression engine.

","abstract":false,"location":{"filename":"src/clear/sql/query/where.cr","line_number":40,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/where.cr#L40"},"def":{"name":"where","yields":0,"block_arity":0,"visibility":"Public","body":"where(Clear::Expression.ensure_node!(with Clear::Expression.new yield))"}},{"html_id":"where(conditions:NamedTuple|Hash(String,Clear::SQL::Any))-instance-method","name":"where","doc":"Build SQL `where` condition using a NamedTuple.\nthis will use:\n- the `=` operator if compared with a literal\n\n```\nquery.where({keyword: \"hello\"}) # WHERE keyword = 'hello'\n```\n\n- the `IN` operator if compared with an array:\n\n```\nquery.where({x: [1, 2]}) # WHERE x in (1,2)\n```\n\n- the `>=` and `<=` | `<` if compared with a range:\n\n```\nquery.where({x: (1..4)}) # WHERE x >= 1 AND x <= 4\nquery.where({x: (1...4)}) # WHERE x >= 1 AND x < 4\n```\n\n- You also can put another select query as argument:\n\n```\nquery.where({x: another_select}) # WHERE x IN (SELECT ... )\n```","summary":"

Build SQL #where condition using a NamedTuple.

","abstract":false,"args":[{"name":"conditions","external_name":"conditions","restriction":"NamedTuple | Hash(String, Clear::SQL::Any)"}],"args_string":"(conditions : NamedTuple | Hash(String, Clear::SQL::Any))","args_html":"(conditions : NamedTuple | Hash(String, Clear::SQL::Any))","location":{"filename":"src/clear/sql/query/where.cr","line_number":74,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/where.cr#L74"},"def":{"name":"where","args":[{"name":"conditions","external_name":"conditions","restriction":"NamedTuple | Hash(String, Clear::SQL::Any)"}],"visibility":"Public","body":"conditions.each do |k, v|\n k = Clear::Expression::Node::Variable.new(k.to_s)\n @wheres << (case v\n when Array\n Clear::Expression::Node::InArray.new(k, v.map do |it|\n Clear::Expression[it]\n end)\n when SelectBuilder\n Clear::Expression::Node::InSelect.new(k, v)\n when Range\n Clear::Expression::Node::InRange.new(k, Clear::Expression[v.begin]..Clear::Expression[v.end], v.exclusive?)\n else\n Clear::Expression::Node::DoubleOperator.new(k, Clear::Expression::Node::Literal.new(v), (v.nil? ? \"IS\" : \"=\"))\n end)\nend\nchange!\n"}},{"html_id":"where(template:String)-instance-method","name":"where","doc":"Build custom SQL `where`\nbeware of SQL injections!\n\n```\nwhere(\"ADD_SOME_DANGEROUS_SQL_HERE\") # WHERE ADD_SOME_DANGEROUS_SQL_HERE\n```","summary":"

Build custom SQL #where beware of SQL injections!

","abstract":false,"args":[{"name":"template","external_name":"template","restriction":"String"}],"args_string":"(template : String)","args_html":"(template : String)","location":{"filename":"src/clear/sql/query/where.cr","line_number":127,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/where.cr#L127"},"def":{"name":"where","args":[{"name":"template","external_name":"template","restriction":"String"}],"visibility":"Public","body":"@wheres << (Clear::Expression::Node::Raw.new(template))\nchange!\n"}},{"html_id":"where(template:String,*args)-instance-method","name":"where","doc":"Build SQL `where` condition using a template string and\ninterpolating `?` characters with parameters given in a tuple or array.\n\n```\nwhere(\"x = ? OR y = ?\", 1, \"l'eau\") # WHERE x = 1 OR y = 'l''eau'\n```\n\nRaise error if there's not enough parameters to cover all the `?` placeholders","summary":"

Build SQL #where condition using a template string and interpolating ? characters with parameters given in a tuple or array.

","abstract":false,"args":[{"name":"template","external_name":"template","restriction":"String"},{"name":"args","external_name":"args","restriction":""}],"args_string":"(template : String, *args)","args_html":"(template : String, *args)","location":{"filename":"src/clear/sql/query/where.cr","line_number":117,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/where.cr#L117"},"def":{"name":"where","args":[{"name":"template","external_name":"template","restriction":"String"},{"name":"args","external_name":"args","restriction":""}],"splat_index":1,"visibility":"Public","body":"where(Clear::Expression::Node::Raw.new(Clear::SQL.raw(template, *args)))"}},{"html_id":"where(template:String,**tuple)-instance-method","name":"where","doc":"Build SQL `where` interpolating `:keyword` with the NamedTuple passed in argument.\n\n```\nwhere(\"id = :id OR date >= :start\", id: 1, start: 1.day.ago)\n# WHERE id = 1 AND date >= '201x-xx-xx ...'\n```","summary":"

Build SQL #where interpolating :keyword with the NamedTuple passed in argument.

","abstract":false,"args":[{"name":"template","external_name":"template","restriction":"String"}],"args_string":"(template : String, **tuple)","args_html":"(template : String, **tuple)","location":{"filename":"src/clear/sql/query/where.cr","line_number":105,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/where.cr#L105"},"def":{"name":"where","args":[{"name":"template","external_name":"template","restriction":"String"}],"double_splat":{"name":"tuple","external_name":"tuple","restriction":""},"visibility":"Public","body":"where(Clear::Expression::Node::Raw.new(Clear::SQL.raw(template, **tuple)))"}},{"html_id":"where(**tuple)-instance-method","name":"where","abstract":false,"location":{"filename":"src/clear/sql/query/where.cr","line_number":44,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/where.cr#L44"},"def":{"name":"where","double_splat":{"name":"tuple","external_name":"tuple","restriction":""},"visibility":"Public","body":"where(conditions: tuple)"}}]},{"html_id":"clear/Clear/SQL/Query/Window","path":"Clear/SQL/Query/Window.html","kind":"module","full_name":"Clear::SQL::Query::Window","name":"Window","abstract":false,"locations":[{"filename":"src/clear/sql/query/window.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/window.cr#L1"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"clear/Clear/SQL/SelectBuilder","kind":"module","full_name":"Clear::SQL::SelectBuilder","name":"SelectBuilder"}],"namespace":{"html_id":"clear/Clear/SQL/Query","kind":"module","full_name":"Clear::SQL::Query","name":"Query"},"instance_methods":[{"html_id":"clear_windows-instance-method","name":"clear_windows","abstract":false,"location":{"filename":"src/clear/sql/query/window.cr","line_number":21,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/window.cr#L21"},"def":{"name":"clear_windows","visibility":"Public","body":"@windows.clear\nchange!\n"}},{"html_id":"print_windows-instance-method","name":"print_windows","abstract":false,"location":{"filename":"src/clear/sql/query/window.cr","line_number":27,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/window.cr#L27"},"def":{"name":"print_windows","visibility":"Public","body":"@windows.join do |name, value|\n {name.to_s, \" AS \", value}.join\nend"}},{"html_id":"window(name,value)-instance-method","name":"window","abstract":false,"args":[{"name":"name","external_name":"name","restriction":""},{"name":"value","external_name":"value","restriction":""}],"args_string":"(name, value)","args_html":"(name, value)","location":{"filename":"src/clear/sql/query/window.cr","line_number":15,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/window.cr#L15"},"def":{"name":"window","args":[{"name":"name","external_name":"name","restriction":""},{"name":"value","external_name":"value","restriction":""}],"visibility":"Public","body":"@windows << {name.to_s, value.to_s}\nchange!\n"}},{"html_id":"window(windows:NamedTuple)-instance-method","name":"window","abstract":false,"args":[{"name":"windows","external_name":"windows","restriction":"NamedTuple"}],"args_string":"(windows : NamedTuple)","args_html":"(windows : NamedTuple)","location":{"filename":"src/clear/sql/query/window.cr","line_number":7,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/window.cr#L7"},"def":{"name":"window","args":[{"name":"windows","external_name":"windows","restriction":"NamedTuple"}],"visibility":"Public","body":"windows.each do |k, v|\n @windows << {k.to_s, v.to_s}\nend\nchange!\n"}},{"html_id":"windows:Array(WindowDeclaration)-instance-method","name":"windows","doc":"eq. WINDOW window_name AS ( window_definition )","summary":"

eq.

","abstract":false,"location":{"filename":"src/clear/sql/query/window.cr","line_number":5,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/window.cr#L5"},"def":{"name":"windows","return_type":"Array(WindowDeclaration)","visibility":"Public","body":"@windows"}}],"types":[{"html_id":"clear/Clear/SQL/Query/Window/WindowDeclaration","path":"Clear/SQL/Query/Window/WindowDeclaration.html","kind":"alias","full_name":"Clear::SQL::Query::Window::WindowDeclaration","name":"WindowDeclaration","abstract":false,"locations":[{"filename":"src/clear/sql/query/window.cr","line_number":2,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/window.cr#L2"}],"repository_name":"clear","program":false,"enum":false,"alias":true,"aliased":"Tuple(String, String)","aliased_html":"{String, String}","const":false,"namespace":{"html_id":"clear/Clear/SQL/Query/Window","kind":"module","full_name":"Clear::SQL::Query::Window","name":"Window"}}]},{"html_id":"clear/Clear/SQL/Query/WithPagination","path":"Clear/SQL/Query/WithPagination.html","kind":"module","full_name":"Clear::SQL::Query::WithPagination","name":"WithPagination","abstract":false,"locations":[{"filename":"src/clear/sql/query/with_pagination.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/with_pagination.cr#L1"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"DEFAULT_LIMIT","name":"DEFAULT_LIMIT","value":"50"},{"id":"DEFAULT_PAGE","name":"DEFAULT_PAGE","value":"1"}],"including_types":[{"html_id":"clear/Clear/SQL/SelectBuilder","kind":"module","full_name":"Clear::SQL::SelectBuilder","name":"SelectBuilder"}],"namespace":{"html_id":"clear/Clear/SQL/Query","kind":"module","full_name":"Clear::SQL::Query","name":"Query"},"instance_methods":[{"html_id":"current_page-instance-method","name":"current_page","doc":"Return the current page","summary":"

Return the current page

","abstract":false,"location":{"filename":"src/clear/sql/query/with_pagination.cr","line_number":33,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/with_pagination.cr#L33"},"def":{"name":"current_page","visibility":"Public","body":"if offset.nil? || limit.nil?\n 1\nelse\n ((offset.as(Int64)) / (limit.as(Int64))) + 1\nend"}},{"html_id":"first_page?-instance-method","name":"first_page?","abstract":false,"location":{"filename":"src/clear/sql/query/with_pagination.cr","line_number":64,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/with_pagination.cr#L64"},"def":{"name":"first_page?","visibility":"Public","body":"current_page <= 1"}},{"html_id":"last_page?-instance-method","name":"last_page?","abstract":false,"location":{"filename":"src/clear/sql/query/with_pagination.cr","line_number":60,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/with_pagination.cr#L60"},"def":{"name":"last_page?","visibility":"Public","body":"next_page.nil?"}},{"html_id":"next_page-instance-method","name":"next_page","doc":"Return `current_page + 1` or `nil` if there is no next page","summary":"

Return current_page + 1 or nil if there is no next page

","abstract":false,"location":{"filename":"src/clear/sql/query/with_pagination.cr","line_number":56,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/with_pagination.cr#L56"},"def":{"name":"next_page","visibility":"Public","body":"current_page < total_pages ? (current_page + 1) : nil"}},{"html_id":"out_of_bounds?-instance-method","name":"out_of_bounds?","doc":"Helper method that is true when someone tries to fetch a page with a\nlarger number than the last page. Can be used in combination with flashes\nand redirecting.","summary":"

Helper method that is true when someone tries to fetch a page with a larger number than the last page.

","abstract":false,"location":{"filename":"src/clear/sql/query/with_pagination.cr","line_number":71,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/with_pagination.cr#L71"},"def":{"name":"out_of_bounds?","visibility":"Public","body":"current_page > total_pages"}},{"html_id":"paginate(page:Int32=DEFAULT_PAGE,per_page:Int32=DEFAULT_LIMIT)-instance-method","name":"paginate","doc":"Enter pagination mode.\nThis is helpful to manage paginated table.\nPagination will handle the page progression automatically and update\n`offset` and `limit` parameters by his own.\n\n```\npage = query.paginate(2, 50)\n```","summary":"

Enter pagination mode.

","abstract":false,"args":[{"name":"page","default_value":"DEFAULT_PAGE","external_name":"page","restriction":"Int32"},{"name":"per_page","default_value":"DEFAULT_LIMIT","external_name":"per_page","restriction":"Int32"}],"args_string":"(page : Int32 = DEFAULT_PAGE, per_page : Int32 = DEFAULT_LIMIT)","args_html":"(page : Int32 = DEFAULT_PAGE, per_page : Int32 = DEFAULT_LIMIT)","location":{"filename":"src/clear/sql/query/with_pagination.cr","line_number":17,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/with_pagination.cr#L17"},"def":{"name":"paginate","args":[{"name":"page","default_value":"DEFAULT_PAGE","external_name":"page","restriction":"Int32"},{"name":"per_page","default_value":"DEFAULT_LIMIT","external_name":"per_page","restriction":"Int32"}],"visibility":"Public","body":"clear_limit.clear_offset\n@total_entries = count\npage = {1, page}.max\n@limit = per_page.to_i64\n@offset = (per_page * (page - 1)).to_i64\nchange!\n"}},{"html_id":"per_page-instance-method","name":"per_page","doc":"Return the number of items maximum per page.","summary":"

Return the number of items maximum per page.

","abstract":false,"location":{"filename":"src/clear/sql/query/with_pagination.cr","line_number":28,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/with_pagination.cr#L28"},"def":{"name":"per_page","visibility":"Public","body":"limit"}},{"html_id":"previous_page-instance-method","name":"previous_page","doc":"Return `current_page - 1` or `nil` if there is no previous page","summary":"

Return current_page - 1 or nil if there is no previous page

","abstract":false,"location":{"filename":"src/clear/sql/query/with_pagination.cr","line_number":51,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/with_pagination.cr#L51"},"def":{"name":"previous_page","visibility":"Public","body":"current_page > 1 ? (current_page - 1) : nil"}},{"html_id":"total_pages-instance-method","name":"total_pages","doc":"Return the total number of pages.","summary":"

Return the total number of pages.

","abstract":false,"location":{"filename":"src/clear/sql/query/with_pagination.cr","line_number":42,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/with_pagination.cr#L42"},"def":{"name":"total_pages","visibility":"Public","body":"if limit.nil? || total_entries.nil?\n 1\nelse\n ((total_entries.as(Int64)) / (limit.as(Int64)).to_f).ceil.to_i\nend"}}]}]},{"html_id":"clear/Clear/SQL/QueryBuildingError","path":"Clear/SQL/QueryBuildingError.html","kind":"class","full_name":"Clear::SQL::QueryBuildingError","name":"QueryBuildingError","abstract":false,"superclass":{"html_id":"clear/Clear/SQL/Error","kind":"class","full_name":"Clear::SQL::Error","name":"Error"},"ancestors":[{"html_id":"clear/Clear/SQL/Error","kind":"class","full_name":"Clear::SQL::Error","name":"Error"},{"html_id":"clear/Exception","kind":"class","full_name":"Exception","name":"Exception"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/sql/errors.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/errors.cr#L6"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/SQL","kind":"module","full_name":"Clear::SQL","name":"SQL"}},{"html_id":"clear/Clear/SQL/RecordNotFoundError","path":"Clear/SQL/RecordNotFoundError.html","kind":"class","full_name":"Clear::SQL::RecordNotFoundError","name":"RecordNotFoundError","abstract":false,"superclass":{"html_id":"clear/Clear/SQL/Error","kind":"class","full_name":"Clear::SQL::Error","name":"Error"},"ancestors":[{"html_id":"clear/Clear/SQL/Error","kind":"class","full_name":"Clear::SQL::Error","name":"Error"},{"html_id":"clear/Exception","kind":"class","full_name":"Exception","name":"Exception"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/sql/errors.cr","line_number":10,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/errors.cr#L10"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/SQL","kind":"module","full_name":"Clear::SQL","name":"SQL"}},{"html_id":"clear/Clear/SQL/RollbackError","path":"Clear/SQL/RollbackError.html","kind":"class","full_name":"Clear::SQL::RollbackError","name":"RollbackError","abstract":false,"superclass":{"html_id":"clear/Clear/SQL/Error","kind":"class","full_name":"Clear::SQL::Error","name":"Error"},"ancestors":[{"html_id":"clear/Clear/SQL/Error","kind":"class","full_name":"Clear::SQL::Error","name":"Error"},{"html_id":"clear/Exception","kind":"class","full_name":"Exception","name":"Exception"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/sql/errors.cr","line_number":13,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/errors.cr#L13"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/SQL","kind":"module","full_name":"Clear::SQL","name":"SQL"},"doc":"Rollback the transaction or the last savepoint.","summary":"

Rollback the transaction or the last savepoint.

"},{"html_id":"clear/Clear/SQL/Selectable","path":"Clear/SQL/Selectable.html","kind":"alias","full_name":"Clear::SQL::Selectable","name":"Selectable","abstract":false,"locations":[{"filename":"src/clear/sql/sql.cr","line_number":68,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/sql.cr#L68"}],"repository_name":"clear","program":false,"enum":false,"alias":true,"aliased":"(Clear::SQL::SelectBuilder | String | Symbol)","aliased_html":"Clear::SQL::SelectBuilder | String | Symbol","const":false,"namespace":{"html_id":"clear/Clear/SQL","kind":"module","full_name":"Clear::SQL","name":"SQL"}},{"html_id":"clear/Clear/SQL/SelectBuilder","path":"Clear/SQL/SelectBuilder.html","kind":"module","full_name":"Clear::SQL::SelectBuilder","name":"SelectBuilder","abstract":false,"ancestors":[{"html_id":"clear/Clear/SQL/Query/WithPagination","kind":"module","full_name":"Clear::SQL::Query::WithPagination","name":"WithPagination"},{"html_id":"clear/Clear/SQL/Query/BeforeQuery","kind":"module","full_name":"Clear::SQL::Query::BeforeQuery","name":"BeforeQuery"},{"html_id":"clear/Clear/SQL/Query/Change","kind":"module","full_name":"Clear::SQL::Query::Change","name":"Change"},{"html_id":"clear/Clear/SQL/Query/Connection","kind":"module","full_name":"Clear::SQL::Query::Connection","name":"Connection"},{"html_id":"clear/Clear/SQL/Query/Pluck","kind":"module","full_name":"Clear::SQL::Query::Pluck","name":"Pluck"},{"html_id":"clear/Clear/SQL/Query/Fetch","kind":"module","full_name":"Clear::SQL::Query::Fetch","name":"Fetch"},{"html_id":"clear/Clear/SQL/Query/Execute","kind":"module","full_name":"Clear::SQL::Query::Execute","name":"Execute"},{"html_id":"clear/Clear/SQL/Query/Lock","kind":"module","full_name":"Clear::SQL::Query::Lock","name":"Lock"},{"html_id":"clear/Clear/SQL/Query/Window","kind":"module","full_name":"Clear::SQL::Query::Window","name":"Window"},{"html_id":"clear/Clear/SQL/Query/CTE","kind":"module","full_name":"Clear::SQL::Query::CTE","name":"CTE"},{"html_id":"clear/Clear/SQL/Query/Aggregate","kind":"module","full_name":"Clear::SQL::Query::Aggregate","name":"Aggregate"},{"html_id":"clear/Clear/SQL/Query/OffsetLimit","kind":"module","full_name":"Clear::SQL::Query::OffsetLimit","name":"OffsetLimit"},{"html_id":"clear/Clear/SQL/Query/GroupBy","kind":"module","full_name":"Clear::SQL::Query::GroupBy","name":"GroupBy"},{"html_id":"clear/Clear/SQL/Query/OrderBy","kind":"module","full_name":"Clear::SQL::Query::OrderBy","name":"OrderBy"},{"html_id":"clear/Clear/SQL/Query/Having","kind":"module","full_name":"Clear::SQL::Query::Having","name":"Having"},{"html_id":"clear/Clear/SQL/Query/Where","kind":"module","full_name":"Clear::SQL::Query::Where","name":"Where"},{"html_id":"clear/Clear/SQL/Query/Join","kind":"module","full_name":"Clear::SQL::Query::Join","name":"Join"},{"html_id":"clear/Clear/SQL/Query/From","kind":"module","full_name":"Clear::SQL::Query::From","name":"From"},{"html_id":"clear/Clear/SQL/Query/Select","kind":"module","full_name":"Clear::SQL::Query::Select","name":"Select"}],"locations":[{"filename":"src/clear/sql/select_builder.cr","line_number":3,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/select_builder.cr#L3"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"clear/Clear/SQL/Query/Aggregate","kind":"module","full_name":"Clear::SQL::Query::Aggregate","name":"Aggregate"},{"html_id":"clear/Clear/SQL/Query/BeforeQuery","kind":"module","full_name":"Clear::SQL::Query::BeforeQuery","name":"BeforeQuery"},{"html_id":"clear/Clear/SQL/Query/Change","kind":"module","full_name":"Clear::SQL::Query::Change","name":"Change"},{"html_id":"clear/Clear/SQL/Query/Connection","kind":"module","full_name":"Clear::SQL::Query::Connection","name":"Connection"},{"html_id":"clear/Clear/SQL/Query/CTE","kind":"module","full_name":"Clear::SQL::Query::CTE","name":"CTE"},{"html_id":"clear/Clear/SQL/Query/Execute","kind":"module","full_name":"Clear::SQL::Query::Execute","name":"Execute"},{"html_id":"clear/Clear/SQL/Query/Fetch","kind":"module","full_name":"Clear::SQL::Query::Fetch","name":"Fetch"},{"html_id":"clear/Clear/SQL/Query/From","kind":"module","full_name":"Clear::SQL::Query::From","name":"From"},{"html_id":"clear/Clear/SQL/Query/GroupBy","kind":"module","full_name":"Clear::SQL::Query::GroupBy","name":"GroupBy"},{"html_id":"clear/Clear/SQL/Query/Having","kind":"module","full_name":"Clear::SQL::Query::Having","name":"Having"},{"html_id":"clear/Clear/SQL/Query/Join","kind":"module","full_name":"Clear::SQL::Query::Join","name":"Join"},{"html_id":"clear/Clear/SQL/Query/Lock","kind":"module","full_name":"Clear::SQL::Query::Lock","name":"Lock"},{"html_id":"clear/Clear/SQL/Query/OffsetLimit","kind":"module","full_name":"Clear::SQL::Query::OffsetLimit","name":"OffsetLimit"},{"html_id":"clear/Clear/SQL/Query/OrderBy","kind":"module","full_name":"Clear::SQL::Query::OrderBy","name":"OrderBy"},{"html_id":"clear/Clear/SQL/Query/Pluck","kind":"module","full_name":"Clear::SQL::Query::Pluck","name":"Pluck"},{"html_id":"clear/Clear/SQL/Query/Select","kind":"module","full_name":"Clear::SQL::Query::Select","name":"Select"},{"html_id":"clear/Clear/SQL/Query/Where","kind":"module","full_name":"Clear::SQL::Query::Where","name":"Where"},{"html_id":"clear/Clear/SQL/Query/Window","kind":"module","full_name":"Clear::SQL::Query::Window","name":"Window"},{"html_id":"clear/Clear/SQL/Query/WithPagination","kind":"module","full_name":"Clear::SQL::Query::WithPagination","name":"WithPagination"}],"including_types":[{"html_id":"clear/Clear/Model/CollectionBase","kind":"class","full_name":"Clear::Model::CollectionBase(T)","name":"CollectionBase"},{"html_id":"clear/Clear/SQL/SelectQuery","kind":"class","full_name":"Clear::SQL::SelectQuery","name":"SelectQuery"}],"namespace":{"html_id":"clear/Clear/SQL","kind":"module","full_name":"Clear::SQL","name":"SQL"},"constructors":[{"html_id":"new(distinct_value=nil,cte={}ofString=>Clear::SQL::SelectBuilder|String,columns=[]ofSQL::Column,froms=[]ofSQL::From,joins=[]ofSQL::Join,wheres=[]ofClear::Expression::Node,havings=[]ofClear::Expression::Node,windows=[]of::Tuple(String,String),group_bys=[]ofSymbolic,order_bys=[]ofClear::SQL::Query::OrderBy::Record,limit=nil,offset=nil,lock=nil,before_query_triggers=[]of(->Nil))-class-method","name":"new","abstract":false,"args":[{"name":"distinct_value","default_value":"nil","external_name":"distinct_value","restriction":""},{"name":"cte","default_value":"{} of String => Clear::SQL::SelectBuilder | String","external_name":"cte","restriction":""},{"name":"columns","default_value":"[] of SQL::Column","external_name":"columns","restriction":""},{"name":"froms","default_value":"[] of SQL::From","external_name":"froms","restriction":""},{"name":"joins","default_value":"[] of SQL::Join","external_name":"joins","restriction":""},{"name":"wheres","default_value":"[] of Clear::Expression::Node","external_name":"wheres","restriction":""},{"name":"havings","default_value":"[] of Clear::Expression::Node","external_name":"havings","restriction":""},{"name":"windows","default_value":"[] of ::Tuple(String, String)","external_name":"windows","restriction":""},{"name":"group_bys","default_value":"[] of Symbolic","external_name":"group_bys","restriction":""},{"name":"order_bys","default_value":"[] of Clear::SQL::Query::OrderBy::Record","external_name":"order_bys","restriction":""},{"name":"limit","default_value":"nil","external_name":"limit","restriction":""},{"name":"offset","default_value":"nil","external_name":"offset","restriction":""},{"name":"lock","default_value":"nil","external_name":"lock","restriction":""},{"name":"before_query_triggers","default_value":"[] of (-> Nil)","external_name":"before_query_triggers","restriction":""}],"args_string":"(distinct_value = nil, cte = {} of String => Clear::SQL::SelectBuilder | String, columns = [] of SQL::Column, froms = [] of SQL::From, joins = [] of SQL::Join, wheres = [] of Clear::Expression::Node, havings = [] of Clear::Expression::Node, windows = [] of ::Tuple(String, String), group_bys = [] of Symbolic, order_bys = [] of Clear::SQL::Query::OrderBy::Record, limit = nil, offset = nil, lock = nil, before_query_triggers = [] of (-> Nil))","args_html":"(distinct_value = nil, cte = {} of String => Clear::SQL::SelectBuilder | String, columns = [] of SQL::Column, froms = [] of SQL::From, joins = [] of SQL::Join, wheres = [] of Clear::Expression::Node, havings = [] of Clear::Expression::Node, windows = [] of ::Tuple(String, String), group_bys = [] of Symbolic, order_bys = [] of Clear::SQL::Query::OrderBy::Record, limit = nil, offset = nil, lock = nil, before_query_triggers = [] of (-> Nil))","location":{"filename":"src/clear/sql/select_builder.cr","line_number":29,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/select_builder.cr#L29"},"def":{"name":"new","args":[{"name":"distinct_value","default_value":"nil","external_name":"distinct_value","restriction":""},{"name":"cte","default_value":"{} of String => Clear::SQL::SelectBuilder | String","external_name":"cte","restriction":""},{"name":"columns","default_value":"[] of SQL::Column","external_name":"columns","restriction":""},{"name":"froms","default_value":"[] of SQL::From","external_name":"froms","restriction":""},{"name":"joins","default_value":"[] of SQL::Join","external_name":"joins","restriction":""},{"name":"wheres","default_value":"[] of Clear::Expression::Node","external_name":"wheres","restriction":""},{"name":"havings","default_value":"[] of Clear::Expression::Node","external_name":"havings","restriction":""},{"name":"windows","default_value":"[] of ::Tuple(String, String)","external_name":"windows","restriction":""},{"name":"group_bys","default_value":"[] of Symbolic","external_name":"group_bys","restriction":""},{"name":"order_bys","default_value":"[] of Clear::SQL::Query::OrderBy::Record","external_name":"order_bys","restriction":""},{"name":"limit","default_value":"nil","external_name":"limit","restriction":""},{"name":"offset","default_value":"nil","external_name":"offset","restriction":""},{"name":"lock","default_value":"nil","external_name":"lock","restriction":""},{"name":"before_query_triggers","default_value":"[] of (-> Nil)","external_name":"before_query_triggers","restriction":""}],"visibility":"Public","body":"_ = allocate\n_.initialize(distinct_value, cte, columns, froms, joins, wheres, havings, windows, group_bys, order_bys, limit, offset, lock, before_query_triggers)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"before_query(&block:->Nil)-instance-method","name":"before_query","doc":"A hook to apply some operation just before the query is executed.\n\n```\ncall = 0\nreq = Clear::SQL.select(\"1\").before_query { call += 1 }\n10.times { req.execute }\npp call # 10\n```","summary":"

A hook to apply some operation just before the query is executed.

","abstract":false,"location":{"filename":"src/clear/sql/select_builder.cr","line_number":26,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/select_builder.cr#L26"},"def":{"name":"before_query","yields":0,"block_arity":0,"block_arg":{"name":"block","external_name":"block","restriction":"(-> Nil)"},"visibility":"Public","body":"@before_query_triggers << block\nself\n"}},{"html_id":"columns:Array(SQL::Column)-instance-method","name":"columns","abstract":false,"def":{"name":"columns","return_type":"Array(SQL::Column)","visibility":"Public","body":"@columns"}},{"html_id":"default_wildcard_table-instance-method","name":"default_wildcard_table","abstract":false,"def":{"name":"default_wildcard_table","visibility":"Public","body":"@default_wildcard_table"}},{"html_id":"dup:self-instance-method","name":"dup","doc":"Duplicate the query","summary":"

Duplicate the query

","abstract":false,"location":{"filename":"src/clear/sql/select_builder.cr","line_number":46,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/select_builder.cr#L46"},"def":{"name":"dup","return_type":"self","visibility":"Public","body":"self.class.new(distinct_value: @distinct_value, cte: @cte.dup, columns: @columns.dup, froms: @froms.dup, joins: @joins.dup, wheres: @wheres.dup, havings: @havings.dup, windows: @windows.dup, group_bys: @group_bys.dup, order_bys: @order_bys.dup, limit: @limit, offset: @offset, lock: @lock, before_query_triggers: @before_query_triggers).use_connection(connection_name)"}},{"html_id":"havings:Array(Clear::Expression::Node)-instance-method","name":"havings","abstract":false,"def":{"name":"havings","return_type":"Array(Clear::Expression::Node)","visibility":"Public","body":"@havings"}},{"html_id":"is_distinct?-instance-method","name":"is_distinct?","abstract":false,"location":{"filename":"src/clear/sql/select_builder.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/select_builder.cr#L4"},"def":{"name":"is_distinct?","visibility":"Public","body":"!!@distinct_value"}},{"html_id":"joins:Array(SQL::Join)-instance-method","name":"joins","abstract":false,"def":{"name":"joins","return_type":"Array(SQL::Join)","visibility":"Public","body":"@joins"}},{"html_id":"limit:Int64|Nil-instance-method","name":"limit","abstract":false,"def":{"name":"limit","return_type":"Int64 | ::Nil","visibility":"Public","body":"@limit"}},{"html_id":"lock:String|Nil-instance-method","name":"lock","abstract":false,"def":{"name":"lock","return_type":"String | ::Nil","visibility":"Public","body":"@lock"}},{"html_id":"offset:Int64|Nil-instance-method","name":"offset","abstract":false,"def":{"name":"offset","return_type":"Int64 | ::Nil","visibility":"Public","body":"@offset"}},{"html_id":"order_bys:Array(Clear::SQL::Query::OrderBy::Record)-instance-method","name":"order_bys","abstract":false,"def":{"name":"order_bys","return_type":"Array(Clear::SQL::Query::OrderBy::Record)","visibility":"Public","body":"@order_bys"}},{"html_id":"to_delete-instance-method","name":"to_delete","doc":"Construct a delete query from this select query.\nIt uses only the `from` and the `where` clause fo the current select request.\nCan be useful in some case, but\n use at your own risk !","summary":"

Construct a delete query from this select query.

","abstract":false,"location":{"filename":"src/clear/sql/select_builder.cr","line_number":83,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/select_builder.cr#L83"},"def":{"name":"to_delete","visibility":"Public","body":"if @froms.size == 1\nelse\n raise(QueryBuildingError.new(\"Cannot build a delete query \" + \"from a select with multiple or none `from` clauses\"))\nend\nv = @froms[0].value\nif v.is_a?(SelectBuilder)\n raise(QueryBuildingError.new(\"Cannot delete from a select with sub-select as `from` clause\"))\nend\nDeleteQuery.new(v.dup, @wheres.dup)\n"}},{"html_id":"to_sql:String-instance-method","name":"to_sql","abstract":false,"location":{"filename":"src/clear/sql/select_builder.cr","line_number":65,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/select_builder.cr#L65"},"def":{"name":"to_sql","return_type":"String","visibility":"Public","body":"[print_ctes, print_select, print_froms, print_joins, print_wheres, print_windows, print_group_bys, print_havings, print_order_bys, print_limit_offsets, print_lock].compact.reject(&.empty?).join(\" \")"}},{"html_id":"to_update-instance-method","name":"to_update","abstract":false,"location":{"filename":"src/clear/sql/select_builder.cr","line_number":94,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/select_builder.cr#L94"},"def":{"name":"to_update","visibility":"Public","body":"if @froms.size == 1\nelse\n raise(QueryBuildingError.new(\"Cannot build a update query \" + \"from a select with multiple or none `from` clauses\"))\nend\nv = @froms[0].value\nif v.is_a?(SelectBuilder)\n raise(QueryBuildingError.new(\"Cannot delete from a select with sub-select as `from` clause\"))\nend\nUpdateQuery.new(table: v.dup, wheres: @wheres.dup)\n"}},{"html_id":"total_entries:Int64|Nil-instance-method","name":"total_entries","abstract":false,"def":{"name":"total_entries","return_type":"Int64 | ::Nil","visibility":"Public","body":"@total_entries"}},{"html_id":"total_entries=(total_entries:Int64|Nil)-instance-method","name":"total_entries=","abstract":false,"args":[{"name":"total_entries","external_name":"total_entries","restriction":"Int64 | ::Nil"}],"args_string":"(total_entries : Int64 | Nil)","args_html":"(total_entries : Int64 | Nil)","def":{"name":"total_entries=","args":[{"name":"total_entries","external_name":"total_entries","restriction":"Int64 | ::Nil"}],"visibility":"Public","body":"@total_entries = total_entries"}},{"html_id":"wheres:Array(Clear::Expression::Node)-instance-method","name":"wheres","doc":"Return the list of where clause; each where clause are transformed into\nClear::Expression::Node","summary":"

Return the list of where clause; each where clause are transformed into Clear::Expression::Node

","abstract":false,"def":{"name":"wheres","return_type":"Array(Clear::Expression::Node)","visibility":"Public","body":"@wheres"}}]},{"html_id":"clear/Clear/SQL/SelectQuery","path":"Clear/SQL/SelectQuery.html","kind":"class","full_name":"Clear::SQL::SelectQuery","name":"SelectQuery","abstract":false,"superclass":{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"clear/Clear/SQL/SelectBuilder","kind":"module","full_name":"Clear::SQL::SelectBuilder","name":"SelectBuilder"},{"html_id":"clear/Clear/SQL/Query/WithPagination","kind":"module","full_name":"Clear::SQL::Query::WithPagination","name":"WithPagination"},{"html_id":"clear/Clear/SQL/Query/BeforeQuery","kind":"module","full_name":"Clear::SQL::Query::BeforeQuery","name":"BeforeQuery"},{"html_id":"clear/Clear/SQL/Query/Change","kind":"module","full_name":"Clear::SQL::Query::Change","name":"Change"},{"html_id":"clear/Clear/SQL/Query/Connection","kind":"module","full_name":"Clear::SQL::Query::Connection","name":"Connection"},{"html_id":"clear/Clear/SQL/Query/Pluck","kind":"module","full_name":"Clear::SQL::Query::Pluck","name":"Pluck"},{"html_id":"clear/Clear/SQL/Query/Fetch","kind":"module","full_name":"Clear::SQL::Query::Fetch","name":"Fetch"},{"html_id":"clear/Clear/SQL/Query/Execute","kind":"module","full_name":"Clear::SQL::Query::Execute","name":"Execute"},{"html_id":"clear/Clear/SQL/Query/Lock","kind":"module","full_name":"Clear::SQL::Query::Lock","name":"Lock"},{"html_id":"clear/Clear/SQL/Query/Window","kind":"module","full_name":"Clear::SQL::Query::Window","name":"Window"},{"html_id":"clear/Clear/SQL/Query/CTE","kind":"module","full_name":"Clear::SQL::Query::CTE","name":"CTE"},{"html_id":"clear/Clear/SQL/Query/Aggregate","kind":"module","full_name":"Clear::SQL::Query::Aggregate","name":"Aggregate"},{"html_id":"clear/Clear/SQL/Query/OffsetLimit","kind":"module","full_name":"Clear::SQL::Query::OffsetLimit","name":"OffsetLimit"},{"html_id":"clear/Clear/SQL/Query/GroupBy","kind":"module","full_name":"Clear::SQL::Query::GroupBy","name":"GroupBy"},{"html_id":"clear/Clear/SQL/Query/OrderBy","kind":"module","full_name":"Clear::SQL::Query::OrderBy","name":"OrderBy"},{"html_id":"clear/Clear/SQL/Query/Having","kind":"module","full_name":"Clear::SQL::Query::Having","name":"Having"},{"html_id":"clear/Clear/SQL/Query/Where","kind":"module","full_name":"Clear::SQL::Query::Where","name":"Where"},{"html_id":"clear/Clear/SQL/Query/Join","kind":"module","full_name":"Clear::SQL::Query::Join","name":"Join"},{"html_id":"clear/Clear/SQL/Query/From","kind":"module","full_name":"Clear::SQL::Query::From","name":"From"},{"html_id":"clear/Clear/SQL/Query/Select","kind":"module","full_name":"Clear::SQL::Query::Select","name":"Select"},{"html_id":"clear/Enumerable","kind":"module","full_name":"Enumerable","name":"Enumerable"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/sql/select_query.cr","line_number":25,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/select_query.cr#L25"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"clear/Clear/SQL/SelectBuilder","kind":"module","full_name":"Clear::SQL::SelectBuilder","name":"SelectBuilder"},{"html_id":"clear/Enumerable","kind":"module","full_name":"Enumerable","name":"Enumerable"}],"namespace":{"html_id":"clear/Clear/SQL","kind":"module","full_name":"Clear::SQL","name":"SQL"},"doc":"A Select Query builder\n\nPostgres documentation:\n\n```\n[ WITH [ RECURSIVE ] with_query [, ...] ]\nSELECT [ ALL | DISTINCT [ ON ( expression [, ...] ) ] ]\n [ * | expression [ [ AS ] output_name ] [, ...] ]\n [ FROM from_item [, ...] ]\n [ WHERE condition ]\n [ GROUP BY grouping_element [, ...] ]\n [ HAVING condition [, ...] ]\n [ WINDOW window_name AS ( window_definition ) [, ...] ]\n [ { UNION | INTERSECT | EXCEPT } [ ALL | DISTINCT ] select ]\n [ ORDER BY expression [ ASC | DESC | USING operator ] [ NULLS { FIRST | LAST } ] [, ...] ]\n [ LIMIT { count | ALL } ]\n [ OFFSET start [ ROW | ROWS ] ]\n [ FETCH { FIRST | NEXT } [ count ] { ROW | ROWS } ONLY ]\n [ FOR { UPDATE | NO KEY UPDATE | SHARE | KEY SHARE } [ OF table_name [, ...] ] [ NOWAIT | SKIP LOCKED ] [...] ]\n```","summary":"

A Select Query builder

","instance_methods":[{"html_id":"each(&):Nil-instance-method","name":"each","doc":"Must yield this collection's elements to the block.","summary":"

Must yield this collection's elements to the block.

","abstract":false,"location":{"filename":"src/clear/sql/select_query.cr","line_number":29,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/select_query.cr#L29"},"def":{"name":"each","yields":1,"block_arity":1,"return_type":"Nil","visibility":"Public","body":"fetch do |h|\n yield(h)\nend"}}]},{"html_id":"clear/Clear/SQL/Symbolic","path":"Clear/SQL/Symbolic.html","kind":"alias","full_name":"Clear::SQL::Symbolic","name":"Symbolic","abstract":false,"locations":[{"filename":"src/clear/sql/sql.cr","line_number":67,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/sql.cr#L67"}],"repository_name":"clear","program":false,"enum":false,"alias":true,"aliased":"(String | Symbol)","aliased_html":"String | Symbol","const":false,"namespace":{"html_id":"clear/Clear/SQL","kind":"module","full_name":"Clear::SQL","name":"SQL"}},{"html_id":"clear/Clear/SQL/Transaction","path":"Clear/SQL/Transaction.html","kind":"module","full_name":"Clear::SQL::Transaction","name":"Transaction","abstract":false,"locations":[{"filename":"src/clear/sql/transaction.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/transaction.cr#L1"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"clear/Clear/SQL","kind":"module","full_name":"Clear::SQL","name":"SQL"}],"namespace":{"html_id":"clear/Clear/SQL","kind":"module","full_name":"Clear::SQL","name":"SQL"},"instance_methods":[{"html_id":"after_commit(connection:String=\"default\",&block:DB::Connection->Nil)-instance-method","name":"after_commit","doc":"Register a callback function which will be fired once when SQL `COMMIT`\noperation is called\n\nThis can be used for example to send email, or perform others tasks\nwhen you want to be sure the data is secured in the database.\n\n```\ntransaction do\n @user = User.find(1)\n @user.subscribe!\n Clear::SQL.after_commit { Email.deliver(ConfirmationMail.new(@user)) }\nend\n```\n\nIn case the transaction fail and eventually rollback, the code won't be called.\n","summary":"

Register a callback function which will be fired once when SQL COMMIT operation is called

","abstract":false,"args":[{"name":"connection","default_value":"\"default\"","external_name":"connection","restriction":"String"}],"args_string":"(connection : String = \"default\", &block : DB::Connection -> Nil)","args_html":"(connection : String = "default", &block : DB::Connection -> Nil)","location":{"filename":"src/clear/sql/transaction.cr","line_number":98,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/transaction.cr#L98"},"def":{"name":"after_commit","args":[{"name":"connection","default_value":"\"default\"","external_name":"connection","restriction":"String"}],"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(DB::Connection -> Nil)"},"visibility":"Public","body":"Clear::SQL::ConnectionPool.with_connection(connection) do |cnx|\n if cnx._clear_in_transaction?\n __temp_88 = cnx\n @@commit_callbacks[__temp_88] = @@commit_callbacks[__temp_88] << block\n else\n raise(Clear::SQL::Error.new(\"you need to be in transaction to add after_commit callback\"))\n end\nend"}},{"html_id":"in_transaction?(connection:String=\"default\")-instance-method","name":"in_transaction?","doc":"Check whether the current pair of fiber/connection is in transaction\nblock or not.","summary":"

Check whether the current pair of fiber/connection is in transaction block or not.

","abstract":false,"args":[{"name":"connection","default_value":"\"default\"","external_name":"connection","restriction":"String"}],"args_string":"(connection : String = \"default\")","args_html":"(connection : String = "default")","location":{"filename":"src/clear/sql/transaction.cr","line_number":29,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/transaction.cr#L29"},"def":{"name":"in_transaction?","args":[{"name":"connection","default_value":"\"default\"","external_name":"connection","restriction":"String"}],"visibility":"Public","body":"Clear::SQL::ConnectionPool.with_connection(connection, &._clear_in_transaction?)"}},{"html_id":"rollback(to=nil)-instance-method","name":"rollback","doc":"Rollback a transaction or return to the previous savepoint in case of a\nwith_savepoint block.\nThe params `to` offer","summary":"

Rollback a transaction or return to the previous savepoint in case of a with_savepoint block.

","abstract":false,"args":[{"name":"to","default_value":"nil","external_name":"to","restriction":""}],"args_string":"(to = nil)","args_html":"(to = nil)","location":{"filename":"src/clear/sql/transaction.cr","line_number":138,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/transaction.cr#L138"},"def":{"name":"rollback","args":[{"name":"to","default_value":"nil","external_name":"to","restriction":""}],"visibility":"Public","body":"raise(RollbackError.new(to))"}},{"html_id":"rollback_transaction-instance-method","name":"rollback_transaction","doc":"Rollback the transaction. In case the call is made inside a savepoint block\nrollback everything.","summary":"

Rollback the transaction.

","abstract":false,"location":{"filename":"src/clear/sql/transaction.cr","line_number":144,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/transaction.cr#L144"},"def":{"name":"rollback_transaction","visibility":"Public","body":"raise(CancelTransactionError.new)"}},{"html_id":"transaction(connection:String=\"default\",level:Level=Level::Serializable,&)-instance-method","name":"transaction","doc":"Enter new transaction block for the current connection/fiber pair.\n\nExample:\n\n```\nClear::SQL.transaction do\n # do something\n Clear::SQL.transaction do # Technically, this block do nothing, since we already are in transaction\n rollback # < Rollback the up-most `transaction` block.\n end\nend\n```\n\nsee #with_savepoint to use a stackable version using savepoints.\n","summary":"

Enter new transaction block for the current connection/fiber pair.

","abstract":false,"args":[{"name":"connection","default_value":"\"default\"","external_name":"connection","restriction":"String"},{"name":"level","default_value":"Level::Serializable","external_name":"level","restriction":"Level"}],"args_string":"(connection : String = \"default\", level : Level = Level::Serializable, &)","args_html":"(connection : String = "default", level : Level = Level::Serializable, &)","location":{"filename":"src/clear/sql/transaction.cr","line_number":48,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/transaction.cr#L48"},"def":{"name":"transaction","args":[{"name":"connection","default_value":"\"default\"","external_name":"connection","restriction":"String"},{"name":"level","default_value":"Level::Serializable","external_name":"level","restriction":"Level"}],"yields":1,"block_arity":1,"visibility":"Public","body":"Clear::SQL::ConnectionPool.with_connection(connection) do |cnx|\n has_rollback = false\n if cnx._clear_in_transaction?\n return yield(cnx)\n else\n cnx._clear_in_transaction = true\n execute(level.to_begin_operation)\n begin\n return yield(cnx)\n rescue e\n has_rollback = true\n is_rollback_error = e.is_a?(RollbackError) || e.is_a?(CancelTransactionError)\n begin\n execute(\"ROLLBACK --\" + (is_rollback_error ? \"normal\" : \"program error\"))\n rescue\n nil\n end\n if is_rollback_error\n else\n raise(e)\n end\n ensure\n cnx._clear_in_transaction = false\n callbacks = @@commit_callbacks.delete(cnx)\n if has_rollback\n else\n execute(\"COMMIT\")\n callbacks.try(&.each(&.call(cnx)))\n end\n end\n end\nend"}},{"html_id":"with_savepoint(sp_name:Symbolic|Nil=nil,connection_name:String=\"default\",&)-instance-method","name":"with_savepoint","doc":"Create a transaction, but this one is stackable\nusing savepoints.\n\nExample:\n\n```\nClear::SQL.with_savepoint do\n # do something\n Clear::SQL.with_savepoint do\n rollback # < Rollback only the last `with_savepoint` block\n end\nend\n```","summary":"

Create a transaction, but this one is stackable using savepoints.

","abstract":false,"args":[{"name":"sp_name","default_value":"nil","external_name":"sp_name","restriction":"Symbolic | ::Nil"},{"name":"connection_name","default_value":"\"default\"","external_name":"connection_name","restriction":"String"}],"args_string":"(sp_name : Symbolic | Nil = nil, connection_name : String = \"default\", &)","args_html":"(sp_name : Symbolic | Nil = nil, connection_name : String = "default", &)","location":{"filename":"src/clear/sql/transaction.cr","line_number":121,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/transaction.cr#L121"},"def":{"name":"with_savepoint","args":[{"name":"sp_name","default_value":"nil","external_name":"sp_name","restriction":"Symbolic | ::Nil"},{"name":"connection_name","default_value":"\"default\"","external_name":"connection_name","restriction":"String"}],"yields":0,"block_arity":0,"visibility":"Public","body":"transaction do |cnx|\n begin\n sp_name || (sp_name = \"sp_#{@@savepoint_uid = @@savepoint_uid + 1}\")\n execute(connection_name, \"SAVEPOINT #{sp_name}\")\n yield\n if cnx._clear_in_transaction?\n execute(connection_name, \"RELEASE SAVEPOINT #{sp_name}\")\n end\n rescue e : RollbackError\n if cnx._clear_in_transaction?\n execute(connection_name, \"ROLLBACK TO SAVEPOINT #{sp_name}\")\n if e.savepoint_id.try(&.!=(sp_name))\n raise(e)\n end\n end\n end\nend"}}],"types":[{"html_id":"clear/Clear/SQL/Transaction/Level","path":"Clear/SQL/Transaction/Level.html","kind":"enum","full_name":"Clear::SQL::Transaction::Level","name":"Level","abstract":false,"ancestors":[{"html_id":"clear/Enum","kind":"struct","full_name":"Enum","name":"Enum"},{"html_id":"clear/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/sql/transaction.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/transaction.cr#L6"}],"repository_name":"clear","program":false,"enum":true,"alias":false,"const":false,"constants":[{"id":"ReadCommitted","name":"ReadCommitted","value":"0"},{"id":"RepeatableRead","name":"RepeatableRead","value":"1"},{"id":"Serializable","name":"Serializable","value":"2"}],"namespace":{"html_id":"clear/Clear/SQL/Transaction","kind":"module","full_name":"Clear::SQL::Transaction","name":"Transaction"},"doc":"Represents the differents levels of transactions\n as described in https://www.postgresql.org/docs/9.5/transaction-iso.html\n\n ReadUncommited is voluntarly ommited as it fallback to ReadCommited in PostgreSQL","summary":"

Represents the differents levels of transactions as described in https://www.postgresql.org/docs/9.5/transaction-iso.html

","instance_methods":[{"html_id":"read_committed?-instance-method","name":"read_committed?","abstract":false,"location":{"filename":"src/clear/sql/transaction.cr","line_number":7,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/transaction.cr#L7"},"def":{"name":"read_committed?","visibility":"Public","body":"self == ReadCommitted"}},{"html_id":"repeatable_read?-instance-method","name":"repeatable_read?","abstract":false,"location":{"filename":"src/clear/sql/transaction.cr","line_number":8,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/transaction.cr#L8"},"def":{"name":"repeatable_read?","visibility":"Public","body":"self == RepeatableRead"}},{"html_id":"serializable?-instance-method","name":"serializable?","abstract":false,"location":{"filename":"src/clear/sql/transaction.cr","line_number":9,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/transaction.cr#L9"},"def":{"name":"serializable?","visibility":"Public","body":"self == Serializable"}}]}]},{"html_id":"clear/Clear/SQL/UpdateQuery","path":"Clear/SQL/UpdateQuery.html","kind":"class","full_name":"Clear::SQL::UpdateQuery","name":"UpdateQuery","abstract":false,"superclass":{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"clear/Clear/SQL/Query/Execute","kind":"module","full_name":"Clear::SQL::Query::Execute","name":"Execute"},{"html_id":"clear/Clear/SQL/Query/Where","kind":"module","full_name":"Clear::SQL::Query::Where","name":"Where"},{"html_id":"clear/Clear/SQL/Query/Change","kind":"module","full_name":"Clear::SQL::Query::Change","name":"Change"},{"html_id":"clear/Clear/SQL/Query/Connection","kind":"module","full_name":"Clear::SQL::Query::Connection","name":"Connection"},{"html_id":"clear/Clear/SQL/Query/CTE","kind":"module","full_name":"Clear::SQL::Query::CTE","name":"CTE"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/sql/update_query.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/update_query.cr#L6"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"clear/Clear/SQL/Query/Change","kind":"module","full_name":"Clear::SQL::Query::Change","name":"Change"},{"html_id":"clear/Clear/SQL/Query/Connection","kind":"module","full_name":"Clear::SQL::Query::Connection","name":"Connection"},{"html_id":"clear/Clear/SQL/Query/CTE","kind":"module","full_name":"Clear::SQL::Query::CTE","name":"CTE"},{"html_id":"clear/Clear/SQL/Query/Execute","kind":"module","full_name":"Clear::SQL::Query::Execute","name":"Execute"},{"html_id":"clear/Clear/SQL/Query/Where","kind":"module","full_name":"Clear::SQL::Query::Where","name":"Where"}],"namespace":{"html_id":"clear/Clear/SQL","kind":"module","full_name":"Clear::SQL","name":"SQL"},"doc":"TODO: Documentation","summary":"

TODO Documentation

","constructors":[{"html_id":"new(table:String|Symbol|Nil,wheres:Array(Clear::Expression::Node)=[]ofClear::Expression::Node)-class-method","name":"new","abstract":false,"args":[{"name":"table","external_name":"table","restriction":"::String | ::Symbol | ::Nil"},{"name":"wheres","default_value":"[] of Clear::Expression::Node","external_name":"wheres","restriction":"::Array(::Clear::Expression::Node)"}],"args_string":"(table : String | Symbol | Nil, wheres : Array(Clear::Expression::Node) = [] of Clear::Expression::Node)","args_html":"(table : String | Symbol | Nil, wheres : Array(Clear::Expression::Node) = [] of Clear::Expression::Node)","location":{"filename":"src/clear/sql/update_query.cr","line_number":19,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/update_query.cr#L19"},"def":{"name":"new","args":[{"name":"table","external_name":"table","restriction":"::String | ::Symbol | ::Nil"},{"name":"wheres","default_value":"[] of Clear::Expression::Node","external_name":"wheres","restriction":"::Array(::Clear::Expression::Node)"}],"visibility":"Public","body":"_ = allocate\n_.initialize(table, wheres)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"set(row:NamedTuple)-instance-method","name":"set","abstract":false,"args":[{"name":"row","external_name":"row","restriction":"NamedTuple"}],"args_string":"(row : NamedTuple)","args_html":"(row : NamedTuple)","location":{"filename":"src/clear/sql/update_query.cr","line_number":22,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/update_query.cr#L22"},"def":{"name":"set","args":[{"name":"row","external_name":"row","restriction":"NamedTuple"}],"visibility":"Public","body":"h = {} of String => Updatable\nrow.each do |k, v|\n h[k.to_s] = v\nend\nset(h)\nchange!\n"}},{"html_id":"set(row:String)-instance-method","name":"set","abstract":false,"args":[{"name":"row","external_name":"row","restriction":"String"}],"args_string":"(row : String)","args_html":"(row : String)","location":{"filename":"src/clear/sql/update_query.cr","line_number":33,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/update_query.cr#L33"},"def":{"name":"set","args":[{"name":"row","external_name":"row","restriction":"String"}],"visibility":"Public","body":"@values << row\nchange!\n"}},{"html_id":"set(row:Hash(String,Updatable))-instance-method","name":"set","abstract":false,"args":[{"name":"row","external_name":"row","restriction":"Hash(String, Updatable)"}],"args_string":"(row : Hash(String, Updatable))","args_html":"(row : Hash(String, Updatable))","location":{"filename":"src/clear/sql/update_query.cr","line_number":38,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/update_query.cr#L38"},"def":{"name":"set","args":[{"name":"row","external_name":"row","restriction":"Hash(String, Updatable)"}],"visibility":"Public","body":"@values << (Hash(String, Updatable).new.merge(row))\nchange!\n"}},{"html_id":"set(**row)-instance-method","name":"set","abstract":false,"location":{"filename":"src/clear/sql/update_query.cr","line_number":29,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/update_query.cr#L29"},"def":{"name":"set","double_splat":{"name":"row","external_name":"row","restriction":""},"visibility":"Public","body":"set(row)"}},{"html_id":"to_sql-instance-method","name":"to_sql","abstract":false,"location":{"filename":"src/clear/sql/update_query.cr","line_number":62,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/update_query.cr#L62"},"def":{"name":"to_sql","visibility":"Public","body":"table = @table.is_a?(Symbol) ? SQL.escape(@table.to_s) : @table\n[print_ctes, \"UPDATE\", table, \"SET\", print_values, print_wheres].compact.join(\" \")\n"}},{"html_id":"wheres:Array(Clear::Expression::Node)-instance-method","name":"wheres","doc":"Return the list of where clause; each where clause are transformed into\nClear::Expression::Node","summary":"

Return the list of where clause; each where clause are transformed into Clear::Expression::Node

","abstract":false,"def":{"name":"wheres","return_type":"Array(Clear::Expression::Node)","visibility":"Public","body":"@wheres"}}],"types":[{"html_id":"clear/Clear/SQL/UpdateQuery/Updatable","path":"Clear/SQL/UpdateQuery/Updatable.html","kind":"alias","full_name":"Clear::SQL::UpdateQuery::Updatable","name":"Updatable","abstract":false,"locations":[{"filename":"src/clear/sql/update_query.cr","line_number":7,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/update_query.cr#L7"}],"repository_name":"clear","program":false,"enum":false,"alias":true,"aliased":"(Array(PG::BoolArray) | Array(PG::CharArray) | Array(PG::Float32Array) | Array(PG::Float64Array) | Array(PG::Int16Array) | Array(PG::Int32Array) | Array(PG::Int64Array) | Array(PG::NumericArray) | Array(PG::StringArray) | Array(PG::TimeArray) | Array(PG::UUIDArray) | BigDecimal | BigFloat | BigInt | Bool | Char | Clear::Expression::Literal | Crypto::Bcrypt::Password | Float32 | Float64 | Int16 | Int32 | Int64 | Int8 | JSON::Any | JSON::PullParser | PG::Geo::Box | PG::Geo::Circle | PG::Geo::Line | PG::Geo::LineSegment | PG::Geo::Path | PG::Geo::Point | PG::Geo::Polygon | PG::Interval | PG::Numeric | Slice(UInt8) | String | Time | UInt16 | UInt32 | UInt64 | UInt8 | UUID | Nil)","aliased_html":"Array(PG::BoolArray) | Array(PG::CharArray) | Array(PG::Float32Array) | Array(PG::Float64Array) | Array(PG::Int16Array) | Array(PG::Int32Array) | Array(PG::Int64Array) | Array(PG::NumericArray) | Array(PG::StringArray) | Array(PG::TimeArray) | Array(PG::UUIDArray) | BigDecimal | BigFloat | BigInt | Bool | Char | Clear::Expression::Literal | Crypto::Bcrypt::Password | Float32 | Float64 | Int16 | Int32 | Int64 | Int8 | JSON::Any | JSON::PullParser | PG::Geo::Box | PG::Geo::Circle | PG::Geo::Line | PG::Geo::LineSegment | PG::Geo::Path | PG::Geo::Point | PG::Geo::Polygon | PG::Interval | PG::Numeric | Slice(UInt8) | String | Time | UInt16 | UInt32 | UInt64 | UInt8 | UUID | Nil","const":false,"namespace":{"html_id":"clear/Clear/SQL/UpdateQuery","kind":"class","full_name":"Clear::SQL::UpdateQuery","name":"UpdateQuery"}},{"html_id":"clear/Clear/SQL/UpdateQuery/UpdateInstruction","path":"Clear/SQL/UpdateQuery/UpdateInstruction.html","kind":"alias","full_name":"Clear::SQL::UpdateQuery::UpdateInstruction","name":"UpdateInstruction","abstract":false,"locations":[{"filename":"src/clear/sql/update_query.cr","line_number":8,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/update_query.cr#L8"}],"repository_name":"clear","program":false,"enum":false,"alias":true,"aliased":"(Hash(String, Array(PG::BoolArray) | Array(PG::CharArray) | Array(PG::Float32Array) | Array(PG::Float64Array) | Array(PG::Int16Array) | Array(PG::Int32Array) | Array(PG::Int64Array) | Array(PG::NumericArray) | Array(PG::StringArray) | Array(PG::TimeArray) | Array(PG::UUIDArray) | BigDecimal | BigFloat | BigInt | Bool | Char | Clear::Expression::Literal | Crypto::Bcrypt::Password | Float32 | Float64 | Int16 | Int32 | Int64 | Int8 | JSON::Any | JSON::PullParser | PG::Geo::Box | PG::Geo::Circle | PG::Geo::Line | PG::Geo::LineSegment | PG::Geo::Path | PG::Geo::Point | PG::Geo::Polygon | PG::Interval | PG::Numeric | Slice(UInt8) | String | Time | UInt16 | UInt32 | UInt64 | UInt8 | UUID | Nil) | String)","aliased_html":"Hash(String, Array(PG::BoolArray) | Array(PG::CharArray) | Array(PG::Float32Array) | Array(PG::Float64Array) | Array(PG::Int16Array) | Array(PG::Int32Array) | Array(PG::Int64Array) | Array(PG::NumericArray) | Array(PG::StringArray) | Array(PG::TimeArray) | Array(PG::UUIDArray) | BigDecimal | BigFloat | BigInt | Bool | Char | Clear::Expression::Literal | Crypto::Bcrypt::Password | Float32 | Float64 | Int16 | Int32 | Int64 | Int8 | JSON::Any | JSON::PullParser | PG::Geo::Box | PG::Geo::Circle | PG::Geo::Line | PG::Geo::LineSegment | PG::Geo::Path | PG::Geo::Point | PG::Geo::Polygon | PG::Interval | PG::Numeric | Slice(UInt8) | String | Time | UInt16 | UInt32 | UInt64 | UInt8 | UUID | Nil) | String","const":false,"namespace":{"html_id":"clear/Clear/SQL/UpdateQuery","kind":"class","full_name":"Clear::SQL::UpdateQuery","name":"UpdateQuery"}}]}]},{"html_id":"clear/Clear/TimeInDay","path":"Clear/TimeInDay.html","kind":"struct","full_name":"Clear::TimeInDay","name":"TimeInDay","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/extensions/time_in_days/time_in_day.cr","line_number":29,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/time_in_days/time_in_day.cr#L29"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear","kind":"module","full_name":"Clear","name":"Clear"},"doc":"`Clear::TimeInDay` represents the \"time\" object of PostgreSQL\n\nIt can be converted automatically from/to a `time` column.\nIt offers helpers which makes it usable also as a stand alone.\n\n## Usage example\n\n```\ntime = Clear::TimeInDay.parse(\"12:33\")\nputs time.hour # 12\nputs time.minutes # 0\n\nTime.local.at(time) # Today at 12:33:00\ntime.to_s # 12:33:00\ntime.to_s(false) # don't show seconds => 12:33\n\ntime = time + 2.minutes # 12:35\n```\n\nAs with Interval, you might wanna use it as a column (use underlying `time` type in PostgreSQL):\n\n```\nclass MyModel\n include Clear::Model\n\n column time_in_day : Clear::TimeInDay\nend\n```","summary":"

Clear::TimeInDay represents the "time" object of PostgreSQL

","class_methods":[{"html_id":"parse(str:String)-class-method","name":"parse","doc":"Parse a string, of format HH:MM or HH:MM:SS","summary":"

Parse a string, of format HH:MM or HH:MM:SS

","abstract":false,"args":[{"name":"str","external_name":"str","restriction":"String"}],"args_string":"(str : String)","args_html":"(str : String)","location":{"filename":"src/clear/extensions/time_in_days/time_in_day.cr","line_number":113,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/time_in_days/time_in_day.cr#L113"},"def":{"name":"parse","args":[{"name":"str","external_name":"str","restriction":"String"}],"visibility":"Public","body":"if str =~ (/^[0-9]+:[0-9]{2}(:[0-9]{2})?$/)\nelse\n raise(\"Wrong format\")\nend\narr = (str.split(/\\:/)).map(&.try(&.to_i))\nhours = arr[0]\nminutes = arr[1]\nseconds = arr[2]?\nif seconds\n return Clear::TimeInDay.new(hours, minutes, seconds)\nend\nClear::TimeInDay.new(hours, minutes)\n"}}],"constructors":[{"html_id":"new(hours,minutes,seconds=0)-class-method","name":"new","abstract":false,"args":[{"name":"hours","external_name":"hours","restriction":""},{"name":"minutes","external_name":"minutes","restriction":""},{"name":"seconds","default_value":"0","external_name":"seconds","restriction":""}],"args_string":"(hours, minutes, seconds = 0)","args_html":"(hours, minutes, seconds = 0)","location":{"filename":"src/clear/extensions/time_in_days/time_in_day.cr","line_number":36,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/time_in_days/time_in_day.cr#L36"},"def":{"name":"new","args":[{"name":"hours","external_name":"hours","restriction":""},{"name":"minutes","external_name":"minutes","restriction":""},{"name":"seconds","default_value":"0","external_name":"seconds","restriction":""}],"visibility":"Public","body":"_ = allocate\n_.initialize(hours, minutes, seconds)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new(microseconds:UInt64=0)-class-method","name":"new","abstract":false,"args":[{"name":"microseconds","default_value":"0","external_name":"microseconds","restriction":"UInt64"}],"args_string":"(microseconds : UInt64 = 0)","args_html":"(microseconds : UInt64 = 0)","location":{"filename":"src/clear/extensions/time_in_days/time_in_day.cr","line_number":40,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/time_in_days/time_in_day.cr#L40"},"def":{"name":"new","args":[{"name":"microseconds","default_value":"0","external_name":"microseconds","restriction":"UInt64"}],"visibility":"Public","body":"_ = allocate\n_.initialize(microseconds)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"+(t:Time::Span)-instance-method","name":"+","abstract":false,"args":[{"name":"t","external_name":"t","restriction":"Time::Span"}],"args_string":"(t : Time::Span)","args_html":"(t : Time::Span)","location":{"filename":"src/clear/extensions/time_in_days/time_in_day.cr","line_number":43,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/time_in_days/time_in_day.cr#L43"},"def":{"name":"+","args":[{"name":"t","external_name":"t","restriction":"Time::Span"}],"visibility":"Public","body":"Clear::TimeInDay.new(microseconds: @microseconds + (t.total_nanoseconds.to_i64 // 1000))"}},{"html_id":"+(x:self)-instance-method","name":"+","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"self"}],"args_string":"(x : self)","args_html":"(x : self)","location":{"filename":"src/clear/extensions/time_in_days/time_in_day.cr","line_number":51,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/time_in_days/time_in_day.cr#L51"},"def":{"name":"+","args":[{"name":"x","external_name":"x","restriction":"self"}],"visibility":"Public","body":"TimeInDay.new(@microseconds + x.ms)"}},{"html_id":"-(t:Time::Span)-instance-method","name":"-","abstract":false,"args":[{"name":"t","external_name":"t","restriction":"Time::Span"}],"args_string":"(t : Time::Span)","args_html":"(t : Time::Span)","location":{"filename":"src/clear/extensions/time_in_days/time_in_day.cr","line_number":47,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/time_in_days/time_in_day.cr#L47"},"def":{"name":"-","args":[{"name":"t","external_name":"t","restriction":"Time::Span"}],"visibility":"Public","body":"Clear::TimeInDay.new(microseconds: @microseconds - (t.total_nanoseconds.to_i64 // 1000))"}},{"html_id":"hour-instance-method","name":"hour","abstract":false,"location":{"filename":"src/clear/extensions/time_in_days/time_in_day.cr","line_number":55,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/time_in_days/time_in_day.cr#L55"},"def":{"name":"hour","visibility":"Public","body":"(@microseconds // HOUR)"}},{"html_id":"inspect-instance-method","name":"inspect","doc":"Returns an unambiguous and information-rich string representation of this\nobject, typically intended for developers.\n\nThis method should usually **not** be overridden. It delegates to\n`#inspect(IO)` which can be overridden for custom implementations.\n\nAlso see `#to_s`.","summary":"

Returns an unambiguous and information-rich string representation of this object, typically intended for developers.

","abstract":false,"location":{"filename":"src/clear/extensions/time_in_days/time_in_day.cr","line_number":79,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/time_in_days/time_in_day.cr#L79"},"def":{"name":"inspect","visibility":"Public","body":"\"#{self.class.name}(#{self})\""}},{"html_id":"microseconds:UInt64-instance-method","name":"microseconds","abstract":false,"location":{"filename":"src/clear/extensions/time_in_days/time_in_day.cr","line_number":30,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/time_in_days/time_in_day.cr#L30"},"def":{"name":"microseconds","return_type":"UInt64","visibility":"Public","body":"@microseconds"}},{"html_id":"minutes-instance-method","name":"minutes","abstract":false,"location":{"filename":"src/clear/extensions/time_in_days/time_in_day.cr","line_number":59,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/time_in_days/time_in_day.cr#L59"},"def":{"name":"minutes","visibility":"Public","body":"(@microseconds % HOUR) // MINUTE"}},{"html_id":"seconds-instance-method","name":"seconds","abstract":false,"location":{"filename":"src/clear/extensions/time_in_days/time_in_day.cr","line_number":63,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/time_in_days/time_in_day.cr#L63"},"def":{"name":"seconds","visibility":"Public","body":"(@microseconds % MINUTE) // SECOND"}},{"html_id":"to_json(json:JSON::Builder):Nil-instance-method","name":"to_json","abstract":false,"args":[{"name":"json","external_name":"json","restriction":"JSON::Builder"}],"args_string":"(json : JSON::Builder) : Nil","args_html":"(json : JSON::Builder) : Nil","location":{"filename":"src/clear/extensions/time_in_days/time_in_day.cr","line_number":108,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/time_in_days/time_in_day.cr#L108"},"def":{"name":"to_json","args":[{"name":"json","external_name":"json","restriction":"JSON::Builder"}],"return_type":"Nil","visibility":"Public","body":"json.string(to_s)"}},{"html_id":"to_s(show_seconds:Bool=true)-instance-method","name":"to_s","doc":"Returns a nicely readable and concise string representation of this object,\ntypically intended for users.\n\nThis method should usually **not** be overridden. It delegates to\n`#to_s(IO)` which can be overridden for custom implementations.\n\nAlso see `#inspect`.","summary":"

Returns a nicely readable and concise string representation of this object, typically intended for users.

","abstract":false,"args":[{"name":"show_seconds","default_value":"true","external_name":"show_seconds","restriction":"Bool"}],"args_string":"(show_seconds : Bool = true)","args_html":"(show_seconds : Bool = true)","location":{"filename":"src/clear/extensions/time_in_days/time_in_day.cr","line_number":83,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/time_in_days/time_in_day.cr#L83"},"def":{"name":"to_s","args":[{"name":"show_seconds","default_value":"true","external_name":"show_seconds","restriction":"Bool"}],"visibility":"Public","body":"io = IO::Memory.new\nto_s(io, show_seconds)\nio.rewind\nio.to_s\n"}},{"html_id":"to_s(io,show_seconds:Bool=true)-instance-method","name":"to_s","doc":"Return a string","summary":"

Return a string

","abstract":false,"args":[{"name":"io","external_name":"io","restriction":""},{"name":"show_seconds","default_value":"true","external_name":"show_seconds","restriction":"Bool"}],"args_string":"(io, show_seconds : Bool = true)","args_html":"(io, show_seconds : Bool = true)","location":{"filename":"src/clear/extensions/time_in_days/time_in_day.cr","line_number":91,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/time_in_days/time_in_day.cr#L91"},"def":{"name":"to_s","args":[{"name":"io","external_name":"io","restriction":""},{"name":"show_seconds","default_value":"true","external_name":"show_seconds","restriction":"Bool"}],"visibility":"Public","body":"hours, minutes, seconds = to_tuple\nif show_seconds\n io << ({hours.to_s.rjust(2, '0'), minutes.to_s.rjust(2, '0'), seconds.to_s.rjust(2, '0')}.join(':'))\nelse\n io << ({hours.to_s.rjust(2, '0'), minutes.to_s.rjust(2, '0')}.join(':'))\nend\n"}},{"html_id":"to_tuple-instance-method","name":"to_tuple","abstract":false,"location":{"filename":"src/clear/extensions/time_in_days/time_in_day.cr","line_number":71,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/time_in_days/time_in_day.cr#L71"},"def":{"name":"to_tuple","visibility":"Public","body":"hours, left = @microseconds.divmod(HOUR)\nminutes, left = left.divmod(MINUTE)\nseconds = left // SECOND\n{hours, minutes, seconds}\n"}},{"html_id":"total_seconds-instance-method","name":"total_seconds","abstract":false,"location":{"filename":"src/clear/extensions/time_in_days/time_in_day.cr","line_number":67,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/time_in_days/time_in_day.cr#L67"},"def":{"name":"total_seconds","visibility":"Public","body":"@microseconds // SECOND"}}],"types":[{"html_id":"clear/Clear/TimeInDay/Converter","path":"Clear/TimeInDay/Converter.html","kind":"module","full_name":"Clear::TimeInDay::Converter","name":"Converter","abstract":false,"locations":[{"filename":"src/clear/extensions/time_in_days/time_in_day_converter.cr","line_number":23,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/time_in_days/time_in_day_converter.cr#L23"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/TimeInDay","kind":"struct","full_name":"Clear::TimeInDay","name":"TimeInDay"},"class_methods":[{"html_id":"to_column(x):TimeInDay|Nil-class-method","name":"to_column","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x) : TimeInDay | Nil","args_html":"(x) : TimeInDay | Nil","location":{"filename":"src/clear/extensions/time_in_days/time_in_day_converter.cr","line_number":24,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/time_in_days/time_in_day_converter.cr#L24"},"def":{"name":"to_column","args":[{"name":"x","external_name":"x","restriction":""}],"return_type":"TimeInDay | ::Nil","visibility":"Public","body":"case x\nwhen TimeInDay\n x\nwhen UInt64\n TimeInDay.new(x)\nwhen Slice\n mem = IO::Memory.new(x, writeable: false)\n TimeInDay.new(mem.read_bytes(UInt64, IO::ByteFormat::BigEndian))\nwhen String\n TimeInDay.parse(x)\nwhen Nil\n nil\nelse\n raise(\"Cannot convert to TimeInDay from #{x.class}\")\nend"}},{"html_id":"to_db(x:TimeInDay|Nil)-class-method","name":"to_db","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"TimeInDay | ::Nil"}],"args_string":"(x : TimeInDay | Nil)","args_html":"(x : TimeInDay | Nil)","location":{"filename":"src/clear/extensions/time_in_days/time_in_day_converter.cr","line_number":42,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/time_in_days/time_in_day_converter.cr#L42"},"def":{"name":"to_db","args":[{"name":"x","external_name":"x","restriction":"TimeInDay | ::Nil"}],"visibility":"Public","body":"x ? x.to_s : nil"}}]}]},{"html_id":"clear/Clear/TSVector","path":"Clear/TSVector.html","kind":"class","full_name":"Clear::TSVector","name":"TSVector","abstract":false,"superclass":{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/extensions/full_text_searchable/tsvector.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/full_text_searchable/tsvector.cr#L1"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear","kind":"module","full_name":"Clear","name":"Clear"},"class_methods":[{"html_id":"decode(x:Slice(UInt8))-class-method","name":"decode","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Slice(UInt8)"}],"args_string":"(x : Slice(UInt8))","args_html":"(x : Slice(UInt8))","location":{"filename":"src/clear/extensions/full_text_searchable/tsvector.cr","line_number":70,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/full_text_searchable/tsvector.cr#L70"},"def":{"name":"decode","args":[{"name":"x","external_name":"x","restriction":"Slice(UInt8)"}],"visibility":"Public","body":"io = IO::Memory.new(x, writeable: false)\nClear::TSVector.new(io)\n"}}],"constructors":[{"html_id":"new(io)-class-method","name":"new","abstract":false,"args":[{"name":"io","external_name":"io","restriction":""}],"args_string":"(io)","args_html":"(io)","location":{"filename":"src/clear/extensions/full_text_searchable/tsvector.cr","line_number":56,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/full_text_searchable/tsvector.cr#L56"},"def":{"name":"new","args":[{"name":"io","external_name":"io","restriction":""}],"visibility":"Public","body":"_ = allocate\n_.initialize(io)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"[](key:String)-instance-method","name":"[]","abstract":false,"args":[{"name":"key","external_name":"key","restriction":"String"}],"args_string":"(key : String)","args_html":"(key : String)","location":{"filename":"src/clear/extensions/full_text_searchable/tsvector.cr","line_number":39,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/full_text_searchable/tsvector.cr#L39"},"def":{"name":"[]","args":[{"name":"key","external_name":"key","restriction":"String"}],"visibility":"Public","body":"lexems[key]"}},{"html_id":"[]?(key:String)-instance-method","name":"[]?","abstract":false,"args":[{"name":"key","external_name":"key","restriction":"String"}],"args_string":"(key : String)","args_html":"(key : String)","location":{"filename":"src/clear/extensions/full_text_searchable/tsvector.cr","line_number":43,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/full_text_searchable/tsvector.cr#L43"},"def":{"name":"[]?","args":[{"name":"key","external_name":"key","restriction":"String"}],"visibility":"Public","body":"lexems[key]?"}},{"html_id":"lexems:Hash(String,Lexem)-instance-method","name":"lexems","abstract":false,"location":{"filename":"src/clear/extensions/full_text_searchable/tsvector.cr","line_number":37,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/full_text_searchable/tsvector.cr#L37"},"def":{"name":"lexems","return_type":"Hash(String, Lexem)","visibility":"Public","body":"@lexems"}},{"html_id":"to_sql-instance-method","name":"to_sql","abstract":false,"location":{"filename":"src/clear/extensions/full_text_searchable/tsvector.cr","line_number":47,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/full_text_searchable/tsvector.cr#L47"},"def":{"name":"to_sql","visibility":"Public","body":"@lexems.values.join(\" \") do |v|\n {Clear::Expression[v.value], v.positions.join(\",\") do |p|\n {p.position, p.weight}.join\n end}.join(\":\")\nend"}}],"types":[{"html_id":"clear/Clear/TSVector/Converter","path":"Clear/TSVector/Converter.html","kind":"module","full_name":"Clear::TSVector::Converter","name":"Converter","abstract":false,"locations":[{"filename":"src/clear/extensions/full_text_searchable/tsvector.cr","line_number":75,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/full_text_searchable/tsvector.cr#L75"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/TSVector","kind":"class","full_name":"Clear::TSVector","name":"TSVector"},"class_methods":[{"html_id":"to_column(x):Clear::TSVector|Nil-class-method","name":"to_column","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x) : Clear::TSVector | Nil","args_html":"(x) : Clear::TSVector | Nil","location":{"filename":"src/clear/extensions/full_text_searchable/tsvector.cr","line_number":76,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/full_text_searchable/tsvector.cr#L76"},"def":{"name":"to_column","args":[{"name":"x","external_name":"x","restriction":""}],"return_type":"Clear::TSVector | ::Nil","visibility":"Public","body":"case x\nwhen Slice\n Clear::TSVector.decode(x.as(Slice(UInt8)))\nwhen Clear::TSVector\n x\nwhen Nil\n nil\nelse\n raise(Clear::ErrorMessages.converter_error(x.class, \"TSVector\"))\nend"}},{"html_id":"to_db(x:TSVector|Nil)-class-method","name":"to_db","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"TSVector | ::Nil"}],"args_string":"(x : TSVector | Nil)","args_html":"(x : TSVector | Nil)","location":{"filename":"src/clear/extensions/full_text_searchable/tsvector.cr","line_number":89,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/full_text_searchable/tsvector.cr#L89"},"def":{"name":"to_db","args":[{"name":"x","external_name":"x","restriction":"TSVector | ::Nil"}],"visibility":"Public","body":"x.try(&.to_sql)"}}]},{"html_id":"clear/Clear/TSVector/Lexem","path":"Clear/TSVector/Lexem.html","kind":"struct","full_name":"Clear::TSVector::Lexem","name":"Lexem","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/extensions/full_text_searchable/tsvector.cr","line_number":2,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/full_text_searchable/tsvector.cr#L2"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"WEIGHTS","name":"WEIGHTS","value":"['A', 'B', 'C', 'D']"}],"namespace":{"html_id":"clear/Clear/TSVector","kind":"class","full_name":"Clear::TSVector","name":"TSVector"},"constructors":[{"html_id":"new(io)-class-method","name":"new","abstract":false,"args":[{"name":"io","external_name":"io","restriction":""}],"args_string":"(io)","args_html":"(io)","location":{"filename":"src/clear/extensions/full_text_searchable/tsvector.cr","line_number":10,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/full_text_searchable/tsvector.cr#L10"},"def":{"name":"new","args":[{"name":"io","external_name":"io","restriction":""}],"visibility":"Public","body":"_ = allocate\n_.initialize(io)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"positions:Array(Position)-instance-method","name":"positions","abstract":false,"location":{"filename":"src/clear/extensions/full_text_searchable/tsvector.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/full_text_searchable/tsvector.cr#L6"},"def":{"name":"positions","return_type":"Array(Position)","visibility":"Public","body":"@positions"}},{"html_id":"value:String-instance-method","name":"value","abstract":false,"location":{"filename":"src/clear/extensions/full_text_searchable/tsvector.cr","line_number":5,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/full_text_searchable/tsvector.cr#L5"},"def":{"name":"value","return_type":"String","visibility":"Public","body":"@value"}}],"types":[{"html_id":"clear/Clear/TSVector/Lexem/Position","path":"Clear/TSVector/Lexem/Position.html","kind":"struct","full_name":"Clear::TSVector::Lexem::Position","name":"Position","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/extensions/full_text_searchable/tsvector.cr","line_number":3,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/full_text_searchable/tsvector.cr#L3"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/TSVector/Lexem","kind":"struct","full_name":"Clear::TSVector::Lexem","name":"Lexem"},"constructors":[{"html_id":"new(weight:Char,position:UInt16)-class-method","name":"new","abstract":false,"args":[{"name":"weight","external_name":"weight","restriction":"Char"},{"name":"position","external_name":"position","restriction":"UInt16"}],"args_string":"(weight : Char, position : UInt16)","args_html":"(weight : Char, position : UInt16)","location":{"filename":"src/clear/extensions/full_text_searchable/tsvector.cr","line_number":3,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/full_text_searchable/tsvector.cr#L3"},"def":{"name":"new","args":[{"name":"weight","external_name":"weight","restriction":"Char"},{"name":"position","external_name":"position","restriction":"UInt16"}],"visibility":"Public","body":"_ = allocate\n_.initialize(weight, position)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"clone-instance-method","name":"clone","abstract":false,"location":{"filename":"src/clear/extensions/full_text_searchable/tsvector.cr","line_number":3,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/full_text_searchable/tsvector.cr#L3"},"def":{"name":"clone","visibility":"Public","body":"self.class.new(@weight.clone, @position.clone)"}},{"html_id":"copy_with(weight_weight=@weight,position_position=@position)-instance-method","name":"copy_with","abstract":false,"args":[{"name":"_weight","default_value":"@weight","external_name":"weight","restriction":""},{"name":"_position","default_value":"@position","external_name":"position","restriction":""}],"args_string":"(weight _weight = @weight, position _position = @position)","args_html":"(weight _weight = @weight, position _position = @position)","location":{"filename":"src/clear/extensions/full_text_searchable/tsvector.cr","line_number":3,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/full_text_searchable/tsvector.cr#L3"},"def":{"name":"copy_with","args":[{"name":"_weight","default_value":"@weight","external_name":"weight","restriction":""},{"name":"_position","default_value":"@position","external_name":"position","restriction":""}],"visibility":"Public","body":"self.class.new(_weight, _position)"}},{"html_id":"position:UInt16-instance-method","name":"position","abstract":false,"def":{"name":"position","return_type":"UInt16","visibility":"Public","body":"@position"}},{"html_id":"weight:Char-instance-method","name":"weight","abstract":false,"def":{"name":"weight","return_type":"Char","visibility":"Public","body":"@weight"}}]}]}]},{"html_id":"clear/Clear/Util","path":"Clear/Util.html","kind":"module","full_name":"Clear::Util","name":"Util","abstract":false,"locations":[{"filename":"src/clear/util.cr","line_number":2,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/util.cr#L2"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"extended_modules":[{"html_id":"clear/Clear/Util","kind":"module","full_name":"Clear::Util","name":"Util"}],"namespace":{"html_id":"clear/Clear","kind":"module","full_name":"Clear","name":"Clear"},"doc":"A set of method(s) useful for building Clear ORM.","summary":"

A set of method(s) useful for building Clear ORM.

","instance_methods":[{"html_id":"hash_union(h1:Hash(A,B),h2:Hash(C,D))forallA,B,C,D-instance-method","name":"hash_union","doc":"Return a new hash which is union of two hash (some kind of deep merge)","summary":"

Return a new hash which is union of two hash (some kind of deep merge)

","abstract":false,"args":[{"name":"h1","external_name":"h1","restriction":"Hash(A, B)"},{"name":"h2","external_name":"h2","restriction":"Hash(C, D)"}],"args_string":"(h1 : Hash(A, B), h2 : Hash(C, D)) forall A, B, C, D","args_html":"(h1 : Hash(A, B), h2 : Hash(C, D)) forall A, B, C, D","location":{"filename":"src/clear/util.cr","line_number":12,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/util.cr#L12"},"def":{"name":"hash_union","args":[{"name":"h1","external_name":"h1","restriction":"Hash(A, B)"},{"name":"h2","external_name":"h2","restriction":"Hash(C, D)"}],"visibility":"Public","body":"o = Hash(A | C, B | D).new\nh1.each do |k, v|\n o[k] = v\nend\nh2.each do |k, v|\n case v\n when Hash\n if (v1 = o[k]).is_a?(Hash)\n o[k] = hash_union(v1, v)\n else\n o[k] = v\n end\n else\n o[k] = v\n end\nend\no\n"}},{"html_id":"lambda(u:U.class,v:V.class,&block:U->V)forallU,V-instance-method","name":"lambda","doc":"Equivalent to ruby's lambda with one parameter.\nThis method is useful combined with the macro system of Crystal.","summary":"

Equivalent to ruby's lambda with one parameter.

","abstract":false,"args":[{"name":"u","external_name":"u","restriction":"U.class"},{"name":"v","external_name":"v","restriction":"V.class"}],"args_string":"(u : U.class, v : V.class, &block : U -> V) forall U, V","args_html":"(u : U.class, v : V.class, &block : U -> V) forall U, V","location":{"filename":"src/clear/util.cr","line_number":7,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/util.cr#L7"},"def":{"name":"lambda","args":[{"name":"u","external_name":"u","restriction":"U.class"},{"name":"v","external_name":"v","restriction":"V.class"}],"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(U -> V)"},"visibility":"Public","body":"block"}}]},{"html_id":"clear/Clear/Validation","path":"Clear/Validation.html","kind":"module","full_name":"Clear::Validation","name":"Validation","abstract":false,"locations":[{"filename":"src/clear/model/validation/helper.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/validation/helper.cr#L1"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear","kind":"module","full_name":"Clear","name":"Clear"},"types":[{"html_id":"clear/Clear/Validation/Helper","path":"Clear/Validation/Helper.html","kind":"module","full_name":"Clear::Validation::Helper","name":"Helper","abstract":false,"locations":[{"filename":"src/clear/model/validation/helper.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/validation/helper.cr#L1"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"clear/Clear/Model/HasValidation","kind":"module","full_name":"Clear::Model::HasValidation","name":"HasValidation"}],"namespace":{"html_id":"clear/Clear/Validation","kind":"module","full_name":"Clear::Validation","name":"Validation"},"macros":[{"html_id":"ensure_than(field,message,&block)-macro","name":"ensure_than","doc":"Usage example:\n\n```\nensure_than email, \"must be an email\" do |v|\n EmailRegexp.valid?(v)\nend\n```","summary":"

Usage example:

","abstract":false,"args":[{"name":"field","external_name":"field","restriction":""},{"name":"message","external_name":"message","restriction":""}],"args_string":"(field, message, &block)","args_html":"(field, message, &block)","location":{"filename":"src/clear/model/validation/helper.cr","line_number":15,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/validation/helper.cr#L15"},"def":{"name":"ensure_than","args":[{"name":"field","external_name":"field","restriction":""},{"name":"message","external_name":"message","restriction":""}],"block_arg":{"name":"block","external_name":"block","restriction":""},"visibility":"Public","body":" if \n{{ field.id }}\n_column.defined?\n o = \n{{ field.id }}\n\n\n fn = Clear::Util.lambda(typeof(o), Object) \n{{ block }}\n\n\n unless fn.call(o)\n add_error(\n{{ field.stringify }}\n, \n{{ message }}\n)\n \nend\n \nend\n\n \n"}},{"html_id":"on_presence(*fields,&block)-macro","name":"on_presence","abstract":false,"args":[{"name":"fields","external_name":"fields","restriction":""}],"args_string":"(*fields, &block)","args_html":"(*fields, &block)","location":{"filename":"src/clear/model/validation/helper.cr","line_number":2,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/validation/helper.cr#L2"},"def":{"name":"on_presence","args":[{"name":"fields","external_name":"fields","restriction":""}],"splat_index":0,"block_arg":{"name":"block","external_name":"block","restriction":""},"visibility":"Public","body":" if \n{{ (fields.map do |x|\n \"self.#{x.id}_column.defined?\"\nend.join(\" && \")).id }}\n\n \n{{ yield }}\n\n \nend\n \n"}}]}]},{"html_id":"clear/Clear/View","path":"Clear/View.html","kind":"class","full_name":"Clear::View","name":"View","abstract":false,"superclass":{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/view/base.cr","line_number":48,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/view/base.cr#L48"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear","kind":"module","full_name":"Clear","name":"Clear"},"doc":"Create and maintain your database views directly in the code.\n\nYou could use the migration system to create and drop your views. However this\nis proven to be difficult, even more if you want to update a view which depends on\nanother subviews.\n\n## How it works ?\n\nWhen you migrate using the migration system, all the views registered\nare going to be destroyed and recreated again.\nOrder of creation depends of the requirement for each views\n\n## Example\n\n```\nClear::View.register :room_per_days do |view|\n view.require(:rooms, :year_days)\n\n view.query <<-SQL\n SELECT room_id, day\n FROM year_days\n CROSS JOIN rooms\n SQL\nend\n\nClear::View.register :rooms do |view|\n view.query <<-SQL\n SELECT room.id as room_id\n FROM generate_series(1, 4) AS room(id)\n SQL\nend\n\nClear::View.register :year_days do |view|\n view.query <<-SQL\n SELECT date.day::date as day\n FROM generate_series(\n date_trunc('day', NOW()),\n date_trunc('day', NOW() + INTERVAL '364 days'),\n INTERVAL '1 day'\n ) AS date(day)\n SQL\nend\n```\n\nIn the example above, room_per_days will be first dropped before a migration\nstart and last created after the migration finished, to prevent issue where some\nviews are linked to others","summary":"

Create and maintain your database views directly in the code.

","class_methods":[{"html_id":"apply(direction:Symbol,view_name:String,apply_cache:Set(String))-class-method","name":"apply","doc":"install the view into postgresql using CREATE VIEW","summary":"

install the view into postgresql using CREATE VIEW

","abstract":false,"args":[{"name":"direction","external_name":"direction","restriction":"Symbol"},{"name":"view_name","external_name":"view_name","restriction":"String"},{"name":"apply_cache","external_name":"apply_cache","restriction":"Set(String)"}],"args_string":"(direction : Symbol, view_name : String, apply_cache : Set(String))","args_html":"(direction : Symbol, view_name : String, apply_cache : Set(String))","location":{"filename":"src/clear/view/base.cr","line_number":76,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/view/base.cr#L76"},"def":{"name":"apply","args":[{"name":"direction","external_name":"direction","restriction":"Symbol"},{"name":"view_name","external_name":"view_name","restriction":"String"},{"name":"apply_cache","external_name":"apply_cache","restriction":"Set(String)"}],"visibility":"Public","body":"if apply_cache.includes?(view_name)\n return\nend\nview = @@views[view_name]\nview.requirement.each do |dep_view|\n apply(direction, dep_view, apply_cache)\nend\nClear::SQL.execute(view.connection, direction == (:drop) ? view.to_drop_sql : view.to_create_sql)\napply_cache << view_name\n"}},{"html_id":"apply(direction:Symbol,apply_cache=Set(String).new)-class-method","name":"apply","doc":"install the view into postgresql using CREATE VIEW","summary":"

install the view into postgresql using CREATE VIEW

","abstract":false,"args":[{"name":"direction","external_name":"direction","restriction":"Symbol"},{"name":"apply_cache","default_value":"Set(String).new","external_name":"apply_cache","restriction":""}],"args_string":"(direction : Symbol, apply_cache = Set(String).new)","args_html":"(direction : Symbol, apply_cache = Set(String).new)","location":{"filename":"src/clear/view/base.cr","line_number":68,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/view/base.cr#L68"},"def":{"name":"apply","args":[{"name":"direction","external_name":"direction","restriction":"Symbol"},{"name":"apply_cache","default_value":"Set(String).new","external_name":"apply_cache","restriction":""}],"visibility":"Public","body":"@@views.values.each do |view|\n if apply_cache.includes?(view.name)\n next\n end\n apply(direction, view.name, apply_cache)\nend"}},{"html_id":"register(name:Clear::SQL::Symbolic,&)-class-method","name":"register","doc":"Call the DSL to register a new view\n\n```\nClear::View.register(:name) do |view|\n # describe the view here.\nend\n```","summary":"

Call the DSL to register a new view

","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Clear::SQL::Symbolic"}],"args_string":"(name : Clear::SQL::Symbolic, &)","args_html":"(name : Clear::SQL::Symbolic, &)","location":{"filename":"src/clear/view/base.cr","line_number":56,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/view/base.cr#L56"},"def":{"name":"register","args":[{"name":"name","external_name":"name","restriction":"Clear::SQL::Symbolic"}],"yields":1,"block_arity":1,"visibility":"Public","body":"view = Clear::View.new\nview.name(name)\nyield view\nif view.name == \"\"\n raise(\"Your view need to have a name\")\nend\nif view.query == \"\"\n raise(\"View `#{view.name}` need to have a query body\")\nend\n@@views[view.name] = view\n"}}],"instance_methods":[{"html_id":"connection(connection:String)-instance-method","name":"connection","doc":"database connection where is installed the view","summary":"

database connection where is installed the view

","abstract":false,"args":[{"name":"connection","external_name":"connection","restriction":"String"}],"args_string":"(connection : String)","args_html":"(connection : String)","location":{"filename":"src/clear/view/base.cr","line_number":118,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/view/base.cr#L118"},"def":{"name":"connection","args":[{"name":"connection","external_name":"connection","restriction":"String"}],"visibility":"Public","body":"@connection = connection"}},{"html_id":"connection:String-instance-method","name":"connection","abstract":false,"location":{"filename":"src/clear/view/base.cr","line_number":99,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/view/base.cr#L99"},"def":{"name":"connection","return_type":"String","visibility":"Public","body":"@connection"}},{"html_id":"full_name-instance-method","name":"full_name","abstract":false,"location":{"filename":"src/clear/view/base.cr","line_number":137,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/view/base.cr#L137"},"def":{"name":"full_name","visibility":"Public","body":"{@schema, @name}.join(\".\") do |x|\n Clear::SQL.escape(x)\nend"}},{"html_id":"materialized(mat:Bool)-instance-method","name":"materialized","doc":"whether the view is materialized or not. I would recommend to use\nmigration execute create/drop whenever the view is a materialized view","summary":"

whether the view is materialized or not.

","abstract":false,"args":[{"name":"mat","external_name":"mat","restriction":"Bool"}],"args_string":"(mat : Bool)","args_html":"(mat : Bool)","location":{"filename":"src/clear/view/base.cr","line_number":124,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/view/base.cr#L124"},"def":{"name":"materialized","args":[{"name":"mat","external_name":"mat","restriction":"Bool"}],"visibility":"Public","body":"@materialized = mat"}},{"html_id":"materialized?:Bool-instance-method","name":"materialized?","abstract":false,"location":{"filename":"src/clear/view/base.cr","line_number":100,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/view/base.cr#L100"},"def":{"name":"materialized?","return_type":"Bool","visibility":"Public","body":"@materialized"}},{"html_id":"name(value:String|Symbol)-instance-method","name":"name","doc":"name of the view","summary":"

name of the view

","abstract":false,"args":[{"name":"value","external_name":"value","restriction":"String | Symbol"}],"args_string":"(value : String | Symbol)","args_html":"(value : String | Symbol)","location":{"filename":"src/clear/view/base.cr","line_number":103,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/view/base.cr#L103"},"def":{"name":"name","args":[{"name":"value","external_name":"value","restriction":"String | Symbol"}],"visibility":"Public","body":"@name = value.to_s"}},{"html_id":"name:String-instance-method","name":"name","abstract":false,"location":{"filename":"src/clear/view/base.cr","line_number":95,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/view/base.cr#L95"},"def":{"name":"name","return_type":"String","visibility":"Public","body":"@name"}},{"html_id":"query(query:String)-instance-method","name":"query","doc":"query body related to the view. Must be a SELECT clause","summary":"

query body related to the view.

","abstract":false,"args":[{"name":"query","external_name":"query","restriction":"String"}],"args_string":"(query : String)","args_html":"(query : String)","location":{"filename":"src/clear/view/base.cr","line_number":113,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/view/base.cr#L113"},"def":{"name":"query","args":[{"name":"query","external_name":"query","restriction":"String"}],"visibility":"Public","body":"@query = query"}},{"html_id":"query:String-instance-method","name":"query","abstract":false,"location":{"filename":"src/clear/view/base.cr","line_number":97,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/view/base.cr#L97"},"def":{"name":"query","return_type":"String","visibility":"Public","body":"@query"}},{"html_id":"require(*req)-instance-method","name":"require","doc":"list of dependencies from the other view related to this view","summary":"

list of dependencies from the other view related to this view

","abstract":false,"args":[{"name":"req","external_name":"req","restriction":""}],"args_string":"(*req)","args_html":"(*req)","location":{"filename":"src/clear/view/base.cr","line_number":129,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/view/base.cr#L129"},"def":{"name":"require","args":[{"name":"req","external_name":"req","restriction":""}],"splat_index":0,"visibility":"Public","body":"req.map(&.to_s).each do |s|\n @requirement.add(s)\nend"}},{"html_id":"requirement:Set(String)-instance-method","name":"requirement","abstract":false,"location":{"filename":"src/clear/view/base.cr","line_number":98,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/view/base.cr#L98"},"def":{"name":"requirement","visibility":"Public","body":"@requirement"}},{"html_id":"schema(value:String|Symbol)-instance-method","name":"schema","doc":"schema to store the view (default public)","summary":"

schema to store the view (default public)

","abstract":false,"args":[{"name":"value","external_name":"value","restriction":"String | Symbol"}],"args_string":"(value : String | Symbol)","args_html":"(value : String | Symbol)","location":{"filename":"src/clear/view/base.cr","line_number":108,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/view/base.cr#L108"},"def":{"name":"schema","args":[{"name":"value","external_name":"value","restriction":"String | Symbol"}],"visibility":"Public","body":"@schema = value.to_s"}},{"html_id":"schema:String-instance-method","name":"schema","abstract":false,"location":{"filename":"src/clear/view/base.cr","line_number":96,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/view/base.cr#L96"},"def":{"name":"schema","return_type":"String","visibility":"Public","body":"@schema"}},{"html_id":"to_create_sql-instance-method","name":"to_create_sql","abstract":false,"location":{"filename":"src/clear/view/base.cr","line_number":141,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/view/base.cr#L141"},"def":{"name":"to_create_sql","visibility":"Public","body":"{\"CREATE OR REPLACE\", (materialized? ? \"MATERIALIZED VIEW\" : \"VIEW\"), full_name, \"AS (\", @query, \")\"}.join(' ')"}},{"html_id":"to_drop_sql-instance-method","name":"to_drop_sql","abstract":false,"location":{"filename":"src/clear/view/base.cr","line_number":133,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/view/base.cr#L133"},"def":{"name":"to_drop_sql","visibility":"Public","body":"\"DROP VIEW IF EXISTS #{@name}\""}}]}]},{"html_id":"clear/Slice","path":"Slice.html","kind":"struct","full_name":"Slice(T)","name":"Slice","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"},{"html_id":"clear/Indexable/Mutable","kind":"module","full_name":"Indexable::Mutable","name":"Mutable"},{"html_id":"clear/Indexable","kind":"module","full_name":"Indexable","name":"Indexable"},{"html_id":"clear/Enumerable","kind":"module","full_name":"Enumerable","name":"Enumerable"},{"html_id":"clear/Iterable","kind":"module","full_name":"Iterable","name":"Iterable"},{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/extensions/core_ext.cr","line_number":109,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/core_ext.cr#L109"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"clear/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"},{"html_id":"clear/Indexable/Mutable","kind":"module","full_name":"Indexable::Mutable","name":"Mutable"}],"doc":"A `Slice` is a `Pointer` with an associated size.\n\nWhile a pointer is unsafe because no bound checks are performed when reading from and writing to it,\nreading from and writing to a slice involve bound checks.\nIn this way, a slice is a safe alternative to `Pointer`.\n\nA Slice can be created as read-only: trying to write to it\nwill raise. For example the slice of bytes returned by\n`String#to_slice` is read-only.","summary":"

A Slice is a Pointer with an associated size.

","instance_methods":[{"html_id":"to_json(json:JSON::Builder)-instance-method","name":"to_json","abstract":false,"args":[{"name":"json","external_name":"json","restriction":"JSON::Builder"}],"args_string":"(json : JSON::Builder)","args_html":"(json : JSON::Builder)","location":{"filename":"src/clear/extensions/core_ext.cr","line_number":110,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/core_ext.cr#L110"},"def":{"name":"to_json","args":[{"name":"json","external_name":"json","restriction":"JSON::Builder"}],"visibility":"Public","body":"json.string(Base64.strict_encode(to_s))"}}]},{"html_id":"clear/Time","path":"Time.html","kind":"struct","full_name":"Time","name":"Time","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Steppable","kind":"module","full_name":"Steppable","name":"Steppable"},{"html_id":"clear/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"},{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/extensions/interval/interval_converter.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/interval/interval_converter.cr#L1"},{"filename":"src/clear/extensions/time_in_days/time_in_day_converter.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/time_in_days/time_in_day_converter.cr#L1"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"clear/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"},{"html_id":"clear/Steppable","kind":"module","full_name":"Steppable","name":"Steppable"}],"doc":"`Time` represents a date-time instant in\n[incremental time](https://www.w3.org/International/articles/definitions-time/#incremental_time)\nobserved in a specific time zone.\n\nThe calendaric calculations are based on the rules of the proleptic Gregorian\ncalendar as specified in [ISO 8601](http://xml.coverpages.org/ISO-FDIS-8601.pdf).\nLeap seconds are ignored.\n\nInternally, the time is stored as an `Int64` representing seconds from epoch\n(`0001-01-01 00:00:00.0 UTC`) and an `Int32` representing\nnanosecond-of-second with value range `0..999_999_999`.\n\nThe supported date range is `0001-01-01 00:00:00.0` to\n`9999-12-31 23:59:59.999_999_999` in any local time zone.\n\n### Telling the Time\n\nThere are several methods to retrieve a `Time` instance representing the\ncurrent time:\n\n```\nTime.utc # returns the current time in UTC\nTime.local Time::Location.load(\"Europe/Berlin\") # returns the current time in time zone Europe/Berlin\nTime.local # returns the current time in current time zone\n```\n\nIt is generally recommended to keep instances in UTC and only apply a\nlocal time zone when formatting for user display, unless the domain logic\nrequires having a specific time zone (for example for calendaric operations).\n\n### Creating a Specific Instant\n\n`Time` instances representing a specific instant can be created by\n`.utc` or `.new` with the date-time specified as individual arguments:\n\n```\ntime = Time.utc(2016, 2, 15, 10, 20, 30)\ntime.to_s # => \"2016-02-15 10:20:30 UTC\"\ntime = Time.local(2016, 2, 15, 10, 20, 30, location: Time::Location.load(\"Europe/Berlin\"))\ntime.to_s # => \"2016-02-15 10:20:30 +01:00\"\n# The time-of-day can be omitted and defaults to midnight (start of day):\ntime = Time.utc(2016, 2, 15)\ntime.to_s # => \"2016-02-15 00:00:00 UTC\"\n```\n\n### Retrieving Time Information\n\nEach `Time` instance allows querying calendar data:\n\n```\ntime = Time.utc(2016, 2, 15, 10, 20, 30)\ntime.year # => 2016\ntime.month # => 2\ntime.day # => 15\ntime.hour # => 10\ntime.minute # => 20\ntime.second # => 30\ntime.millisecond # => 0\ntime.nanosecond # => 0\ntime.day_of_week # => Time::DayOfWeek::Monday\ntime.day_of_year # => 46\ntime.monday? # => true\ntime.time_of_day # => 10:20:30\n```\n\nFor querying if a time is at a specific day of week, `Time` offers named\npredicate methods, delegating to `#day_of_week`:\n\n```\ntime.monday? # => true\n# ...\ntime.sunday? # => false\n```\n\n### Time Zones\n\nEach time is attached to a specific time zone, represented by a `Location`\n(see `#location`).\n`#zone` returns the time zone observed in this location at the current time\n(i.e. the instant represented by this `Time`).\n`#offset` returns the offset of the current zone in seconds.\n\n```\ntime = Time.local(2018, 3, 8, 22, 5, 13, location: Time::Location.load(\"Europe/Berlin\"))\ntime # => 2018-03-08 22:05:13 +01:00 Europe/Berlin\ntime.location # => #\ntime.zone # => #\ntime.offset # => 3600\n```\n\nUsing `.utc`, the location is `Time::Location::UTC`:\n\n```\ntime = Time.utc(2018, 3, 8, 22, 5, 13)\ntime # => 2018-03-08 22:05:13.0 UTC\ntime.location # => #\ntime.zone # => #\ntime.offset # => 0\n```\n\nA `Time` instance can be transformed to a different time zone while retaining\nthe same instant using `#in`:\n\n```\ntime_de = Time.local(2018, 3, 8, 22, 5, 13, location: Time::Location.load(\"Europe/Berlin\"))\ntime_ar = time_de.in Time::Location.load(\"America/Buenos_Aires\")\ntime_de # => 2018-03-08 22:05:13 +01:00 Europe/Berlin\ntime_ar # => 2018-03-08 18:05:13 -03:00 America/Buenos_Aires\n```\n\nBoth `Time` instances show a different local date-time, but they represent\nthe same date-time in the instant time-line, therefore they are considered\nequal:\n\n```\ntime_de.to_utc # => 2018-03-08 21:05:13 UTC\ntime_ar.to_utc # => 2018-03-08 21:05:13 UTC\ntime_de == time_ar # => true\n```\n\nThere are also two special methods for converting to UTC and local time zone:\n\n```\ntime.to_utc # equals time.in(Location::UTC)\ntime.to_local # equals time.in(Location.local)\n```\n\n`#to_local_in` allows changing the time zone while keeping\nthe same local date-time (wall clock) which results in a different instant\non the time line.\n\n### Formatting and Parsing Time\n\nTo make date-time instances exchangeable between different computer systems\nor readable to humans, they are usually converted to and from a string\nrepresentation.\n\nThe method `#to_s` formats the date-time according to a specified pattern.\n\n```\ntime = Time.utc(2015, 10, 12, 10, 30, 0)\ntime.to_s(\"%Y-%m-%d %H:%M:%S %:z\") # => \"2015-10-12 10:30:00 +00:00\"\n```\n\nSimilarly, `Time.parse` and `Time.parse!` are used to construct a `Time` instance from date-time\ninformation in a string, according to a specified pattern:\n\n```\nTime.parse(\"2015-10-12 10:30:00 +00:00\", \"%Y-%m-%d %H:%M:%S %z\", Time::Location::UTC)\nTime.parse!(\"2015-10-12 10:30:00 +00:00\", \"%Y-%m-%d %H:%M:%S %z\")\n```\n\nSee `Time::Format` for all directives.\n\n### Calculations\n\n```\nTime.utc(2015, 10, 10) - 5.days # => 2015-10-05 00:00:00 +00:00\n\nspan = Time.utc(2015, 10, 10) - Time.utc(2015, 9, 10)\nspan.days # => 30\nspan.total_hours # => 720\nspan.total_minutes # => 43200\n```\n\n## Measuring Time\n\nThe typical time representation provided by the operating system is based on\na \"wall clock\" which is subject to changes for clock synchronization.\nThis can result in discontinuous jumps in the time-line making it not\nsuitable for accurately measuring elapsed time.\n\nInstances of `Time` are focused on telling time – using a \"wall clock\".\nWhen `Time.local` is called multiple times, the difference between the\nreturned instances is not guaranteed to equal to the time elapsed between\nmaking the calls; even the order of the returned `Time` instances might\nnot reflect invocation order.\n\n```\nt1 = Time.utc\n# operation that takes 1 minute\nt2 = Time.utc\nt2 - t1 # => ?\n```\n\nThe resulting `Time::Span` could be anything, even negative, if the\ncomputer's wall clock has changed between both calls.\n\nAs an alternative, the operating system also provides a monotonic clock.\nIts time-line has no specified starting point but is strictly linearly\nincreasing.\n\nThis monotonic clock should always be used for measuring elapsed time.\n\nA reading from this clock can be taken using `.monotonic`:\n\n```\nt1 = Time.monotonic\n# operation that takes 1 minute\nt2 = Time.monotonic\nt2 - t1 # => 1.minute (approximately)\n```\n\nThe execution time of a block can be measured using `.measure`:\n\n```\nelapsed_time = Time.measure do\n # operation that takes 20 milliseconds\nend\nelapsed_time # => 20.milliseconds (approximately)\n```","summary":"

Time represents a date-time instant in incremental time observed in a specific time zone.

","instance_methods":[{"html_id":"+(interval:Clear::Interval)-instance-method","name":"+","abstract":false,"args":[{"name":"interval","external_name":"interval","restriction":"Clear::Interval"}],"args_string":"(interval : Clear::Interval)","args_html":"(interval : Clear::Interval)","location":{"filename":"src/clear/extensions/interval/interval_converter.cr","line_number":2,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/interval/interval_converter.cr#L2"},"def":{"name":"+","args":[{"name":"interval","external_name":"interval","restriction":"Clear::Interval"}],"visibility":"Public","body":"[interval.months.months, interval.days.days, interval.hours.hours, interval.minutes.minutes, interval.seconds.seconds, interval.milliseconds.milliseconds, interval.microseconds.microseconds].reduce(self) do |acc, e|\n acc + e\nend"}},{"html_id":"+(time_in_day:Clear::TimeInDay)-instance-method","name":"+","abstract":false,"args":[{"name":"time_in_day","external_name":"time_in_day","restriction":"Clear::TimeInDay"}],"args_string":"(time_in_day : Clear::TimeInDay)","args_html":"(time_in_day : Clear::TimeInDay)","location":{"filename":"src/clear/extensions/time_in_days/time_in_day_converter.cr","line_number":14,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/time_in_days/time_in_day_converter.cr#L14"},"def":{"name":"+","args":[{"name":"time_in_day","external_name":"time_in_day","restriction":"Clear::TimeInDay"}],"visibility":"Public","body":"self + time_in_day.microseconds.microseconds"}},{"html_id":"-(interval:Clear::Interval)-instance-method","name":"-","abstract":false,"args":[{"name":"interval","external_name":"interval","restriction":"Clear::Interval"}],"args_string":"(interval : Clear::Interval)","args_html":"(interval : Clear::Interval)","location":{"filename":"src/clear/extensions/interval/interval_converter.cr","line_number":14,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/interval/interval_converter.cr#L14"},"def":{"name":"-","args":[{"name":"interval","external_name":"interval","restriction":"Clear::Interval"}],"visibility":"Public","body":"[interval.months.months, interval.days.days, interval.hours.hours, interval.minutes.minutes, interval.seconds.seconds, interval.milliseconds.milliseconds, interval.microseconds.microseconds].reduce(self) do |acc, e|\n acc - e\nend"}},{"html_id":"-(time_in_day:Clear::TimeInDay)-instance-method","name":"-","abstract":false,"args":[{"name":"time_in_day","external_name":"time_in_day","restriction":"Clear::TimeInDay"}],"args_string":"(time_in_day : Clear::TimeInDay)","args_html":"(time_in_day : Clear::TimeInDay)","location":{"filename":"src/clear/extensions/time_in_days/time_in_day_converter.cr","line_number":18,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/time_in_days/time_in_day_converter.cr#L18"},"def":{"name":"-","args":[{"name":"time_in_day","external_name":"time_in_day","restriction":"Clear::TimeInDay"}],"visibility":"Public","body":"self - time_in_day.microseconds.microseconds"}},{"html_id":"at(time_in_day:Clear::TimeInDay,timezone=nil):Time-instance-method","name":"at","abstract":false,"args":[{"name":"time_in_day","external_name":"time_in_day","restriction":"Clear::TimeInDay"},{"name":"timezone","default_value":"nil","external_name":"timezone","restriction":""}],"args_string":"(time_in_day : Clear::TimeInDay, timezone = nil) : Time","args_html":"(time_in_day : Clear::TimeInDay, timezone = nil) : Time","location":{"filename":"src/clear/extensions/time_in_days/time_in_day_converter.cr","line_number":2,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/time_in_days/time_in_day_converter.cr#L2"},"def":{"name":"at","args":[{"name":"time_in_day","external_name":"time_in_day","restriction":"Clear::TimeInDay"},{"name":"timezone","default_value":"nil","external_name":"timezone","restriction":""}],"return_type":"Time","visibility":"Public","body":"if timezone\n if timezone.is_a?(String)\n timezone = Time::Location.load(timezone)\n end\n (self.in(timezone)).at_beginning_of_day + time_in_day.microseconds.microseconds\nelse\n at_beginning_of_day + time_in_day.microseconds.microseconds\nend"}}]},{"html_id":"clear/UUID","path":"UUID.html","kind":"struct","full_name":"UUID","name":"UUID","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"},{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/extensions/uuid/uuid.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/uuid/uuid.cr#L1"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"clear/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"}],"doc":"Represents a UUID (Universally Unique IDentifier).\n\nNOTE: To use `UUID`, you must explicitly import it with `require \"uuid\"`","summary":"

Represents a UUID (Universally Unique IDentifier).

","instance_methods":[{"html_id":"to_json(json:JSON::Builder)-instance-method","name":"to_json","abstract":false,"args":[{"name":"json","external_name":"json","restriction":"JSON::Builder"}],"args_string":"(json : JSON::Builder)","args_html":"(json : JSON::Builder)","location":{"filename":"src/clear/extensions/uuid/uuid.cr","line_number":2,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/uuid/uuid.cr#L2"},"def":{"name":"to_json","args":[{"name":"json","external_name":"json","restriction":"JSON::Builder"}],"visibility":"Public","body":"json.string(to_s)"}}]}]}} \ No newline at end of file diff --git a/js/doc.js b/js/doc.js new file mode 100644 index 000000000..eaedd5c32 --- /dev/null +++ b/js/doc.js @@ -0,0 +1,1099 @@ +window.CrystalDocs = (window.CrystalDocs || {}); + +CrystalDocs.base_path = (CrystalDocs.base_path || ""); + +CrystalDocs.searchIndex = (CrystalDocs.searchIndex || false); +CrystalDocs.MAX_RESULTS_DISPLAY = 140; + +CrystalDocs.runQuery = function(query) { + function searchType(type, query, results) { + var matches = []; + var matchedFields = []; + var name = type.full_name; + var i = name.lastIndexOf("::"); + if (i > 0) { + name = name.substring(i + 2); + } + var nameMatches = query.matches(name); + if (nameMatches){ + matches = matches.concat(nameMatches); + matchedFields.push("name"); + } + + var namespaceMatches = query.matchesNamespace(type.full_name); + if(namespaceMatches){ + matches = matches.concat(namespaceMatches); + matchedFields.push("name"); + } + + var docMatches = query.matches(type.doc); + if(docMatches){ + matches = matches.concat(docMatches); + matchedFields.push("doc"); + } + if (matches.length > 0) { + results.push({ + id: type.html_id, + result_type: "type", + kind: type.kind, + name: name, + full_name: type.full_name, + href: type.path, + summary: type.summary, + matched_fields: matchedFields, + matched_terms: matches + }); + } + + if (type.instance_methods) { + type.instance_methods.forEach(function(method) { + searchMethod(method, type, "instance_method", query, results); + }) + } + if (type.class_methods) { + type.class_methods.forEach(function(method) { + searchMethod(method, type, "class_method", query, results); + }) + } + if (type.constructors) { + type.constructors.forEach(function(constructor) { + searchMethod(constructor, type, "constructor", query, results); + }) + } + if (type.macros) { + type.macros.forEach(function(macro) { + searchMethod(macro, type, "macro", query, results); + }) + } + if (type.constants) { + type.constants.forEach(function(constant){ + searchConstant(constant, type, query, results); + }); + } + if (type.types) { + type.types.forEach(function(subtype){ + searchType(subtype, query, results); + }); + } + }; + + function searchMethod(method, type, kind, query, results) { + var matches = []; + var matchedFields = []; + var nameMatches = query.matchesMethod(method.name, kind, type); + if (nameMatches){ + matches = matches.concat(nameMatches); + matchedFields.push("name"); + } + + if (method.args) { + method.args.forEach(function(arg){ + var argMatches = query.matches(arg.external_name); + if (argMatches) { + matches = matches.concat(argMatches); + matchedFields.push("args"); + } + }); + } + + var docMatches = query.matches(type.doc); + if(docMatches){ + matches = matches.concat(docMatches); + matchedFields.push("doc"); + } + + if (matches.length > 0) { + var typeMatches = query.matches(type.full_name); + if (typeMatches) { + matchedFields.push("type"); + matches = matches.concat(typeMatches); + } + results.push({ + id: method.html_id, + type: type.full_name, + result_type: kind, + name: method.name, + full_name: type.full_name + "#" + method.name, + args_string: method.args_string, + summary: method.summary, + href: type.path + "#" + method.html_id, + matched_fields: matchedFields, + matched_terms: matches + }); + } + } + + function searchConstant(constant, type, query, results) { + var matches = []; + var matchedFields = []; + var nameMatches = query.matches(constant.name); + if (nameMatches){ + matches = matches.concat(nameMatches); + matchedFields.push("name"); + } + var docMatches = query.matches(constant.doc); + if(docMatches){ + matches = matches.concat(docMatches); + matchedFields.push("doc"); + } + if (matches.length > 0) { + var typeMatches = query.matches(type.full_name); + if (typeMatches) { + matchedFields.push("type"); + matches = matches.concat(typeMatches); + } + results.push({ + id: constant.id, + type: type.full_name, + result_type: "constant", + name: constant.name, + full_name: type.full_name + "#" + constant.name, + value: constant.value, + summary: constant.summary, + href: type.path + "#" + constant.id, + matched_fields: matchedFields, + matched_terms: matches + }); + } + } + + var results = []; + searchType(CrystalDocs.searchIndex.program, query, results); + return results; +}; + +CrystalDocs.rankResults = function(results, query) { + function uniqueArray(ar) { + var j = {}; + + ar.forEach(function(v) { + j[v + "::" + typeof v] = v; + }); + + return Object.keys(j).map(function(v) { + return j[v]; + }); + } + + results = results.sort(function(a, b) { + var matchedTermsDiff = uniqueArray(b.matched_terms).length - uniqueArray(a.matched_terms).length; + var aHasDocs = b.matched_fields.includes("doc"); + var bHasDocs = b.matched_fields.includes("doc"); + + var aOnlyDocs = aHasDocs && a.matched_fields.length == 1; + var bOnlyDocs = bHasDocs && b.matched_fields.length == 1; + + if (a.result_type == "type" && b.result_type != "type" && !aOnlyDocs) { + if(CrystalDocs.DEBUG) { console.log("a is type b not"); } + return -1; + } else if (b.result_type == "type" && a.result_type != "type" && !bOnlyDocs) { + if(CrystalDocs.DEBUG) { console.log("b is type, a not"); } + return 1; + } + if (a.matched_fields.includes("name")) { + if (b.matched_fields.includes("name")) { + var a_name = (CrystalDocs.prefixForType(a.result_type) || "") + ((a.result_type == "type") ? a.full_name : a.name); + var b_name = (CrystalDocs.prefixForType(b.result_type) || "") + ((b.result_type == "type") ? b.full_name : b.name); + a_name = a_name.toLowerCase(); + b_name = b_name.toLowerCase(); + for(var i = 0; i < query.normalizedTerms.length; i++) { + var term = query.terms[i].replace(/^::?|::?$/, ""); + var a_orig_index = a_name.indexOf(term); + var b_orig_index = b_name.indexOf(term); + if(CrystalDocs.DEBUG) { console.log("term: " + term + " a: " + a_name + " b: " + b_name); } + if(CrystalDocs.DEBUG) { console.log(a_orig_index, b_orig_index, a_orig_index - b_orig_index); } + if (a_orig_index >= 0) { + if (b_orig_index >= 0) { + if(CrystalDocs.DEBUG) { console.log("both have exact match", a_orig_index > b_orig_index ? -1 : 1); } + if(a_orig_index != b_orig_index) { + if(CrystalDocs.DEBUG) { console.log("both have exact match at different positions", a_orig_index > b_orig_index ? 1 : -1); } + return a_orig_index > b_orig_index ? 1 : -1; + } + } else { + if(CrystalDocs.DEBUG) { console.log("a has exact match, b not"); } + return -1; + } + } else if (b_orig_index >= 0) { + if(CrystalDocs.DEBUG) { console.log("b has exact match, a not"); } + return 1; + } + } + } else { + if(CrystalDocs.DEBUG) { console.log("a has match in name, b not"); } + return -1; + } + } else if ( + !a.matched_fields.includes("name") && + b.matched_fields.includes("name") + ) { + return 1; + } + + if (matchedTermsDiff != 0 || (aHasDocs != bHasDocs)) { + if(CrystalDocs.DEBUG) { console.log("matchedTermsDiff: " + matchedTermsDiff, aHasDocs, bHasDocs); } + return matchedTermsDiff; + } + + var matchedFieldsDiff = b.matched_fields.length - a.matched_fields.length; + if (matchedFieldsDiff != 0) { + if(CrystalDocs.DEBUG) { console.log("matched to different number of fields: " + matchedFieldsDiff); } + return matchedFieldsDiff > 0 ? 1 : -1; + } + + var nameCompare = a.name.localeCompare(b.name); + if(nameCompare != 0){ + if(CrystalDocs.DEBUG) { console.log("nameCompare resulted in: " + a.name + "<=>" + b.name + ": " + nameCompare); } + return nameCompare > 0 ? 1 : -1; + } + + if(a.matched_fields.includes("args") && b.matched_fields.includes("args")) { + for(var i = 0; i < query.terms.length; i++) { + var term = query.terms[i]; + var aIndex = a.args_string.indexOf(term); + var bIndex = b.args_string.indexOf(term); + if(CrystalDocs.DEBUG) { console.log("index of " + term + " in args_string: " + aIndex + " - " + bIndex); } + if(aIndex >= 0){ + if(bIndex >= 0){ + if(aIndex != bIndex){ + return aIndex > bIndex ? 1 : -1; + } + }else{ + return -1; + } + }else if(bIndex >= 0) { + return 1; + } + } + } + + return 0; + }); + + if (results.length > 1) { + // if we have more than two search terms, only include results with the most matches + var bestMatchedTerms = uniqueArray(results[0].matched_terms).length; + + results = results.filter(function(result) { + return uniqueArray(result.matched_terms).length + 1 >= bestMatchedTerms; + }); + } + return results; +}; + +CrystalDocs.prefixForType = function(type) { + switch (type) { + case "instance_method": + return "#"; + + case "class_method": + case "macro": + case "constructor": + return "."; + + default: + return false; + } +}; + +CrystalDocs.displaySearchResults = function(results, query) { + function sanitize(html){ + return html.replace(/<(?!\/?code)[^>]+>/g, ""); + } + + // limit results + if (results.length > CrystalDocs.MAX_RESULTS_DISPLAY) { + results = results.slice(0, CrystalDocs.MAX_RESULTS_DISPLAY); + } + + var $frag = document.createDocumentFragment(); + var $resultsElem = document.querySelector(".search-list"); + $resultsElem.innerHTML = ""; + + results.forEach(function(result, i) { + var url = CrystalDocs.base_path + result.href; + var type = false; + + var title = query.highlight(result.result_type == "type" ? result.full_name : result.name); + + var prefix = CrystalDocs.prefixForType(result.result_type); + if (prefix) { + title = "" + prefix + "" + title; + } + + title = "" + title + ""; + + if (result.args_string) { + title += + "" + query.highlight(result.args_string) + ""; + } + + $elem = document.createElement("li"); + $elem.className = "search-result search-result--" + result.result_type; + $elem.dataset.href = url; + $elem.setAttribute("title", result.full_name + " docs page"); + + var $title = document.createElement("div"); + $title.setAttribute("class", "search-result__title"); + var $titleLink = document.createElement("a"); + $titleLink.setAttribute("href", url); + + $titleLink.innerHTML = title; + $title.appendChild($titleLink); + $elem.appendChild($title); + $elem.addEventListener("click", function() { + $titleLink.click(); + }); + + if (result.result_type !== "type") { + var $type = document.createElement("div"); + $type.setAttribute("class", "search-result__type"); + $type.innerHTML = query.highlight(result.type); + $elem.appendChild($type); + } + + if(result.summary){ + var $doc = document.createElement("div"); + $doc.setAttribute("class", "search-result__doc"); + $doc.innerHTML = query.highlight(sanitize(result.summary)); + $elem.appendChild($doc); + } + + $elem.appendChild(document.createComment(JSON.stringify(result))); + $frag.appendChild($elem); + }); + + $resultsElem.appendChild($frag); + + CrystalDocs.toggleResultsList(true); +}; + +CrystalDocs.toggleResultsList = function(visible) { + if (visible) { + document.querySelector(".types-list").classList.add("hidden"); + document.querySelector(".search-results").classList.remove("hidden"); + } else { + document.querySelector(".types-list").classList.remove("hidden"); + document.querySelector(".search-results").classList.add("hidden"); + } +}; + +CrystalDocs.Query = function(string) { + this.original = string; + this.terms = string.split(/\s+/).filter(function(word) { + return CrystalDocs.Query.stripModifiers(word).length > 0; + }); + + var normalized = this.terms.map(CrystalDocs.Query.normalizeTerm); + this.normalizedTerms = normalized; + + function runMatcher(field, matcher) { + if (!field) { + return false; + } + var normalizedValue = CrystalDocs.Query.normalizeTerm(field); + + var matches = []; + normalized.forEach(function(term) { + if (matcher(normalizedValue, term)) { + matches.push(term); + } + }); + return matches.length > 0 ? matches : false; + } + + this.matches = function(field) { + return runMatcher(field, function(normalized, term) { + if (term[0] == "#" || term[0] == ".") { + return false; + } + return normalized.indexOf(term) >= 0; + }); + }; + + function namespaceMatcher(normalized, term){ + var i = term.indexOf(":"); + if(i >= 0){ + term = term.replace(/^::?|::?$/, ""); + var index = normalized.indexOf(term); + if((index == 0) || (index > 0 && normalized[index-1] == ":")){ + return true; + } + } + return false; + } + this.matchesMethod = function(name, kind, type) { + return runMatcher(name, function(normalized, term) { + var i = term.indexOf("#"); + if(i >= 0){ + if (kind != "instance_method") { + return false; + } + }else{ + i = term.indexOf("."); + if(i >= 0){ + if (kind != "class_method" && kind != "macro" && kind != "constructor") { + return false; + } + }else{ + //neither # nor . + if(term.indexOf(":") && namespaceMatcher(normalized, term)){ + return true; + } + } + } + + var methodName = term; + if(i >= 0){ + var termType = term.substring(0, i); + methodName = term.substring(i+1); + + if(termType != "") { + if(CrystalDocs.Query.normalizeTerm(type.full_name).indexOf(termType) < 0){ + return false; + } + } + } + return normalized.indexOf(methodName) >= 0; + }); + }; + + this.matchesNamespace = function(namespace){ + return runMatcher(namespace, namespaceMatcher); + }; + + this.highlight = function(string) { + if (typeof string == "undefined") { + return ""; + } + function escapeRegExp(s) { + return s.replace(/[.*+?\^${}()|\[\]\\]/g, "\\$&").replace(/^[#\.:]+/, ""); + } + return string.replace( + new RegExp("(" + this.normalizedTerms.map(escapeRegExp).join("|") + ")", "gi"), + "$1" + ); + }; +}; +CrystalDocs.Query.normalizeTerm = function(term) { + return term.toLowerCase(); +}; +CrystalDocs.Query.stripModifiers = function(term) { + switch (term[0]) { + case "#": + case ".": + case ":": + return term.substr(1); + + default: + return term; + } +} + +CrystalDocs.search = function(string) { + if(!CrystalDocs.searchIndex) { + console.log("CrystalDocs search index not initialized, delaying search"); + + document.addEventListener("CrystalDocs:loaded", function listener(){ + document.removeEventListener("CrystalDocs:loaded", listener); + CrystalDocs.search(string); + }); + return; + } + + document.dispatchEvent(new Event("CrystalDocs:searchStarted")); + + var query = new CrystalDocs.Query(string); + var results = CrystalDocs.runQuery(query); + results = CrystalDocs.rankResults(results, query); + CrystalDocs.displaySearchResults(results, query); + + document.dispatchEvent(new Event("CrystalDocs:searchPerformed")); +}; + +CrystalDocs.initializeIndex = function(data) { + CrystalDocs.searchIndex = data; + + document.dispatchEvent(new Event("CrystalDocs:loaded")); +}; + +CrystalDocs.loadIndex = function() { + function loadJSON(file, callback) { + var xobj = new XMLHttpRequest(); + xobj.overrideMimeType("application/json"); + xobj.open("GET", file, true); + xobj.onreadystatechange = function() { + if (xobj.readyState == 4 && xobj.status == "200") { + callback(xobj.responseText); + } + }; + xobj.send(null); + } + + function loadScript(file) { + script = document.createElement("script"); + script.src = file; + document.body.appendChild(script); + } + + function parseJSON(json) { + CrystalDocs.initializeIndex(JSON.parse(json)); + } + + for(var i = 0; i < document.scripts.length; i++){ + var script = document.scripts[i]; + if (script.src && script.src.indexOf("js/doc.js") >= 0) { + if (script.src.indexOf("file://") == 0) { + // We need to support JSONP files for the search to work on local file system. + var jsonPath = script.src.replace("js/doc.js", "search-index.js"); + loadScript(jsonPath); + return; + } else { + var jsonPath = script.src.replace("js/doc.js", "index.json"); + loadJSON(jsonPath, parseJSON); + return; + } + } + } + console.error("Could not find location of js/doc.js"); +}; + +// Callback for jsonp +function crystal_doc_search_index_callback(data) { + CrystalDocs.initializeIndex(data); +} + +Navigator = function(sidebar, searchInput, list, leaveSearchScope){ + this.list = list; + var self = this; + + var performingSearch = false; + + document.addEventListener('CrystalDocs:searchStarted', function(){ + performingSearch = true; + }); + document.addEventListener('CrystalDocs:searchDebounceStarted', function(){ + performingSearch = true; + }); + document.addEventListener('CrystalDocs:searchPerformed', function(){ + performingSearch = false; + }); + document.addEventListener('CrystalDocs:searchDebounceStopped', function(event){ + performingSearch = false; + }); + + function delayWhileSearching(callback) { + if(performingSearch){ + document.addEventListener('CrystalDocs:searchPerformed', function listener(){ + document.removeEventListener('CrystalDocs:searchPerformed', listener); + + // add some delay to let search results display kick in + setTimeout(callback, 100); + }); + }else{ + callback(); + } + } + + function clearMoveTimeout() { + clearTimeout(self.moveTimeout); + self.moveTimeout = null; + } + + function startMoveTimeout(upwards){ + /*if(self.moveTimeout) { + clearMoveTimeout(); + } + + var go = function() { + if (!self.moveTimeout) return; + self.move(upwards); + self.moveTimeout = setTimeout(go, 600); + }; + self.moveTimeout = setTimeout(go, 800);*/ + } + + function scrollCenter(element) { + var rect = element.getBoundingClientRect(); + var middle = sidebar.clientHeight / 2; + sidebar.scrollTop += rect.top + rect.height / 2 - middle; + } + + var move = this.move = function(upwards){ + if(!this.current){ + this.highlightFirst(); + return true; + } + var next = upwards ? this.current.previousElementSibling : this.current.nextElementSibling; + if(next && next.classList) { + this.highlight(next); + scrollCenter(next); + return true; + } + return false; + }; + + this.moveRight = function(){ + }; + this.moveLeft = function(){ + }; + + this.highlight = function(elem) { + if(!elem){ + return; + } + this.removeHighlight(); + + this.current = elem; + this.current.classList.add("current"); + }; + + this.highlightFirst = function(){ + this.highlight(this.list.querySelector('li:first-child')); + }; + + this.removeHighlight = function() { + if(this.current){ + this.current.classList.remove("current"); + } + this.current = null; + } + + this.openSelectedResult = function() { + if(this.current) { + this.current.click(); + } + } + + this.focus = function() { + searchInput.focus(); + searchInput.select(); + this.highlightFirst(); + } + + function handleKeyUp(event) { + switch(event.key) { + case "ArrowUp": + case "ArrowDown": + case "i": + case "j": + case "k": + case "l": + case "c": + case "h": + case "t": + case "n": + event.stopPropagation(); + clearMoveTimeout(); + } + } + + function handleKeyDown(event) { + switch(event.key) { + case "Enter": + event.stopPropagation(); + event.preventDefault(); + leaveSearchScope(); + self.openSelectedResult(); + break; + case "Escape": + event.stopPropagation(); + event.preventDefault(); + leaveSearchScope(); + break; + case "j": + case "c": + case "ArrowUp": + if(event.ctrlKey || event.key == "ArrowUp") { + event.stopPropagation(); + self.move(true); + startMoveTimeout(true); + } + break; + case "k": + case "h": + case "ArrowDown": + if(event.ctrlKey || event.key == "ArrowDown") { + event.stopPropagation(); + self.move(false); + startMoveTimeout(false); + } + break; + case "k": + case "t": + case "ArrowLeft": + if(event.ctrlKey || event.key == "ArrowLeft") { + event.stopPropagation(); + self.moveLeft(); + } + break; + case "l": + case "n": + case "ArrowRight": + if(event.ctrlKey || event.key == "ArrowRight") { + event.stopPropagation(); + self.moveRight(); + } + break; + } + } + + function handleInputKeyUp(event) { + switch(event.key) { + case "ArrowUp": + case "ArrowDown": + event.stopPropagation(); + event.preventDefault(); + clearMoveTimeout(); + } + } + + function handleInputKeyDown(event) { + switch(event.key) { + case "Enter": + event.stopPropagation(); + event.preventDefault(); + delayWhileSearching(function(){ + self.openSelectedResult(); + leaveSearchScope(); + }); + break; + case "Escape": + event.stopPropagation(); + event.preventDefault(); + // remove focus from search input + leaveSearchScope(); + sidebar.focus(); + break; + case "ArrowUp": + event.stopPropagation(); + event.preventDefault(); + self.move(true); + startMoveTimeout(true); + break; + + case "ArrowDown": + event.stopPropagation(); + event.preventDefault(); + self.move(false); + startMoveTimeout(false); + break; + } + } + + sidebar.tabIndex = 100; // set tabIndex to enable keylistener + sidebar.addEventListener('keyup', function(event) { + handleKeyUp(event); + }); + sidebar.addEventListener('keydown', function(event) { + handleKeyDown(event); + }); + searchInput.addEventListener('keydown', function(event) { + handleInputKeyDown(event); + }); + searchInput.addEventListener('keyup', function(event) { + handleInputKeyUp(event); + }); + this.move(); +}; + +CrystalDocs.initializeVersions = function () { + function loadJSON(file, callback) { + var xobj = new XMLHttpRequest(); + xobj.overrideMimeType("application/json"); + xobj.open("GET", file, true); + xobj.onreadystatechange = function() { + if (xobj.readyState == 4 && xobj.status == "200") { + callback(xobj.responseText); + } + }; + xobj.send(null); + } + + function parseJSON(json) { + CrystalDocs.loadConfig(JSON.parse(json)); + } + + $elem = document.querySelector("html > head > meta[name=\"crystal_docs.json_config_url\"]") + if ($elem == undefined) { + return + } + jsonURL = $elem.getAttribute("content") + if (jsonURL && jsonURL != "") { + loadJSON(jsonURL, parseJSON); + } +} + +CrystalDocs.loadConfig = function (config) { + var projectVersions = config["versions"] + var currentVersion = document.querySelector("html > head > meta[name=\"crystal_docs.project_version\"]").getAttribute("content") + + var currentVersionInList = projectVersions.find(function (element) { + return element.name == currentVersion + }) + + if (!currentVersionInList) { + projectVersions.unshift({ name: currentVersion, url: '#' }) + } + + $version = document.querySelector(".project-summary > .project-version") + $version.innerHTML = "" + + $select = document.createElement("select") + $select.classList.add("project-versions-nav") + $select.addEventListener("change", function () { + window.location.href = this.value + }) + projectVersions.forEach(function (version) { + $item = document.createElement("option") + $item.setAttribute("value", version.url) + $item.append(document.createTextNode(version.name)) + + if (version.name == currentVersion) { + $item.setAttribute("selected", true) + $item.setAttribute("disabled", true) + } + $select.append($item) + }); + $form = document.createElement("form") + $form.setAttribute("autocomplete", "off") + $form.append($select) + $version.append($form) +} + +document.addEventListener("DOMContentLoaded", function () { + CrystalDocs.initializeVersions() +}) + +var UsageModal = function(title, content) { + var $body = document.body; + var self = this; + var $modalBackground = document.createElement("div"); + $modalBackground.classList.add("modal-background"); + var $usageModal = document.createElement("div"); + $usageModal.classList.add("usage-modal"); + $modalBackground.appendChild($usageModal); + var $title = document.createElement("h3"); + $title.classList.add("modal-title"); + $title.innerHTML = title + $usageModal.appendChild($title); + var $closeButton = document.createElement("span"); + $closeButton.classList.add("close-button"); + $closeButton.setAttribute("title", "Close modal"); + $closeButton.innerText = '×'; + $usageModal.appendChild($closeButton); + $usageModal.insertAdjacentHTML("beforeend", content); + + $modalBackground.addEventListener('click', function(event) { + var element = event.target || event.srcElement; + + if(element == $modalBackground) { + self.hide(); + } + }); + $closeButton.addEventListener('click', function(event) { + self.hide(); + }); + + $body.insertAdjacentElement('beforeend', $modalBackground); + + this.show = function(){ + $body.classList.add("js-modal-visible"); + }; + this.hide = function(){ + $body.classList.remove("js-modal-visible"); + }; + this.isVisible = function(){ + return $body.classList.contains("js-modal-visible"); + } +} + + +document.addEventListener('DOMContentLoaded', function() { + var sessionStorage; + try { + sessionStorage = window.sessionStorage; + } catch (e) { } + if(!sessionStorage) { + sessionStorage = { + setItem: function() {}, + getItem: function() {}, + removeItem: function() {} + }; + } + + var repositoryName = document.querySelector('[name=repository-name]').getAttribute('content'); + var typesList = document.querySelector('.types-list'); + var searchInput = document.querySelector('.search-input'); + var parents = document.querySelectorAll('.types-list li.parent'); + + var scrollSidebarToOpenType = function(){ + var openTypes = typesList.querySelectorAll('.current'); + if (openTypes.length > 0) { + var lastOpenType = openTypes[openTypes.length - 1]; + lastOpenType.scrollIntoView(!(window.matchMedia('only screen and (max-width: 635px)')).matches); + } + } + + scrollSidebarToOpenType(); + + var setPersistentSearchQuery = function(value){ + sessionStorage.setItem(repositoryName + '::search-input:value', value); + } + + for(var i = 0; i < parents.length; i++) { + var _parent = parents[i]; + _parent.addEventListener('click', function(e) { + e.stopPropagation(); + + if(e.target.tagName.toLowerCase() == 'li') { + if(e.target.className.match(/open/)) { + sessionStorage.removeItem(e.target.getAttribute('data-id')); + e.target.className = e.target.className.replace(/ +open/g, ''); + } else { + sessionStorage.setItem(e.target.getAttribute('data-id'), '1'); + if(e.target.className.indexOf('open') == -1) { + e.target.className += ' open'; + } + } + } + }); + + if(sessionStorage.getItem(_parent.getAttribute('data-id')) == '1') { + _parent.className += ' open'; + } + } + + var leaveSearchScope = function(){ + CrystalDocs.toggleResultsList(false); + window.focus(); + } + + var navigator = new Navigator(document.querySelector('.types-list'), searchInput, document.querySelector(".search-results"), leaveSearchScope); + + CrystalDocs.loadIndex(); + var searchTimeout; + var lastSearchText = false; + var performSearch = function() { + document.dispatchEvent(new Event("CrystalDocs:searchDebounceStarted")); + + clearTimeout(searchTimeout); + searchTimeout = setTimeout(function() { + var text = searchInput.value; + + if(text == "") { + CrystalDocs.toggleResultsList(false); + }else if(text == lastSearchText){ + document.dispatchEvent(new Event("CrystalDocs:searchDebounceStopped")); + }else{ + CrystalDocs.search(text); + navigator.highlightFirst(); + searchInput.focus(); + } + lastSearchText = text; + setPersistentSearchQuery(text); + }, 200); + }; + + if(location.hash.length > 3 && location.hash.substring(0,3) == "#q="){ + // allows directly linking a search query which is then executed on the client + // this comes handy for establishing a custom browser search engine with https://crystal-lang.org/api/#q=%s as a search URL + // TODO: Add OpenSearch description + var searchQuery = location.hash.substring(3); + history.pushState({searchQuery: searchQuery}, "Search for " + searchQuery, location.href.replace(/#q=.*/, "")); + searchInput.value = decodeURIComponent(searchQuery); + document.addEventListener('CrystalDocs:loaded', performSearch); + } + + if (searchInput.value.length == 0) { + var searchText = sessionStorage.getItem(repositoryName + '::search-input:value'); + if(searchText){ + searchInput.value = searchText; + } + } + searchInput.addEventListener('keyup', performSearch); + searchInput.addEventListener('input', performSearch); + + var usageModal = new UsageModal('Keyboard Shortcuts', '' + + '
    ' + + '
  • ' + + ' ' + + ' s,' + + ' /' + + ' ' + + ' Search' + + '
  • ' + + '
  • ' + + ' Esc' + + ' Abort search / Close modal' + + '
  • ' + + '
  • ' + + ' ' + + ' ,' + + ' Enter' + + ' ' + + ' Open highlighted result' + + '
  • ' + + '
  • ' + + ' ' + + ' ,' + + ' Ctrl+j' + + ' ' + + ' Select previous result' + + '
  • ' + + '
  • ' + + ' ' + + ' ,' + + ' Ctrl+k' + + ' ' + + ' Select next result' + + '
  • ' + + '
  • ' + + ' ?' + + ' Show usage info' + + '
  • ' + + '
' + ); + + function handleShortkeys(event) { + var element = event.target || event.srcElement; + + if(element.tagName == "INPUT" || element.tagName == "TEXTAREA" || element.parentElement.tagName == "TEXTAREA"){ + return; + } + + switch(event.key) { + case "?": + usageModal.show(); + break; + + case "Escape": + usageModal.hide(); + break; + + case "s": + case "/": + if(usageModal.isVisible()) { + return; + } + event.stopPropagation(); + navigator.focus(); + performSearch(); + break; + } + } + + document.addEventListener('keyup', handleShortkeys); + + var scrollToEntryFromLocationHash = function() { + var hash = window.location.hash; + if (hash) { + var targetAnchor = decodeURI(hash.substr(1)); + var targetEl = document.getElementById(targetAnchor) + if (targetEl) { + targetEl.offsetParent.scrollTop = targetEl.offsetTop; + } + } + }; + window.addEventListener("hashchange", scrollToEntryFromLocationHash, false); + scrollToEntryFromLocationHash(); +}); diff --git a/search-index.js b/search-index.js new file mode 100644 index 000000000..cf9a6a2aa --- /dev/null +++ b/search-index.js @@ -0,0 +1 @@ +crystal_doc_search_index_callback({"repository_name":"clear","body":"

\"clear\"

\n\n# Clear\n\n![Crystal CI](https://github.com/crystal-garage/clear/workflows/Crystal%20CI/badge.svg)\n[![GitHub release](https://img.shields.io/github/release/crystal-garage/clear.svg)](https://github.com/crystal-garage/clear/releases)\n\nClear is an ORM built specifically for PostgreSQL in Crystal.\n\nIt's probably the most advanced ORM for PG on Crystal in term of features offered.\nIt features Active Record pattern models, and low-level SQL builder.\n\nYou can deal out of the box with jsonb, tsvectors, cursors, CTE, bcrypt password,\narray, uuid primary key, foreign constraints... and other things !\nIt also has a powerful DSL to construct `where` and `having` clauses.\n\nThe philosophy beneath is to please me (and you !) with emphasis made on business\ncode readability and minimal setup.\n\nThe project is quite active and well maintened, too !\n\n## Why to use Clear ?\n\nIn few seconds, you want to use Clear if:\n\n- [x] You want an expressive ORM. Put straight your thought to your code !\n- [x] You'd like to use advanced Postgres features without hassle\n- [x] You are at aware of the pro and cons of Active Records pattern\n\nYou don't want to use Clear if:\n\n- [ ] You're not willing to use on PostgreSQL\n- [ ] You look for a minimalist ORM / Data Mapper\n- [ ] You need something which doesn't evolve, with breaking changes.\n Clear is still in alpha but starting to mature !\n\n## Features\n\n- Active Record pattern based ORM\n- Expressiveness as mantra - even with advanced features like jsonb, regexp... -\n\n```crystal\n # Like ...\n Product.query.where { ( type == \"Book\" ) & ( metadata.jsonb(\"author.full_name\") == \"Philip K. Dick\" ) }\n # ^--- will use @> operator, to relay on your gin index. For real.\n\n Product.query.where { ( products.type == \"Book\" ) & ( products.metadata.jsonb(\"author.full_name\") != \"Philip K. Dick\" ) }\n # ^--- this time will use -> notation, because no optimizations possible :/\n\n # Or...\n User.query.where { created_at.in? 5.days.ago .. 1.day.ago }\n\n # Or even...\n ORM.query.where { ( description =~ /(^| )awesome($| )/i ) }.first!.name # Clear! :-)\n```\n\n- Proper debug information\n - Log and colorize query. Show you the last query if your code crash !\n - If failing on compile for a good reason, give proper explaination (or at least try)\n- Migration system\n- Validation system\n- N+1 query avoidance strategy\n- Transaction, rollback & savepoint\n- Access to CTE, locks, cursors, scope, pagination, join, window, multi-connection and many others features\n- Model lifecycle/hooks\n- JSONB, UUID, FullTextSearch\n\n### Installation\n\nIn `shards.yml`\n\n```yml\ndependencies:\n clear:\n github: crystal-garage/clear\n branch: develop\n```\n\nThen:\n\n```crystal\n require \"clear\"\n```\n\n### Model definition\n\nClear offers some mixins, just include them in your classes to _clear_ them:\n\n#### Column mapping\n\n```crystal\n\nclass User\n include Clear::Model\n\n column id : Int64, primary: true\n\n column email : String\n\n column first_name : String?\n column last_name : String?\n\n column encrypted_password : Crypto::Bcrypt::Password\n\n def password=(x)\n self.encrypted_password = Crypto::Bcrypt::Password.create(password)\n end\nend\n\n```\n\n#### Column types\n\n- `Number`, `String`, `Time`, `Boolean` and `Jsonb` structures are already mapped.\n- `Array` of primitives too.\n For other type of data, just create your own converter !\n\n```crystal\nclass Clear::Model::Converter::MyClassConversion\n def self.to_column(x) : MyClass?\n case x\n when String\n MyClass.from_string(x)\n when Slice(UInt8)\n MyClass.from_slice(x)\n else\n raise \"Cannot convert from #{x.class} to MyClass\"\n end\n end\n\n def self.to_db(x : UUID?)\n x.to_s\n end\nend\n\nClear::Model::Converter.add_converter(\"MyClass\", Clear::Model::Converter::MyClassConversion)\n```\n\n##### Column presence\n\nMost of the ORM for Crystal are mapping column type as `Type | Nil` union.\nIt makes sens so we allow selection of some columns only of a model.\nHowever, this have a caveats: columns are still accessible, and will return nil,\neven if the real value of the column is not null !\n\nMoreover, most of the developers will enforce nullity only on their programming\nlanguage level via validation, but not on the database, leading to inconsistency.\n\nTherefore, we choose to throw exception whenever a column is accessed before\nit has been initialized and to enforce presence through the union system of\nCrystal.\n\nClear offers this through the use of column wrapper.\nWrapper can be of the type of the column as in postgres, or in `UNKNOWN` state.\nThis approach offers more flexibility:\n\n```crystal\nUser.query.select(\"last_name\").each do |usr|\n puts usr.first_name #Will raise an exception, as first_name hasn't been fetched.\nend\n\nu = User.new\nu.first_name_column.defined? #Return false\nu.first_name_column.value(\"\") # Call the value or empty string if not defined :-)\nu.first_name = \"bonjour\"\nu.first_name_column.defined? #Return true now !\n```\n\nWrapper give also some pretty useful features:\n\n```crystal\nu = User.new\nu.email = \"me@myaddress.com\"\nu.email_column.changed? # TRUE\nu.email_column.revert\nu.email_column.defined? # No more\n```\n\n#### Associations\n\nClear offers `has_many`, `has_one`, `belongs_to` and `has_many through` associations:\n\n```crystal\nclass Security::Action\n belongs_to role : Role\nend\n\nclass Security::Role\n has_many user : User\nend\n\nclass User\n include Clear::Model\n\n has_one user_info : UserInfo\n has_many posts : Post\n\n belongs_to role : Security::Role\n\n # Use of the standard keys (users_id <=> security_role_id)\n has_many actions : Security::Action, through: Security::Role\nend\n```\n\n### Querying\n\nClear offers a collection system for your models. The collection system\ntakes origin to the lower API `Clear::SQL`, used to build requests.\n\n#### Simple query\n\n##### Fetch a model\n\nTo fetch one model:\n\n```crystal\n# 1. Get the first user\nUser.query.first #Get the first user, ordered by primary key\n\n# Get a specific user\nUser.find!(1) #Get the first user, or throw exception if not found.\n\n# Usage of query provides a `find_by` kind of method:\nu : User? = User.query.find { email =~ /yacine/i }\n```\n\n##### Fetch multiple models\n\nTo prepare a collection, juste use `Model#query`.\nCollections include `SQL::Select` object, so all the low level API\n(`where`, `join`, `group_by`, `lock`...) can be used in this context.\n\n```crystal\n# Get multiple users\nUser.query.where { (id >= 100) & (id <= 200) }.each do |user|\n # Do something with user !\nend\n\n#In case you know there's millions of row, use a cursor to avoid memory issues !\nUser.query.where { (id >= 1) & (id <= 20_000_000) }.each_cursor(batch: 100) do |user|\n # Do something with user; only 100 users will be stored in memory\n # This method is using pg cursor, so it's 100% transaction-safe\nend\n```\n\n##### Aggregate functions\n\nCall aggregate functions from the query is possible. For complex aggregation,\nI would recommend to use the `SQL::View` API (note: Not yet developed),\nand keep the model query for _fetching_ models only\n\n```crystal\n# count\nuser_on_gmail = User.query.where { email.ilike \"@gmail.com%\" }.count #Note: count return is Int64\n# min/max\nmax_id = User.query.where { email.ilike \"@gmail.com%\" }.max(\"id\", Int32)\n# your own aggregate\nweighted_avg = User.query.agg(\"SUM(performance_weight * performance_score) / SUM(performance_weight)\", Float64)\n```\n\n##### Fetching associations\n\nAssociations are basically getter which create predefined SQL.\nTo access to an association, just call it !\n\n```crystal\nUser.query.each do |user|\n puts \"User #{user.id} posts:\"\n user.posts.each do |post| #Works, but will trigger a request for each user.\n puts \"• #{post.id}\"\n end\nend\n```\n\n###### Caching association for N+1 request\n\nFor every association, you can tell Clear to encache the results to avoid\nN+1 queries, using `with_XXX` on the collection:\n\n```crystal\n# Will call two requests only.\nUser.query.with_posts.each do |user|\n puts \"User #{user.id} posts:\"\n user.posts.each do |post|\n puts \"• #{post.id}\"\n end\nend\n```\n\nNote than Clear doesn't perform a join method, and the SQL produced will use\nthe operator `IN` on the association.\n\nIn the case above:\n\n- The first request will be\n\n```\n SELECT * FROM users;\n```\n\n- Thanks to the cache, a second request will be called before fetching the users:\n\n```\n SELECT * FROM posts WHERE user_id IN ( SELECT id FROM users )\n```\n\nI have plan in a late future to offer different query strategies for the cache (e.g. joins, unions...)\n\n###### Associations caching examples\n\nWhen you use the caching system of the association, using filters on association will\ninvalidate the cache, and N+1 query will happens.\n\nFor example:\n\n```crystal\nUser.query.with_posts.each do |user|\n puts \"User #{user.id} published posts:\"\n # Here: The cache system will not work. The cache on association\n # is invalidated by the filter `where`.\n user.posts.where({published: true}).each do |post|\n puts \"• #{post.id}\"\n end\nend\n```\n\nThe way to fix it is to filter on the association itself:\n\n```crystal\nUser.query.with_posts(&.where({published: true})).each do |user|\n puts \"User #{user.id} published posts:\"\n # The posts collection of user is already encached with the published filter\n user.posts.each do |post|\n puts \"• #{post.id}\"\n end\nend\n```\n\nNote than, of course in this example `user.posts` are not ALL the posts but only the\n`published` posts\n\nThanks to this system, we can stack it to encache long distance relations:\n\n```crystal\n# Will cache users<=>posts & posts<=>category\n# Total: 3 requests !\nUser.query.with_posts(&.with_category).each do |user|\n #...\nend\n```\n\n##### Querying computed or foreign columns\n\nIn case you want columns computed by postgres, or stored in another table, you can use `fetch_column`.\nBy default, for performance reasons, `fetch_columns` option is set to false.\n\n```crystal\nusers = User.query.select(email: \"users.email\",\n remark: \"infos.remark\").join(\"infos\"){ infos.user_id == users.id }.to_a(fetch_columns: true)\n\n# Now the column \"remark\" will be fetched into each user object.\n# Access can be made using `[]` operator on the model.\n\nusers.each do |u|\n puts \"email: `#{u.email}`, remark: `#{u[\"remark\"]?}`\"\nend\n```\n\n### Inspection & SQL logging\n\n#### Inspection\n\n`inspect` over model offers debugging insights:\n\n```text\n p # => #,\n @content_column=\n \"...\",\n @errors=[],\n @id_column=38,\n @persisted=true,\n @published_column=true,\n @read_only=false,\n @title_column=\"Lorem ipsum torquent inceptos\"*,\n @user_id_column=5>\n```\n\nIn this case, the `*` means a column is changed and the object is dirty and diverge from the database.\n\n#### SQL Logging\n\nOne thing very important for a good ORM is to offer vision of the SQL\ncalled under the hood.\nClear is offering SQL logging tools, with SQL syntax colorizing in your terminal.\n\nFor activation, simply setup the logger to `DEBUG` level !\n\n```\nLog.builder.bind \"clear.*\", :debug, Log::IOBackend.new(STDOUT)\n```\n\n### Save & validation\n\n#### Save\n\nObject can be persisted, saved, updated:\n\n```crystal\nu = User.new\nu.email = \"test@example.com\"\nu.save! #Save or throw if unsavable (validation failed).\n```\n\nColumns can be checked & reverted:\n\n```crystal\nu = User.new\nu.email = \"test@example.com\"\nu.email_column.changed? # < Return \"true\"\nu.email_column.revert # Return to #undef.\n```\n\n#### Validation\n\n##### Presence validator\n\nPresence validator is done using the type of the column:\n\n```crystal\nclass User\n include Clear::Model\n\n column first_name : String # Must be present\n column last_name : String? # Can be null\nend\n```\n\n###### `NOT NULL DEFAULT ...` CASE\n\nThere's a case when a column CAN be null inside Crystal, if not persisted,\nbut CANNOT be null inside Postgres.\n\nIt's for example the case of the `id` column, which take value after saving !\n\nIn this case, you can write:\n\n```crystal\nclass User\n column id : Int64, primary: true, presence: false #id will be set using pg serial !\nend\n```\n\nThus, in all case this will fail:\n\n```\nu = User.new\nu.id # raise error\n```\n\n##### Other validators\n\nWhen you save your model, Clear will call first the presence validators, then\ncall your custom made validators. All you have to do is to reimplement\nthe `validate` method:\n\n```crystal\nclass MyModel\n#...\n def validate\n # Your code goes here\n end\nend\n```\n\nValidation fails if `model#errors` is not empty:\n\n```crystal\n class MyModel\n #...\n def validate\n if first_name_column.defined? && first_name != \"ABCD\" #< See below why `defined?` must be called.\n add_error(\"first_name\", \"must be ABCD!\")\n end\n end\n end\n```\n\n##### Unique validator\n\nPlease use `unique` feature of postgres. Unique validator at crystal level is a\nnon-go and lead to terrible race concurrency issues if your deploy on multiple nodes/pods.\nIt's an anti-pattern and must be avoided at any cost.\n\n##### The validation and the presence system\n\nIn the case you try validation on a column which has not been initialized,\nClear will complain, telling you you cannot access to the column.\nLet's see an example here:\n\n```crystal\nclass MyModel\n #...\n def validate\n add_error(\"first_name\", \"should not be empty\") if first_name == \"\"\n end\nend\n\nMyModel.new.save! #< Raise unexpected exception, not validation failure :(\n```\n\nThis validator will raise an exception, because first_name has never been initialized.\nTo avoid this, we have many way:\n\n```crystal\n# 1. Check presence:\n\ndef validate\n if first_name_column.defined? #Ensure we have a value here.\n add_error(\"first_name\", \"should not be empty\") if first_name == \"\"\n end\nend\n\n# 2. Use column object + default value\ndef validate\n add_error(\"first_name\", \"should not be empty\") if first_name_column.value(\"\") == \"\"\nend\n\n# 3. Use the helper macro `on_presence`\ndef validate\n on_presence(first_name) do\n add_error(\"first_name\", \"should not be empty\") if first_name == \"\"\n end\nend\n\n#4. Use the helper macro `ensure_than`\ndef validate\n ensure_than(first_name, \"should not be empty\", &.!=(\"\"))\nend\n\n#5. Use the `ensure_than` helper (but with block notation) !\ndef validate\n ensure_than(first_name, \"should not be empty\") do |column|\n column != \"\"\n end\nend\n\n```\n\nI recommend the 4th method in most of the cases you will faces.\nSimple to write and easy to read !\n\n### Migration\n\nClear offers of course a migration system.\n\nMigration should have an `order` column set.\nThis number can be wrote at the end of the class itself:\n\n```crystal\nclass Migration1\n include Clear::Migration\n\n def change(dir)\n #...\n end\nend\n```\n\n#### Using filename\n\nAnother way is to write down all your migrations one file per migration, and\nnaming the file using the `[number]_migration_description.cr` pattern.\nIn this case, the migration class name doesn't need to have a number at the end of the class name.\n\n```crystal\n# in src/db/migrations/1234_create_table.cr\nclass CreateTable\n include Clear::Migration\n\n def change(dir)\n #...\n end\nend\n```\n\n#### Migration examples\n\nMigration must implement the method `change(dir : Migration::Direction)`\n\nDirection is the current direction of the migration (up or down).\nIt provides few methods: `up?`, `down?`, `up(&block)`, `down(&block)`\n\nYou can create a table:\n\n```crystal\n def change(dir)\n create_table(:test) do |t|\n t.column :first_name, :string, index: true\n t.column :last_name, :string, unique: true\n\n t.index \"lower(first_name || ' ' || last_name)\", using: :btree\n\n t.timestamps\n end\n end\n```\n\n#### Constraints\n\nI strongly encourage to use the foreign key constraints of postgres for your references:\n\n```crystal\n t.references to: \"users\", on_delete: \"cascade\", null: false\n```\n\nThere's no plan to offer on Crystal level the `on_delete` feature, like\n`dependent` in ActiveRecord. That's a standard PG feature, just set it\nup in migration\n\n## Performances\n\nModels add a layer of computation. Below is a sample with a very simple model\n(two integer column), with fetching of 100k rows over 1M rows database, using --release flag:\n\n| Method | | Total time | Speed |\n| -------------------------: | ----: | -------------------- | -----------: |\n| Simple load 100k | 12.04 | ( 83.03ms) (± 3.87%) | 2.28× slower |\n| With cursor | 8.26 | ( 121.0ms) (± 1.25%) | 3.32× slower |\n| With attributes | 10.30 | ( 97.12ms) (± 4.07%) | 2.67× slower |\n| With attributes and cursor | 7.55 | (132.52ms) (± 2.39%) | 3.64× slower |\n| SQL only | 27.46 | ( 36.42ms) (± 5.05%) | fastest |\n\n- `Simple load 100k` is using an array to fetch the 100k rows.\n- `With cursor` is querying 1000 rows at a time\n- `With attribute` setup a hash to deal with unknown attributes in the model (e.g. aggregates)\n- `With attribute and cursor` is doing cursored fetch with hash attributes created\n- `SQL only` build and execute SQL using SQL::Builder\n\nAs you can see, it takes around 100ms to fetch 100k rows for this simple model (SQL included).\nIf for more complex model, it would take a bit more of time, I think the performances\nare quite reasonable, and tenfold or plus faster than Rails's ActiveRecord.\n\n## Licensing\n\nThis shard is provided under the MIT license.\n\n## Contribution\n\nAll contributions are welcome ! As a specialized ORM for PostgreSQL,\nbe sure a great contribution on a very specific PG feature will be incorporated\nto this shard.\nI hope one day we will cover all the features of PG here !\n\n### Running Tests\n\nIn order to run the test suite, you will need to have the PostgresSQL service locally available via a socket for access with psql. psql will attempt to use the 'postgres' user to create the test database. If you are working with a newly installed database that may not have the postgres user, this can be created with `createuser -s postgres`.\n","program":{"html_id":"clear/toplevel","path":"toplevel.html","kind":"module","full_name":"Top Level Namespace","name":"Top Level Namespace","abstract":false,"locations":[],"repository_name":"clear","program":true,"enum":false,"alias":false,"const":false,"constants":[{"id":"ARRAY_TYPEMAP","name":"ARRAY_TYPEMAP","value":"{\"Bool\" => \"boolean[]\", \"String\" => \"text[]\", \"Float32\" => \"real[]\", \"Float64\" => \"double precision[]\", \"Int32\" => \"int[]\", \"Int64\" => \"bigint[]\"}"},{"id":"ARRAY_VALUES","name":"ARRAY_VALUES","value":"{bool: Bool, s: String, f32: Float32, f: Float64, i: Int32, i64: Int64}"}],"macros":[{"html_id":"columns_to_instance_vars-macro","name":"columns_to_instance_vars","doc":"Used internally to deserialise json","summary":"

Used internally to deserialise json

","abstract":false,"location":{"filename":"src/clear/model/json_deserialize.cr","line_number":19,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/json_deserialize.cr#L19"},"def":{"name":"columns_to_instance_vars","visibility":"Public","body":" \n# :nodoc:\n\n struct Assigner\n include JSON::Serializable\n\n \n{% for name, settings in COLUMNS %}\n @[JSON::Field(presence: true)]\n getter {{ name.id }} : {{ settings[:type] }} {% if settings[:type].resolve.nilable? %}{% else %} | Nil {% end %}\n @[JSON::Field(ignore: true)]\n getter? {{ name.id }}_present : Bool\n {% end %}\n\n\n \n# Create a new empty model and fill the columns with object's instance variables\n\n \n# Trusted flag set to true will allow mass assignment without protection\n\n def create(trusted : Bool)\n assign_columns(\n{{ @type }}\n.new, trusted)\n \nend\n\n \n# Update the inputted model and assign the columns with object's instance variables\n\n \n# Trusted flag set to true will allow mass assignment without protection\n\n def update(model, trusted : Bool)\n assign_columns(model, trusted)\n \nend\n\n macro finished\n \n# Assign properties to the model inputted with object's instance variables\n\n \n# Trusted flag set to true will allow mass assignment without protection\n\n protected def assign_columns(model, trusted : Bool)\n \n{% for name, settings in COLUMNS %}\n if ({{ settings[:mass_assign] }} || trusted) && self.{{ name.id }}_present?\n %value = self.{{ name.id }}\n {% if settings[:type].resolve.nilable? %}\n model.{{ name.id }} = %value\n {% else %}\n model.{{ name.id }} = %value unless %value.nil?\n {% end %}\n end\n {% end %}\n\n\n model\n \nend\n \nend\n \nend\n\n \n# Create a new empty model and fill the columns from json. Returns the new model\n\n \n#\n\n \n# Trusted flag set to true will allow mass assignment without protection, FALSE by default\n\n def self.from_json(string_or_io : String | IO, trusted : Bool = false)\n Assigner.from_json(string_or_io).create(trusted)\n \nend\n\n \n# Create a new model from json and save it. Returns the model.\n\n \n#\n\n \n# The model may not be saved due to validation failure;\n\n \n# check the returned model `errors?` and `persisted?` flags.\n\n \n# Trusted flag set to true will allow mass assignment without protection, FALSE by default\n\n def self.create_from_json(string_or_io : String | IO, trusted : Bool = false)\n mdl = self.from_json(string_or_io, trusted)\n mdl.save\n mdl\n \nend\n\n \n# Create a new model from json and save it. Returns the model.\n\n \n#\n\n \n# Returns the newly inserted model\n\n \n# Raises an exception if validation failed during the saving process.\n\n \n# Trusted flag set to true will allow mass assignment without protection, FALSE by default\n\n def self.create_from_json!(string_or_io : String | IO, trusted : Bool = false)\n self.from_json(string_or_io, trusted).save!\n \nend\n\n \n# Set the fields from json passed as argument\n\n \n# Trusted flag set to true will allow mass assignment without protection, FALSE by default\n\n def set_from_json(string_or_io : String | IO, trusted : Bool = false)\n Assigner.from_json(string_or_io).update(self, trusted)\n \nend\n\n \n# Set the fields from json passed as argument and call `save` on the object\n\n \n# Trusted flag set to true will allow mass assignment without protection, FALSE by default\n\n def update_from_json(string_or_io : String | IO, trusted : Bool = false)\n mdl = set_from_json(string_or_io, trusted)\n mdl.save\n mdl\n \nend\n\n \n# Set the fields from json passed as argument and call `save!` on the object\n\n \n# Trusted flag set to true will allow mass assignment without protection, FALSE by default\n\n def update_from_json!(string_or_io : String | IO, trusted : Bool = false)\n set_from_json(string_or_io, trusted).save!\n \nend\n\n"}}],"types":[{"html_id":"clear/BigDecimal","path":"BigDecimal.html","kind":"struct","full_name":"BigDecimal","name":"BigDecimal","abstract":false,"superclass":{"html_id":"clear/Number","kind":"struct","full_name":"Number","name":"Number"},"ancestors":[{"html_id":"clear/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"},{"html_id":"clear/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"},{"html_id":"clear/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"},{"html_id":"clear/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"},{"html_id":"clear/Number","kind":"struct","full_name":"Number","name":"Number"},{"html_id":"clear/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"},{"html_id":"clear/Steppable","kind":"module","full_name":"Steppable","name":"Steppable"},{"html_id":"clear/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/extensions/core_ext.cr","line_number":121,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/core_ext.cr#L121"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"clear/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"},{"html_id":"clear/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"},{"html_id":"clear/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"},{"html_id":"clear/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"}],"doc":"A `BigDecimal` can represent arbitrarily large precision decimals.\n\nIt is internally represented by a pair of `BigInt` and `UInt64`: value and scale.\nValue contains the actual value, and scale tells the decimal point place.\nE.g. when value is `1234` and scale `2`, the result is `12.34`.\n\nNOTE: To use `BigDecimal`, you must explicitly import it with `require \"big\"`\n\nThe general idea and some of the arithmetic algorithms were adapted from\nthe MIT/APACHE-licensed [bigdecimal-rs](https://github.com/akubera/bigdecimal-rs).","summary":"

A BigDecimal can represent arbitrarily large precision decimals.

","instance_methods":[{"html_id":"to_json(json:JSON::Builder)-instance-method","name":"to_json","abstract":false,"args":[{"name":"json","external_name":"json","restriction":"JSON::Builder"}],"args_string":"(json : JSON::Builder)","args_html":"(json : JSON::Builder)","location":{"filename":"src/clear/extensions/core_ext.cr","line_number":122,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/core_ext.cr#L122"},"def":{"name":"to_json","args":[{"name":"json","external_name":"json","restriction":"JSON::Builder"}],"visibility":"Public","body":"json.string(to_s)"}}]},{"html_id":"clear/Char","path":"Char.html","kind":"struct","full_name":"Char","name":"Char","abstract":false,"superclass":{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},"ancestors":[{"html_id":"clear/Steppable","kind":"module","full_name":"Steppable","name":"Steppable"},{"html_id":"clear/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"lib/inflector/src/inflector/string.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/lib/inflector/src/inflector/string.cr#L4"},{"filename":"src/clear/extensions/core_ext.cr","line_number":5,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/core_ext.cr#L5"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"clear/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"},{"html_id":"clear/Steppable","kind":"module","full_name":"Steppable","name":"Steppable"}],"doc":"A `Char` represents a [Unicode](http://en.wikipedia.org/wiki/Unicode) [code point](http://en.wikipedia.org/wiki/Code_point).\nIt occupies 32 bits.\n\nIt is created by enclosing an UTF-8 character in single quotes.\n\n```\n'a'\n'z'\n'0'\n'_'\n'あ'\n```\n\nYou can use a backslash to denote some characters:\n\n```\n'\\'' # single quote\n'\\\\' # backslash\n'\\e' # escape\n'\\f' # form feed\n'\\n' # newline\n'\\r' # carriage return\n'\\t' # tab\n'\\v' # vertical tab\n```\n\nYou can use a backslash followed by an *u* and four hexadecimal characters to denote a unicode codepoint written:\n\n```\n'\\u0041' # == 'A'\n```\n\nOr you can use curly braces and specify up to four hexadecimal numbers:\n\n```\n'\\u{41}' # == 'A'\n```\n\nSee [`Char` literals](https://crystal-lang.org/reference/syntax_and_semantics/literals/char.html) in the language reference.","summary":"

A Char represents a Unicode code point.

","instance_methods":[{"html_id":"to_json(json:JSON::Builder)-instance-method","name":"to_json","abstract":false,"args":[{"name":"json","external_name":"json","restriction":"JSON::Builder"}],"args_string":"(json : JSON::Builder)","args_html":"(json : JSON::Builder)","location":{"filename":"src/clear/extensions/core_ext.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/core_ext.cr#L6"},"def":{"name":"to_json","args":[{"name":"json","external_name":"json","restriction":"JSON::Builder"}],"visibility":"Public","body":"json.string(\"#{self}\")"}}]},{"html_id":"clear/Citext","path":"Citext.html","kind":"struct","full_name":"Citext","name":"Citext","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/extensions/citext/citext.cr","line_number":3,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/citext/citext.cr#L3"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"doc":"Represents a case insensitive text, used by Postgres\nWrap a string and basically change the equality check to make it case insensitive.s","summary":"

Represents a case insensitive text, used by Postgres Wrap a string and basically change the equality check to make it case insensitive.s

","constructors":[{"html_id":"new(string:String)-class-method","name":"new","abstract":false,"args":[{"name":"string","external_name":"string","restriction":"::String"}],"args_string":"(string : String)","args_html":"(string : String)","location":{"filename":"src/clear/extensions/citext/citext.cr","line_number":8,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/citext/citext.cr#L8"},"def":{"name":"new","args":[{"name":"string","external_name":"string","restriction":"::String"}],"visibility":"Public","body":"_ = allocate\n_.initialize(string)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"!=(x:String|Citext)-instance-method","name":"!=","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"String | Citext"}],"args_string":"(x : String | Citext)","args_html":"(x : String | Citext)","location":{"filename":"src/clear/extensions/citext/citext.cr","line_number":15,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/citext/citext.cr#L15"},"def":{"name":"!=","args":[{"name":"x","external_name":"x","restriction":"String | Citext"}],"visibility":"Public","body":"!(self == x)"}},{"html_id":"==(x:String|Citext)-instance-method","name":"==","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"String | Citext"}],"args_string":"(x : String | Citext)","args_html":"(x : String | Citext)","location":{"filename":"src/clear/extensions/citext/citext.cr","line_number":11,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/citext/citext.cr#L11"},"def":{"name":"==","args":[{"name":"x","external_name":"x","restriction":"String | Citext"}],"visibility":"Public","body":"(compare(x.to_s, true)) == 0"}},{"html_id":"string:String-instance-method","name":"string","abstract":false,"location":{"filename":"src/clear/extensions/citext/citext.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/citext/citext.cr#L4"},"def":{"name":"string","return_type":"String","visibility":"Public","body":"@string"}}],"macros":[{"html_id":"method_missing(call)-macro","name":"method_missing","abstract":false,"args":[{"name":"call","external_name":"call","restriction":""}],"args_string":"(call)","args_html":"(call)","location":{"filename":"src/clear/extensions/citext/citext.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/citext/citext.cr#L6"},"def":{"name":"method_missing","args":[{"name":"call","external_name":"call","restriction":""}],"visibility":"Public","body":" @string.\n{{ call }}\n\n \n"}}]},{"html_id":"clear/Clear","path":"Clear.html","kind":"module","full_name":"Clear","name":"Clear","abstract":false,"locations":[{"filename":"src/clear/cli.cr","line_number":9,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli.cr#L9"},{"filename":"src/clear/extensions/enum/enum.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/enum/enum.cr#L1"},{"filename":"src/clear/log.cr","line_number":3,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/log.cr#L3"},{"filename":"src/clear/model/converters/json_any_converter.cr","line_number":24,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/json_any_converter.cr#L24"},{"filename":"src/clear/seed.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/seed.cr#L1"},{"filename":"src/clear/sql/lock.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/lock.cr#L1"},{"filename":"src/clear/sql/sql.cr","line_number":19,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/sql.cr#L19"},{"filename":"src/clear/sql/truncate.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/truncate.cr#L1"},{"filename":"src/clear/version.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/version.cr#L1"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"Log","name":"Log","value":"::Log.for(\"clear\")"},{"id":"VERSION","name":"VERSION","value":"{{ (`shards version /home/runner/work/clear/clear/src/clear`).chomp.stringify }}"}],"class_methods":[{"html_id":"apply_seeds-class-method","name":"apply_seeds","abstract":false,"location":{"filename":"src/clear/seed.cr","line_number":12,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/seed.cr#L12"},"def":{"name":"apply_seeds","visibility":"Public","body":"Clear::SQL.transaction do\n @@seed_list.each(&.call)\nend"}},{"html_id":"seed(&block)-class-method","name":"seed","doc":"Register a seed block.\nthis block will be called by `Clear.apply_seeds`\nor conveniently by the CLI\nusing `$cli_cmd migrate seeds`","summary":"

Register a seed block.

","abstract":false,"location":{"filename":"src/clear/seed.cr","line_number":8,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/seed.cr#L8"},"def":{"name":"seed","yields":0,"block_arity":0,"block_arg":{"name":"block","external_name":"block","restriction":""},"visibility":"Public","body":"@@seed_list << block"}},{"html_id":"with_cli(&)-class-method","name":"with_cli","doc":"Check for the CLI. If the CLI is not triggered, yield the block passed as parameter","summary":"

Check for the CLI.

","abstract":false,"location":{"filename":"src/clear/cli.cr","line_number":32,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli.cr#L32"},"def":{"name":"with_cli","yields":0,"block_arity":0,"visibility":"Public","body":"if ARGV.size > 0 && (ARGV[0] == \"clear\")\n ARGV.shift\n Clear::CLI.run\nelse\n yield\nend"}}],"macros":[{"html_id":"enum(name,*values,&block)-macro","name":"enum","doc":"## Enum\n\nClear offers full support of postgres enum strings.\n\n### Example\n\nLet's say you need to define an enum for genders:\n\n```\n# Define the enum\nClear.enum MyApp::Gender, \"male\", \"female\" # , ...\n```\n\nIn migration, we tell Postgres about the enum:\n\n```\ncreate_enum :gender, MyApp::Gender # < Create the new type `gender` in the database\n\ncreate_table :users do |t|\n # ...\n t.gender \"gender\" # < first `gender` is the type of column, while second is the name of the column\nend\n```\n\nFinally in your model, simply add the enum as column:\n\n```\nclass User\n include Clear::Model\n # ...\n\n column gender : MyApp::Gender\nend\n```\n\nNow, you can assign the enum:\n\n```\nu = User.new\nu.gender = MyApp::Gender::Male\n```\n\nYou can dynamically check and build the enumeration values:\n\n```\nMyApp::Gender.authorized_values # < return [\"male\", \"female\"]\nMyApp::Gender.all # < return [MyApp::Gender::Male, MyApp::Gender::Female]\n\nMyApp::Gender.from_string(\"male\") # < return MyApp::Gender::Male\nMyApp::Gender.from_string(\"unknown\") # < throw Clear::IllegalEnumValueError\n\nMyApp::Gender.valid?(\"female\") # < Return true\nMyApp::Gender.valid?(\"unknown\") # < Return false\n```\n\nHowever, you cannot write:\n\n```\nu = User.new\nu.gender = \"male\"\n```\n\nBut instead:\n\n```\nu = User.new\nu.gender = MyApp::Gender::Male\n```","summary":"

\n \n \nEnum

","abstract":false,"args":[{"name":"name","external_name":"name","restriction":""},{"name":"values","external_name":"values","restriction":""}],"args_string":"(name, *values, &block)","args_html":"(name, *values, &block)","location":{"filename":"src/clear/extensions/enum/enum.cr","line_number":113,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/enum/enum.cr#L113"},"def":{"name":"enum","args":[{"name":"name","external_name":"name","restriction":""},{"name":"values","external_name":"values","restriction":""}],"splat_index":1,"block_arg":{"name":"block","external_name":"block","restriction":""},"visibility":"Public","body":" struct \n{{ name.id }}\n < ::Clear::Enum\n \n{% for i in values %}\n {{ i.camelcase.id }} = {{ name.id }}.new(\"{{ i.id }}\")\n {% end %}\n\n\n \n{% if true %}\n AUTHORIZED_VALUES = {\n {% for i in values %}\n \"{{ i.id }}\" => {{ i.camelcase.id }},\n {% end %}\n }\n {% end %}\n\n\n \n# Return the enum with the string passed as parameter.\n\n \n# Throw Clear::IllegalEnumValueError if the string is not found.\n\n def self.from_string(str : String)\n AUTHORIZED_VALUES[str]? || raise ::Clear::IllegalEnumValueError.new(\"Illegal enum value for `#{self.class}`: '#{str}'\")\n \nend\n\n \n# Return the list of authorized values\n\n def self.authorized_values\n AUTHORIZED_VALUES.keys\n \nend\n\n def self.all\n AUTHORIZED_VALUES.values\n \nend\n\n def self.valid?(x)\n AUTHORIZED_VALUES[x]?\n \nend\n\n macro finished\n module ::Clear::Model::Converter::\n\\{\n{@type}}Converter\n def self.to_column(x) : ::\n\\{\n{@type}}?\n case x\n when Nil\n nil\n when ::\n\\{\n{@type}}\n x\n when String\n ::\n\\{\n{@type}}.from_string(x)\n when Slice(UInt8)\n ::\n\\{\n{@type}}.from_string(String.new(x))\n \nelse\n raise Clear::ErrorMessages.converter_error(x.class.name, \"::\n\\{\n{@type}}\")\n \nend\n \nend\n\n def self.to_db(x : ::\n\\{\n{@type}}?)\n x.to_s\n \nend\n \nend\n\n Clear::Model::Converter.add_converter(\"\n\\{\n{@type}}\", ::Clear::Model::Converter::\n\\{\n{@type}}Converter)\n \nend\n\n \n{{ yield }}\n\n \nend\n \n"}},{"html_id":"json_serializable_converter(type)-macro","name":"json_serializable_converter","doc":"Register a type to allow use in Clear column system.\nType must include JSON::Serializable.\n[More info about how to use JSON::Serializable it can be found here](https://crystal-lang.org/api/latest/JSON/Serializable.html)\n\n```\nClear.json_serializable_converter(MyJsonType)\n\n# ...\n\nclass YourModel\n include Clear::Model\n # ...\n column my_column : MyJsonType # jsonb (recommended), json or string column in postgresql.\nend\n```","summary":"

Register a type to allow use in Clear column system.

","abstract":false,"args":[{"name":"type","external_name":"type","restriction":""}],"args_string":"(type)","args_html":"(type)","location":{"filename":"src/clear/model/converters/json_any_converter.cr","line_number":40,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/json_any_converter.cr#L40"},"def":{"name":"json_serializable_converter","args":[{"name":"type","external_name":"type","restriction":""}],"visibility":"Public","body":" \n{% type = type.resolve %}\n\n module ::Clear::Model::Converter::\n{{ type }}\nConverter\n def self.to_column(x) : ::\n{{ type }}\n?\n case x\n when ::\n{{ type }}\n\n x\n when String\n ::\n{{ type }}\n.new(::JSON::PullParser.new(x))\n when ::JSON::PullParser\n ::\n{{ type }}\n.new(x)\n when ::JSON::Any\n ::\n{{ type }}\n.new(::JSON::PullParser.new(x.to_json))\n \nelse\n raise \"Cannot convert to \n{{ type }}\n from #{x.class}\"\n \nend\n \nend\n\n def self.to_db(x : ::\n{{ type }}\n?)\n x ? x.to_json : nil\n \nend\n \nend\n\n ::Clear::Model::Converter.add_converter(\n{{ \"#{type}\" }}\n, ::Clear::Model::Converter::\n{{ type }}\nConverter)\n \n"}}],"types":[{"html_id":"clear/Clear/CLI","path":"Clear/CLI.html","kind":"module","full_name":"Clear::CLI","name":"CLI","abstract":false,"locations":[{"filename":"src/clear/cli.cr","line_number":10,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli.cr#L10"},{"filename":"src/clear/cli/command.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/command.cr#L1"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear","kind":"module","full_name":"Clear","name":"Clear"},"class_methods":[{"html_id":"run-class-method","name":"run","abstract":false,"location":{"filename":"src/clear/cli.cr","line_number":11,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli.cr#L11"},"def":{"name":"run","visibility":"Public","body":"Clear::CLI::Base.run"}}],"types":[{"html_id":"clear/Clear/CLI/Base","path":"Clear/CLI/Base.html","kind":"class","full_name":"Clear::CLI::Base","name":"Base","abstract":false,"superclass":{"html_id":"clear/Admiral/Command","kind":"class","full_name":"Admiral::Command","name":"Command"},"ancestors":[{"html_id":"clear/Admiral/Command/Run","kind":"module","full_name":"Admiral::Command::Run","name":"Run"},{"html_id":"clear/Clear/CLI/Command","kind":"module","full_name":"Clear::CLI::Command","name":"Command"},{"html_id":"clear/Admiral/Command","kind":"class","full_name":"Admiral::Command","name":"Command"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli.cr","line_number":15,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli.cr#L15"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"HELP","name":"HELP","value":"{\"description\" => \"\"}"}],"included_modules":[{"html_id":"clear/Admiral/Command/Run","kind":"module","full_name":"Admiral::Command::Run","name":"Run"},{"html_id":"clear/Clear/CLI/Command","kind":"module","full_name":"Clear::CLI::Command","name":"Command"}],"namespace":{"html_id":"clear/Clear/CLI","kind":"module","full_name":"Clear::CLI","name":"CLI"},"class_methods":[{"html_id":"description-class-method","name":"description","abstract":false,"location":{"filename":"src/clear/cli.cr","line_number":15,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli.cr#L15"},"def":{"name":"description","visibility":"Public","body":"HELP[\"description\"]"}},{"html_id":"run(*args,**params)-class-method","name":"run","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **params)","args_html":"(*args, **params)","location":{"filename":"src/clear/cli.cr","line_number":15,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli.cr#L15"},"def":{"name":"run","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"params","external_name":"params","restriction":""},"splat_index":0,"visibility":"Public","body":"(new(*args, **params)).parse_and_run"}}],"instance_methods":[{"html_id":"__rescue_from___Admiral__Error(e)-instance-method","name":"__rescue_from___Admiral__Error","abstract":false,"args":[{"name":"e","external_name":"e","restriction":""}],"args_string":"(e)","args_html":"(e)","def":{"name":"__rescue_from___Admiral__Error","args":[{"name":"e","external_name":"e","restriction":""}],"visibility":"Public","body":"panic(e.message.colorize(:red))"}},{"html_id":"arguments-instance-method","name":"arguments","doc":"Returns the commands `Arguments` object.\n\nYou can access names arguments by name.\nYou can also access the remaning arguments using `.arguments[index]`.","summary":"

Returns the commands Arguments object.

","abstract":false,"location":{"filename":"src/clear/cli.cr","line_number":15,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli.cr#L15"},"def":{"name":"arguments","visibility":"Public","body":"@arguments || (@arguments = Arguments.new(self))"}},{"html_id":"flags-instance-method","name":"flags","doc":"Returns the commands `Flags` object.\n\nYou can access names flags by name.","summary":"

Returns the commands Flags object.

","abstract":false,"location":{"filename":"src/clear/cli.cr","line_number":15,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli.cr#L15"},"def":{"name":"flags","visibility":"Public","body":"@flags || (@flags = Flags.new(self))"}},{"html_id":"help-instance-method","name":"help","abstract":false,"def":{"name":"help","visibility":"Public","body":"[help_usage, \"\" + \"\\n\", help_flags, help_arguments, help_sub_commands].reject() do |__arg0|\n __arg0.strip.empty?\nend.join(\"\\n\")"}},{"html_id":"run-instance-method","name":"run","doc":"The run command.","summary":"

The run command.

","abstract":false,"location":{"filename":"src/clear/cli.cr","line_number":16,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli.cr#L16"},"def":{"name":"run","visibility":"Public","body":"Colorize.enabled = !flags.no_color\nrun_impl\n"}},{"html_id":"run_impl-instance-method","name":"run_impl","abstract":false,"location":{"filename":"src/clear/cli.cr","line_number":25,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli.cr#L25"},"def":{"name":"run_impl","visibility":"Public","body":"STDOUT.puts(help)"}},{"html_id":"sub(command,*args,**params)-instance-method","name":"sub","doc":"Invokes a sub command by name, passing `self` as the parent.","summary":"

Invokes a sub command by name, passing self as the parent.

","abstract":false,"args":[{"name":"command","external_name":"command","restriction":""},{"name":"args","external_name":"args","restriction":""}],"args_string":"(command, *args, **params)","args_html":"(command, *args, **params)","location":{"filename":"src/clear/cli.cr","line_number":15,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli.cr#L15"},"def":{"name":"sub","args":[{"name":"command","external_name":"command","restriction":""},{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"params","external_name":"params","restriction":""},"splat_index":1,"visibility":"Public","body":"SubCommands.invoke(command, *args, **params, parent: self)"}},{"html_id":"version-instance-method","name":"version","abstract":false,"location":{"filename":"src/clear/cli.cr","line_number":18,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli.cr#L18"},"def":{"name":"version","visibility":"Public","body":"Clear::VERSION"}}],"types":[{"html_id":"clear/Clear/CLI/Base/Arguments","path":"Clear/CLI/Base/Arguments.html","kind":"struct","full_name":"Clear::CLI::Base::Arguments","name":"Arguments","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Iterable","kind":"module","full_name":"Iterable","name":"Iterable"},{"html_id":"clear/Enumerable","kind":"module","full_name":"Enumerable","name":"Enumerable"},{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli.cr","line_number":15,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli.cr#L15"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"SPECS","name":"SPECS","value":"{} of String => NamedTuple(type: String, description: Tuple(String, String | ::Nil), default: String, is_required: Bool)"}],"included_modules":[{"html_id":"clear/Enumerable","kind":"module","full_name":"Enumerable","name":"Enumerable"},{"html_id":"clear/Iterable","kind":"module","full_name":"Iterable","name":"Iterable"}],"namespace":{"html_id":"clear/Clear/CLI/Base","kind":"class","full_name":"Clear::CLI::Base","name":"Base"},"constructors":[{"html_id":"new(command:Admiral::Command)-class-method","name":"new","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"new","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":"_ = allocate\n_.initialize(command)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"[](*args,**options)-instance-method","name":"[]","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","def":{"name":"[]","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@__rest__[*args, **options]"}},{"html_id":"[](*args,**options,&)-instance-method","name":"[]","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","def":{"name":"[]","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@__rest__.[](*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"each(*args,**options)-instance-method","name":"each","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","def":{"name":"each","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@__rest__.each(*args, **options)"}},{"html_id":"each(*args,**options,&)-instance-method","name":"each","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","def":{"name":"each","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@__rest__.each(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"exists?(name:Symbol)-instance-method","name":"exists?","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"exists?","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":"!!SPECS[name]?"}},{"html_id":"get(name:Symbol)-instance-method","name":"get","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"get","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":""}},{"html_id":"get?(name:Symbol)-instance-method","name":"get?","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"get?","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":"exists?(name) ? get(name) : false"}},{"html_id":"inspect(io)-instance-method","name":"inspect","abstract":false,"args":[{"name":"io","external_name":"io","restriction":""}],"args_string":"(io)","args_html":"(io)","location":{"filename":"src/clear/cli.cr","line_number":15,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli.cr#L15"},"def":{"name":"inspect","args":[{"name":"io","external_name":"io","restriction":""}],"visibility":"Public","body":"names = SPECS.keys\nif size > 0\n names << \"...\"\nend\nio << \"<#{self.class}\"\nio << \"(\"\nif names.empty?\nelse\n io << (names.join(\", \"))\nend\nio << \")\"\nio << \">\"\n"}},{"html_id":"rest:Array(String)-instance-method","name":"rest","abstract":false,"def":{"name":"rest","visibility":"Public","body":"@__rest__"}},{"html_id":"validate!(command:Admiral::Command)-instance-method","name":"validate!","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"validate!","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":""}},{"html_id":"value_from_spec(command:Admiral::Command,*,arg:String,type,default,is_required:Bool)-instance-method","name":"value_from_spec","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"},{"name":"","external_name":"","restriction":""},{"name":"arg","external_name":"arg","restriction":"String"},{"name":"type","external_name":"type","restriction":""},{"name":"default","external_name":"default","restriction":""},{"name":"is_required","external_name":"is_required","restriction":"Bool"}],"args_string":"(command : Admiral::Command, *, arg : String, type, default, is_required : Bool)","args_html":"(command : Admiral::Command, *, arg : String, type, default, is_required : Bool)","location":{"filename":"src/clear/cli.cr","line_number":15,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli.cr#L15"},"def":{"name":"value_from_spec","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"},{"name":"","external_name":"","restriction":""},{"name":"arg","external_name":"arg","restriction":"String"},{"name":"type","external_name":"type","restriction":""},{"name":"default","external_name":"default","restriction":""},{"name":"is_required","external_name":"is_required","restriction":"Bool"}],"splat_index":1,"visibility":"Public","body":"pos_only = false\nindex = 0\nwhile ((command.@argv)[index]?.to_s.starts_with?(\"-\")) && !pos_only\n index = index + 1\n pos_only = (command.@argv)[index]? == \"--\"\nend\nif (command.@argv)[index]?\n value = (command.@argv).delete_at(index)\n type.new(value)\nelse\n default\nend\n"}}]},{"html_id":"clear/Clear/CLI/Base/Flags","path":"Clear/CLI/Base/Flags.html","kind":"struct","full_name":"Clear::CLI::Base::Flags","name":"Flags","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli.cr","line_number":15,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli.cr#L15"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"DESCRIPTIONS","name":"DESCRIPTIONS","value":"{} of String => String"},{"id":"SPECS","name":"SPECS","value":"{\"verbose\" => {kind: \"bool\", type: \"Bool\", default: \"false\", description: {\"--verbose, -v\", \"Display verbose informations during execution\"}, short: \"v\", long: \"verbose\", is_required: true}, \"no_color\" => {kind: \"bool\", type: \"Bool\", default: \"false\", description: {\"--no-color\", \"Cancel color output\"}, short: \"nil\", long: \"no-color\", is_required: true}, \"__version__\" => {kind: \"bool\", type: \"Bool\", default: \"false\", description: {\"--version\", \"Displays the version of the current application.\"}, short: \"nil\", long: \"version\", is_required: true}, \"__help__\" => {kind: \"bool\", type: \"Bool\", default: \"false\", description: {\"--help\", \"Displays help for the current command.\"}, short: \"nil\", long: \"help\", is_required: true}} of String => NamedTuple(kind: String, type: String, default: String, description: Tuple(String, String | ::Nil), short: String | ::Nil, long: String, is_required: Bool)"}],"namespace":{"html_id":"clear/Clear/CLI/Base","kind":"class","full_name":"Clear::CLI::Base","name":"Base"},"doc":"Extend the flags struct to include the flag","summary":"

Extend the flags struct to include the flag

","constructors":[{"html_id":"new(command:Admiral::Command)-class-method","name":"new","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"new","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":"_ = allocate\n_.initialize(command)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"__help__-instance-method","name":"__help__","abstract":false,"def":{"name":"__help__","visibility":"Public","body":"@__help__.not_nil!"}},{"html_id":"__version__-instance-method","name":"__version__","abstract":false,"def":{"name":"__version__","visibility":"Public","body":"@__version__.not_nil!"}},{"html_id":"inspect(io)-instance-method","name":"inspect","abstract":false,"args":[{"name":"io","external_name":"io","restriction":""}],"args_string":"(io)","args_html":"(io)","location":{"filename":"src/clear/cli.cr","line_number":15,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli.cr#L15"},"def":{"name":"inspect","args":[{"name":"io","external_name":"io","restriction":""}],"visibility":"Public","body":"io << \"<#{self.class}\"\nio << \"(\"\nif SPECS.empty?\nelse\n io << (SPECS.keys.join(\", \"))\nend\nio << \")\"\nio << \">\"\n"}},{"html_id":"no_color-instance-method","name":"no_color","abstract":false,"def":{"name":"no_color","visibility":"Public","body":"@no_color.not_nil!"}},{"html_id":"validate!(command)-instance-method","name":"validate!","abstract":false,"args":[{"name":"command","external_name":"command","restriction":""}],"args_string":"(command)","args_html":"(command)","def":{"name":"validate!","args":[{"name":"command","external_name":"command","restriction":""}],"visibility":"Public","body":"if @verbose.nil?\n raise(Admiral::Error.new(\"Flag required: --verbose\"))\nend\nif @no_color.nil?\n raise(Admiral::Error.new(\"Flag required: --no-color\"))\nend\nif @__version__.nil?\n raise(Admiral::Error.new(\"Flag required: --version\"))\nend\nif @__help__.nil?\n raise(Admiral::Error.new(\"Flag required: --help\"))\nend\nraise_extra_flags!(command)\n"}},{"html_id":"verbose-instance-method","name":"verbose","abstract":false,"def":{"name":"verbose","visibility":"Public","body":"@verbose.not_nil!"}}]}]},{"html_id":"clear/Clear/CLI/Command","path":"Clear/CLI/Command.html","kind":"module","full_name":"Clear::CLI::Command","name":"Command","abstract":false,"locations":[{"filename":"src/clear/cli/command.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/command.cr#L1"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"clear/Clear/CLI/Base","kind":"class","full_name":"Clear::CLI::Base","name":"Base"},{"html_id":"clear/Clear/CLI/Generator","kind":"class","full_name":"Clear::CLI::Generator","name":"Generator"},{"html_id":"clear/Clear/CLI/Generator/Migration","kind":"class","full_name":"Clear::CLI::Generator::Migration","name":"Migration"},{"html_id":"clear/Clear/CLI/Generator/Model","kind":"class","full_name":"Clear::CLI::Generator::Model","name":"Model"},{"html_id":"clear/Clear/CLI/Generator/NewKemal","kind":"class","full_name":"Clear::CLI::Generator::NewKemal","name":"NewKemal"},{"html_id":"clear/Clear/CLI/Migration","kind":"class","full_name":"Clear::CLI::Migration","name":"Migration"},{"html_id":"clear/Clear/CLI/Migration/Down","kind":"class","full_name":"Clear::CLI::Migration::Down","name":"Down"},{"html_id":"clear/Clear/CLI/Migration/Migrate","kind":"class","full_name":"Clear::CLI::Migration::Migrate","name":"Migrate"},{"html_id":"clear/Clear/CLI/Migration/Rollback","kind":"class","full_name":"Clear::CLI::Migration::Rollback","name":"Rollback"},{"html_id":"clear/Clear/CLI/Migration/Seed","kind":"class","full_name":"Clear::CLI::Migration::Seed","name":"Seed"},{"html_id":"clear/Clear/CLI/Migration/Set","kind":"class","full_name":"Clear::CLI::Migration::Set","name":"Set"},{"html_id":"clear/Clear/CLI/Migration/Status","kind":"class","full_name":"Clear::CLI::Migration::Status","name":"Status"},{"html_id":"clear/Clear/CLI/Migration/Up","kind":"class","full_name":"Clear::CLI::Migration::Up","name":"Up"},{"html_id":"clear/Clear/CLI/Seed","kind":"class","full_name":"Clear::CLI::Seed","name":"Seed"}],"namespace":{"html_id":"clear/Clear/CLI","kind":"module","full_name":"Clear::CLI","name":"CLI"}},{"html_id":"clear/Clear/CLI/Generator","path":"Clear/CLI/Generator.html","kind":"class","full_name":"Clear::CLI::Generator","name":"Generator","abstract":false,"superclass":{"html_id":"clear/Admiral/Command","kind":"class","full_name":"Admiral::Command","name":"Command"},"ancestors":[{"html_id":"clear/Admiral/Command/Run","kind":"module","full_name":"Admiral::Command::Run","name":"Run"},{"html_id":"clear/Clear/CLI/Command","kind":"module","full_name":"Clear::CLI::Command","name":"Command"},{"html_id":"clear/Admiral/Command","kind":"class","full_name":"Admiral::Command","name":"Command"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli/generator.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generator.cr#L4"},{"filename":"src/clear/cli/generators/migration.cr","line_number":3,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/migration.cr#L3"},{"filename":"src/clear/cli/generators/model.cr","line_number":3,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/model.cr#L3"},{"filename":"src/clear/cli/generators/new/kemal.cr","line_number":3,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/new/kemal.cr#L3"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"HELP","name":"HELP","value":"{\"description\" => \"\"}"}],"included_modules":[{"html_id":"clear/Admiral/Command/Run","kind":"module","full_name":"Admiral::Command::Run","name":"Run"},{"html_id":"clear/Clear/CLI/Command","kind":"module","full_name":"Clear::CLI::Command","name":"Command"}],"namespace":{"html_id":"clear/Clear/CLI","kind":"module","full_name":"Clear::CLI","name":"CLI"},"class_methods":[{"html_id":"[](name)-class-method","name":"[]","abstract":false,"args":[{"name":"name","external_name":"name","restriction":""}],"args_string":"(name)","args_html":"(name)","location":{"filename":"src/clear/cli/generator.cr","line_number":21,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generator.cr#L21"},"def":{"name":"[]","args":[{"name":"name","external_name":"name","restriction":""}],"visibility":"Public","body":"@@generators[name]"}},{"html_id":"[]?(name)-class-method","name":"[]?","abstract":false,"args":[{"name":"name","external_name":"name","restriction":""}],"args_string":"(name)","args_html":"(name)","location":{"filename":"src/clear/cli/generator.cr","line_number":17,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generator.cr#L17"},"def":{"name":"[]?","args":[{"name":"name","external_name":"name","restriction":""}],"visibility":"Public","body":"@@generators[name]?"}},{"html_id":"add(name,desc,&block:Array(String)->Nil)-class-method","name":"add","abstract":false,"args":[{"name":"name","external_name":"name","restriction":""},{"name":"desc","external_name":"desc","restriction":""}],"args_string":"(name, desc, &block : Array(String) -> Nil)","args_html":"(name, desc, &block : Array(String) -> Nil)","location":{"filename":"src/clear/cli/generator.cr","line_number":13,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generator.cr#L13"},"def":{"name":"add","args":[{"name":"name","external_name":"name","restriction":""},{"name":"desc","external_name":"desc","restriction":""}],"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Array(String) -> Nil)"},"visibility":"Public","body":"@@generators[name] = Record.new(name, desc, block)"}},{"html_id":"description-class-method","name":"description","abstract":false,"location":{"filename":"src/clear/cli/generator.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generator.cr#L4"},"def":{"name":"description","visibility":"Public","body":"HELP[\"description\"]"}},{"html_id":"generators-class-method","name":"generators","abstract":false,"location":{"filename":"src/clear/cli/generator.cr","line_number":11,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generator.cr#L11"},"def":{"name":"generators","visibility":"Public","body":"@@generators"}},{"html_id":"run(*args,**params)-class-method","name":"run","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **params)","args_html":"(*args, **params)","location":{"filename":"src/clear/cli/generator.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generator.cr#L4"},"def":{"name":"run","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"params","external_name":"params","restriction":""},"splat_index":0,"visibility":"Public","body":"(new(*args, **params)).parse_and_run"}}],"instance_methods":[{"html_id":"__rescue_from___Admiral__Error(e)-instance-method","name":"__rescue_from___Admiral__Error","abstract":false,"args":[{"name":"e","external_name":"e","restriction":""}],"args_string":"(e)","args_html":"(e)","def":{"name":"__rescue_from___Admiral__Error","args":[{"name":"e","external_name":"e","restriction":""}],"visibility":"Public","body":"panic(e.message.colorize(:red))"}},{"html_id":"arguments-instance-method","name":"arguments","doc":"Returns the commands `Arguments` object.\n\nYou can access names arguments by name.\nYou can also access the remaning arguments using `.arguments[index]`.","summary":"

Returns the commands Arguments object.

","abstract":false,"location":{"filename":"src/clear/cli/generator.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generator.cr#L4"},"def":{"name":"arguments","visibility":"Public","body":"@arguments || (@arguments = Arguments.new(self))"}},{"html_id":"flags-instance-method","name":"flags","doc":"Returns the commands `Flags` object.\n\nYou can access names flags by name.","summary":"

Returns the commands Flags object.

","abstract":false,"location":{"filename":"src/clear/cli/generator.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generator.cr#L4"},"def":{"name":"flags","visibility":"Public","body":"@flags || (@flags = Flags.new(self))"}},{"html_id":"help-instance-method","name":"help","abstract":false,"def":{"name":"help","visibility":"Public","body":"[help_usage, \"Generate code automatically\" + \"\\n\", help_flags, help_arguments, help_sub_commands].reject() do |__arg0|\n __arg0.strip.empty?\nend.join(\"\\n\")"}},{"html_id":"run-instance-method","name":"run","doc":"The run command.","summary":"

The run command.

","abstract":false,"location":{"filename":"src/clear/cli/generator.cr","line_number":5,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generator.cr#L5"},"def":{"name":"run","visibility":"Public","body":"Colorize.enabled = !flags.no_color\nrun_impl\n"}},{"html_id":"run_impl-instance-method","name":"run_impl","abstract":false,"location":{"filename":"src/clear/cli/generator.cr","line_number":25,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generator.cr#L25"},"def":{"name":"run_impl","visibility":"Public","body":"puts(help)"}},{"html_id":"sub(command,*args,**params)-instance-method","name":"sub","doc":"Invokes a sub command by name, passing `self` as the parent.","summary":"

Invokes a sub command by name, passing self as the parent.

","abstract":false,"args":[{"name":"command","external_name":"command","restriction":""},{"name":"args","external_name":"args","restriction":""}],"args_string":"(command, *args, **params)","args_html":"(command, *args, **params)","location":{"filename":"src/clear/cli/generator.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generator.cr#L4"},"def":{"name":"sub","args":[{"name":"command","external_name":"command","restriction":""},{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"params","external_name":"params","restriction":""},"splat_index":1,"visibility":"Public","body":"SubCommands.invoke(command, *args, **params, parent: self)"}}],"macros":[{"html_id":"ecr_to_s(string,opts)-macro","name":"ecr_to_s","abstract":false,"args":[{"name":"string","external_name":"string","restriction":""},{"name":"opts","external_name":"opts","restriction":""}],"args_string":"(string, opts)","args_html":"(string, opts)","location":{"filename":"src/clear/cli/generator.cr","line_number":29,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generator.cr#L29"},"def":{"name":"ecr_to_s","args":[{"name":"string","external_name":"string","restriction":""},{"name":"opts","external_name":"opts","restriction":""}],"visibility":"Public","body":" opts = \n{{ opts }}\n\n io = IO::Memory.new\n ECR.embed \n{{ string }}\n, io\n io.to_s\n \n"}}],"types":[{"html_id":"clear/Clear/CLI/Generator/Arguments","path":"Clear/CLI/Generator/Arguments.html","kind":"struct","full_name":"Clear::CLI::Generator::Arguments","name":"Arguments","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Iterable","kind":"module","full_name":"Iterable","name":"Iterable"},{"html_id":"clear/Enumerable","kind":"module","full_name":"Enumerable","name":"Enumerable"},{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli/generator.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generator.cr#L4"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"SPECS","name":"SPECS","value":"{} of String => NamedTuple(type: String, description: Tuple(String, String | ::Nil), default: String, is_required: Bool)"}],"included_modules":[{"html_id":"clear/Enumerable","kind":"module","full_name":"Enumerable","name":"Enumerable"},{"html_id":"clear/Iterable","kind":"module","full_name":"Iterable","name":"Iterable"}],"namespace":{"html_id":"clear/Clear/CLI/Generator","kind":"class","full_name":"Clear::CLI::Generator","name":"Generator"},"constructors":[{"html_id":"new(command:Admiral::Command)-class-method","name":"new","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"new","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":"_ = allocate\n_.initialize(command)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"[](*args,**options)-instance-method","name":"[]","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","def":{"name":"[]","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@__rest__[*args, **options]"}},{"html_id":"[](*args,**options,&)-instance-method","name":"[]","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","def":{"name":"[]","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@__rest__.[](*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"each(*args,**options)-instance-method","name":"each","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","def":{"name":"each","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@__rest__.each(*args, **options)"}},{"html_id":"each(*args,**options,&)-instance-method","name":"each","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","def":{"name":"each","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@__rest__.each(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"exists?(name:Symbol)-instance-method","name":"exists?","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"exists?","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":"!!SPECS[name]?"}},{"html_id":"get(name:Symbol)-instance-method","name":"get","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"get","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":""}},{"html_id":"get?(name:Symbol)-instance-method","name":"get?","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"get?","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":"exists?(name) ? get(name) : false"}},{"html_id":"inspect(io)-instance-method","name":"inspect","abstract":false,"args":[{"name":"io","external_name":"io","restriction":""}],"args_string":"(io)","args_html":"(io)","location":{"filename":"src/clear/cli/generator.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generator.cr#L4"},"def":{"name":"inspect","args":[{"name":"io","external_name":"io","restriction":""}],"visibility":"Public","body":"names = SPECS.keys\nif size > 0\n names << \"...\"\nend\nio << \"<#{self.class}\"\nio << \"(\"\nif names.empty?\nelse\n io << (names.join(\", \"))\nend\nio << \")\"\nio << \">\"\n"}},{"html_id":"rest:Array(String)-instance-method","name":"rest","abstract":false,"def":{"name":"rest","visibility":"Public","body":"@__rest__"}},{"html_id":"validate!(command:Admiral::Command)-instance-method","name":"validate!","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"validate!","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":""}},{"html_id":"value_from_spec(command:Admiral::Command,*,arg:String,type,default,is_required:Bool)-instance-method","name":"value_from_spec","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"},{"name":"","external_name":"","restriction":""},{"name":"arg","external_name":"arg","restriction":"String"},{"name":"type","external_name":"type","restriction":""},{"name":"default","external_name":"default","restriction":""},{"name":"is_required","external_name":"is_required","restriction":"Bool"}],"args_string":"(command : Admiral::Command, *, arg : String, type, default, is_required : Bool)","args_html":"(command : Admiral::Command, *, arg : String, type, default, is_required : Bool)","location":{"filename":"src/clear/cli/generator.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generator.cr#L4"},"def":{"name":"value_from_spec","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"},{"name":"","external_name":"","restriction":""},{"name":"arg","external_name":"arg","restriction":"String"},{"name":"type","external_name":"type","restriction":""},{"name":"default","external_name":"default","restriction":""},{"name":"is_required","external_name":"is_required","restriction":"Bool"}],"splat_index":1,"visibility":"Public","body":"pos_only = false\nindex = 0\nwhile ((command.@argv)[index]?.to_s.starts_with?(\"-\")) && !pos_only\n index = index + 1\n pos_only = (command.@argv)[index]? == \"--\"\nend\nif (command.@argv)[index]?\n value = (command.@argv).delete_at(index)\n type.new(value)\nelse\n default\nend\n"}}]},{"html_id":"clear/Clear/CLI/Generator/Flags","path":"Clear/CLI/Generator/Flags.html","kind":"struct","full_name":"Clear::CLI::Generator::Flags","name":"Flags","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli/generator.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generator.cr#L4"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"DESCRIPTIONS","name":"DESCRIPTIONS","value":"{} of String => String"},{"id":"SPECS","name":"SPECS","value":"{\"verbose\" => {kind: \"bool\", type: \"Bool\", default: \"false\", description: {\"--verbose, -v\", \"Display verbose informations during execution\"}, short: \"v\", long: \"verbose\", is_required: true}, \"no_color\" => {kind: \"bool\", type: \"Bool\", default: \"false\", description: {\"--no-color\", \"Cancel color output\"}, short: \"nil\", long: \"no-color\", is_required: true}, \"__help__\" => {kind: \"bool\", type: \"Bool\", default: \"false\", description: {\"--help\", \"Displays help for the current command.\"}, short: \"nil\", long: \"help\", is_required: true}} of String => NamedTuple(kind: String, type: String, default: String, description: Tuple(String, String | ::Nil), short: String | ::Nil, long: String, is_required: Bool)"}],"namespace":{"html_id":"clear/Clear/CLI/Generator","kind":"class","full_name":"Clear::CLI::Generator","name":"Generator"},"doc":"Extend the flags struct to include the flag","summary":"

Extend the flags struct to include the flag

","constructors":[{"html_id":"new(command:Admiral::Command)-class-method","name":"new","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"new","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":"_ = allocate\n_.initialize(command)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"__help__-instance-method","name":"__help__","abstract":false,"def":{"name":"__help__","visibility":"Public","body":"@__help__.not_nil!"}},{"html_id":"inspect(io)-instance-method","name":"inspect","abstract":false,"args":[{"name":"io","external_name":"io","restriction":""}],"args_string":"(io)","args_html":"(io)","location":{"filename":"src/clear/cli/generator.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generator.cr#L4"},"def":{"name":"inspect","args":[{"name":"io","external_name":"io","restriction":""}],"visibility":"Public","body":"io << \"<#{self.class}\"\nio << \"(\"\nif SPECS.empty?\nelse\n io << (SPECS.keys.join(\", \"))\nend\nio << \")\"\nio << \">\"\n"}},{"html_id":"no_color-instance-method","name":"no_color","abstract":false,"def":{"name":"no_color","visibility":"Public","body":"@no_color.not_nil!"}},{"html_id":"validate!(command)-instance-method","name":"validate!","abstract":false,"args":[{"name":"command","external_name":"command","restriction":""}],"args_string":"(command)","args_html":"(command)","def":{"name":"validate!","args":[{"name":"command","external_name":"command","restriction":""}],"visibility":"Public","body":"if @verbose.nil?\n raise(Admiral::Error.new(\"Flag required: --verbose\"))\nend\nif @no_color.nil?\n raise(Admiral::Error.new(\"Flag required: --no-color\"))\nend\nif @__help__.nil?\n raise(Admiral::Error.new(\"Flag required: --help\"))\nend\nraise_extra_flags!(command)\n"}},{"html_id":"verbose-instance-method","name":"verbose","abstract":false,"def":{"name":"verbose","visibility":"Public","body":"@verbose.not_nil!"}}]},{"html_id":"clear/Clear/CLI/Generator/Migration","path":"Clear/CLI/Generator/Migration.html","kind":"class","full_name":"Clear::CLI::Generator::Migration","name":"Migration","abstract":false,"superclass":{"html_id":"clear/Admiral/Command","kind":"class","full_name":"Admiral::Command","name":"Command"},"ancestors":[{"html_id":"clear/Clear/CLI/Command","kind":"module","full_name":"Clear::CLI::Command","name":"Command"},{"html_id":"clear/Admiral/Command","kind":"class","full_name":"Admiral::Command","name":"Command"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli/generators/migration.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/migration.cr#L6"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"HELP","name":"HELP","value":"{\"description\" => \"\"}"}],"included_modules":[{"html_id":"clear/Clear/CLI/Command","kind":"module","full_name":"Clear::CLI::Command","name":"Command"}],"namespace":{"html_id":"clear/Clear/CLI/Generator","kind":"class","full_name":"Clear::CLI::Generator","name":"Generator"},"class_methods":[{"html_id":"description-class-method","name":"description","abstract":false,"location":{"filename":"src/clear/cli/generators/migration.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/migration.cr#L6"},"def":{"name":"description","visibility":"Public","body":"HELP[\"description\"]"}},{"html_id":"run(*args,**params)-class-method","name":"run","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **params)","args_html":"(*args, **params)","location":{"filename":"src/clear/cli/generators/migration.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/migration.cr#L6"},"def":{"name":"run","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"params","external_name":"params","restriction":""},"splat_index":0,"visibility":"Public","body":"(new(*args, **params)).parse_and_run"}}],"instance_methods":[{"html_id":"__rescue_from___Admiral__Error(e)-instance-method","name":"__rescue_from___Admiral__Error","abstract":false,"args":[{"name":"e","external_name":"e","restriction":""}],"args_string":"(e)","args_html":"(e)","def":{"name":"__rescue_from___Admiral__Error","args":[{"name":"e","external_name":"e","restriction":""}],"visibility":"Public","body":"panic(e.message.colorize(:red))"}},{"html_id":"arguments-instance-method","name":"arguments","doc":"Returns the commands `Arguments` object.\n\nYou can access names arguments by name.\nYou can also access the remaning arguments using `.arguments[index]`.","summary":"

Returns the commands Arguments object.

","abstract":false,"location":{"filename":"src/clear/cli/generators/migration.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/migration.cr#L6"},"def":{"name":"arguments","visibility":"Public","body":"@arguments || (@arguments = Arguments.new(self))"}},{"html_id":"flags-instance-method","name":"flags","doc":"Returns the commands `Flags` object.\n\nYou can access names flags by name.","summary":"

Returns the commands Flags object.

","abstract":false,"location":{"filename":"src/clear/cli/generators/migration.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/migration.cr#L6"},"def":{"name":"flags","visibility":"Public","body":"@flags || (@flags = Flags.new(self))"}},{"html_id":"help-instance-method","name":"help","abstract":false,"def":{"name":"help","visibility":"Public","body":"[help_usage, \"Generate a new migration\" + \"\\n\", help_flags, help_arguments, help_sub_commands].reject() do |__arg0|\n __arg0.strip.empty?\nend.join(\"\\n\")"}},{"html_id":"run-instance-method","name":"run","doc":"The run command.","summary":"

The run command.

","abstract":false,"location":{"filename":"src/clear/cli/generators/migration.cr","line_number":7,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/migration.cr#L7"},"def":{"name":"run","visibility":"Public","body":"Colorize.enabled = !flags.no_color\nrun_impl\n"}},{"html_id":"run_impl-instance-method","name":"run_impl","abstract":false,"location":{"filename":"src/clear/cli/generators/migration.cr","line_number":19,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/migration.cr#L19"},"def":{"name":"run_impl","visibility":"Public","body":"g = Generate::Generator.new\ng.target_directory = flags.directory\nname = arguments.name\nif name\n name_underscore = name.underscore\n class_name = name.camelcase\n migration_uid = Time.local.to_unix.to_s.rjust(10, '0')\n g[\"migration_uid\"] = migration_uid\n g[\"class_name\"] = class_name\n migration_file = \"#{migration_uid}_#{name_underscore}.cr\"\n if Dir[File.join(g.target_directory, \"src/db/migrations/*_#{name_underscore}.cr\")].empty?\n else\n puts(\"A migration file `xxxx_#{name_underscore}.cr` already exists\")\n exit(1)\n end\n g.in_directory(\"src/db/migrations\") do\n g.file(migration_file, Clear::CLI::Generator.ecr_to_s(\"/home/runner/work/clear/clear/src/clear/cli/generators/../../../../templates/migration.cr.ecr\", g))\n end\nelse\n puts(\"Please provide a name for the migration\")\n exit(1)\nend\n"}},{"html_id":"sub(command,*args,**params)-instance-method","name":"sub","doc":"Invokes a sub command by name, passing `self` as the parent.","summary":"

Invokes a sub command by name, passing self as the parent.

","abstract":false,"args":[{"name":"command","external_name":"command","restriction":""},{"name":"args","external_name":"args","restriction":""}],"args_string":"(command, *args, **params)","args_html":"(command, *args, **params)","location":{"filename":"src/clear/cli/generators/migration.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/migration.cr#L6"},"def":{"name":"sub","args":[{"name":"command","external_name":"command","restriction":""},{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"params","external_name":"params","restriction":""},"splat_index":1,"visibility":"Public","body":"SubCommands.invoke(command, *args, **params, parent: self)"}}],"types":[{"html_id":"clear/Clear/CLI/Generator/Migration/Arguments","path":"Clear/CLI/Generator/Migration/Arguments.html","kind":"struct","full_name":"Clear::CLI::Generator::Migration::Arguments","name":"Arguments","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Iterable","kind":"module","full_name":"Iterable","name":"Iterable"},{"html_id":"clear/Enumerable","kind":"module","full_name":"Enumerable","name":"Enumerable"},{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli/generators/migration.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/migration.cr#L6"},{"filename":"src/clear/cli/generators/migration.cr","line_number":17,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/migration.cr#L17"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"SPECS","name":"SPECS","value":"{\"name\" => {type: \"String\", description: {\"name\", \"\"}, default: \"nil\", is_required: false}} of String => NamedTuple(type: String, description: Tuple(String, String | ::Nil), default: String, is_required: Bool)"}],"included_modules":[{"html_id":"clear/Enumerable","kind":"module","full_name":"Enumerable","name":"Enumerable"},{"html_id":"clear/Iterable","kind":"module","full_name":"Iterable","name":"Iterable"}],"namespace":{"html_id":"clear/Clear/CLI/Generator/Migration","kind":"class","full_name":"Clear::CLI::Generator::Migration","name":"Migration"},"constructors":[{"html_id":"new(command:Admiral::Command)-class-method","name":"new","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"new","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":"_ = allocate\n_.initialize(command)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"[](*args,**options)-instance-method","name":"[]","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","def":{"name":"[]","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@__rest__[*args, **options]"}},{"html_id":"[](*args,**options,&)-instance-method","name":"[]","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","def":{"name":"[]","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@__rest__.[](*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"each(*args,**options)-instance-method","name":"each","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","def":{"name":"each","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@__rest__.each(*args, **options)"}},{"html_id":"each(*args,**options,&)-instance-method","name":"each","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","def":{"name":"each","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@__rest__.each(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"exists?(name:Symbol)-instance-method","name":"exists?","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"exists?","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":"!!SPECS[name]?"}},{"html_id":"get(name:Symbol)-instance-method","name":"get","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"get","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":"{name: @name}[name]?"}},{"html_id":"get?(name:Symbol)-instance-method","name":"get?","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"get?","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":"exists?(name) ? get(name) : false"}},{"html_id":"inspect(io)-instance-method","name":"inspect","abstract":false,"args":[{"name":"io","external_name":"io","restriction":""}],"args_string":"(io)","args_html":"(io)","location":{"filename":"src/clear/cli/generators/migration.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/migration.cr#L6"},"def":{"name":"inspect","args":[{"name":"io","external_name":"io","restriction":""}],"visibility":"Public","body":"names = SPECS.keys\nif size > 0\n names << \"...\"\nend\nio << \"<#{self.class}\"\nio << \"(\"\nif names.empty?\nelse\n io << (names.join(\", \"))\nend\nio << \")\"\nio << \">\"\n"}},{"html_id":"name:String|Nil-instance-method","name":"name","abstract":false,"location":{"filename":"src/clear/cli/generators/migration.cr","line_number":17,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/migration.cr#L17"},"def":{"name":"name","return_type":"String | Nil","visibility":"Public","body":"@name"}},{"html_id":"rest:Array(String)-instance-method","name":"rest","abstract":false,"def":{"name":"rest","visibility":"Public","body":"@__rest__"}},{"html_id":"validate!(command:Admiral::Command)-instance-method","name":"validate!","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"validate!","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":"if {type: \"String\", description: {\"name\", \"\"}, default: \"nil\", is_required: false}[:is_required] && @name.nil?\n raise(Admiral::Error.new(\"Argument required: name\"))\nend"}},{"html_id":"value_from_spec(command:Admiral::Command,*,arg:String,type,default,is_required:Bool)-instance-method","name":"value_from_spec","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"},{"name":"","external_name":"","restriction":""},{"name":"arg","external_name":"arg","restriction":"String"},{"name":"type","external_name":"type","restriction":""},{"name":"default","external_name":"default","restriction":""},{"name":"is_required","external_name":"is_required","restriction":"Bool"}],"args_string":"(command : Admiral::Command, *, arg : String, type, default, is_required : Bool)","args_html":"(command : Admiral::Command, *, arg : String, type, default, is_required : Bool)","location":{"filename":"src/clear/cli/generators/migration.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/migration.cr#L6"},"def":{"name":"value_from_spec","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"},{"name":"","external_name":"","restriction":""},{"name":"arg","external_name":"arg","restriction":"String"},{"name":"type","external_name":"type","restriction":""},{"name":"default","external_name":"default","restriction":""},{"name":"is_required","external_name":"is_required","restriction":"Bool"}],"splat_index":1,"visibility":"Public","body":"pos_only = false\nindex = 0\nwhile ((command.@argv)[index]?.to_s.starts_with?(\"-\")) && !pos_only\n index = index + 1\n pos_only = (command.@argv)[index]? == \"--\"\nend\nif (command.@argv)[index]?\n value = (command.@argv).delete_at(index)\n type.new(value)\nelse\n default\nend\n"}}]},{"html_id":"clear/Clear/CLI/Generator/Migration/Flags","path":"Clear/CLI/Generator/Migration/Flags.html","kind":"struct","full_name":"Clear::CLI::Generator::Migration::Flags","name":"Flags","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli/generators/migration.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/migration.cr#L6"},{"filename":"src/clear/cli/generators/migration.cr","line_number":11,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/migration.cr#L11"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"DESCRIPTIONS","name":"DESCRIPTIONS","value":"{} of String => String"},{"id":"SPECS","name":"SPECS","value":"{\"verbose\" => {kind: \"bool\", type: \"Bool\", default: \"false\", description: {\"--verbose, -v\", \"Display verbose informations during execution\"}, short: \"v\", long: \"verbose\", is_required: true}, \"no_color\" => {kind: \"bool\", type: \"Bool\", default: \"false\", description: {\"--no-color\", \"Cancel color output\"}, short: \"nil\", long: \"no-color\", is_required: true}, \"__help__\" => {kind: \"bool\", type: \"Bool\", default: \"false\", description: {\"--help\", \"Displays help for the current command.\"}, short: \"nil\", long: \"help\", is_required: true}, \"directory\" => {kind: \"nil\", type: \"String\", default: \"\\\".\\\"\", description: {\"--directory, -d (default: \\\".\\\")\", \"Set target directory\"}, short: \"d\", long: \"directory\", is_required: true}} of String => NamedTuple(kind: String, type: String, default: String, description: Tuple(String, String | ::Nil), short: String | ::Nil, long: String, is_required: Bool)"}],"namespace":{"html_id":"clear/Clear/CLI/Generator/Migration","kind":"class","full_name":"Clear::CLI::Generator::Migration","name":"Migration"},"doc":"Extend the flags struct to include the flag","summary":"

Extend the flags struct to include the flag

","constructors":[{"html_id":"new(command:Admiral::Command)-class-method","name":"new","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"new","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":"_ = allocate\n_.initialize(command)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"__help__-instance-method","name":"__help__","abstract":false,"def":{"name":"__help__","visibility":"Public","body":"@__help__.not_nil!"}},{"html_id":"directory-instance-method","name":"directory","abstract":false,"location":{"filename":"src/clear/cli/generators/migration.cr","line_number":11,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/migration.cr#L11"},"def":{"name":"directory","visibility":"Public","body":"@directory.not_nil!"}},{"html_id":"inspect(io)-instance-method","name":"inspect","abstract":false,"args":[{"name":"io","external_name":"io","restriction":""}],"args_string":"(io)","args_html":"(io)","location":{"filename":"src/clear/cli/generators/migration.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/migration.cr#L6"},"def":{"name":"inspect","args":[{"name":"io","external_name":"io","restriction":""}],"visibility":"Public","body":"io << \"<#{self.class}\"\nio << \"(\"\nif SPECS.empty?\nelse\n io << (SPECS.keys.join(\", \"))\nend\nio << \")\"\nio << \">\"\n"}},{"html_id":"no_color-instance-method","name":"no_color","abstract":false,"def":{"name":"no_color","visibility":"Public","body":"@no_color.not_nil!"}},{"html_id":"validate!(command)-instance-method","name":"validate!","abstract":false,"args":[{"name":"command","external_name":"command","restriction":""}],"args_string":"(command)","args_html":"(command)","def":{"name":"validate!","args":[{"name":"command","external_name":"command","restriction":""}],"visibility":"Public","body":"if @verbose.nil?\n raise(Admiral::Error.new(\"Flag required: --verbose\"))\nend\nif @no_color.nil?\n raise(Admiral::Error.new(\"Flag required: --no-color\"))\nend\nif @__help__.nil?\n raise(Admiral::Error.new(\"Flag required: --help\"))\nend\nif @directory.nil?\n raise(Admiral::Error.new(\"Flag required: --directory\"))\nend\nraise_extra_flags!(command)\n"}},{"html_id":"verbose-instance-method","name":"verbose","abstract":false,"def":{"name":"verbose","visibility":"Public","body":"@verbose.not_nil!"}}]}]},{"html_id":"clear/Clear/CLI/Generator/Model","path":"Clear/CLI/Generator/Model.html","kind":"class","full_name":"Clear::CLI::Generator::Model","name":"Model","abstract":false,"superclass":{"html_id":"clear/Admiral/Command","kind":"class","full_name":"Admiral::Command","name":"Command"},"ancestors":[{"html_id":"clear/Clear/CLI/Command","kind":"module","full_name":"Clear::CLI::Command","name":"Command"},{"html_id":"clear/Admiral/Command","kind":"class","full_name":"Admiral::Command","name":"Command"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli/generators/model.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/model.cr#L6"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"HELP","name":"HELP","value":"{\"description\" => \"\"}"}],"included_modules":[{"html_id":"clear/Clear/CLI/Command","kind":"module","full_name":"Clear::CLI::Command","name":"Command"}],"namespace":{"html_id":"clear/Clear/CLI/Generator","kind":"class","full_name":"Clear::CLI::Generator","name":"Generator"},"class_methods":[{"html_id":"description-class-method","name":"description","abstract":false,"location":{"filename":"src/clear/cli/generators/model.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/model.cr#L6"},"def":{"name":"description","visibility":"Public","body":"HELP[\"description\"]"}},{"html_id":"run(*args,**params)-class-method","name":"run","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **params)","args_html":"(*args, **params)","location":{"filename":"src/clear/cli/generators/model.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/model.cr#L6"},"def":{"name":"run","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"params","external_name":"params","restriction":""},"splat_index":0,"visibility":"Public","body":"(new(*args, **params)).parse_and_run"}}],"instance_methods":[{"html_id":"__rescue_from___Admiral__Error(e)-instance-method","name":"__rescue_from___Admiral__Error","abstract":false,"args":[{"name":"e","external_name":"e","restriction":""}],"args_string":"(e)","args_html":"(e)","def":{"name":"__rescue_from___Admiral__Error","args":[{"name":"e","external_name":"e","restriction":""}],"visibility":"Public","body":"panic(e.message.colorize(:red))"}},{"html_id":"arguments-instance-method","name":"arguments","doc":"Returns the commands `Arguments` object.\n\nYou can access names arguments by name.\nYou can also access the remaning arguments using `.arguments[index]`.","summary":"

Returns the commands Arguments object.

","abstract":false,"location":{"filename":"src/clear/cli/generators/model.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/model.cr#L6"},"def":{"name":"arguments","visibility":"Public","body":"@arguments || (@arguments = Arguments.new(self))"}},{"html_id":"flags-instance-method","name":"flags","doc":"Returns the commands `Flags` object.\n\nYou can access names flags by name.","summary":"

Returns the commands Flags object.

","abstract":false,"location":{"filename":"src/clear/cli/generators/model.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/model.cr#L6"},"def":{"name":"flags","visibility":"Public","body":"@flags || (@flags = Flags.new(self))"}},{"html_id":"help-instance-method","name":"help","abstract":false,"def":{"name":"help","visibility":"Public","body":"[help_usage, \"Create a new model and the first migration\" + \"\\n\", help_flags, help_arguments, help_sub_commands].reject() do |__arg0|\n __arg0.strip.empty?\nend.join(\"\\n\")"}},{"html_id":"run-instance-method","name":"run","doc":"The run command.","summary":"

The run command.

","abstract":false,"location":{"filename":"src/clear/cli/generators/model.cr","line_number":7,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/model.cr#L7"},"def":{"name":"run","visibility":"Public","body":"Colorize.enabled = !flags.no_color\nrun_impl\n"}},{"html_id":"run_impl-instance-method","name":"run_impl","abstract":false,"location":{"filename":"src/clear/cli/generators/model.cr","line_number":19,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/model.cr#L19"},"def":{"name":"run_impl","visibility":"Public","body":"g = Generate::Generator.new\ng.target_directory = flags.directory\nname = arguments.name\nif name\n name_underscore = name.underscore\n model_table = name_underscore.pluralize\n class_name = name.camelcase\n fields = @argv.join(\"|\")\n migration_uid = Time.local.to_unix.to_s.rjust(10, '0')\n g[\"model_class\"] = class_name\n g[\"migration_uid\"] = migration_uid\n g[\"model_table\"] = model_table\n g[\"model_fields\"] = fields\n model_file = \"#{name_underscore}.cr\"\n migration_file = \"#{migration_uid}_create_#{name_underscore.pluralize}.cr\"\n if Dir[File.join(g.target_directory, \"src/db/migrations/*_create_#{name_underscore.pluralize}.cr\")].empty?\n else\n puts(\"A migration file `xxxx__create_#{name_underscore.pluralize}.cr` already exists\")\n exit(1)\n end\n g.in_directory(\"src/models\") do\n g.file(model_file, Clear::CLI::Generator.ecr_to_s(\"/home/runner/work/clear/clear/src/clear/cli/generators/../../../../templates/model/model.cr.ecr\", g))\n end\n g.in_directory(\"src/db/migrations\") do\n g.file(migration_file, Clear::CLI::Generator.ecr_to_s(\"/home/runner/work/clear/clear/src/clear/cli/generators/../../../../templates/model/migration.cr.ecr\", g))\n end\nelse\n puts(\"Please provide a name for the model\")\n exit(1)\nend\n"}},{"html_id":"sub(command,*args,**params)-instance-method","name":"sub","doc":"Invokes a sub command by name, passing `self` as the parent.","summary":"

Invokes a sub command by name, passing self as the parent.

","abstract":false,"args":[{"name":"command","external_name":"command","restriction":""},{"name":"args","external_name":"args","restriction":""}],"args_string":"(command, *args, **params)","args_html":"(command, *args, **params)","location":{"filename":"src/clear/cli/generators/model.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/model.cr#L6"},"def":{"name":"sub","args":[{"name":"command","external_name":"command","restriction":""},{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"params","external_name":"params","restriction":""},"splat_index":1,"visibility":"Public","body":"SubCommands.invoke(command, *args, **params, parent: self)"}}],"types":[{"html_id":"clear/Clear/CLI/Generator/Model/Arguments","path":"Clear/CLI/Generator/Model/Arguments.html","kind":"struct","full_name":"Clear::CLI::Generator::Model::Arguments","name":"Arguments","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Iterable","kind":"module","full_name":"Iterable","name":"Iterable"},{"html_id":"clear/Enumerable","kind":"module","full_name":"Enumerable","name":"Enumerable"},{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli/generators/model.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/model.cr#L6"},{"filename":"src/clear/cli/generators/model.cr","line_number":17,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/model.cr#L17"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"SPECS","name":"SPECS","value":"{\"name\" => {type: \"String\", description: {\"name\", \"\"}, default: \"nil\", is_required: false}} of String => NamedTuple(type: String, description: Tuple(String, String | ::Nil), default: String, is_required: Bool)"}],"included_modules":[{"html_id":"clear/Enumerable","kind":"module","full_name":"Enumerable","name":"Enumerable"},{"html_id":"clear/Iterable","kind":"module","full_name":"Iterable","name":"Iterable"}],"namespace":{"html_id":"clear/Clear/CLI/Generator/Model","kind":"class","full_name":"Clear::CLI::Generator::Model","name":"Model"},"constructors":[{"html_id":"new(command:Admiral::Command)-class-method","name":"new","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"new","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":"_ = allocate\n_.initialize(command)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"[](*args,**options)-instance-method","name":"[]","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","def":{"name":"[]","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@__rest__[*args, **options]"}},{"html_id":"[](*args,**options,&)-instance-method","name":"[]","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","def":{"name":"[]","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@__rest__.[](*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"each(*args,**options)-instance-method","name":"each","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","def":{"name":"each","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@__rest__.each(*args, **options)"}},{"html_id":"each(*args,**options,&)-instance-method","name":"each","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","def":{"name":"each","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@__rest__.each(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"exists?(name:Symbol)-instance-method","name":"exists?","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"exists?","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":"!!SPECS[name]?"}},{"html_id":"get(name:Symbol)-instance-method","name":"get","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"get","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":"{name: @name}[name]?"}},{"html_id":"get?(name:Symbol)-instance-method","name":"get?","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"get?","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":"exists?(name) ? get(name) : false"}},{"html_id":"inspect(io)-instance-method","name":"inspect","abstract":false,"args":[{"name":"io","external_name":"io","restriction":""}],"args_string":"(io)","args_html":"(io)","location":{"filename":"src/clear/cli/generators/model.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/model.cr#L6"},"def":{"name":"inspect","args":[{"name":"io","external_name":"io","restriction":""}],"visibility":"Public","body":"names = SPECS.keys\nif size > 0\n names << \"...\"\nend\nio << \"<#{self.class}\"\nio << \"(\"\nif names.empty?\nelse\n io << (names.join(\", \"))\nend\nio << \")\"\nio << \">\"\n"}},{"html_id":"name:String|Nil-instance-method","name":"name","abstract":false,"location":{"filename":"src/clear/cli/generators/model.cr","line_number":17,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/model.cr#L17"},"def":{"name":"name","return_type":"String | Nil","visibility":"Public","body":"@name"}},{"html_id":"rest:Array(String)-instance-method","name":"rest","abstract":false,"def":{"name":"rest","visibility":"Public","body":"@__rest__"}},{"html_id":"validate!(command:Admiral::Command)-instance-method","name":"validate!","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"validate!","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":"if {type: \"String\", description: {\"name\", \"\"}, default: \"nil\", is_required: false}[:is_required] && @name.nil?\n raise(Admiral::Error.new(\"Argument required: name\"))\nend"}},{"html_id":"value_from_spec(command:Admiral::Command,*,arg:String,type,default,is_required:Bool)-instance-method","name":"value_from_spec","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"},{"name":"","external_name":"","restriction":""},{"name":"arg","external_name":"arg","restriction":"String"},{"name":"type","external_name":"type","restriction":""},{"name":"default","external_name":"default","restriction":""},{"name":"is_required","external_name":"is_required","restriction":"Bool"}],"args_string":"(command : Admiral::Command, *, arg : String, type, default, is_required : Bool)","args_html":"(command : Admiral::Command, *, arg : String, type, default, is_required : Bool)","location":{"filename":"src/clear/cli/generators/model.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/model.cr#L6"},"def":{"name":"value_from_spec","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"},{"name":"","external_name":"","restriction":""},{"name":"arg","external_name":"arg","restriction":"String"},{"name":"type","external_name":"type","restriction":""},{"name":"default","external_name":"default","restriction":""},{"name":"is_required","external_name":"is_required","restriction":"Bool"}],"splat_index":1,"visibility":"Public","body":"pos_only = false\nindex = 0\nwhile ((command.@argv)[index]?.to_s.starts_with?(\"-\")) && !pos_only\n index = index + 1\n pos_only = (command.@argv)[index]? == \"--\"\nend\nif (command.@argv)[index]?\n value = (command.@argv).delete_at(index)\n type.new(value)\nelse\n default\nend\n"}}]},{"html_id":"clear/Clear/CLI/Generator/Model/Flags","path":"Clear/CLI/Generator/Model/Flags.html","kind":"struct","full_name":"Clear::CLI::Generator::Model::Flags","name":"Flags","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli/generators/model.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/model.cr#L6"},{"filename":"src/clear/cli/generators/model.cr","line_number":11,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/model.cr#L11"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"DESCRIPTIONS","name":"DESCRIPTIONS","value":"{} of String => String"},{"id":"SPECS","name":"SPECS","value":"{\"verbose\" => {kind: \"bool\", type: \"Bool\", default: \"false\", description: {\"--verbose, -v\", \"Display verbose informations during execution\"}, short: \"v\", long: \"verbose\", is_required: true}, \"no_color\" => {kind: \"bool\", type: \"Bool\", default: \"false\", description: {\"--no-color\", \"Cancel color output\"}, short: \"nil\", long: \"no-color\", is_required: true}, \"__help__\" => {kind: \"bool\", type: \"Bool\", default: \"false\", description: {\"--help\", \"Displays help for the current command.\"}, short: \"nil\", long: \"help\", is_required: true}, \"directory\" => {kind: \"nil\", type: \"String\", default: \"\\\".\\\"\", description: {\"--directory, -d (default: \\\".\\\")\", \"Set target directory\"}, short: \"d\", long: \"directory\", is_required: true}} of String => NamedTuple(kind: String, type: String, default: String, description: Tuple(String, String | ::Nil), short: String | ::Nil, long: String, is_required: Bool)"}],"namespace":{"html_id":"clear/Clear/CLI/Generator/Model","kind":"class","full_name":"Clear::CLI::Generator::Model","name":"Model"},"doc":"Extend the flags struct to include the flag","summary":"

Extend the flags struct to include the flag

","constructors":[{"html_id":"new(command:Admiral::Command)-class-method","name":"new","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"new","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":"_ = allocate\n_.initialize(command)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"__help__-instance-method","name":"__help__","abstract":false,"def":{"name":"__help__","visibility":"Public","body":"@__help__.not_nil!"}},{"html_id":"directory-instance-method","name":"directory","abstract":false,"location":{"filename":"src/clear/cli/generators/model.cr","line_number":11,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/model.cr#L11"},"def":{"name":"directory","visibility":"Public","body":"@directory.not_nil!"}},{"html_id":"inspect(io)-instance-method","name":"inspect","abstract":false,"args":[{"name":"io","external_name":"io","restriction":""}],"args_string":"(io)","args_html":"(io)","location":{"filename":"src/clear/cli/generators/model.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/model.cr#L6"},"def":{"name":"inspect","args":[{"name":"io","external_name":"io","restriction":""}],"visibility":"Public","body":"io << \"<#{self.class}\"\nio << \"(\"\nif SPECS.empty?\nelse\n io << (SPECS.keys.join(\", \"))\nend\nio << \")\"\nio << \">\"\n"}},{"html_id":"no_color-instance-method","name":"no_color","abstract":false,"def":{"name":"no_color","visibility":"Public","body":"@no_color.not_nil!"}},{"html_id":"validate!(command)-instance-method","name":"validate!","abstract":false,"args":[{"name":"command","external_name":"command","restriction":""}],"args_string":"(command)","args_html":"(command)","def":{"name":"validate!","args":[{"name":"command","external_name":"command","restriction":""}],"visibility":"Public","body":"if @verbose.nil?\n raise(Admiral::Error.new(\"Flag required: --verbose\"))\nend\nif @no_color.nil?\n raise(Admiral::Error.new(\"Flag required: --no-color\"))\nend\nif @__help__.nil?\n raise(Admiral::Error.new(\"Flag required: --help\"))\nend\nif @directory.nil?\n raise(Admiral::Error.new(\"Flag required: --directory\"))\nend\nraise_extra_flags!(command)\n"}},{"html_id":"verbose-instance-method","name":"verbose","abstract":false,"def":{"name":"verbose","visibility":"Public","body":"@verbose.not_nil!"}}]}]},{"html_id":"clear/Clear/CLI/Generator/NewKemal","path":"Clear/CLI/Generator/NewKemal.html","kind":"class","full_name":"Clear::CLI::Generator::NewKemal","name":"NewKemal","abstract":false,"superclass":{"html_id":"clear/Admiral/Command","kind":"class","full_name":"Admiral::Command","name":"Command"},"ancestors":[{"html_id":"clear/Clear/CLI/Command","kind":"module","full_name":"Clear::CLI::Command","name":"Command"},{"html_id":"clear/Admiral/Command","kind":"class","full_name":"Admiral::Command","name":"Command"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli/generators/new/kemal.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/new/kemal.cr#L6"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"HELP","name":"HELP","value":"{\"description\" => \"\"}"}],"included_modules":[{"html_id":"clear/Clear/CLI/Command","kind":"module","full_name":"Clear::CLI::Command","name":"Command"}],"namespace":{"html_id":"clear/Clear/CLI/Generator","kind":"class","full_name":"Clear::CLI::Generator","name":"Generator"},"class_methods":[{"html_id":"description-class-method","name":"description","abstract":false,"location":{"filename":"src/clear/cli/generators/new/kemal.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/new/kemal.cr#L6"},"def":{"name":"description","visibility":"Public","body":"HELP[\"description\"]"}},{"html_id":"run(*args,**params)-class-method","name":"run","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **params)","args_html":"(*args, **params)","location":{"filename":"src/clear/cli/generators/new/kemal.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/new/kemal.cr#L6"},"def":{"name":"run","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"params","external_name":"params","restriction":""},"splat_index":0,"visibility":"Public","body":"(new(*args, **params)).parse_and_run"}}],"instance_methods":[{"html_id":"__rescue_from___Admiral__Error(e)-instance-method","name":"__rescue_from___Admiral__Error","abstract":false,"args":[{"name":"e","external_name":"e","restriction":""}],"args_string":"(e)","args_html":"(e)","def":{"name":"__rescue_from___Admiral__Error","args":[{"name":"e","external_name":"e","restriction":""}],"visibility":"Public","body":"panic(e.message.colorize(:red))"}},{"html_id":"arguments-instance-method","name":"arguments","doc":"Returns the commands `Arguments` object.\n\nYou can access names arguments by name.\nYou can also access the remaning arguments using `.arguments[index]`.","summary":"

Returns the commands Arguments object.

","abstract":false,"location":{"filename":"src/clear/cli/generators/new/kemal.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/new/kemal.cr#L6"},"def":{"name":"arguments","visibility":"Public","body":"@arguments || (@arguments = Arguments.new(self))"}},{"html_id":"flags-instance-method","name":"flags","doc":"Returns the commands `Flags` object.\n\nYou can access names flags by name.","summary":"

Returns the commands Flags object.

","abstract":false,"location":{"filename":"src/clear/cli/generators/new/kemal.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/new/kemal.cr#L6"},"def":{"name":"flags","visibility":"Public","body":"@flags || (@flags = Flags.new(self))"}},{"html_id":"run-instance-method","name":"run","doc":"The run command.","summary":"

The run command.

","abstract":false,"location":{"filename":"src/clear/cli/generators/new/kemal.cr","line_number":7,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/new/kemal.cr#L7"},"def":{"name":"run","visibility":"Public","body":"Colorize.enabled = !flags.no_color\nrun_impl\n"}},{"html_id":"run_impl-instance-method","name":"run_impl","abstract":false,"location":{"filename":"src/clear/cli/generators/new/kemal.cr","line_number":17,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/new/kemal.cr#L17"},"def":{"name":"run_impl","visibility":"Public","body":"g = Generate::Generator.new\ng.target_directory = flags.directory\ng[\"app_name\"] = arguments.name || (File.basename(g.target_directory))\ng[\"app_name_underscore\"] = g[\"app_name\"].underscore\ng[\"app_name_camelcase\"] = g[\"app_name\"].camelcase\ng[\"git_username\"] = (`git config user.email`).chomp || \"email@example.com\"\ng[\"git_email\"] = (`git config user.name`).chomp || \"Your Name\"\ng.in_directory(\"bin\") do\n g.file(\"appctl\", Clear::CLI::Generator.ecr_to_s(\"/home/runner/work/clear/clear/src/clear/cli/generators/new/../../../../../templates/kemal/bin/appctl.ecr\", g))\n g.file(\"clear_cli.cr\", Clear::CLI::Generator.ecr_to_s(\"/home/runner/work/clear/clear/src/clear/cli/generators/new/../../../../../templates/kemal/bin/clear_cli.cr.ecr\", g))\n g.file(\"server.cr\", Clear::CLI::Generator.ecr_to_s(\"/home/runner/work/clear/clear/src/clear/cli/generators/new/../../../../../templates/kemal/bin/server.cr.ecr\", g))\nend\ng.in_directory(\"config\") do\n g.file(\"database.yml\", Clear::CLI::Generator.ecr_to_s(\"/home/runner/work/clear/clear/src/clear/cli/generators/new/../../../../../templates/kemal/config/database.yml.ecr\", g))\nend\ng.in_directory(\"src\") do\n g.in_directory(\"controllers\") do\n g.file(\"application_controller.cr\", Clear::CLI::Generator.ecr_to_s(\"/home/runner/work/clear/clear/src/clear/cli/generators/new/../../../../../templates/kemal/src/controllers/application_controller.ecr\", g))\n g.file(\"welcome_controller.cr\", Clear::CLI::Generator.ecr_to_s(\"/home/runner/work/clear/clear/src/clear/cli/generators/new/../../../../../templates/kemal/src/controllers/welcome_controller.ecr\", g))\n end\n g.in_directory(\"db\") do\n g.file(\"init.cr\", Clear::CLI::Generator.ecr_to_s(\"/home/runner/work/clear/clear/src/clear/cli/generators/new/../../../../../templates/kemal/src/db/init.ecr\", g))\n end\n g.in_directory(\"models\") do\n g.file(\"init.cr\", Clear::CLI::Generator.ecr_to_s(\"/home/runner/work/clear/clear/src/clear/cli/generators/new/../../../../../templates/kemal/src/models/application_model.ecr\", g))\n end\n g.in_directory(\"views\") do\n g.in_directory(\"components\") do\n g.file(\"footer.cr\", Clear::CLI::Generator.ecr_to_s(\"/home/runner/work/clear/clear/src/clear/cli/generators/new/../../../../../templates/kemal/src/views/components/footer.ecr\", g))\n end\n g.in_directory(\"layouts\") do\n g.file(\"application.cr\", Clear::CLI::Generator.ecr_to_s(\"/home/runner/work/clear/clear/src/clear/cli/generators/new/../../../../../templates/kemal/src/views/layouts/application.ecr\", g))\n end\n g.in_directory(\"welcome\") do\n g.file(\"index.cr\", Clear::CLI::Generator.ecr_to_s(\"/home/runner/work/clear/clear/src/clear/cli/generators/new/../../../../../templates/kemal/src/views/welcome/index.ecr\", g))\n end\n end\n g.file(\"app.cr\", Clear::CLI::Generator.ecr_to_s(\"/home/runner/work/clear/clear/src/clear/cli/generators/new/../../../../../templates/kemal/src/app.ecr\", g))\nend\ng.file(\".gitignore\", Clear::CLI::Generator.ecr_to_s(\"/home/runner/work/clear/clear/src/clear/cli/generators/new/../../../../../templates/kemal/_gitignore.ecr\", g))\ng.file(\"shard.yml\", Clear::CLI::Generator.ecr_to_s(\"/home/runner/work/clear/clear/src/clear/cli/generators/new/../../../../../templates/kemal/shard.yml.ecr\", g))\nsystem(\"chmod +x #{g.target_directory}/bin/appctl\")\nsystem(\"cd #{g.target_directory} && shards\")\nputs(\"Clear + Kemal template is now generated. `cd #{g.target_directory} && clear-cli server` to play ! :-)\")\n"}},{"html_id":"sub(command,*args,**params)-instance-method","name":"sub","doc":"Invokes a sub command by name, passing `self` as the parent.","summary":"

Invokes a sub command by name, passing self as the parent.

","abstract":false,"args":[{"name":"command","external_name":"command","restriction":""},{"name":"args","external_name":"args","restriction":""}],"args_string":"(command, *args, **params)","args_html":"(command, *args, **params)","location":{"filename":"src/clear/cli/generators/new/kemal.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/new/kemal.cr#L6"},"def":{"name":"sub","args":[{"name":"command","external_name":"command","restriction":""},{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"params","external_name":"params","restriction":""},"splat_index":1,"visibility":"Public","body":"SubCommands.invoke(command, *args, **params, parent: self)"}}],"types":[{"html_id":"clear/Clear/CLI/Generator/NewKemal/Arguments","path":"Clear/CLI/Generator/NewKemal/Arguments.html","kind":"struct","full_name":"Clear::CLI::Generator::NewKemal::Arguments","name":"Arguments","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Iterable","kind":"module","full_name":"Iterable","name":"Iterable"},{"html_id":"clear/Enumerable","kind":"module","full_name":"Enumerable","name":"Enumerable"},{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli/generators/new/kemal.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/new/kemal.cr#L6"},{"filename":"src/clear/cli/generators/new/kemal.cr","line_number":15,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/new/kemal.cr#L15"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"SPECS","name":"SPECS","value":"{\"name\" => {type: \"String\", description: {\"name\", \"\"}, default: \"nil\", is_required: false}} of String => NamedTuple(type: String, description: Tuple(String, String | ::Nil), default: String, is_required: Bool)"}],"included_modules":[{"html_id":"clear/Enumerable","kind":"module","full_name":"Enumerable","name":"Enumerable"},{"html_id":"clear/Iterable","kind":"module","full_name":"Iterable","name":"Iterable"}],"namespace":{"html_id":"clear/Clear/CLI/Generator/NewKemal","kind":"class","full_name":"Clear::CLI::Generator::NewKemal","name":"NewKemal"},"constructors":[{"html_id":"new(command:Admiral::Command)-class-method","name":"new","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"new","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":"_ = allocate\n_.initialize(command)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"[](*args,**options)-instance-method","name":"[]","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","def":{"name":"[]","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@__rest__[*args, **options]"}},{"html_id":"[](*args,**options,&)-instance-method","name":"[]","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","def":{"name":"[]","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@__rest__.[](*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"each(*args,**options)-instance-method","name":"each","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","def":{"name":"each","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@__rest__.each(*args, **options)"}},{"html_id":"each(*args,**options,&)-instance-method","name":"each","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","def":{"name":"each","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@__rest__.each(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"exists?(name:Symbol)-instance-method","name":"exists?","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"exists?","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":"!!SPECS[name]?"}},{"html_id":"get(name:Symbol)-instance-method","name":"get","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"get","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":"{name: @name}[name]?"}},{"html_id":"get?(name:Symbol)-instance-method","name":"get?","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"get?","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":"exists?(name) ? get(name) : false"}},{"html_id":"inspect(io)-instance-method","name":"inspect","abstract":false,"args":[{"name":"io","external_name":"io","restriction":""}],"args_string":"(io)","args_html":"(io)","location":{"filename":"src/clear/cli/generators/new/kemal.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/new/kemal.cr#L6"},"def":{"name":"inspect","args":[{"name":"io","external_name":"io","restriction":""}],"visibility":"Public","body":"names = SPECS.keys\nif size > 0\n names << \"...\"\nend\nio << \"<#{self.class}\"\nio << \"(\"\nif names.empty?\nelse\n io << (names.join(\", \"))\nend\nio << \")\"\nio << \">\"\n"}},{"html_id":"name:String|Nil-instance-method","name":"name","abstract":false,"location":{"filename":"src/clear/cli/generators/new/kemal.cr","line_number":15,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/new/kemal.cr#L15"},"def":{"name":"name","return_type":"String | Nil","visibility":"Public","body":"@name"}},{"html_id":"rest:Array(String)-instance-method","name":"rest","abstract":false,"def":{"name":"rest","visibility":"Public","body":"@__rest__"}},{"html_id":"validate!(command:Admiral::Command)-instance-method","name":"validate!","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"validate!","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":"if {type: \"String\", description: {\"name\", \"\"}, default: \"nil\", is_required: false}[:is_required] && @name.nil?\n raise(Admiral::Error.new(\"Argument required: name\"))\nend"}},{"html_id":"value_from_spec(command:Admiral::Command,*,arg:String,type,default,is_required:Bool)-instance-method","name":"value_from_spec","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"},{"name":"","external_name":"","restriction":""},{"name":"arg","external_name":"arg","restriction":"String"},{"name":"type","external_name":"type","restriction":""},{"name":"default","external_name":"default","restriction":""},{"name":"is_required","external_name":"is_required","restriction":"Bool"}],"args_string":"(command : Admiral::Command, *, arg : String, type, default, is_required : Bool)","args_html":"(command : Admiral::Command, *, arg : String, type, default, is_required : Bool)","location":{"filename":"src/clear/cli/generators/new/kemal.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/new/kemal.cr#L6"},"def":{"name":"value_from_spec","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"},{"name":"","external_name":"","restriction":""},{"name":"arg","external_name":"arg","restriction":"String"},{"name":"type","external_name":"type","restriction":""},{"name":"default","external_name":"default","restriction":""},{"name":"is_required","external_name":"is_required","restriction":"Bool"}],"splat_index":1,"visibility":"Public","body":"pos_only = false\nindex = 0\nwhile ((command.@argv)[index]?.to_s.starts_with?(\"-\")) && !pos_only\n index = index + 1\n pos_only = (command.@argv)[index]? == \"--\"\nend\nif (command.@argv)[index]?\n value = (command.@argv).delete_at(index)\n type.new(value)\nelse\n default\nend\n"}}]},{"html_id":"clear/Clear/CLI/Generator/NewKemal/Flags","path":"Clear/CLI/Generator/NewKemal/Flags.html","kind":"struct","full_name":"Clear::CLI::Generator::NewKemal::Flags","name":"Flags","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli/generators/new/kemal.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/new/kemal.cr#L6"},{"filename":"src/clear/cli/generators/new/kemal.cr","line_number":9,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/new/kemal.cr#L9"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"DESCRIPTIONS","name":"DESCRIPTIONS","value":"{} of String => String"},{"id":"SPECS","name":"SPECS","value":"{\"verbose\" => {kind: \"bool\", type: \"Bool\", default: \"false\", description: {\"--verbose, -v\", \"Display verbose informations during execution\"}, short: \"v\", long: \"verbose\", is_required: true}, \"no_color\" => {kind: \"bool\", type: \"Bool\", default: \"false\", description: {\"--no-color\", \"Cancel color output\"}, short: \"nil\", long: \"no-color\", is_required: true}, \"directory\" => {kind: \"nil\", type: \"String\", default: \"\\\".\\\"\", description: {\"--directory, -d (default: \\\".\\\")\", \"Set target directory\"}, short: \"d\", long: \"directory\", is_required: true}} of String => NamedTuple(kind: String, type: String, default: String, description: Tuple(String, String | ::Nil), short: String | ::Nil, long: String, is_required: Bool)"}],"namespace":{"html_id":"clear/Clear/CLI/Generator/NewKemal","kind":"class","full_name":"Clear::CLI::Generator::NewKemal","name":"NewKemal"},"doc":"Extend the flags struct to include the flag","summary":"

Extend the flags struct to include the flag

","constructors":[{"html_id":"new(command:Admiral::Command)-class-method","name":"new","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"new","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":"_ = allocate\n_.initialize(command)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"directory-instance-method","name":"directory","abstract":false,"location":{"filename":"src/clear/cli/generators/new/kemal.cr","line_number":9,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/new/kemal.cr#L9"},"def":{"name":"directory","visibility":"Public","body":"@directory.not_nil!"}},{"html_id":"inspect(io)-instance-method","name":"inspect","abstract":false,"args":[{"name":"io","external_name":"io","restriction":""}],"args_string":"(io)","args_html":"(io)","location":{"filename":"src/clear/cli/generators/new/kemal.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generators/new/kemal.cr#L6"},"def":{"name":"inspect","args":[{"name":"io","external_name":"io","restriction":""}],"visibility":"Public","body":"io << \"<#{self.class}\"\nio << \"(\"\nif SPECS.empty?\nelse\n io << (SPECS.keys.join(\", \"))\nend\nio << \")\"\nio << \">\"\n"}},{"html_id":"no_color-instance-method","name":"no_color","abstract":false,"def":{"name":"no_color","visibility":"Public","body":"@no_color.not_nil!"}},{"html_id":"validate!(command)-instance-method","name":"validate!","abstract":false,"args":[{"name":"command","external_name":"command","restriction":""}],"args_string":"(command)","args_html":"(command)","def":{"name":"validate!","args":[{"name":"command","external_name":"command","restriction":""}],"visibility":"Public","body":"if @verbose.nil?\n raise(Admiral::Error.new(\"Flag required: --verbose\"))\nend\nif @no_color.nil?\n raise(Admiral::Error.new(\"Flag required: --no-color\"))\nend\nif @directory.nil?\n raise(Admiral::Error.new(\"Flag required: --directory\"))\nend\nraise_extra_flags!(command)\n"}},{"html_id":"verbose-instance-method","name":"verbose","abstract":false,"def":{"name":"verbose","visibility":"Public","body":"@verbose.not_nil!"}}]}]},{"html_id":"clear/Clear/CLI/Generator/Record","path":"Clear/CLI/Generator/Record.html","kind":"struct","full_name":"Clear::CLI::Generator::Record","name":"Record","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli/generator.cr","line_number":7,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generator.cr#L7"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/CLI/Generator","kind":"class","full_name":"Clear::CLI::Generator","name":"Generator"},"constructors":[{"html_id":"new(name:String,desc:String,callback:Array(String)->Nil)-class-method","name":"new","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"String"},{"name":"desc","external_name":"desc","restriction":"String"},{"name":"callback","external_name":"callback","restriction":"(Array(String) -> Nil)"}],"args_string":"(name : String, desc : String, callback : Array(String) -> Nil)","args_html":"(name : String, desc : String, callback : Array(String) -> Nil)","location":{"filename":"src/clear/cli/generator.cr","line_number":7,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generator.cr#L7"},"def":{"name":"new","args":[{"name":"name","external_name":"name","restriction":"String"},{"name":"desc","external_name":"desc","restriction":"String"},{"name":"callback","external_name":"callback","restriction":"(Array(String) -> Nil)"}],"visibility":"Public","body":"_ = allocate\n_.initialize(name, desc, callback)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"callback:Array(String)->Nil-instance-method","name":"callback","abstract":false,"def":{"name":"callback","return_type":"(Array(String) -> Nil)","visibility":"Public","body":"@callback"}},{"html_id":"clone-instance-method","name":"clone","abstract":false,"location":{"filename":"src/clear/cli/generator.cr","line_number":7,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generator.cr#L7"},"def":{"name":"clone","visibility":"Public","body":"self.class.new(@name.clone, @desc.clone, @callback.clone)"}},{"html_id":"copy_with(name_name=@name,desc_desc=@desc,callback_callback=@callback)-instance-method","name":"copy_with","abstract":false,"args":[{"name":"_name","default_value":"@name","external_name":"name","restriction":""},{"name":"_desc","default_value":"@desc","external_name":"desc","restriction":""},{"name":"_callback","default_value":"@callback","external_name":"callback","restriction":""}],"args_string":"(name _name = @name, desc _desc = @desc, callback _callback = @callback)","args_html":"(name _name = @name, desc _desc = @desc, callback _callback = @callback)","location":{"filename":"src/clear/cli/generator.cr","line_number":7,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/generator.cr#L7"},"def":{"name":"copy_with","args":[{"name":"_name","default_value":"@name","external_name":"name","restriction":""},{"name":"_desc","default_value":"@desc","external_name":"desc","restriction":""},{"name":"_callback","default_value":"@callback","external_name":"callback","restriction":""}],"visibility":"Public","body":"self.class.new(_name, _desc, _callback)"}},{"html_id":"desc:String-instance-method","name":"desc","abstract":false,"def":{"name":"desc","return_type":"String","visibility":"Public","body":"@desc"}},{"html_id":"name:String-instance-method","name":"name","abstract":false,"def":{"name":"name","return_type":"String","visibility":"Public","body":"@name"}}]}]},{"html_id":"clear/Clear/CLI/Migration","path":"Clear/CLI/Migration.html","kind":"class","full_name":"Clear::CLI::Migration","name":"Migration","abstract":false,"superclass":{"html_id":"clear/Admiral/Command","kind":"class","full_name":"Admiral::Command","name":"Command"},"ancestors":[{"html_id":"clear/Admiral/Command/Run","kind":"module","full_name":"Admiral::Command::Run","name":"Run"},{"html_id":"clear/Clear/CLI/Command","kind":"module","full_name":"Clear::CLI::Command","name":"Command"},{"html_id":"clear/Admiral/Command","kind":"class","full_name":"Admiral::Command","name":"Command"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli/migration.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L1"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"HELP","name":"HELP","value":"{\"description\" => \"\"}"}],"included_modules":[{"html_id":"clear/Admiral/Command/Run","kind":"module","full_name":"Admiral::Command::Run","name":"Run"},{"html_id":"clear/Clear/CLI/Command","kind":"module","full_name":"Clear::CLI::Command","name":"Command"}],"namespace":{"html_id":"clear/Clear/CLI","kind":"module","full_name":"Clear::CLI","name":"CLI"},"class_methods":[{"html_id":"description-class-method","name":"description","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L1"},"def":{"name":"description","visibility":"Public","body":"HELP[\"description\"]"}},{"html_id":"run(*args,**params)-class-method","name":"run","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **params)","args_html":"(*args, **params)","location":{"filename":"src/clear/cli/migration.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L1"},"def":{"name":"run","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"params","external_name":"params","restriction":""},"splat_index":0,"visibility":"Public","body":"(new(*args, **params)).parse_and_run"}}],"instance_methods":[{"html_id":"__rescue_from___Admiral__Error(e)-instance-method","name":"__rescue_from___Admiral__Error","abstract":false,"args":[{"name":"e","external_name":"e","restriction":""}],"args_string":"(e)","args_html":"(e)","def":{"name":"__rescue_from___Admiral__Error","args":[{"name":"e","external_name":"e","restriction":""}],"visibility":"Public","body":"panic(e.message.colorize(:red))"}},{"html_id":"arguments-instance-method","name":"arguments","doc":"Returns the commands `Arguments` object.\n\nYou can access names arguments by name.\nYou can also access the remaning arguments using `.arguments[index]`.","summary":"

Returns the commands Arguments object.

","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L1"},"def":{"name":"arguments","visibility":"Public","body":"@arguments || (@arguments = Arguments.new(self))"}},{"html_id":"flags-instance-method","name":"flags","doc":"Returns the commands `Flags` object.\n\nYou can access names flags by name.","summary":"

Returns the commands Flags object.

","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L1"},"def":{"name":"flags","visibility":"Public","body":"@flags || (@flags = Flags.new(self))"}},{"html_id":"help-instance-method","name":"help","abstract":false,"def":{"name":"help","visibility":"Public","body":"[help_usage, \"Manage migration state of your database\" + \"\\n\", help_flags, help_arguments, help_sub_commands].reject() do |__arg0|\n __arg0.strip.empty?\nend.join(\"\\n\")"}},{"html_id":"run-instance-method","name":"run","doc":"The run command.","summary":"

The run command.

","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":2,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L2"},"def":{"name":"run","visibility":"Public","body":"Colorize.enabled = !flags.no_color\nrun_impl\n"}},{"html_id":"run_impl-instance-method","name":"run_impl","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":108,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L108"},"def":{"name":"run_impl","visibility":"Public","body":"Clear::Migration::Manager.instance.apply_all"}},{"html_id":"sub(command,*args,**params)-instance-method","name":"sub","doc":"Invokes a sub command by name, passing `self` as the parent.","summary":"

Invokes a sub command by name, passing self as the parent.

","abstract":false,"args":[{"name":"command","external_name":"command","restriction":""},{"name":"args","external_name":"args","restriction":""}],"args_string":"(command, *args, **params)","args_html":"(command, *args, **params)","location":{"filename":"src/clear/cli/migration.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L1"},"def":{"name":"sub","args":[{"name":"command","external_name":"command","restriction":""},{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"params","external_name":"params","restriction":""},"splat_index":1,"visibility":"Public","body":"SubCommands.invoke(command, *args, **params, parent: self)"}}],"types":[{"html_id":"clear/Clear/CLI/Migration/Arguments","path":"Clear/CLI/Migration/Arguments.html","kind":"struct","full_name":"Clear::CLI::Migration::Arguments","name":"Arguments","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Iterable","kind":"module","full_name":"Iterable","name":"Iterable"},{"html_id":"clear/Enumerable","kind":"module","full_name":"Enumerable","name":"Enumerable"},{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli/migration.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L1"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"SPECS","name":"SPECS","value":"{} of String => NamedTuple(type: String, description: Tuple(String, String | ::Nil), default: String, is_required: Bool)"}],"included_modules":[{"html_id":"clear/Enumerable","kind":"module","full_name":"Enumerable","name":"Enumerable"},{"html_id":"clear/Iterable","kind":"module","full_name":"Iterable","name":"Iterable"}],"namespace":{"html_id":"clear/Clear/CLI/Migration","kind":"class","full_name":"Clear::CLI::Migration","name":"Migration"},"constructors":[{"html_id":"new(command:Admiral::Command)-class-method","name":"new","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"new","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":"_ = allocate\n_.initialize(command)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"[](*args,**options)-instance-method","name":"[]","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","def":{"name":"[]","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@__rest__[*args, **options]"}},{"html_id":"[](*args,**options,&)-instance-method","name":"[]","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","def":{"name":"[]","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@__rest__.[](*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"each(*args,**options)-instance-method","name":"each","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","def":{"name":"each","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@__rest__.each(*args, **options)"}},{"html_id":"each(*args,**options,&)-instance-method","name":"each","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","def":{"name":"each","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@__rest__.each(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"exists?(name:Symbol)-instance-method","name":"exists?","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"exists?","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":"!!SPECS[name]?"}},{"html_id":"get(name:Symbol)-instance-method","name":"get","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"get","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":""}},{"html_id":"get?(name:Symbol)-instance-method","name":"get?","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"get?","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":"exists?(name) ? get(name) : false"}},{"html_id":"inspect(io)-instance-method","name":"inspect","abstract":false,"args":[{"name":"io","external_name":"io","restriction":""}],"args_string":"(io)","args_html":"(io)","location":{"filename":"src/clear/cli/migration.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L1"},"def":{"name":"inspect","args":[{"name":"io","external_name":"io","restriction":""}],"visibility":"Public","body":"names = SPECS.keys\nif size > 0\n names << \"...\"\nend\nio << \"<#{self.class}\"\nio << \"(\"\nif names.empty?\nelse\n io << (names.join(\", \"))\nend\nio << \")\"\nio << \">\"\n"}},{"html_id":"rest:Array(String)-instance-method","name":"rest","abstract":false,"def":{"name":"rest","visibility":"Public","body":"@__rest__"}},{"html_id":"validate!(command:Admiral::Command)-instance-method","name":"validate!","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"validate!","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":""}},{"html_id":"value_from_spec(command:Admiral::Command,*,arg:String,type,default,is_required:Bool)-instance-method","name":"value_from_spec","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"},{"name":"","external_name":"","restriction":""},{"name":"arg","external_name":"arg","restriction":"String"},{"name":"type","external_name":"type","restriction":""},{"name":"default","external_name":"default","restriction":""},{"name":"is_required","external_name":"is_required","restriction":"Bool"}],"args_string":"(command : Admiral::Command, *, arg : String, type, default, is_required : Bool)","args_html":"(command : Admiral::Command, *, arg : String, type, default, is_required : Bool)","location":{"filename":"src/clear/cli/migration.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L1"},"def":{"name":"value_from_spec","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"},{"name":"","external_name":"","restriction":""},{"name":"arg","external_name":"arg","restriction":"String"},{"name":"type","external_name":"type","restriction":""},{"name":"default","external_name":"default","restriction":""},{"name":"is_required","external_name":"is_required","restriction":"Bool"}],"splat_index":1,"visibility":"Public","body":"pos_only = false\nindex = 0\nwhile ((command.@argv)[index]?.to_s.starts_with?(\"-\")) && !pos_only\n index = index + 1\n pos_only = (command.@argv)[index]? == \"--\"\nend\nif (command.@argv)[index]?\n value = (command.@argv).delete_at(index)\n type.new(value)\nelse\n default\nend\n"}}]},{"html_id":"clear/Clear/CLI/Migration/Down","path":"Clear/CLI/Migration/Down.html","kind":"class","full_name":"Clear::CLI::Migration::Down","name":"Down","abstract":false,"superclass":{"html_id":"clear/Admiral/Command","kind":"class","full_name":"Admiral::Command","name":"Command"},"ancestors":[{"html_id":"clear/Clear/CLI/Command","kind":"module","full_name":"Clear::CLI::Command","name":"Command"},{"html_id":"clear/Admiral/Command","kind":"class","full_name":"Admiral::Command","name":"Command"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli/migration.cr","line_number":37,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L37"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"HELP","name":"HELP","value":"{\"description\" => \"\"}"}],"included_modules":[{"html_id":"clear/Clear/CLI/Command","kind":"module","full_name":"Clear::CLI::Command","name":"Command"}],"namespace":{"html_id":"clear/Clear/CLI/Migration","kind":"class","full_name":"Clear::CLI::Migration","name":"Migration"},"class_methods":[{"html_id":"description-class-method","name":"description","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":37,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L37"},"def":{"name":"description","visibility":"Public","body":"HELP[\"description\"]"}},{"html_id":"run(*args,**params)-class-method","name":"run","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **params)","args_html":"(*args, **params)","location":{"filename":"src/clear/cli/migration.cr","line_number":37,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L37"},"def":{"name":"run","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"params","external_name":"params","restriction":""},"splat_index":0,"visibility":"Public","body":"(new(*args, **params)).parse_and_run"}}],"instance_methods":[{"html_id":"__rescue_from___Admiral__Error(e)-instance-method","name":"__rescue_from___Admiral__Error","abstract":false,"args":[{"name":"e","external_name":"e","restriction":""}],"args_string":"(e)","args_html":"(e)","def":{"name":"__rescue_from___Admiral__Error","args":[{"name":"e","external_name":"e","restriction":""}],"visibility":"Public","body":"panic(e.message.colorize(:red))"}},{"html_id":"arguments-instance-method","name":"arguments","doc":"Returns the commands `Arguments` object.\n\nYou can access names arguments by name.\nYou can also access the remaning arguments using `.arguments[index]`.","summary":"

Returns the commands Arguments object.

","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":37,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L37"},"def":{"name":"arguments","visibility":"Public","body":"@arguments || (@arguments = Arguments.new(self))"}},{"html_id":"flags-instance-method","name":"flags","doc":"Returns the commands `Flags` object.\n\nYou can access names flags by name.","summary":"

Returns the commands Flags object.

","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":37,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L37"},"def":{"name":"flags","visibility":"Public","body":"@flags || (@flags = Flags.new(self))"}},{"html_id":"help-instance-method","name":"help","abstract":false,"def":{"name":"help","visibility":"Public","body":"[help_usage, \"Downgrade your database to a specific migration version\" + \"\\n\", help_flags, help_arguments, help_sub_commands].reject() do |__arg0|\n __arg0.strip.empty?\nend.join(\"\\n\")"}},{"html_id":"run-instance-method","name":"run","doc":"The run command.","summary":"

The run command.

","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":38,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L38"},"def":{"name":"run","visibility":"Public","body":"Colorize.enabled = !flags.no_color\nrun_impl\n"}},{"html_id":"run_impl-instance-method","name":"run_impl","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":43,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L43"},"def":{"name":"run_impl","visibility":"Public","body":"Clear::Migration::Manager.instance.down(arguments.migration_number)"}},{"html_id":"sub(command,*args,**params)-instance-method","name":"sub","doc":"Invokes a sub command by name, passing `self` as the parent.","summary":"

Invokes a sub command by name, passing self as the parent.

","abstract":false,"args":[{"name":"command","external_name":"command","restriction":""},{"name":"args","external_name":"args","restriction":""}],"args_string":"(command, *args, **params)","args_html":"(command, *args, **params)","location":{"filename":"src/clear/cli/migration.cr","line_number":37,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L37"},"def":{"name":"sub","args":[{"name":"command","external_name":"command","restriction":""},{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"params","external_name":"params","restriction":""},"splat_index":1,"visibility":"Public","body":"SubCommands.invoke(command, *args, **params, parent: self)"}}],"types":[{"html_id":"clear/Clear/CLI/Migration/Down/Arguments","path":"Clear/CLI/Migration/Down/Arguments.html","kind":"struct","full_name":"Clear::CLI::Migration::Down::Arguments","name":"Arguments","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Iterable","kind":"module","full_name":"Iterable","name":"Iterable"},{"html_id":"clear/Enumerable","kind":"module","full_name":"Enumerable","name":"Enumerable"},{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli/migration.cr","line_number":37,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L37"},{"filename":"src/clear/cli/migration.cr","line_number":40,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L40"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"SPECS","name":"SPECS","value":"{\"migration_number\" => {type: \"Int64\", description: {\"migration_number (required)\", \"\"}, default: \"nil\", is_required: true}} of String => NamedTuple(type: String, description: Tuple(String, String | ::Nil), default: String, is_required: Bool)"}],"included_modules":[{"html_id":"clear/Enumerable","kind":"module","full_name":"Enumerable","name":"Enumerable"},{"html_id":"clear/Iterable","kind":"module","full_name":"Iterable","name":"Iterable"}],"namespace":{"html_id":"clear/Clear/CLI/Migration/Down","kind":"class","full_name":"Clear::CLI::Migration::Down","name":"Down"},"constructors":[{"html_id":"new(command:Admiral::Command)-class-method","name":"new","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"new","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":"_ = allocate\n_.initialize(command)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"[](*args,**options)-instance-method","name":"[]","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","def":{"name":"[]","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@__rest__[*args, **options]"}},{"html_id":"[](*args,**options,&)-instance-method","name":"[]","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","def":{"name":"[]","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@__rest__.[](*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"each(*args,**options)-instance-method","name":"each","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","def":{"name":"each","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@__rest__.each(*args, **options)"}},{"html_id":"each(*args,**options,&)-instance-method","name":"each","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","def":{"name":"each","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@__rest__.each(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"exists?(name:Symbol)-instance-method","name":"exists?","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"exists?","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":"!!SPECS[name]?"}},{"html_id":"get(name:Symbol)-instance-method","name":"get","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"get","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":"{migration_number: @migration_number}[name]?"}},{"html_id":"get?(name:Symbol)-instance-method","name":"get?","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"get?","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":"exists?(name) ? get(name) : false"}},{"html_id":"inspect(io)-instance-method","name":"inspect","abstract":false,"args":[{"name":"io","external_name":"io","restriction":""}],"args_string":"(io)","args_html":"(io)","location":{"filename":"src/clear/cli/migration.cr","line_number":37,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L37"},"def":{"name":"inspect","args":[{"name":"io","external_name":"io","restriction":""}],"visibility":"Public","body":"names = SPECS.keys\nif size > 0\n names << \"...\"\nend\nio << \"<#{self.class}\"\nio << \"(\"\nif names.empty?\nelse\n io << (names.join(\", \"))\nend\nio << \")\"\nio << \">\"\n"}},{"html_id":"migration_number:Int64-instance-method","name":"migration_number","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":40,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L40"},"def":{"name":"migration_number","return_type":"Int64","visibility":"Public","body":"@migration_number.not_nil!"}},{"html_id":"rest:Array(String)-instance-method","name":"rest","abstract":false,"def":{"name":"rest","visibility":"Public","body":"@__rest__"}},{"html_id":"validate!(command:Admiral::Command)-instance-method","name":"validate!","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"validate!","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":"if {type: \"Int64\", description: {\"migration_number (required)\", \"\"}, default: \"nil\", is_required: true}[:is_required] && @migration_number.nil?\n raise(Admiral::Error.new(\"Argument required: migration_number\"))\nend"}},{"html_id":"value_from_spec(command:Admiral::Command,*,arg:String,type,default,is_required:Bool)-instance-method","name":"value_from_spec","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"},{"name":"","external_name":"","restriction":""},{"name":"arg","external_name":"arg","restriction":"String"},{"name":"type","external_name":"type","restriction":""},{"name":"default","external_name":"default","restriction":""},{"name":"is_required","external_name":"is_required","restriction":"Bool"}],"args_string":"(command : Admiral::Command, *, arg : String, type, default, is_required : Bool)","args_html":"(command : Admiral::Command, *, arg : String, type, default, is_required : Bool)","location":{"filename":"src/clear/cli/migration.cr","line_number":37,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L37"},"def":{"name":"value_from_spec","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"},{"name":"","external_name":"","restriction":""},{"name":"arg","external_name":"arg","restriction":"String"},{"name":"type","external_name":"type","restriction":""},{"name":"default","external_name":"default","restriction":""},{"name":"is_required","external_name":"is_required","restriction":"Bool"}],"splat_index":1,"visibility":"Public","body":"pos_only = false\nindex = 0\nwhile ((command.@argv)[index]?.to_s.starts_with?(\"-\")) && !pos_only\n index = index + 1\n pos_only = (command.@argv)[index]? == \"--\"\nend\nif (command.@argv)[index]?\n value = (command.@argv).delete_at(index)\n type.new(value)\nelse\n default\nend\n"}}]},{"html_id":"clear/Clear/CLI/Migration/Down/Flags","path":"Clear/CLI/Migration/Down/Flags.html","kind":"struct","full_name":"Clear::CLI::Migration::Down::Flags","name":"Flags","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli/migration.cr","line_number":37,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L37"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"DESCRIPTIONS","name":"DESCRIPTIONS","value":"{} of String => String"},{"id":"SPECS","name":"SPECS","value":"{\"verbose\" => {kind: \"bool\", type: \"Bool\", default: \"false\", description: {\"--verbose, -v\", \"Display verbose informations during execution\"}, short: \"v\", long: \"verbose\", is_required: true}, \"no_color\" => {kind: \"bool\", type: \"Bool\", default: \"false\", description: {\"--no-color\", \"Cancel color output\"}, short: \"nil\", long: \"no-color\", is_required: true}, \"__help__\" => {kind: \"bool\", type: \"Bool\", default: \"false\", description: {\"--help\", \"Displays help for the current command.\"}, short: \"nil\", long: \"help\", is_required: true}} of String => NamedTuple(kind: String, type: String, default: String, description: Tuple(String, String | ::Nil), short: String | ::Nil, long: String, is_required: Bool)"}],"namespace":{"html_id":"clear/Clear/CLI/Migration/Down","kind":"class","full_name":"Clear::CLI::Migration::Down","name":"Down"},"doc":"Extend the flags struct to include the flag","summary":"

Extend the flags struct to include the flag

","constructors":[{"html_id":"new(command:Admiral::Command)-class-method","name":"new","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"new","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":"_ = allocate\n_.initialize(command)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"__help__-instance-method","name":"__help__","abstract":false,"def":{"name":"__help__","visibility":"Public","body":"@__help__.not_nil!"}},{"html_id":"inspect(io)-instance-method","name":"inspect","abstract":false,"args":[{"name":"io","external_name":"io","restriction":""}],"args_string":"(io)","args_html":"(io)","location":{"filename":"src/clear/cli/migration.cr","line_number":37,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L37"},"def":{"name":"inspect","args":[{"name":"io","external_name":"io","restriction":""}],"visibility":"Public","body":"io << \"<#{self.class}\"\nio << \"(\"\nif SPECS.empty?\nelse\n io << (SPECS.keys.join(\", \"))\nend\nio << \")\"\nio << \">\"\n"}},{"html_id":"no_color-instance-method","name":"no_color","abstract":false,"def":{"name":"no_color","visibility":"Public","body":"@no_color.not_nil!"}},{"html_id":"validate!(command)-instance-method","name":"validate!","abstract":false,"args":[{"name":"command","external_name":"command","restriction":""}],"args_string":"(command)","args_html":"(command)","def":{"name":"validate!","args":[{"name":"command","external_name":"command","restriction":""}],"visibility":"Public","body":"if @verbose.nil?\n raise(Admiral::Error.new(\"Flag required: --verbose\"))\nend\nif @no_color.nil?\n raise(Admiral::Error.new(\"Flag required: --no-color\"))\nend\nif @__help__.nil?\n raise(Admiral::Error.new(\"Flag required: --help\"))\nend\nraise_extra_flags!(command)\n"}},{"html_id":"verbose-instance-method","name":"verbose","abstract":false,"def":{"name":"verbose","visibility":"Public","body":"@verbose.not_nil!"}}]}]},{"html_id":"clear/Clear/CLI/Migration/Flags","path":"Clear/CLI/Migration/Flags.html","kind":"struct","full_name":"Clear::CLI::Migration::Flags","name":"Flags","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli/migration.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L1"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"DESCRIPTIONS","name":"DESCRIPTIONS","value":"{} of String => String"},{"id":"SPECS","name":"SPECS","value":"{\"verbose\" => {kind: \"bool\", type: \"Bool\", default: \"false\", description: {\"--verbose, -v\", \"Display verbose informations during execution\"}, short: \"v\", long: \"verbose\", is_required: true}, \"no_color\" => {kind: \"bool\", type: \"Bool\", default: \"false\", description: {\"--no-color\", \"Cancel color output\"}, short: \"nil\", long: \"no-color\", is_required: true}, \"__help__\" => {kind: \"bool\", type: \"Bool\", default: \"false\", description: {\"--help\", \"Displays help for the current command.\"}, short: \"nil\", long: \"help\", is_required: true}} of String => NamedTuple(kind: String, type: String, default: String, description: Tuple(String, String | ::Nil), short: String | ::Nil, long: String, is_required: Bool)"}],"namespace":{"html_id":"clear/Clear/CLI/Migration","kind":"class","full_name":"Clear::CLI::Migration","name":"Migration"},"doc":"Extend the flags struct to include the flag","summary":"

Extend the flags struct to include the flag

","constructors":[{"html_id":"new(command:Admiral::Command)-class-method","name":"new","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"new","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":"_ = allocate\n_.initialize(command)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"__help__-instance-method","name":"__help__","abstract":false,"def":{"name":"__help__","visibility":"Public","body":"@__help__.not_nil!"}},{"html_id":"inspect(io)-instance-method","name":"inspect","abstract":false,"args":[{"name":"io","external_name":"io","restriction":""}],"args_string":"(io)","args_html":"(io)","location":{"filename":"src/clear/cli/migration.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L1"},"def":{"name":"inspect","args":[{"name":"io","external_name":"io","restriction":""}],"visibility":"Public","body":"io << \"<#{self.class}\"\nio << \"(\"\nif SPECS.empty?\nelse\n io << (SPECS.keys.join(\", \"))\nend\nio << \")\"\nio << \">\"\n"}},{"html_id":"no_color-instance-method","name":"no_color","abstract":false,"def":{"name":"no_color","visibility":"Public","body":"@no_color.not_nil!"}},{"html_id":"validate!(command)-instance-method","name":"validate!","abstract":false,"args":[{"name":"command","external_name":"command","restriction":""}],"args_string":"(command)","args_html":"(command)","def":{"name":"validate!","args":[{"name":"command","external_name":"command","restriction":""}],"visibility":"Public","body":"if @verbose.nil?\n raise(Admiral::Error.new(\"Flag required: --verbose\"))\nend\nif @no_color.nil?\n raise(Admiral::Error.new(\"Flag required: --no-color\"))\nend\nif @__help__.nil?\n raise(Admiral::Error.new(\"Flag required: --help\"))\nend\nraise_extra_flags!(command)\n"}},{"html_id":"verbose-instance-method","name":"verbose","abstract":false,"def":{"name":"verbose","visibility":"Public","body":"@verbose.not_nil!"}}]},{"html_id":"clear/Clear/CLI/Migration/Migrate","path":"Clear/CLI/Migration/Migrate.html","kind":"class","full_name":"Clear::CLI::Migration::Migrate","name":"Migrate","abstract":false,"superclass":{"html_id":"clear/Admiral/Command","kind":"class","full_name":"Admiral::Command","name":"Command"},"ancestors":[{"html_id":"clear/Clear/CLI/Command","kind":"module","full_name":"Clear::CLI::Command","name":"Command"},{"html_id":"clear/Admiral/Command","kind":"class","full_name":"Admiral::Command","name":"Command"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli/migration.cr","line_number":71,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L71"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"HELP","name":"HELP","value":"{\"description\" => \"\"}"}],"included_modules":[{"html_id":"clear/Clear/CLI/Command","kind":"module","full_name":"Clear::CLI::Command","name":"Command"}],"namespace":{"html_id":"clear/Clear/CLI/Migration","kind":"class","full_name":"Clear::CLI::Migration","name":"Migration"},"class_methods":[{"html_id":"description-class-method","name":"description","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":71,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L71"},"def":{"name":"description","visibility":"Public","body":"HELP[\"description\"]"}},{"html_id":"run(*args,**params)-class-method","name":"run","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **params)","args_html":"(*args, **params)","location":{"filename":"src/clear/cli/migration.cr","line_number":71,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L71"},"def":{"name":"run","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"params","external_name":"params","restriction":""},"splat_index":0,"visibility":"Public","body":"(new(*args, **params)).parse_and_run"}}],"instance_methods":[{"html_id":"__rescue_from___Admiral__Error(e)-instance-method","name":"__rescue_from___Admiral__Error","abstract":false,"args":[{"name":"e","external_name":"e","restriction":""}],"args_string":"(e)","args_html":"(e)","def":{"name":"__rescue_from___Admiral__Error","args":[{"name":"e","external_name":"e","restriction":""}],"visibility":"Public","body":"panic(e.message.colorize(:red))"}},{"html_id":"arguments-instance-method","name":"arguments","doc":"Returns the commands `Arguments` object.\n\nYou can access names arguments by name.\nYou can also access the remaning arguments using `.arguments[index]`.","summary":"

Returns the commands Arguments object.

","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":71,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L71"},"def":{"name":"arguments","visibility":"Public","body":"@arguments || (@arguments = Arguments.new(self))"}},{"html_id":"flags-instance-method","name":"flags","doc":"Returns the commands `Flags` object.\n\nYou can access names flags by name.","summary":"

Returns the commands Flags object.

","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":71,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L71"},"def":{"name":"flags","visibility":"Public","body":"@flags || (@flags = Flags.new(self))"}},{"html_id":"run-instance-method","name":"run","doc":"The run command.","summary":"

The run command.

","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":72,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L72"},"def":{"name":"run","visibility":"Public","body":"Colorize.enabled = !flags.no_color\nrun_impl\n"}},{"html_id":"run_impl-instance-method","name":"run_impl","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":74,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L74"},"def":{"name":"run_impl","visibility":"Public","body":"Clear::Migration::Manager.instance.apply_all"}},{"html_id":"sub(command,*args,**params)-instance-method","name":"sub","doc":"Invokes a sub command by name, passing `self` as the parent.","summary":"

Invokes a sub command by name, passing self as the parent.

","abstract":false,"args":[{"name":"command","external_name":"command","restriction":""},{"name":"args","external_name":"args","restriction":""}],"args_string":"(command, *args, **params)","args_html":"(command, *args, **params)","location":{"filename":"src/clear/cli/migration.cr","line_number":71,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L71"},"def":{"name":"sub","args":[{"name":"command","external_name":"command","restriction":""},{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"params","external_name":"params","restriction":""},"splat_index":1,"visibility":"Public","body":"SubCommands.invoke(command, *args, **params, parent: self)"}}],"types":[{"html_id":"clear/Clear/CLI/Migration/Migrate/Arguments","path":"Clear/CLI/Migration/Migrate/Arguments.html","kind":"struct","full_name":"Clear::CLI::Migration::Migrate::Arguments","name":"Arguments","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Iterable","kind":"module","full_name":"Iterable","name":"Iterable"},{"html_id":"clear/Enumerable","kind":"module","full_name":"Enumerable","name":"Enumerable"},{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli/migration.cr","line_number":71,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L71"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"SPECS","name":"SPECS","value":"{} of String => NamedTuple(type: String, description: Tuple(String, String | ::Nil), default: String, is_required: Bool)"}],"included_modules":[{"html_id":"clear/Enumerable","kind":"module","full_name":"Enumerable","name":"Enumerable"},{"html_id":"clear/Iterable","kind":"module","full_name":"Iterable","name":"Iterable"}],"namespace":{"html_id":"clear/Clear/CLI/Migration/Migrate","kind":"class","full_name":"Clear::CLI::Migration::Migrate","name":"Migrate"},"constructors":[{"html_id":"new(command:Admiral::Command)-class-method","name":"new","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"new","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":"_ = allocate\n_.initialize(command)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"[](*args,**options)-instance-method","name":"[]","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","def":{"name":"[]","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@__rest__[*args, **options]"}},{"html_id":"[](*args,**options,&)-instance-method","name":"[]","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","def":{"name":"[]","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@__rest__.[](*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"each(*args,**options)-instance-method","name":"each","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","def":{"name":"each","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@__rest__.each(*args, **options)"}},{"html_id":"each(*args,**options,&)-instance-method","name":"each","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","def":{"name":"each","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@__rest__.each(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"exists?(name:Symbol)-instance-method","name":"exists?","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"exists?","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":"!!SPECS[name]?"}},{"html_id":"get(name:Symbol)-instance-method","name":"get","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"get","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":""}},{"html_id":"get?(name:Symbol)-instance-method","name":"get?","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"get?","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":"exists?(name) ? get(name) : false"}},{"html_id":"inspect(io)-instance-method","name":"inspect","abstract":false,"args":[{"name":"io","external_name":"io","restriction":""}],"args_string":"(io)","args_html":"(io)","location":{"filename":"src/clear/cli/migration.cr","line_number":71,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L71"},"def":{"name":"inspect","args":[{"name":"io","external_name":"io","restriction":""}],"visibility":"Public","body":"names = SPECS.keys\nif size > 0\n names << \"...\"\nend\nio << \"<#{self.class}\"\nio << \"(\"\nif names.empty?\nelse\n io << (names.join(\", \"))\nend\nio << \")\"\nio << \">\"\n"}},{"html_id":"rest:Array(String)-instance-method","name":"rest","abstract":false,"def":{"name":"rest","visibility":"Public","body":"@__rest__"}},{"html_id":"validate!(command:Admiral::Command)-instance-method","name":"validate!","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"validate!","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":""}},{"html_id":"value_from_spec(command:Admiral::Command,*,arg:String,type,default,is_required:Bool)-instance-method","name":"value_from_spec","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"},{"name":"","external_name":"","restriction":""},{"name":"arg","external_name":"arg","restriction":"String"},{"name":"type","external_name":"type","restriction":""},{"name":"default","external_name":"default","restriction":""},{"name":"is_required","external_name":"is_required","restriction":"Bool"}],"args_string":"(command : Admiral::Command, *, arg : String, type, default, is_required : Bool)","args_html":"(command : Admiral::Command, *, arg : String, type, default, is_required : Bool)","location":{"filename":"src/clear/cli/migration.cr","line_number":71,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L71"},"def":{"name":"value_from_spec","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"},{"name":"","external_name":"","restriction":""},{"name":"arg","external_name":"arg","restriction":"String"},{"name":"type","external_name":"type","restriction":""},{"name":"default","external_name":"default","restriction":""},{"name":"is_required","external_name":"is_required","restriction":"Bool"}],"splat_index":1,"visibility":"Public","body":"pos_only = false\nindex = 0\nwhile ((command.@argv)[index]?.to_s.starts_with?(\"-\")) && !pos_only\n index = index + 1\n pos_only = (command.@argv)[index]? == \"--\"\nend\nif (command.@argv)[index]?\n value = (command.@argv).delete_at(index)\n type.new(value)\nelse\n default\nend\n"}}]},{"html_id":"clear/Clear/CLI/Migration/Migrate/Flags","path":"Clear/CLI/Migration/Migrate/Flags.html","kind":"struct","full_name":"Clear::CLI::Migration::Migrate::Flags","name":"Flags","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli/migration.cr","line_number":71,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L71"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"DESCRIPTIONS","name":"DESCRIPTIONS","value":"{} of String => String"},{"id":"SPECS","name":"SPECS","value":"{\"verbose\" => {kind: \"bool\", type: \"Bool\", default: \"false\", description: {\"--verbose, -v\", \"Display verbose informations during execution\"}, short: \"v\", long: \"verbose\", is_required: true}, \"no_color\" => {kind: \"bool\", type: \"Bool\", default: \"false\", description: {\"--no-color\", \"Cancel color output\"}, short: \"nil\", long: \"no-color\", is_required: true}} of String => NamedTuple(kind: String, type: String, default: String, description: Tuple(String, String | ::Nil), short: String | ::Nil, long: String, is_required: Bool)"}],"namespace":{"html_id":"clear/Clear/CLI/Migration/Migrate","kind":"class","full_name":"Clear::CLI::Migration::Migrate","name":"Migrate"},"doc":"Extend the flags struct to include the flag","summary":"

Extend the flags struct to include the flag

","constructors":[{"html_id":"new(command:Admiral::Command)-class-method","name":"new","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"new","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":"_ = allocate\n_.initialize(command)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"inspect(io)-instance-method","name":"inspect","abstract":false,"args":[{"name":"io","external_name":"io","restriction":""}],"args_string":"(io)","args_html":"(io)","location":{"filename":"src/clear/cli/migration.cr","line_number":71,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L71"},"def":{"name":"inspect","args":[{"name":"io","external_name":"io","restriction":""}],"visibility":"Public","body":"io << \"<#{self.class}\"\nio << \"(\"\nif SPECS.empty?\nelse\n io << (SPECS.keys.join(\", \"))\nend\nio << \")\"\nio << \">\"\n"}},{"html_id":"no_color-instance-method","name":"no_color","abstract":false,"def":{"name":"no_color","visibility":"Public","body":"@no_color.not_nil!"}},{"html_id":"validate!(command)-instance-method","name":"validate!","abstract":false,"args":[{"name":"command","external_name":"command","restriction":""}],"args_string":"(command)","args_html":"(command)","def":{"name":"validate!","args":[{"name":"command","external_name":"command","restriction":""}],"visibility":"Public","body":"if @verbose.nil?\n raise(Admiral::Error.new(\"Flag required: --verbose\"))\nend\nif @no_color.nil?\n raise(Admiral::Error.new(\"Flag required: --no-color\"))\nend\nraise_extra_flags!(command)\n"}},{"html_id":"verbose-instance-method","name":"verbose","abstract":false,"def":{"name":"verbose","visibility":"Public","body":"@verbose.not_nil!"}}]}]},{"html_id":"clear/Clear/CLI/Migration/Rollback","path":"Clear/CLI/Migration/Rollback.html","kind":"class","full_name":"Clear::CLI::Migration::Rollback","name":"Rollback","abstract":false,"superclass":{"html_id":"clear/Admiral/Command","kind":"class","full_name":"Admiral::Command","name":"Command"},"ancestors":[{"html_id":"clear/Clear/CLI/Command","kind":"module","full_name":"Clear::CLI::Command","name":"Command"},{"html_id":"clear/Admiral/Command","kind":"class","full_name":"Admiral::Command","name":"Command"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli/migration.cr","line_number":79,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L79"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"HELP","name":"HELP","value":"{\"description\" => \"\"}"}],"included_modules":[{"html_id":"clear/Clear/CLI/Command","kind":"module","full_name":"Clear::CLI::Command","name":"Command"}],"namespace":{"html_id":"clear/Clear/CLI/Migration","kind":"class","full_name":"Clear::CLI::Migration","name":"Migration"},"class_methods":[{"html_id":"description-class-method","name":"description","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":79,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L79"},"def":{"name":"description","visibility":"Public","body":"HELP[\"description\"]"}},{"html_id":"run(*args,**params)-class-method","name":"run","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **params)","args_html":"(*args, **params)","location":{"filename":"src/clear/cli/migration.cr","line_number":79,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L79"},"def":{"name":"run","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"params","external_name":"params","restriction":""},"splat_index":0,"visibility":"Public","body":"(new(*args, **params)).parse_and_run"}}],"instance_methods":[{"html_id":"__rescue_from___Admiral__Error(e)-instance-method","name":"__rescue_from___Admiral__Error","abstract":false,"args":[{"name":"e","external_name":"e","restriction":""}],"args_string":"(e)","args_html":"(e)","def":{"name":"__rescue_from___Admiral__Error","args":[{"name":"e","external_name":"e","restriction":""}],"visibility":"Public","body":"panic(e.message.colorize(:red))"}},{"html_id":"arguments-instance-method","name":"arguments","doc":"Returns the commands `Arguments` object.\n\nYou can access names arguments by name.\nYou can also access the remaning arguments using `.arguments[index]`.","summary":"

Returns the commands Arguments object.

","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":79,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L79"},"def":{"name":"arguments","visibility":"Public","body":"@arguments || (@arguments = Arguments.new(self))"}},{"html_id":"flags-instance-method","name":"flags","doc":"Returns the commands `Flags` object.\n\nYou can access names flags by name.","summary":"

Returns the commands Flags object.

","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":79,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L79"},"def":{"name":"flags","visibility":"Public","body":"@flags || (@flags = Flags.new(self))"}},{"html_id":"help-instance-method","name":"help","abstract":false,"def":{"name":"help","visibility":"Public","body":"[help_usage, \"Rollback the last up migration\" + \"\\n\", help_flags, help_arguments, help_sub_commands].reject() do |__arg0|\n __arg0.strip.empty?\nend.join(\"\\n\")"}},{"html_id":"run-instance-method","name":"run","doc":"The run command.","summary":"

The run command.

","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":80,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L80"},"def":{"name":"run","visibility":"Public","body":"Colorize.enabled = !flags.no_color\nrun_impl\n"}},{"html_id":"run_impl-instance-method","name":"run_impl","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":85,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L85"},"def":{"name":"run_impl","visibility":"Public","body":"array = Clear::Migration::Manager.instance.migrations_up.to_a.sort\nnum = (arguments.num.try(&.to_i) || 1) + 1\nif num > array.size\n num = array.size - 1\nend\nClear::Migration::Manager.instance.apply_to(array[-num], direction: :down)\n"}},{"html_id":"sub(command,*args,**params)-instance-method","name":"sub","doc":"Invokes a sub command by name, passing `self` as the parent.","summary":"

Invokes a sub command by name, passing self as the parent.

","abstract":false,"args":[{"name":"command","external_name":"command","restriction":""},{"name":"args","external_name":"args","restriction":""}],"args_string":"(command, *args, **params)","args_html":"(command, *args, **params)","location":{"filename":"src/clear/cli/migration.cr","line_number":79,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L79"},"def":{"name":"sub","args":[{"name":"command","external_name":"command","restriction":""},{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"params","external_name":"params","restriction":""},"splat_index":1,"visibility":"Public","body":"SubCommands.invoke(command, *args, **params, parent: self)"}}],"types":[{"html_id":"clear/Clear/CLI/Migration/Rollback/Arguments","path":"Clear/CLI/Migration/Rollback/Arguments.html","kind":"struct","full_name":"Clear::CLI::Migration::Rollback::Arguments","name":"Arguments","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Iterable","kind":"module","full_name":"Iterable","name":"Iterable"},{"html_id":"clear/Enumerable","kind":"module","full_name":"Enumerable","name":"Enumerable"},{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli/migration.cr","line_number":79,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L79"},{"filename":"src/clear/cli/migration.cr","line_number":83,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L83"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"SPECS","name":"SPECS","value":"{\"num\" => {type: \"Int64\", description: {\"num\", \"\"}, default: \"nil\", is_required: false}} of String => NamedTuple(type: String, description: Tuple(String, String | ::Nil), default: String, is_required: Bool)"}],"included_modules":[{"html_id":"clear/Enumerable","kind":"module","full_name":"Enumerable","name":"Enumerable"},{"html_id":"clear/Iterable","kind":"module","full_name":"Iterable","name":"Iterable"}],"namespace":{"html_id":"clear/Clear/CLI/Migration/Rollback","kind":"class","full_name":"Clear::CLI::Migration::Rollback","name":"Rollback"},"constructors":[{"html_id":"new(command:Admiral::Command)-class-method","name":"new","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"new","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":"_ = allocate\n_.initialize(command)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"[](*args,**options)-instance-method","name":"[]","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","def":{"name":"[]","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@__rest__[*args, **options]"}},{"html_id":"[](*args,**options,&)-instance-method","name":"[]","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","def":{"name":"[]","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@__rest__.[](*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"each(*args,**options)-instance-method","name":"each","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","def":{"name":"each","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@__rest__.each(*args, **options)"}},{"html_id":"each(*args,**options,&)-instance-method","name":"each","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","def":{"name":"each","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@__rest__.each(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"exists?(name:Symbol)-instance-method","name":"exists?","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"exists?","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":"!!SPECS[name]?"}},{"html_id":"get(name:Symbol)-instance-method","name":"get","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"get","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":"{num: @num}[name]?"}},{"html_id":"get?(name:Symbol)-instance-method","name":"get?","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"get?","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":"exists?(name) ? get(name) : false"}},{"html_id":"inspect(io)-instance-method","name":"inspect","abstract":false,"args":[{"name":"io","external_name":"io","restriction":""}],"args_string":"(io)","args_html":"(io)","location":{"filename":"src/clear/cli/migration.cr","line_number":79,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L79"},"def":{"name":"inspect","args":[{"name":"io","external_name":"io","restriction":""}],"visibility":"Public","body":"names = SPECS.keys\nif size > 0\n names << \"...\"\nend\nio << \"<#{self.class}\"\nio << \"(\"\nif names.empty?\nelse\n io << (names.join(\", \"))\nend\nio << \")\"\nio << \">\"\n"}},{"html_id":"num:Int64|Nil-instance-method","name":"num","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":83,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L83"},"def":{"name":"num","return_type":"Int64 | Nil","visibility":"Public","body":"@num"}},{"html_id":"rest:Array(String)-instance-method","name":"rest","abstract":false,"def":{"name":"rest","visibility":"Public","body":"@__rest__"}},{"html_id":"validate!(command:Admiral::Command)-instance-method","name":"validate!","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"validate!","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":"if {type: \"Int64\", description: {\"num\", \"\"}, default: \"nil\", is_required: false}[:is_required] && @num.nil?\n raise(Admiral::Error.new(\"Argument required: num\"))\nend"}},{"html_id":"value_from_spec(command:Admiral::Command,*,arg:String,type,default,is_required:Bool)-instance-method","name":"value_from_spec","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"},{"name":"","external_name":"","restriction":""},{"name":"arg","external_name":"arg","restriction":"String"},{"name":"type","external_name":"type","restriction":""},{"name":"default","external_name":"default","restriction":""},{"name":"is_required","external_name":"is_required","restriction":"Bool"}],"args_string":"(command : Admiral::Command, *, arg : String, type, default, is_required : Bool)","args_html":"(command : Admiral::Command, *, arg : String, type, default, is_required : Bool)","location":{"filename":"src/clear/cli/migration.cr","line_number":79,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L79"},"def":{"name":"value_from_spec","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"},{"name":"","external_name":"","restriction":""},{"name":"arg","external_name":"arg","restriction":"String"},{"name":"type","external_name":"type","restriction":""},{"name":"default","external_name":"default","restriction":""},{"name":"is_required","external_name":"is_required","restriction":"Bool"}],"splat_index":1,"visibility":"Public","body":"pos_only = false\nindex = 0\nwhile ((command.@argv)[index]?.to_s.starts_with?(\"-\")) && !pos_only\n index = index + 1\n pos_only = (command.@argv)[index]? == \"--\"\nend\nif (command.@argv)[index]?\n value = (command.@argv).delete_at(index)\n type.new(value)\nelse\n default\nend\n"}}]},{"html_id":"clear/Clear/CLI/Migration/Rollback/Flags","path":"Clear/CLI/Migration/Rollback/Flags.html","kind":"struct","full_name":"Clear::CLI::Migration::Rollback::Flags","name":"Flags","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli/migration.cr","line_number":79,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L79"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"DESCRIPTIONS","name":"DESCRIPTIONS","value":"{} of String => String"},{"id":"SPECS","name":"SPECS","value":"{\"verbose\" => {kind: \"bool\", type: \"Bool\", default: \"false\", description: {\"--verbose, -v\", \"Display verbose informations during execution\"}, short: \"v\", long: \"verbose\", is_required: true}, \"no_color\" => {kind: \"bool\", type: \"Bool\", default: \"false\", description: {\"--no-color\", \"Cancel color output\"}, short: \"nil\", long: \"no-color\", is_required: true}, \"__help__\" => {kind: \"bool\", type: \"Bool\", default: \"false\", description: {\"--help\", \"Displays help for the current command.\"}, short: \"nil\", long: \"help\", is_required: true}} of String => NamedTuple(kind: String, type: String, default: String, description: Tuple(String, String | ::Nil), short: String | ::Nil, long: String, is_required: Bool)"}],"namespace":{"html_id":"clear/Clear/CLI/Migration/Rollback","kind":"class","full_name":"Clear::CLI::Migration::Rollback","name":"Rollback"},"doc":"Extend the flags struct to include the flag","summary":"

Extend the flags struct to include the flag

","constructors":[{"html_id":"new(command:Admiral::Command)-class-method","name":"new","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"new","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":"_ = allocate\n_.initialize(command)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"__help__-instance-method","name":"__help__","abstract":false,"def":{"name":"__help__","visibility":"Public","body":"@__help__.not_nil!"}},{"html_id":"inspect(io)-instance-method","name":"inspect","abstract":false,"args":[{"name":"io","external_name":"io","restriction":""}],"args_string":"(io)","args_html":"(io)","location":{"filename":"src/clear/cli/migration.cr","line_number":79,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L79"},"def":{"name":"inspect","args":[{"name":"io","external_name":"io","restriction":""}],"visibility":"Public","body":"io << \"<#{self.class}\"\nio << \"(\"\nif SPECS.empty?\nelse\n io << (SPECS.keys.join(\", \"))\nend\nio << \")\"\nio << \">\"\n"}},{"html_id":"no_color-instance-method","name":"no_color","abstract":false,"def":{"name":"no_color","visibility":"Public","body":"@no_color.not_nil!"}},{"html_id":"validate!(command)-instance-method","name":"validate!","abstract":false,"args":[{"name":"command","external_name":"command","restriction":""}],"args_string":"(command)","args_html":"(command)","def":{"name":"validate!","args":[{"name":"command","external_name":"command","restriction":""}],"visibility":"Public","body":"if @verbose.nil?\n raise(Admiral::Error.new(\"Flag required: --verbose\"))\nend\nif @no_color.nil?\n raise(Admiral::Error.new(\"Flag required: --no-color\"))\nend\nif @__help__.nil?\n raise(Admiral::Error.new(\"Flag required: --help\"))\nend\nraise_extra_flags!(command)\n"}},{"html_id":"verbose-instance-method","name":"verbose","abstract":false,"def":{"name":"verbose","visibility":"Public","body":"@verbose.not_nil!"}}]}]},{"html_id":"clear/Clear/CLI/Migration/Seed","path":"Clear/CLI/Migration/Seed.html","kind":"class","full_name":"Clear::CLI::Migration::Seed","name":"Seed","abstract":false,"superclass":{"html_id":"clear/Admiral/Command","kind":"class","full_name":"Admiral::Command","name":"Command"},"ancestors":[{"html_id":"clear/Clear/CLI/Command","kind":"module","full_name":"Clear::CLI::Command","name":"Command"},{"html_id":"clear/Admiral/Command","kind":"class","full_name":"Admiral::Command","name":"Command"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli/migration.cr","line_number":16,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L16"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"HELP","name":"HELP","value":"{\"description\" => \"\"}"}],"included_modules":[{"html_id":"clear/Clear/CLI/Command","kind":"module","full_name":"Clear::CLI::Command","name":"Command"}],"namespace":{"html_id":"clear/Clear/CLI/Migration","kind":"class","full_name":"Clear::CLI::Migration","name":"Migration"},"class_methods":[{"html_id":"description-class-method","name":"description","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":16,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L16"},"def":{"name":"description","visibility":"Public","body":"HELP[\"description\"]"}},{"html_id":"run(*args,**params)-class-method","name":"run","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **params)","args_html":"(*args, **params)","location":{"filename":"src/clear/cli/migration.cr","line_number":16,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L16"},"def":{"name":"run","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"params","external_name":"params","restriction":""},"splat_index":0,"visibility":"Public","body":"(new(*args, **params)).parse_and_run"}}],"instance_methods":[{"html_id":"__rescue_from___Admiral__Error(e)-instance-method","name":"__rescue_from___Admiral__Error","abstract":false,"args":[{"name":"e","external_name":"e","restriction":""}],"args_string":"(e)","args_html":"(e)","def":{"name":"__rescue_from___Admiral__Error","args":[{"name":"e","external_name":"e","restriction":""}],"visibility":"Public","body":"panic(e.message.colorize(:red))"}},{"html_id":"arguments-instance-method","name":"arguments","doc":"Returns the commands `Arguments` object.\n\nYou can access names arguments by name.\nYou can also access the remaning arguments using `.arguments[index]`.","summary":"

Returns the commands Arguments object.

","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":16,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L16"},"def":{"name":"arguments","visibility":"Public","body":"@arguments || (@arguments = Arguments.new(self))"}},{"html_id":"flags-instance-method","name":"flags","doc":"Returns the commands `Flags` object.\n\nYou can access names flags by name.","summary":"

Returns the commands Flags object.

","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":16,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L16"},"def":{"name":"flags","visibility":"Public","body":"@flags || (@flags = Flags.new(self))"}},{"html_id":"help-instance-method","name":"help","abstract":false,"def":{"name":"help","visibility":"Public","body":"[help_usage, \"Call the seeds data\" + \"\\n\", help_flags, help_arguments, help_sub_commands].reject() do |__arg0|\n __arg0.strip.empty?\nend.join(\"\\n\")"}},{"html_id":"run-instance-method","name":"run","doc":"The run command.","summary":"

The run command.

","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":17,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L17"},"def":{"name":"run","visibility":"Public","body":"Colorize.enabled = !flags.no_color\nrun_impl\n"}},{"html_id":"run_impl-instance-method","name":"run_impl","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":21,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L21"},"def":{"name":"run_impl","visibility":"Public","body":"Clear.apply_seeds"}},{"html_id":"sub(command,*args,**params)-instance-method","name":"sub","doc":"Invokes a sub command by name, passing `self` as the parent.","summary":"

Invokes a sub command by name, passing self as the parent.

","abstract":false,"args":[{"name":"command","external_name":"command","restriction":""},{"name":"args","external_name":"args","restriction":""}],"args_string":"(command, *args, **params)","args_html":"(command, *args, **params)","location":{"filename":"src/clear/cli/migration.cr","line_number":16,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L16"},"def":{"name":"sub","args":[{"name":"command","external_name":"command","restriction":""},{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"params","external_name":"params","restriction":""},"splat_index":1,"visibility":"Public","body":"SubCommands.invoke(command, *args, **params, parent: self)"}}],"types":[{"html_id":"clear/Clear/CLI/Migration/Seed/Arguments","path":"Clear/CLI/Migration/Seed/Arguments.html","kind":"struct","full_name":"Clear::CLI::Migration::Seed::Arguments","name":"Arguments","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Iterable","kind":"module","full_name":"Iterable","name":"Iterable"},{"html_id":"clear/Enumerable","kind":"module","full_name":"Enumerable","name":"Enumerable"},{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli/migration.cr","line_number":16,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L16"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"SPECS","name":"SPECS","value":"{} of String => NamedTuple(type: String, description: Tuple(String, String | ::Nil), default: String, is_required: Bool)"}],"included_modules":[{"html_id":"clear/Enumerable","kind":"module","full_name":"Enumerable","name":"Enumerable"},{"html_id":"clear/Iterable","kind":"module","full_name":"Iterable","name":"Iterable"}],"namespace":{"html_id":"clear/Clear/CLI/Migration/Seed","kind":"class","full_name":"Clear::CLI::Migration::Seed","name":"Seed"},"constructors":[{"html_id":"new(command:Admiral::Command)-class-method","name":"new","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"new","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":"_ = allocate\n_.initialize(command)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"[](*args,**options)-instance-method","name":"[]","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","def":{"name":"[]","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@__rest__[*args, **options]"}},{"html_id":"[](*args,**options,&)-instance-method","name":"[]","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","def":{"name":"[]","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@__rest__.[](*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"each(*args,**options)-instance-method","name":"each","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","def":{"name":"each","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@__rest__.each(*args, **options)"}},{"html_id":"each(*args,**options,&)-instance-method","name":"each","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","def":{"name":"each","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@__rest__.each(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"exists?(name:Symbol)-instance-method","name":"exists?","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"exists?","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":"!!SPECS[name]?"}},{"html_id":"get(name:Symbol)-instance-method","name":"get","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"get","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":""}},{"html_id":"get?(name:Symbol)-instance-method","name":"get?","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"get?","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":"exists?(name) ? get(name) : false"}},{"html_id":"inspect(io)-instance-method","name":"inspect","abstract":false,"args":[{"name":"io","external_name":"io","restriction":""}],"args_string":"(io)","args_html":"(io)","location":{"filename":"src/clear/cli/migration.cr","line_number":16,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L16"},"def":{"name":"inspect","args":[{"name":"io","external_name":"io","restriction":""}],"visibility":"Public","body":"names = SPECS.keys\nif size > 0\n names << \"...\"\nend\nio << \"<#{self.class}\"\nio << \"(\"\nif names.empty?\nelse\n io << (names.join(\", \"))\nend\nio << \")\"\nio << \">\"\n"}},{"html_id":"rest:Array(String)-instance-method","name":"rest","abstract":false,"def":{"name":"rest","visibility":"Public","body":"@__rest__"}},{"html_id":"validate!(command:Admiral::Command)-instance-method","name":"validate!","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"validate!","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":""}},{"html_id":"value_from_spec(command:Admiral::Command,*,arg:String,type,default,is_required:Bool)-instance-method","name":"value_from_spec","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"},{"name":"","external_name":"","restriction":""},{"name":"arg","external_name":"arg","restriction":"String"},{"name":"type","external_name":"type","restriction":""},{"name":"default","external_name":"default","restriction":""},{"name":"is_required","external_name":"is_required","restriction":"Bool"}],"args_string":"(command : Admiral::Command, *, arg : String, type, default, is_required : Bool)","args_html":"(command : Admiral::Command, *, arg : String, type, default, is_required : Bool)","location":{"filename":"src/clear/cli/migration.cr","line_number":16,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L16"},"def":{"name":"value_from_spec","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"},{"name":"","external_name":"","restriction":""},{"name":"arg","external_name":"arg","restriction":"String"},{"name":"type","external_name":"type","restriction":""},{"name":"default","external_name":"default","restriction":""},{"name":"is_required","external_name":"is_required","restriction":"Bool"}],"splat_index":1,"visibility":"Public","body":"pos_only = false\nindex = 0\nwhile ((command.@argv)[index]?.to_s.starts_with?(\"-\")) && !pos_only\n index = index + 1\n pos_only = (command.@argv)[index]? == \"--\"\nend\nif (command.@argv)[index]?\n value = (command.@argv).delete_at(index)\n type.new(value)\nelse\n default\nend\n"}}]},{"html_id":"clear/Clear/CLI/Migration/Seed/Flags","path":"Clear/CLI/Migration/Seed/Flags.html","kind":"struct","full_name":"Clear::CLI::Migration::Seed::Flags","name":"Flags","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli/migration.cr","line_number":16,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L16"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"DESCRIPTIONS","name":"DESCRIPTIONS","value":"{} of String => String"},{"id":"SPECS","name":"SPECS","value":"{\"verbose\" => {kind: \"bool\", type: \"Bool\", default: \"false\", description: {\"--verbose, -v\", \"Display verbose informations during execution\"}, short: \"v\", long: \"verbose\", is_required: true}, \"no_color\" => {kind: \"bool\", type: \"Bool\", default: \"false\", description: {\"--no-color\", \"Cancel color output\"}, short: \"nil\", long: \"no-color\", is_required: true}, \"__help__\" => {kind: \"bool\", type: \"Bool\", default: \"false\", description: {\"--help\", \"Displays help for the current command.\"}, short: \"nil\", long: \"help\", is_required: true}} of String => NamedTuple(kind: String, type: String, default: String, description: Tuple(String, String | ::Nil), short: String | ::Nil, long: String, is_required: Bool)"}],"namespace":{"html_id":"clear/Clear/CLI/Migration/Seed","kind":"class","full_name":"Clear::CLI::Migration::Seed","name":"Seed"},"doc":"Extend the flags struct to include the flag","summary":"

Extend the flags struct to include the flag

","constructors":[{"html_id":"new(command:Admiral::Command)-class-method","name":"new","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"new","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":"_ = allocate\n_.initialize(command)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"__help__-instance-method","name":"__help__","abstract":false,"def":{"name":"__help__","visibility":"Public","body":"@__help__.not_nil!"}},{"html_id":"inspect(io)-instance-method","name":"inspect","abstract":false,"args":[{"name":"io","external_name":"io","restriction":""}],"args_string":"(io)","args_html":"(io)","location":{"filename":"src/clear/cli/migration.cr","line_number":16,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L16"},"def":{"name":"inspect","args":[{"name":"io","external_name":"io","restriction":""}],"visibility":"Public","body":"io << \"<#{self.class}\"\nio << \"(\"\nif SPECS.empty?\nelse\n io << (SPECS.keys.join(\", \"))\nend\nio << \")\"\nio << \">\"\n"}},{"html_id":"no_color-instance-method","name":"no_color","abstract":false,"def":{"name":"no_color","visibility":"Public","body":"@no_color.not_nil!"}},{"html_id":"validate!(command)-instance-method","name":"validate!","abstract":false,"args":[{"name":"command","external_name":"command","restriction":""}],"args_string":"(command)","args_html":"(command)","def":{"name":"validate!","args":[{"name":"command","external_name":"command","restriction":""}],"visibility":"Public","body":"if @verbose.nil?\n raise(Admiral::Error.new(\"Flag required: --verbose\"))\nend\nif @no_color.nil?\n raise(Admiral::Error.new(\"Flag required: --no-color\"))\nend\nif @__help__.nil?\n raise(Admiral::Error.new(\"Flag required: --help\"))\nend\nraise_extra_flags!(command)\n"}},{"html_id":"verbose-instance-method","name":"verbose","abstract":false,"def":{"name":"verbose","visibility":"Public","body":"@verbose.not_nil!"}}]}]},{"html_id":"clear/Clear/CLI/Migration/Set","path":"Clear/CLI/Migration/Set.html","kind":"class","full_name":"Clear::CLI::Migration::Set","name":"Set","abstract":false,"superclass":{"html_id":"clear/Admiral/Command","kind":"class","full_name":"Admiral::Command","name":"Command"},"ancestors":[{"html_id":"clear/Clear/CLI/Command","kind":"module","full_name":"Clear::CLI::Command","name":"Command"},{"html_id":"clear/Admiral/Command","kind":"class","full_name":"Admiral::Command","name":"Command"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli/migration.cr","line_number":48,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L48"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"HELP","name":"HELP","value":"{\"description\" => \"\"}"}],"included_modules":[{"html_id":"clear/Clear/CLI/Command","kind":"module","full_name":"Clear::CLI::Command","name":"Command"}],"namespace":{"html_id":"clear/Clear/CLI/Migration","kind":"class","full_name":"Clear::CLI::Migration","name":"Migration"},"class_methods":[{"html_id":"description-class-method","name":"description","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":48,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L48"},"def":{"name":"description","visibility":"Public","body":"HELP[\"description\"]"}},{"html_id":"run(*args,**params)-class-method","name":"run","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **params)","args_html":"(*args, **params)","location":{"filename":"src/clear/cli/migration.cr","line_number":48,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L48"},"def":{"name":"run","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"params","external_name":"params","restriction":""},"splat_index":0,"visibility":"Public","body":"(new(*args, **params)).parse_and_run"}}],"instance_methods":[{"html_id":"__rescue_from___Admiral__Error(e)-instance-method","name":"__rescue_from___Admiral__Error","abstract":false,"args":[{"name":"e","external_name":"e","restriction":""}],"args_string":"(e)","args_html":"(e)","def":{"name":"__rescue_from___Admiral__Error","args":[{"name":"e","external_name":"e","restriction":""}],"visibility":"Public","body":"panic(e.message.colorize(:red))"}},{"html_id":"arguments-instance-method","name":"arguments","doc":"Returns the commands `Arguments` object.\n\nYou can access names arguments by name.\nYou can also access the remaning arguments using `.arguments[index]`.","summary":"

Returns the commands Arguments object.

","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":48,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L48"},"def":{"name":"arguments","visibility":"Public","body":"@arguments || (@arguments = Arguments.new(self))"}},{"html_id":"flags-instance-method","name":"flags","doc":"Returns the commands `Flags` object.\n\nYou can access names flags by name.","summary":"

Returns the commands Flags object.

","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":48,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L48"},"def":{"name":"flags","visibility":"Public","body":"@flags || (@flags = Flags.new(self))"}},{"html_id":"run-instance-method","name":"run","doc":"The run command.","summary":"

The run command.

","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":49,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L49"},"def":{"name":"run","visibility":"Public","body":"Colorize.enabled = !flags.no_color\nrun_impl\n"}},{"html_id":"run_impl-instance-method","name":"run_impl","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":54,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L54"},"def":{"name":"run_impl","visibility":"Public","body":"dir_symbol = case flags.direction\nwhen \"up\"\n :up\nwhen \"down\"\n :down\nwhen \"both\"\n :both\nelse\n puts(\"Bad argument --direction : #{flags.direction}. Must be up|down|both\")\n exit(1)\nend\nClear::Migration::Manager.instance.apply_to(arguments.to, direction: dir_symbol)\n"}},{"html_id":"sub(command,*args,**params)-instance-method","name":"sub","doc":"Invokes a sub command by name, passing `self` as the parent.","summary":"

Invokes a sub command by name, passing self as the parent.

","abstract":false,"args":[{"name":"command","external_name":"command","restriction":""},{"name":"args","external_name":"args","restriction":""}],"args_string":"(command, *args, **params)","args_html":"(command, *args, **params)","location":{"filename":"src/clear/cli/migration.cr","line_number":48,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L48"},"def":{"name":"sub","args":[{"name":"command","external_name":"command","restriction":""},{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"params","external_name":"params","restriction":""},"splat_index":1,"visibility":"Public","body":"SubCommands.invoke(command, *args, **params, parent: self)"}}],"types":[{"html_id":"clear/Clear/CLI/Migration/Set/Arguments","path":"Clear/CLI/Migration/Set/Arguments.html","kind":"struct","full_name":"Clear::CLI::Migration::Set::Arguments","name":"Arguments","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Iterable","kind":"module","full_name":"Iterable","name":"Iterable"},{"html_id":"clear/Enumerable","kind":"module","full_name":"Enumerable","name":"Enumerable"},{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli/migration.cr","line_number":48,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L48"},{"filename":"src/clear/cli/migration.cr","line_number":52,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L52"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"SPECS","name":"SPECS","value":"{\"to\" => {type: \"Int64\", description: {\"to (required)\", \"\"}, default: \"nil\", is_required: true}} of String => NamedTuple(type: String, description: Tuple(String, String | ::Nil), default: String, is_required: Bool)"}],"included_modules":[{"html_id":"clear/Enumerable","kind":"module","full_name":"Enumerable","name":"Enumerable"},{"html_id":"clear/Iterable","kind":"module","full_name":"Iterable","name":"Iterable"}],"namespace":{"html_id":"clear/Clear/CLI/Migration/Set","kind":"class","full_name":"Clear::CLI::Migration::Set","name":"Set"},"constructors":[{"html_id":"new(command:Admiral::Command)-class-method","name":"new","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"new","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":"_ = allocate\n_.initialize(command)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"[](*args,**options)-instance-method","name":"[]","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","def":{"name":"[]","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@__rest__[*args, **options]"}},{"html_id":"[](*args,**options,&)-instance-method","name":"[]","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","def":{"name":"[]","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@__rest__.[](*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"each(*args,**options)-instance-method","name":"each","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","def":{"name":"each","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@__rest__.each(*args, **options)"}},{"html_id":"each(*args,**options,&)-instance-method","name":"each","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","def":{"name":"each","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@__rest__.each(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"exists?(name:Symbol)-instance-method","name":"exists?","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"exists?","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":"!!SPECS[name]?"}},{"html_id":"get(name:Symbol)-instance-method","name":"get","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"get","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":"{to: @to}[name]?"}},{"html_id":"get?(name:Symbol)-instance-method","name":"get?","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"get?","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":"exists?(name) ? get(name) : false"}},{"html_id":"inspect(io)-instance-method","name":"inspect","abstract":false,"args":[{"name":"io","external_name":"io","restriction":""}],"args_string":"(io)","args_html":"(io)","location":{"filename":"src/clear/cli/migration.cr","line_number":48,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L48"},"def":{"name":"inspect","args":[{"name":"io","external_name":"io","restriction":""}],"visibility":"Public","body":"names = SPECS.keys\nif size > 0\n names << \"...\"\nend\nio << \"<#{self.class}\"\nio << \"(\"\nif names.empty?\nelse\n io << (names.join(\", \"))\nend\nio << \")\"\nio << \">\"\n"}},{"html_id":"rest:Array(String)-instance-method","name":"rest","abstract":false,"def":{"name":"rest","visibility":"Public","body":"@__rest__"}},{"html_id":"to:Int64-instance-method","name":"to","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":52,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L52"},"def":{"name":"to","return_type":"Int64","visibility":"Public","body":"@to.not_nil!"}},{"html_id":"validate!(command:Admiral::Command)-instance-method","name":"validate!","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"validate!","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":"if {type: \"Int64\", description: {\"to (required)\", \"\"}, default: \"nil\", is_required: true}[:is_required] && @to.nil?\n raise(Admiral::Error.new(\"Argument required: to\"))\nend"}},{"html_id":"value_from_spec(command:Admiral::Command,*,arg:String,type,default,is_required:Bool)-instance-method","name":"value_from_spec","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"},{"name":"","external_name":"","restriction":""},{"name":"arg","external_name":"arg","restriction":"String"},{"name":"type","external_name":"type","restriction":""},{"name":"default","external_name":"default","restriction":""},{"name":"is_required","external_name":"is_required","restriction":"Bool"}],"args_string":"(command : Admiral::Command, *, arg : String, type, default, is_required : Bool)","args_html":"(command : Admiral::Command, *, arg : String, type, default, is_required : Bool)","location":{"filename":"src/clear/cli/migration.cr","line_number":48,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L48"},"def":{"name":"value_from_spec","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"},{"name":"","external_name":"","restriction":""},{"name":"arg","external_name":"arg","restriction":"String"},{"name":"type","external_name":"type","restriction":""},{"name":"default","external_name":"default","restriction":""},{"name":"is_required","external_name":"is_required","restriction":"Bool"}],"splat_index":1,"visibility":"Public","body":"pos_only = false\nindex = 0\nwhile ((command.@argv)[index]?.to_s.starts_with?(\"-\")) && !pos_only\n index = index + 1\n pos_only = (command.@argv)[index]? == \"--\"\nend\nif (command.@argv)[index]?\n value = (command.@argv).delete_at(index)\n type.new(value)\nelse\n default\nend\n"}}]},{"html_id":"clear/Clear/CLI/Migration/Set/Flags","path":"Clear/CLI/Migration/Set/Flags.html","kind":"struct","full_name":"Clear::CLI::Migration::Set::Flags","name":"Flags","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli/migration.cr","line_number":48,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L48"},{"filename":"src/clear/cli/migration.cr","line_number":51,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L51"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"DESCRIPTIONS","name":"DESCRIPTIONS","value":"{} of String => String"},{"id":"SPECS","name":"SPECS","value":"{\"verbose\" => {kind: \"bool\", type: \"Bool\", default: \"false\", description: {\"--verbose, -v\", \"Display verbose informations during execution\"}, short: \"v\", long: \"verbose\", is_required: true}, \"no_color\" => {kind: \"bool\", type: \"Bool\", default: \"false\", description: {\"--no-color\", \"Cancel color output\"}, short: \"nil\", long: \"no-color\", is_required: true}, \"direction\" => {kind: \"nil\", type: \"String\", default: \"\\\"both\\\"\", description: {\"--direction, -d (default: \\\"both\\\")\", \"\"}, short: \"d\", long: \"direction\", is_required: true}} of String => NamedTuple(kind: String, type: String, default: String, description: Tuple(String, String | ::Nil), short: String | ::Nil, long: String, is_required: Bool)"}],"namespace":{"html_id":"clear/Clear/CLI/Migration/Set","kind":"class","full_name":"Clear::CLI::Migration::Set","name":"Set"},"doc":"Extend the flags struct to include the flag","summary":"

Extend the flags struct to include the flag

","constructors":[{"html_id":"new(command:Admiral::Command)-class-method","name":"new","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"new","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":"_ = allocate\n_.initialize(command)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"direction-instance-method","name":"direction","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":51,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L51"},"def":{"name":"direction","visibility":"Public","body":"@direction.not_nil!"}},{"html_id":"inspect(io)-instance-method","name":"inspect","abstract":false,"args":[{"name":"io","external_name":"io","restriction":""}],"args_string":"(io)","args_html":"(io)","location":{"filename":"src/clear/cli/migration.cr","line_number":48,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L48"},"def":{"name":"inspect","args":[{"name":"io","external_name":"io","restriction":""}],"visibility":"Public","body":"io << \"<#{self.class}\"\nio << \"(\"\nif SPECS.empty?\nelse\n io << (SPECS.keys.join(\", \"))\nend\nio << \")\"\nio << \">\"\n"}},{"html_id":"no_color-instance-method","name":"no_color","abstract":false,"def":{"name":"no_color","visibility":"Public","body":"@no_color.not_nil!"}},{"html_id":"validate!(command)-instance-method","name":"validate!","abstract":false,"args":[{"name":"command","external_name":"command","restriction":""}],"args_string":"(command)","args_html":"(command)","def":{"name":"validate!","args":[{"name":"command","external_name":"command","restriction":""}],"visibility":"Public","body":"if @verbose.nil?\n raise(Admiral::Error.new(\"Flag required: --verbose\"))\nend\nif @no_color.nil?\n raise(Admiral::Error.new(\"Flag required: --no-color\"))\nend\nif @direction.nil?\n raise(Admiral::Error.new(\"Flag required: --direction\"))\nend\nraise_extra_flags!(command)\n"}},{"html_id":"verbose-instance-method","name":"verbose","abstract":false,"def":{"name":"verbose","visibility":"Public","body":"@verbose.not_nil!"}}]}]},{"html_id":"clear/Clear/CLI/Migration/Status","path":"Clear/CLI/Migration/Status.html","kind":"class","full_name":"Clear::CLI::Migration::Status","name":"Status","abstract":false,"superclass":{"html_id":"clear/Admiral/Command","kind":"class","full_name":"Admiral::Command","name":"Command"},"ancestors":[{"html_id":"clear/Clear/CLI/Command","kind":"module","full_name":"Clear::CLI::Command","name":"Command"},{"html_id":"clear/Admiral/Command","kind":"class","full_name":"Admiral::Command","name":"Command"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli/migration.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L6"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"HELP","name":"HELP","value":"{\"description\" => \"\"}"}],"included_modules":[{"html_id":"clear/Clear/CLI/Command","kind":"module","full_name":"Clear::CLI::Command","name":"Command"}],"namespace":{"html_id":"clear/Clear/CLI/Migration","kind":"class","full_name":"Clear::CLI::Migration","name":"Migration"},"class_methods":[{"html_id":"description-class-method","name":"description","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L6"},"def":{"name":"description","visibility":"Public","body":"HELP[\"description\"]"}},{"html_id":"run(*args,**params)-class-method","name":"run","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **params)","args_html":"(*args, **params)","location":{"filename":"src/clear/cli/migration.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L6"},"def":{"name":"run","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"params","external_name":"params","restriction":""},"splat_index":0,"visibility":"Public","body":"(new(*args, **params)).parse_and_run"}}],"instance_methods":[{"html_id":"__rescue_from___Admiral__Error(e)-instance-method","name":"__rescue_from___Admiral__Error","abstract":false,"args":[{"name":"e","external_name":"e","restriction":""}],"args_string":"(e)","args_html":"(e)","def":{"name":"__rescue_from___Admiral__Error","args":[{"name":"e","external_name":"e","restriction":""}],"visibility":"Public","body":"panic(e.message.colorize(:red))"}},{"html_id":"arguments-instance-method","name":"arguments","doc":"Returns the commands `Arguments` object.\n\nYou can access names arguments by name.\nYou can also access the remaning arguments using `.arguments[index]`.","summary":"

Returns the commands Arguments object.

","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L6"},"def":{"name":"arguments","visibility":"Public","body":"@arguments || (@arguments = Arguments.new(self))"}},{"html_id":"flags-instance-method","name":"flags","doc":"Returns the commands `Flags` object.\n\nYou can access names flags by name.","summary":"

Returns the commands Flags object.

","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L6"},"def":{"name":"flags","visibility":"Public","body":"@flags || (@flags = Flags.new(self))"}},{"html_id":"help-instance-method","name":"help","abstract":false,"def":{"name":"help","visibility":"Public","body":"[help_usage, \"Return the current state of the database\" + \"\\n\", help_flags, help_arguments, help_sub_commands].reject() do |__arg0|\n __arg0.strip.empty?\nend.join(\"\\n\")"}},{"html_id":"run-instance-method","name":"run","doc":"The run command.","summary":"

The run command.

","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":7,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L7"},"def":{"name":"run","visibility":"Public","body":"Colorize.enabled = !flags.no_color\nrun_impl\n"}},{"html_id":"run_impl-instance-method","name":"run_impl","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":11,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L11"},"def":{"name":"run_impl","visibility":"Public","body":"puts(Clear::Migration::Manager.instance.print_status)"}},{"html_id":"sub(command,*args,**params)-instance-method","name":"sub","doc":"Invokes a sub command by name, passing `self` as the parent.","summary":"

Invokes a sub command by name, passing self as the parent.

","abstract":false,"args":[{"name":"command","external_name":"command","restriction":""},{"name":"args","external_name":"args","restriction":""}],"args_string":"(command, *args, **params)","args_html":"(command, *args, **params)","location":{"filename":"src/clear/cli/migration.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L6"},"def":{"name":"sub","args":[{"name":"command","external_name":"command","restriction":""},{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"params","external_name":"params","restriction":""},"splat_index":1,"visibility":"Public","body":"SubCommands.invoke(command, *args, **params, parent: self)"}}],"types":[{"html_id":"clear/Clear/CLI/Migration/Status/Arguments","path":"Clear/CLI/Migration/Status/Arguments.html","kind":"struct","full_name":"Clear::CLI::Migration::Status::Arguments","name":"Arguments","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Iterable","kind":"module","full_name":"Iterable","name":"Iterable"},{"html_id":"clear/Enumerable","kind":"module","full_name":"Enumerable","name":"Enumerable"},{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli/migration.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L6"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"SPECS","name":"SPECS","value":"{} of String => NamedTuple(type: String, description: Tuple(String, String | ::Nil), default: String, is_required: Bool)"}],"included_modules":[{"html_id":"clear/Enumerable","kind":"module","full_name":"Enumerable","name":"Enumerable"},{"html_id":"clear/Iterable","kind":"module","full_name":"Iterable","name":"Iterable"}],"namespace":{"html_id":"clear/Clear/CLI/Migration/Status","kind":"class","full_name":"Clear::CLI::Migration::Status","name":"Status"},"constructors":[{"html_id":"new(command:Admiral::Command)-class-method","name":"new","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"new","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":"_ = allocate\n_.initialize(command)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"[](*args,**options)-instance-method","name":"[]","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","def":{"name":"[]","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@__rest__[*args, **options]"}},{"html_id":"[](*args,**options,&)-instance-method","name":"[]","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","def":{"name":"[]","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@__rest__.[](*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"each(*args,**options)-instance-method","name":"each","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","def":{"name":"each","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@__rest__.each(*args, **options)"}},{"html_id":"each(*args,**options,&)-instance-method","name":"each","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","def":{"name":"each","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@__rest__.each(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"exists?(name:Symbol)-instance-method","name":"exists?","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"exists?","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":"!!SPECS[name]?"}},{"html_id":"get(name:Symbol)-instance-method","name":"get","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"get","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":""}},{"html_id":"get?(name:Symbol)-instance-method","name":"get?","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"get?","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":"exists?(name) ? get(name) : false"}},{"html_id":"inspect(io)-instance-method","name":"inspect","abstract":false,"args":[{"name":"io","external_name":"io","restriction":""}],"args_string":"(io)","args_html":"(io)","location":{"filename":"src/clear/cli/migration.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L6"},"def":{"name":"inspect","args":[{"name":"io","external_name":"io","restriction":""}],"visibility":"Public","body":"names = SPECS.keys\nif size > 0\n names << \"...\"\nend\nio << \"<#{self.class}\"\nio << \"(\"\nif names.empty?\nelse\n io << (names.join(\", \"))\nend\nio << \")\"\nio << \">\"\n"}},{"html_id":"rest:Array(String)-instance-method","name":"rest","abstract":false,"def":{"name":"rest","visibility":"Public","body":"@__rest__"}},{"html_id":"validate!(command:Admiral::Command)-instance-method","name":"validate!","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"validate!","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":""}},{"html_id":"value_from_spec(command:Admiral::Command,*,arg:String,type,default,is_required:Bool)-instance-method","name":"value_from_spec","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"},{"name":"","external_name":"","restriction":""},{"name":"arg","external_name":"arg","restriction":"String"},{"name":"type","external_name":"type","restriction":""},{"name":"default","external_name":"default","restriction":""},{"name":"is_required","external_name":"is_required","restriction":"Bool"}],"args_string":"(command : Admiral::Command, *, arg : String, type, default, is_required : Bool)","args_html":"(command : Admiral::Command, *, arg : String, type, default, is_required : Bool)","location":{"filename":"src/clear/cli/migration.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L6"},"def":{"name":"value_from_spec","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"},{"name":"","external_name":"","restriction":""},{"name":"arg","external_name":"arg","restriction":"String"},{"name":"type","external_name":"type","restriction":""},{"name":"default","external_name":"default","restriction":""},{"name":"is_required","external_name":"is_required","restriction":"Bool"}],"splat_index":1,"visibility":"Public","body":"pos_only = false\nindex = 0\nwhile ((command.@argv)[index]?.to_s.starts_with?(\"-\")) && !pos_only\n index = index + 1\n pos_only = (command.@argv)[index]? == \"--\"\nend\nif (command.@argv)[index]?\n value = (command.@argv).delete_at(index)\n type.new(value)\nelse\n default\nend\n"}}]},{"html_id":"clear/Clear/CLI/Migration/Status/Flags","path":"Clear/CLI/Migration/Status/Flags.html","kind":"struct","full_name":"Clear::CLI::Migration::Status::Flags","name":"Flags","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli/migration.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L6"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"DESCRIPTIONS","name":"DESCRIPTIONS","value":"{} of String => String"},{"id":"SPECS","name":"SPECS","value":"{\"verbose\" => {kind: \"bool\", type: \"Bool\", default: \"false\", description: {\"--verbose, -v\", \"Display verbose informations during execution\"}, short: \"v\", long: \"verbose\", is_required: true}, \"no_color\" => {kind: \"bool\", type: \"Bool\", default: \"false\", description: {\"--no-color\", \"Cancel color output\"}, short: \"nil\", long: \"no-color\", is_required: true}, \"__help__\" => {kind: \"bool\", type: \"Bool\", default: \"false\", description: {\"--help\", \"Displays help for the current command.\"}, short: \"nil\", long: \"help\", is_required: true}} of String => NamedTuple(kind: String, type: String, default: String, description: Tuple(String, String | ::Nil), short: String | ::Nil, long: String, is_required: Bool)"}],"namespace":{"html_id":"clear/Clear/CLI/Migration/Status","kind":"class","full_name":"Clear::CLI::Migration::Status","name":"Status"},"doc":"Extend the flags struct to include the flag","summary":"

Extend the flags struct to include the flag

","constructors":[{"html_id":"new(command:Admiral::Command)-class-method","name":"new","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"new","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":"_ = allocate\n_.initialize(command)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"__help__-instance-method","name":"__help__","abstract":false,"def":{"name":"__help__","visibility":"Public","body":"@__help__.not_nil!"}},{"html_id":"inspect(io)-instance-method","name":"inspect","abstract":false,"args":[{"name":"io","external_name":"io","restriction":""}],"args_string":"(io)","args_html":"(io)","location":{"filename":"src/clear/cli/migration.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L6"},"def":{"name":"inspect","args":[{"name":"io","external_name":"io","restriction":""}],"visibility":"Public","body":"io << \"<#{self.class}\"\nio << \"(\"\nif SPECS.empty?\nelse\n io << (SPECS.keys.join(\", \"))\nend\nio << \")\"\nio << \">\"\n"}},{"html_id":"no_color-instance-method","name":"no_color","abstract":false,"def":{"name":"no_color","visibility":"Public","body":"@no_color.not_nil!"}},{"html_id":"validate!(command)-instance-method","name":"validate!","abstract":false,"args":[{"name":"command","external_name":"command","restriction":""}],"args_string":"(command)","args_html":"(command)","def":{"name":"validate!","args":[{"name":"command","external_name":"command","restriction":""}],"visibility":"Public","body":"if @verbose.nil?\n raise(Admiral::Error.new(\"Flag required: --verbose\"))\nend\nif @no_color.nil?\n raise(Admiral::Error.new(\"Flag required: --no-color\"))\nend\nif @__help__.nil?\n raise(Admiral::Error.new(\"Flag required: --help\"))\nend\nraise_extra_flags!(command)\n"}},{"html_id":"verbose-instance-method","name":"verbose","abstract":false,"def":{"name":"verbose","visibility":"Public","body":"@verbose.not_nil!"}}]}]},{"html_id":"clear/Clear/CLI/Migration/Up","path":"Clear/CLI/Migration/Up.html","kind":"class","full_name":"Clear::CLI::Migration::Up","name":"Up","abstract":false,"superclass":{"html_id":"clear/Admiral/Command","kind":"class","full_name":"Admiral::Command","name":"Command"},"ancestors":[{"html_id":"clear/Clear/CLI/Command","kind":"module","full_name":"Clear::CLI::Command","name":"Command"},{"html_id":"clear/Admiral/Command","kind":"class","full_name":"Admiral::Command","name":"Command"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli/migration.cr","line_number":26,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L26"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"HELP","name":"HELP","value":"{\"description\" => \"\"}"}],"included_modules":[{"html_id":"clear/Clear/CLI/Command","kind":"module","full_name":"Clear::CLI::Command","name":"Command"}],"namespace":{"html_id":"clear/Clear/CLI/Migration","kind":"class","full_name":"Clear::CLI::Migration","name":"Migration"},"class_methods":[{"html_id":"description-class-method","name":"description","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":26,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L26"},"def":{"name":"description","visibility":"Public","body":"HELP[\"description\"]"}},{"html_id":"run(*args,**params)-class-method","name":"run","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **params)","args_html":"(*args, **params)","location":{"filename":"src/clear/cli/migration.cr","line_number":26,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L26"},"def":{"name":"run","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"params","external_name":"params","restriction":""},"splat_index":0,"visibility":"Public","body":"(new(*args, **params)).parse_and_run"}}],"instance_methods":[{"html_id":"__rescue_from___Admiral__Error(e)-instance-method","name":"__rescue_from___Admiral__Error","abstract":false,"args":[{"name":"e","external_name":"e","restriction":""}],"args_string":"(e)","args_html":"(e)","def":{"name":"__rescue_from___Admiral__Error","args":[{"name":"e","external_name":"e","restriction":""}],"visibility":"Public","body":"panic(e.message.colorize(:red))"}},{"html_id":"arguments-instance-method","name":"arguments","doc":"Returns the commands `Arguments` object.\n\nYou can access names arguments by name.\nYou can also access the remaning arguments using `.arguments[index]`.","summary":"

Returns the commands Arguments object.

","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":26,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L26"},"def":{"name":"arguments","visibility":"Public","body":"@arguments || (@arguments = Arguments.new(self))"}},{"html_id":"flags-instance-method","name":"flags","doc":"Returns the commands `Flags` object.\n\nYou can access names flags by name.","summary":"

Returns the commands Flags object.

","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":26,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L26"},"def":{"name":"flags","visibility":"Public","body":"@flags || (@flags = Flags.new(self))"}},{"html_id":"help-instance-method","name":"help","abstract":false,"def":{"name":"help","visibility":"Public","body":"[help_usage, \"Upgrade your database to a specific migration version\" + \"\\n\", help_flags, help_arguments, help_sub_commands].reject() do |__arg0|\n __arg0.strip.empty?\nend.join(\"\\n\")"}},{"html_id":"run-instance-method","name":"run","doc":"The run command.","summary":"

The run command.

","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":27,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L27"},"def":{"name":"run","visibility":"Public","body":"Colorize.enabled = !flags.no_color\nrun_impl\n"}},{"html_id":"run_impl-instance-method","name":"run_impl","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":32,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L32"},"def":{"name":"run_impl","visibility":"Public","body":"Clear::Migration::Manager.instance.up(arguments.migration_number)"}},{"html_id":"sub(command,*args,**params)-instance-method","name":"sub","doc":"Invokes a sub command by name, passing `self` as the parent.","summary":"

Invokes a sub command by name, passing self as the parent.

","abstract":false,"args":[{"name":"command","external_name":"command","restriction":""},{"name":"args","external_name":"args","restriction":""}],"args_string":"(command, *args, **params)","args_html":"(command, *args, **params)","location":{"filename":"src/clear/cli/migration.cr","line_number":26,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L26"},"def":{"name":"sub","args":[{"name":"command","external_name":"command","restriction":""},{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"params","external_name":"params","restriction":""},"splat_index":1,"visibility":"Public","body":"SubCommands.invoke(command, *args, **params, parent: self)"}}],"types":[{"html_id":"clear/Clear/CLI/Migration/Up/Arguments","path":"Clear/CLI/Migration/Up/Arguments.html","kind":"struct","full_name":"Clear::CLI::Migration::Up::Arguments","name":"Arguments","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Iterable","kind":"module","full_name":"Iterable","name":"Iterable"},{"html_id":"clear/Enumerable","kind":"module","full_name":"Enumerable","name":"Enumerable"},{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli/migration.cr","line_number":26,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L26"},{"filename":"src/clear/cli/migration.cr","line_number":29,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L29"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"SPECS","name":"SPECS","value":"{\"migration_number\" => {type: \"Int64\", description: {\"migration_number (required)\", \"\"}, default: \"nil\", is_required: true}} of String => NamedTuple(type: String, description: Tuple(String, String | ::Nil), default: String, is_required: Bool)"}],"included_modules":[{"html_id":"clear/Enumerable","kind":"module","full_name":"Enumerable","name":"Enumerable"},{"html_id":"clear/Iterable","kind":"module","full_name":"Iterable","name":"Iterable"}],"namespace":{"html_id":"clear/Clear/CLI/Migration/Up","kind":"class","full_name":"Clear::CLI::Migration::Up","name":"Up"},"constructors":[{"html_id":"new(command:Admiral::Command)-class-method","name":"new","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"new","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":"_ = allocate\n_.initialize(command)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"[](*args,**options)-instance-method","name":"[]","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","def":{"name":"[]","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@__rest__[*args, **options]"}},{"html_id":"[](*args,**options,&)-instance-method","name":"[]","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","def":{"name":"[]","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@__rest__.[](*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"each(*args,**options)-instance-method","name":"each","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","def":{"name":"each","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@__rest__.each(*args, **options)"}},{"html_id":"each(*args,**options,&)-instance-method","name":"each","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","def":{"name":"each","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@__rest__.each(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"exists?(name:Symbol)-instance-method","name":"exists?","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"exists?","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":"!!SPECS[name]?"}},{"html_id":"get(name:Symbol)-instance-method","name":"get","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"get","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":"{migration_number: @migration_number}[name]?"}},{"html_id":"get?(name:Symbol)-instance-method","name":"get?","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"get?","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":"exists?(name) ? get(name) : false"}},{"html_id":"inspect(io)-instance-method","name":"inspect","abstract":false,"args":[{"name":"io","external_name":"io","restriction":""}],"args_string":"(io)","args_html":"(io)","location":{"filename":"src/clear/cli/migration.cr","line_number":26,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L26"},"def":{"name":"inspect","args":[{"name":"io","external_name":"io","restriction":""}],"visibility":"Public","body":"names = SPECS.keys\nif size > 0\n names << \"...\"\nend\nio << \"<#{self.class}\"\nio << \"(\"\nif names.empty?\nelse\n io << (names.join(\", \"))\nend\nio << \")\"\nio << \">\"\n"}},{"html_id":"migration_number:Int64-instance-method","name":"migration_number","abstract":false,"location":{"filename":"src/clear/cli/migration.cr","line_number":29,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L29"},"def":{"name":"migration_number","return_type":"Int64","visibility":"Public","body":"@migration_number.not_nil!"}},{"html_id":"rest:Array(String)-instance-method","name":"rest","abstract":false,"def":{"name":"rest","visibility":"Public","body":"@__rest__"}},{"html_id":"validate!(command:Admiral::Command)-instance-method","name":"validate!","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"validate!","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":"if {type: \"Int64\", description: {\"migration_number (required)\", \"\"}, default: \"nil\", is_required: true}[:is_required] && @migration_number.nil?\n raise(Admiral::Error.new(\"Argument required: migration_number\"))\nend"}},{"html_id":"value_from_spec(command:Admiral::Command,*,arg:String,type,default,is_required:Bool)-instance-method","name":"value_from_spec","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"},{"name":"","external_name":"","restriction":""},{"name":"arg","external_name":"arg","restriction":"String"},{"name":"type","external_name":"type","restriction":""},{"name":"default","external_name":"default","restriction":""},{"name":"is_required","external_name":"is_required","restriction":"Bool"}],"args_string":"(command : Admiral::Command, *, arg : String, type, default, is_required : Bool)","args_html":"(command : Admiral::Command, *, arg : String, type, default, is_required : Bool)","location":{"filename":"src/clear/cli/migration.cr","line_number":26,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L26"},"def":{"name":"value_from_spec","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"},{"name":"","external_name":"","restriction":""},{"name":"arg","external_name":"arg","restriction":"String"},{"name":"type","external_name":"type","restriction":""},{"name":"default","external_name":"default","restriction":""},{"name":"is_required","external_name":"is_required","restriction":"Bool"}],"splat_index":1,"visibility":"Public","body":"pos_only = false\nindex = 0\nwhile ((command.@argv)[index]?.to_s.starts_with?(\"-\")) && !pos_only\n index = index + 1\n pos_only = (command.@argv)[index]? == \"--\"\nend\nif (command.@argv)[index]?\n value = (command.@argv).delete_at(index)\n type.new(value)\nelse\n default\nend\n"}}]},{"html_id":"clear/Clear/CLI/Migration/Up/Flags","path":"Clear/CLI/Migration/Up/Flags.html","kind":"struct","full_name":"Clear::CLI::Migration::Up::Flags","name":"Flags","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli/migration.cr","line_number":26,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L26"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"DESCRIPTIONS","name":"DESCRIPTIONS","value":"{} of String => String"},{"id":"SPECS","name":"SPECS","value":"{\"verbose\" => {kind: \"bool\", type: \"Bool\", default: \"false\", description: {\"--verbose, -v\", \"Display verbose informations during execution\"}, short: \"v\", long: \"verbose\", is_required: true}, \"no_color\" => {kind: \"bool\", type: \"Bool\", default: \"false\", description: {\"--no-color\", \"Cancel color output\"}, short: \"nil\", long: \"no-color\", is_required: true}, \"__help__\" => {kind: \"bool\", type: \"Bool\", default: \"false\", description: {\"--help\", \"Displays help for the current command.\"}, short: \"nil\", long: \"help\", is_required: true}} of String => NamedTuple(kind: String, type: String, default: String, description: Tuple(String, String | ::Nil), short: String | ::Nil, long: String, is_required: Bool)"}],"namespace":{"html_id":"clear/Clear/CLI/Migration/Up","kind":"class","full_name":"Clear::CLI::Migration::Up","name":"Up"},"doc":"Extend the flags struct to include the flag","summary":"

Extend the flags struct to include the flag

","constructors":[{"html_id":"new(command:Admiral::Command)-class-method","name":"new","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"new","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":"_ = allocate\n_.initialize(command)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"__help__-instance-method","name":"__help__","abstract":false,"def":{"name":"__help__","visibility":"Public","body":"@__help__.not_nil!"}},{"html_id":"inspect(io)-instance-method","name":"inspect","abstract":false,"args":[{"name":"io","external_name":"io","restriction":""}],"args_string":"(io)","args_html":"(io)","location":{"filename":"src/clear/cli/migration.cr","line_number":26,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/migration.cr#L26"},"def":{"name":"inspect","args":[{"name":"io","external_name":"io","restriction":""}],"visibility":"Public","body":"io << \"<#{self.class}\"\nio << \"(\"\nif SPECS.empty?\nelse\n io << (SPECS.keys.join(\", \"))\nend\nio << \")\"\nio << \">\"\n"}},{"html_id":"no_color-instance-method","name":"no_color","abstract":false,"def":{"name":"no_color","visibility":"Public","body":"@no_color.not_nil!"}},{"html_id":"validate!(command)-instance-method","name":"validate!","abstract":false,"args":[{"name":"command","external_name":"command","restriction":""}],"args_string":"(command)","args_html":"(command)","def":{"name":"validate!","args":[{"name":"command","external_name":"command","restriction":""}],"visibility":"Public","body":"if @verbose.nil?\n raise(Admiral::Error.new(\"Flag required: --verbose\"))\nend\nif @no_color.nil?\n raise(Admiral::Error.new(\"Flag required: --no-color\"))\nend\nif @__help__.nil?\n raise(Admiral::Error.new(\"Flag required: --help\"))\nend\nraise_extra_flags!(command)\n"}},{"html_id":"verbose-instance-method","name":"verbose","abstract":false,"def":{"name":"verbose","visibility":"Public","body":"@verbose.not_nil!"}}]}]}]},{"html_id":"clear/Clear/CLI/Seed","path":"Clear/CLI/Seed.html","kind":"class","full_name":"Clear::CLI::Seed","name":"Seed","abstract":false,"superclass":{"html_id":"clear/Admiral/Command","kind":"class","full_name":"Admiral::Command","name":"Command"},"ancestors":[{"html_id":"clear/Clear/CLI/Command","kind":"module","full_name":"Clear::CLI::Command","name":"Command"},{"html_id":"clear/Admiral/Command","kind":"class","full_name":"Admiral::Command","name":"Command"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli/seed.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/seed.cr#L1"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"HELP","name":"HELP","value":"{\"description\" => \"\"}"}],"included_modules":[{"html_id":"clear/Clear/CLI/Command","kind":"module","full_name":"Clear::CLI::Command","name":"Command"}],"namespace":{"html_id":"clear/Clear/CLI","kind":"module","full_name":"Clear::CLI","name":"CLI"},"class_methods":[{"html_id":"description-class-method","name":"description","abstract":false,"location":{"filename":"src/clear/cli/seed.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/seed.cr#L1"},"def":{"name":"description","visibility":"Public","body":"HELP[\"description\"]"}},{"html_id":"run(*args,**params)-class-method","name":"run","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **params)","args_html":"(*args, **params)","location":{"filename":"src/clear/cli/seed.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/seed.cr#L1"},"def":{"name":"run","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"params","external_name":"params","restriction":""},"splat_index":0,"visibility":"Public","body":"(new(*args, **params)).parse_and_run"}}],"instance_methods":[{"html_id":"__rescue_from___Admiral__Error(e)-instance-method","name":"__rescue_from___Admiral__Error","abstract":false,"args":[{"name":"e","external_name":"e","restriction":""}],"args_string":"(e)","args_html":"(e)","def":{"name":"__rescue_from___Admiral__Error","args":[{"name":"e","external_name":"e","restriction":""}],"visibility":"Public","body":"panic(e.message.colorize(:red))"}},{"html_id":"arguments-instance-method","name":"arguments","doc":"Returns the commands `Arguments` object.\n\nYou can access names arguments by name.\nYou can also access the remaning arguments using `.arguments[index]`.","summary":"

Returns the commands Arguments object.

","abstract":false,"location":{"filename":"src/clear/cli/seed.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/seed.cr#L1"},"def":{"name":"arguments","visibility":"Public","body":"@arguments || (@arguments = Arguments.new(self))"}},{"html_id":"flags-instance-method","name":"flags","doc":"Returns the commands `Flags` object.\n\nYou can access names flags by name.","summary":"

Returns the commands Flags object.

","abstract":false,"location":{"filename":"src/clear/cli/seed.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/seed.cr#L1"},"def":{"name":"flags","visibility":"Public","body":"@flags || (@flags = Flags.new(self))"}},{"html_id":"help-instance-method","name":"help","abstract":false,"def":{"name":"help","visibility":"Public","body":"[help_usage, \"Seed the database with seed data\" + \"\\n\", help_flags, help_arguments, help_sub_commands].reject() do |__arg0|\n __arg0.strip.empty?\nend.join(\"\\n\")"}},{"html_id":"run-instance-method","name":"run","doc":"The run command.","summary":"

The run command.

","abstract":false,"location":{"filename":"src/clear/cli/seed.cr","line_number":2,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/seed.cr#L2"},"def":{"name":"run","visibility":"Public","body":"Colorize.enabled = !flags.no_color\nrun_impl\n"}},{"html_id":"run_impl-instance-method","name":"run_impl","abstract":false,"location":{"filename":"src/clear/cli/seed.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/seed.cr#L6"},"def":{"name":"run_impl","visibility":"Public","body":"Clear.apply_seeds"}},{"html_id":"sub(command,*args,**params)-instance-method","name":"sub","doc":"Invokes a sub command by name, passing `self` as the parent.","summary":"

Invokes a sub command by name, passing self as the parent.

","abstract":false,"args":[{"name":"command","external_name":"command","restriction":""},{"name":"args","external_name":"args","restriction":""}],"args_string":"(command, *args, **params)","args_html":"(command, *args, **params)","location":{"filename":"src/clear/cli/seed.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/seed.cr#L1"},"def":{"name":"sub","args":[{"name":"command","external_name":"command","restriction":""},{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"params","external_name":"params","restriction":""},"splat_index":1,"visibility":"Public","body":"SubCommands.invoke(command, *args, **params, parent: self)"}}],"types":[{"html_id":"clear/Clear/CLI/Seed/Arguments","path":"Clear/CLI/Seed/Arguments.html","kind":"struct","full_name":"Clear::CLI::Seed::Arguments","name":"Arguments","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Iterable","kind":"module","full_name":"Iterable","name":"Iterable"},{"html_id":"clear/Enumerable","kind":"module","full_name":"Enumerable","name":"Enumerable"},{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli/seed.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/seed.cr#L1"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"SPECS","name":"SPECS","value":"{} of String => NamedTuple(type: String, description: Tuple(String, String | ::Nil), default: String, is_required: Bool)"}],"included_modules":[{"html_id":"clear/Enumerable","kind":"module","full_name":"Enumerable","name":"Enumerable"},{"html_id":"clear/Iterable","kind":"module","full_name":"Iterable","name":"Iterable"}],"namespace":{"html_id":"clear/Clear/CLI/Seed","kind":"class","full_name":"Clear::CLI::Seed","name":"Seed"},"constructors":[{"html_id":"new(command:Admiral::Command)-class-method","name":"new","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"new","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":"_ = allocate\n_.initialize(command)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"[](*args,**options)-instance-method","name":"[]","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","def":{"name":"[]","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@__rest__[*args, **options]"}},{"html_id":"[](*args,**options,&)-instance-method","name":"[]","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","def":{"name":"[]","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@__rest__.[](*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"each(*args,**options)-instance-method","name":"each","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","def":{"name":"each","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@__rest__.each(*args, **options)"}},{"html_id":"each(*args,**options,&)-instance-method","name":"each","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","def":{"name":"each","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@__rest__.each(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"exists?(name:Symbol)-instance-method","name":"exists?","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"exists?","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":"!!SPECS[name]?"}},{"html_id":"get(name:Symbol)-instance-method","name":"get","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"get","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":""}},{"html_id":"get?(name:Symbol)-instance-method","name":"get?","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"args_string":"(name : Symbol)","args_html":"(name : Symbol)","def":{"name":"get?","args":[{"name":"name","external_name":"name","restriction":"Symbol"}],"visibility":"Public","body":"exists?(name) ? get(name) : false"}},{"html_id":"inspect(io)-instance-method","name":"inspect","abstract":false,"args":[{"name":"io","external_name":"io","restriction":""}],"args_string":"(io)","args_html":"(io)","location":{"filename":"src/clear/cli/seed.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/seed.cr#L1"},"def":{"name":"inspect","args":[{"name":"io","external_name":"io","restriction":""}],"visibility":"Public","body":"names = SPECS.keys\nif size > 0\n names << \"...\"\nend\nio << \"<#{self.class}\"\nio << \"(\"\nif names.empty?\nelse\n io << (names.join(\", \"))\nend\nio << \")\"\nio << \">\"\n"}},{"html_id":"rest:Array(String)-instance-method","name":"rest","abstract":false,"def":{"name":"rest","visibility":"Public","body":"@__rest__"}},{"html_id":"validate!(command:Admiral::Command)-instance-method","name":"validate!","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"validate!","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":""}},{"html_id":"value_from_spec(command:Admiral::Command,*,arg:String,type,default,is_required:Bool)-instance-method","name":"value_from_spec","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"},{"name":"","external_name":"","restriction":""},{"name":"arg","external_name":"arg","restriction":"String"},{"name":"type","external_name":"type","restriction":""},{"name":"default","external_name":"default","restriction":""},{"name":"is_required","external_name":"is_required","restriction":"Bool"}],"args_string":"(command : Admiral::Command, *, arg : String, type, default, is_required : Bool)","args_html":"(command : Admiral::Command, *, arg : String, type, default, is_required : Bool)","location":{"filename":"src/clear/cli/seed.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/seed.cr#L1"},"def":{"name":"value_from_spec","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"},{"name":"","external_name":"","restriction":""},{"name":"arg","external_name":"arg","restriction":"String"},{"name":"type","external_name":"type","restriction":""},{"name":"default","external_name":"default","restriction":""},{"name":"is_required","external_name":"is_required","restriction":"Bool"}],"splat_index":1,"visibility":"Public","body":"pos_only = false\nindex = 0\nwhile ((command.@argv)[index]?.to_s.starts_with?(\"-\")) && !pos_only\n index = index + 1\n pos_only = (command.@argv)[index]? == \"--\"\nend\nif (command.@argv)[index]?\n value = (command.@argv).delete_at(index)\n type.new(value)\nelse\n default\nend\n"}}]},{"html_id":"clear/Clear/CLI/Seed/Flags","path":"Clear/CLI/Seed/Flags.html","kind":"struct","full_name":"Clear::CLI::Seed::Flags","name":"Flags","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/cli/seed.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/seed.cr#L1"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"DESCRIPTIONS","name":"DESCRIPTIONS","value":"{} of String => String"},{"id":"SPECS","name":"SPECS","value":"{\"verbose\" => {kind: \"bool\", type: \"Bool\", default: \"false\", description: {\"--verbose, -v\", \"Display verbose informations during execution\"}, short: \"v\", long: \"verbose\", is_required: true}, \"no_color\" => {kind: \"bool\", type: \"Bool\", default: \"false\", description: {\"--no-color\", \"Cancel color output\"}, short: \"nil\", long: \"no-color\", is_required: true}, \"__help__\" => {kind: \"bool\", type: \"Bool\", default: \"false\", description: {\"--help\", \"Displays help for the current command.\"}, short: \"nil\", long: \"help\", is_required: true}} of String => NamedTuple(kind: String, type: String, default: String, description: Tuple(String, String | ::Nil), short: String | ::Nil, long: String, is_required: Bool)"}],"namespace":{"html_id":"clear/Clear/CLI/Seed","kind":"class","full_name":"Clear::CLI::Seed","name":"Seed"},"doc":"Extend the flags struct to include the flag","summary":"

Extend the flags struct to include the flag

","constructors":[{"html_id":"new(command:Admiral::Command)-class-method","name":"new","abstract":false,"args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"args_string":"(command : Admiral::Command)","args_html":"(command : Admiral::Command)","def":{"name":"new","args":[{"name":"command","external_name":"command","restriction":"::Admiral::Command"}],"visibility":"Public","body":"_ = allocate\n_.initialize(command)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"__help__-instance-method","name":"__help__","abstract":false,"def":{"name":"__help__","visibility":"Public","body":"@__help__.not_nil!"}},{"html_id":"inspect(io)-instance-method","name":"inspect","abstract":false,"args":[{"name":"io","external_name":"io","restriction":""}],"args_string":"(io)","args_html":"(io)","location":{"filename":"src/clear/cli/seed.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/cli/seed.cr#L1"},"def":{"name":"inspect","args":[{"name":"io","external_name":"io","restriction":""}],"visibility":"Public","body":"io << \"<#{self.class}\"\nio << \"(\"\nif SPECS.empty?\nelse\n io << (SPECS.keys.join(\", \"))\nend\nio << \")\"\nio << \">\"\n"}},{"html_id":"no_color-instance-method","name":"no_color","abstract":false,"def":{"name":"no_color","visibility":"Public","body":"@no_color.not_nil!"}},{"html_id":"validate!(command)-instance-method","name":"validate!","abstract":false,"args":[{"name":"command","external_name":"command","restriction":""}],"args_string":"(command)","args_html":"(command)","def":{"name":"validate!","args":[{"name":"command","external_name":"command","restriction":""}],"visibility":"Public","body":"if @verbose.nil?\n raise(Admiral::Error.new(\"Flag required: --verbose\"))\nend\nif @no_color.nil?\n raise(Admiral::Error.new(\"Flag required: --no-color\"))\nend\nif @__help__.nil?\n raise(Admiral::Error.new(\"Flag required: --help\"))\nend\nraise_extra_flags!(command)\n"}},{"html_id":"verbose-instance-method","name":"verbose","abstract":false,"def":{"name":"verbose","visibility":"Public","body":"@verbose.not_nil!"}}]}]}]},{"html_id":"clear/Clear/Enum","path":"Clear/Enum.html","kind":"struct","full_name":"Clear::Enum","name":"Enum","abstract":true,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Clear/Expression/Literal","kind":"module","full_name":"Clear::Expression::Literal","name":"Literal"},{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/extensions/enum/enum.cr","line_number":7,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/enum/enum.cr#L7"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"clear/Clear/Expression/Literal","kind":"module","full_name":"Clear::Expression::Literal","name":"Literal"}],"namespace":{"html_id":"clear/Clear","kind":"module","full_name":"Clear","name":"Clear"},"doc":"Clear::Enum wrap the enums used in PostgreSQL.\nSee `Clear.enum` macro helper.","summary":"

Clear::Enum wrap the enums used in PostgreSQL.

","constructors":[{"html_id":"new(value:JSON::PullParser|String)-class-method","name":"new","abstract":false,"args":[{"name":"value","external_name":"value","restriction":"::JSON::PullParser | ::String"}],"args_string":"(value : JSON::PullParser | String)","args_html":"(value : JSON::PullParser | String)","location":{"filename":"src/clear/extensions/enum/enum.cr","line_number":12,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/enum/enum.cr#L12"},"def":{"name":"new","args":[{"name":"value","external_name":"value","restriction":"::JSON::PullParser | ::String"}],"visibility":"Public","body":"_ = allocate\n_.initialize(value)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"==(x)-instance-method","name":"==","doc":"Returns `true` if this struct is equal to *other*.\n\nBoth structs' instance vars are compared to each other. Thus, two\nstructs are considered equal if each of their instance variables are\nequal. Subclasses should override this method to provide specific\nequality semantics.\n\n```\nstruct Point\n def initialize(@x : Int32, @y : Int32)\n end\nend\n\np1 = Point.new 1, 2\np2 = Point.new 1, 2\np3 = Point.new 3, 4\n\np1 == p2 # => true\np1 == p3 # => false\n```","summary":"

Returns true if this struct is equal to other.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x)","args_html":"(x)","location":{"filename":"src/clear/extensions/enum/enum.cr","line_number":27,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/enum/enum.cr#L27"},"def":{"name":"==","args":[{"name":"x","external_name":"x","restriction":""}],"visibility":"Public","body":"(super(x)) || (@value == x)"}},{"html_id":"to_json(json:JSON::Builder)-instance-method","name":"to_json","abstract":false,"args":[{"name":"json","external_name":"json","restriction":"JSON::Builder"}],"args_string":"(json : JSON::Builder)","args_html":"(json : JSON::Builder)","location":{"filename":"src/clear/extensions/enum/enum.cr","line_number":23,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/enum/enum.cr#L23"},"def":{"name":"to_json","args":[{"name":"json","external_name":"json","restriction":"JSON::Builder"}],"visibility":"Public","body":"json.string(@value)"}},{"html_id":"to_s:String-instance-method","name":"to_s","doc":"Returns a nicely readable and concise string representation of this object,\ntypically intended for users.\n\nThis method should usually **not** be overridden. It delegates to\n`#to_s(IO)` which can be overridden for custom implementations.\n\nAlso see `#inspect`.","summary":"

Returns a nicely readable and concise string representation of this object, typically intended for users.

","abstract":false,"location":{"filename":"src/clear/extensions/enum/enum.cr","line_number":15,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/enum/enum.cr#L15"},"def":{"name":"to_s","return_type":"String","visibility":"Public","body":"@value.to_s"}},{"html_id":"to_sql:String-instance-method","name":"to_sql","abstract":false,"location":{"filename":"src/clear/extensions/enum/enum.cr","line_number":19,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/enum/enum.cr#L19"},"def":{"name":"to_sql","return_type":"String","visibility":"Public","body":"@value.to_sql"}}],"types":[{"html_id":"clear/Clear/Enum/Converter","path":"Clear/Enum/Converter.html","kind":"module","full_name":"Clear::Enum::Converter(T)","name":"Converter","abstract":false,"locations":[{"filename":"src/clear/extensions/enum/enum.cr","line_number":31,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/enum/enum.cr#L31"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Enum","kind":"struct","full_name":"Clear::Enum","name":"Enum"},"class_methods":[{"html_id":"to_column(x):T|Nil-class-method","name":"to_column","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x) : T | Nil","args_html":"(x) : T | Nil","location":{"filename":"src/clear/extensions/enum/enum.cr","line_number":32,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/enum/enum.cr#L32"},"def":{"name":"to_column","args":[{"name":"x","external_name":"x","restriction":""}],"return_type":"T | ::Nil","visibility":"Public","body":"case x\nwhen String\n T.authorized_values[x]\nwhen Nil\n nil\nelse\n raise(converter_error(x.class.name, \"Enum: #{T.class.name}\"))\nend"}}]}]},{"html_id":"clear/Clear/ErrorMessages","path":"Clear/ErrorMessages.html","kind":"module","full_name":"Clear::ErrorMessages","name":"ErrorMessages","abstract":false,"locations":[{"filename":"src/clear/error_messages.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/error_messages.cr#L4"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"extended_modules":[{"html_id":"clear/Clear/ErrorMessages","kind":"module","full_name":"Clear::ErrorMessages","name":"ErrorMessages"}],"including_types":[{"html_id":"clear/Clear/Migration","kind":"module","full_name":"Clear::Migration","name":"Migration"},{"html_id":"clear/Clear/Migration/Manager","kind":"class","full_name":"Clear::Migration::Manager","name":"Manager"},{"html_id":"clear/Clear/Migration/Operation","kind":"class","full_name":"Clear::Migration::Operation","name":"Operation"},{"html_id":"clear/Clear/Model","kind":"module","full_name":"Clear::Model","name":"Model"},{"html_id":"clear/Clear/Model/Column","kind":"class","full_name":"Clear::Model::Column(T, C)","name":"Column"}],"namespace":{"html_id":"clear/Clear","kind":"module","full_name":"Clear","name":"Clear"},"doc":"This module list most of the runtime errors happening in Clear.\nIt's an attempt to make Clear user friendly by enabling advanced resolution\nof problems when they raise.","summary":"

This module list most of the runtime errors happening in Clear.

","instance_methods":[{"html_id":"build_error_message(message:String,ways_to_resolve:Tuple|Array=Tuple.new,manual_pages:Tuple|Array=Tuple.new)-instance-method","name":"build_error_message","abstract":false,"args":[{"name":"message","external_name":"message","restriction":"String"},{"name":"ways_to_resolve","default_value":"Tuple.new","external_name":"ways_to_resolve","restriction":"Tuple | Array"},{"name":"manual_pages","default_value":"Tuple.new","external_name":"manual_pages","restriction":"Tuple | Array"}],"args_string":"(message : String, ways_to_resolve : Tuple | Array = Tuple.new, manual_pages : Tuple | Array = Tuple.new)","args_html":"(message : String, ways_to_resolve : Tuple | Array = Tuple.new, manual_pages : Tuple | Array = Tuple.new)","location":{"filename":"src/clear/error_messages.cr","line_number":65,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/error_messages.cr#L65"},"def":{"name":"build_error_message","args":[{"name":"message","external_name":"message","restriction":"String"},{"name":"ways_to_resolve","default_value":"Tuple.new","external_name":"ways_to_resolve","restriction":"Tuple | Array"},{"name":"manual_pages","default_value":"Tuple.new","external_name":"manual_pages","restriction":"Tuple | Array"}],"visibility":"Public","body":"{% if flag?(:release) %}\n message\n {% else %}\n format_width({\n build_message(message),\n build_tips(ways_to_resolve),\n build_manual(manual_pages),\n (\n \"You may also have encountered a bug. \\n\" +\n \"Feel free to submit an issue: \\n#{build_url(\"https://github.com/anykeyh/clear/issues/new\")}\"\n ),\n \"\\n\\nStack trace:\\n\",\n }.join)\n {% end %}"}},{"html_id":"converter_error(from,to)-instance-method","name":"converter_error","abstract":false,"args":[{"name":"from","external_name":"from","restriction":""},{"name":"to","external_name":"to","restriction":""}],"args_string":"(from, to)","args_html":"(from, to)","location":{"filename":"src/clear/error_messages.cr","line_number":209,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/error_messages.cr#L209"},"def":{"name":"converter_error","args":[{"name":"from","external_name":"from","restriction":""},{"name":"to","external_name":"to","restriction":""}],"visibility":"Public","body":"build_error_message(\"Clear cannot convert from `#{from}` to #{to}.\", {\"Ensure your database column type matches the column declaration in Clear\"}, {\"model/Definition.md\"})"}},{"html_id":"format_width(x,w=80)-instance-method","name":"format_width","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""},{"name":"w","default_value":"80","external_name":"w","restriction":""}],"args_string":"(x, w = 80)","args_html":"(x, w = 80)","location":{"filename":"src/clear/error_messages.cr","line_number":11,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/error_messages.cr#L11"},"def":{"name":"format_width","args":[{"name":"x","external_name":"x","restriction":""},{"name":"w","default_value":"80","external_name":"w","restriction":""}],"visibility":"Public","body":"counter = 0\no = [] of String\n(x.split(/([ \\n\\t])/)).each do |word|\n case word\n when \"\\n\"\n o << word\n counter = 0\n else\n counter = counter + word.size\n if counter > w\n o << \"\\n\"\n if word == \" \"\n counter = 0\n else\n o << word\n counter = word.size\n end\n else\n o << word\n end\n end\nend\no.join\n"}},{"html_id":"illegal_setter_access_to_undefined_column(name)-instance-method","name":"illegal_setter_access_to_undefined_column","abstract":false,"args":[{"name":"name","external_name":"name","restriction":""}],"args_string":"(name)","args_html":"(name)","location":{"filename":"src/clear/error_messages.cr","line_number":177,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/error_messages.cr#L177"},"def":{"name":"illegal_setter_access_to_undefined_column","args":[{"name":"name","external_name":"name","restriction":""}],"visibility":"Public","body":"build_error_message(\"You're trying to access to the column `#{name}` but it is not initialized.\", {\"Ensure that the column `#{name}` exists in your table\", \"If the model comes from a collection query, there was maybe a filtering on your `select` clause, \" + \"and you forgot to declare the column `#{name}`\", \"In the case of unpersisted models, please initialize by calling `#{name}=` first\", \"For validator, try `ensure_than` method, or use `#{name}_column.defined?` to avoid your validation code.\", \"Are you calling `#{name}_column.revert` somewhere before?\", \"If your model comes from JSON, please ensure the JSON source defines the column. Usage of `strict` mode will \" + \"trigger exception on JSON loading.\"}, {\"model/Definition.md\", \"model/Lifecycle.md\"})"}},{"html_id":"lack_of_primary_key(model_name)-instance-method","name":"lack_of_primary_key","abstract":false,"args":[{"name":"model_name","external_name":"model_name","restriction":""}],"args_string":"(model_name)","args_html":"(model_name)","location":{"filename":"src/clear/error_messages.cr","line_number":218,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/error_messages.cr#L218"},"def":{"name":"lack_of_primary_key","args":[{"name":"model_name","external_name":"model_name","restriction":""}],"visibility":"Public","body":"build_error_message(\"Model `#{model_name}` lacks of primary key field\", {\"Define a column as primary key\", \"Only one column can be primary key (no compound keys are allowed in Clear for now)\", \"You can use the helpers for primary key (see manual page)\"}, {\"model/PrimaryKeyTweaking.md\"})"}},{"html_id":"migration_already_down(number)-instance-method","name":"migration_already_down","abstract":false,"args":[{"name":"number","external_name":"number","restriction":""}],"args_string":"(number)","args_html":"(number)","location":{"filename":"src/clear/error_messages.cr","line_number":94,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/error_messages.cr#L94"},"def":{"name":"migration_already_down","args":[{"name":"number","external_name":"number","restriction":""}],"visibility":"Public","body":"build_error_message(\"Migration already down: #{number}\", {\"You're trying to force a migration which is not set in your database yet. \" + \"You should up the migration first, then down it again.\"}, {\"migration/Migration.md\"})"}},{"html_id":"migration_already_up(number)-instance-method","name":"migration_already_up","abstract":false,"args":[{"name":"number","external_name":"number","restriction":""}],"args_string":"(number)","args_html":"(number)","location":{"filename":"src/clear/error_messages.cr","line_number":82,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/error_messages.cr#L82"},"def":{"name":"migration_already_up","args":[{"name":"number","external_name":"number","restriction":""}],"visibility":"Public","body":"build_error_message(\"Migration already up: #{number}\", {\"You're trying to force a migration which is already existing in your database. \" + \"You should down the migration first, then up it again.\"}, {\"migration/Migration.md\"})"}},{"html_id":"migration_irreversible(name=nil,operation=nil)-instance-method","name":"migration_irreversible","abstract":false,"args":[{"name":"name","default_value":"nil","external_name":"name","restriction":""},{"name":"operation","default_value":"nil","external_name":"operation","restriction":""}],"args_string":"(name = nil, operation = nil)","args_html":"(name = nil, operation = nil)","location":{"filename":"src/clear/error_messages.cr","line_number":144,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/error_messages.cr#L144"},"def":{"name":"migration_irreversible","args":[{"name":"name","default_value":"nil","external_name":"name","restriction":""},{"name":"operation","default_value":"nil","external_name":"operation","restriction":""}],"visibility":"Public","body":"op_string = operation ? \"This is caused by the operation #{operation} which is irreversible.\" : nil\nmig_string = name ? \"The migration `#{name}` is irreversible. You're trying to down a migration which is not downable, \" + \"because the operations are one way only.\" : \"A migration is irreversible. You're trying to down a migration which is not downable, \" + \"because the operations are one way only.\"\nbuild_error_message(mig_string, [op_string, \"Build a way to revert the migration\", \"Do not revert the migration\", \"Maybe you need to manually flush the migration using Postgres. `__clear_metadatas` table store loaded \" + \"migrations. Good luck !\"].compact, {\"migration/Migration.md\"})\n"}},{"html_id":"migration_not_found(number)-instance-method","name":"migration_not_found","abstract":false,"args":[{"name":"number","external_name":"number","restriction":""}],"args_string":"(number)","args_html":"(number)","location":{"filename":"src/clear/error_messages.cr","line_number":106,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/error_messages.cr#L106"},"def":{"name":"migration_not_found","args":[{"name":"number","external_name":"number","restriction":""}],"visibility":"Public","body":"build_error_message(\"The migration number `#{number}` is not found.\", {\"Ensure your migration files are required\", \"Number of the migrations can be found in the filename, \" + \"in the classname or in the `uid` method of the migration.\"}, {\"migration/Migration.md\"})"}},{"html_id":"migration_not_unique(numbers)-instance-method","name":"migration_not_unique","abstract":false,"args":[{"name":"numbers","external_name":"numbers","restriction":""}],"args_string":"(numbers)","args_html":"(numbers)","location":{"filename":"src/clear/error_messages.cr","line_number":164,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/error_messages.cr#L164"},"def":{"name":"migration_not_unique","args":[{"name":"numbers","external_name":"numbers","restriction":""}],"visibility":"Public","body":"build_error_message(\"The migration manage found collision on migration number. Migrations number are: #{numbers.join(\", \")}\", {\"It happens when migration share the same `uid`. Try to change the UID of one of your migrations\", \"By default, Clear has a `-1` migration used internally. Do not use this migration number.\", \"Migration numbers can be found in filename, classname or return of `uid` method\"}, {\"migration/Migration.md\"})"}},{"html_id":"no_migration_yet(version)-instance-method","name":"no_migration_yet","abstract":false,"args":[{"name":"version","external_name":"version","restriction":""}],"args_string":"(version)","args_html":"(version)","location":{"filename":"src/clear/error_messages.cr","line_number":119,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/error_messages.cr#L119"},"def":{"name":"no_migration_yet","args":[{"name":"version","external_name":"version","restriction":""}],"visibility":"Public","body":"build_error_message(\"No migrations are registered yet, so we cannot go to version=#{version}\", {\"Ensure your migration files are required\", \"Ensure you have some migration files. Captain obvious to the rescue! ;-)\"}, {\"migration/Migration.md\"})"}},{"html_id":"null_column_mapping_error(name,type)-instance-method","name":"null_column_mapping_error","abstract":false,"args":[{"name":"name","external_name":"name","restriction":""},{"name":"type","external_name":"type","restriction":""}],"args_string":"(name, type)","args_html":"(name, type)","location":{"filename":"src/clear/error_messages.cr","line_number":196,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/error_messages.cr#L196"},"def":{"name":"null_column_mapping_error","args":[{"name":"name","external_name":"name","restriction":""},{"name":"type","external_name":"type","restriction":""}],"visibility":"Public","body":"build_error_message(\"Your field `#{name}` is declared as `#{type}` but `NULL` value has been found in the database.\", {\"In your model, declare your column `column #{name} : #{type}?` (note the `?` which allow nil value)\", \"In your database, adding `DEFAULT` value and/or `NOT NULL` constraint should disallow NULL fields \" + \"from your data.\"}, {\"model/Definition.md#presence-validation\"})"}},{"html_id":"order_by_error_invalid_order(current_order)-instance-method","name":"order_by_error_invalid_order","abstract":false,"args":[{"name":"current_order","external_name":"current_order","restriction":""}],"args_string":"(current_order)","args_html":"(current_order)","location":{"filename":"src/clear/error_messages.cr","line_number":259,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/error_messages.cr#L259"},"def":{"name":"order_by_error_invalid_order","args":[{"name":"current_order","external_name":"current_order","restriction":""}],"visibility":"Public","body":"build_error_message(\"Order by allow only ASC and DESC directions. But #{current_order} was given.\", {\"Ensure to use :asc, :desc symbol (or string) when constructing your query.\", \"If the code is dynamic, force the casting to one of the two value above, to avoid SQL injection.\"}, {\"querying/RequestBuilding.md\"})"}},{"html_id":"polymorphic_nil(through)-instance-method","name":"polymorphic_nil","abstract":false,"args":[{"name":"through","external_name":"through","restriction":""}],"args_string":"(through)","args_html":"(through)","location":{"filename":"src/clear/error_messages.cr","line_number":229,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/error_messages.cr#L229"},"def":{"name":"polymorphic_nil","args":[{"name":"through","external_name":"through","restriction":""}],"visibility":"Public","body":"build_error_message(\"Impossible to instantiate polymorphic object, because the type given by the data is nil.\", {\"The column `#{through}` contains NULL value, but is set as storage for \" + \"the type of the polymorphic object.\", \"Try to set DEFAULT value for your column `#{through}`\", \"In case of new implementation of polymorphic system, we recommend you to update the column to the previous \" + \"Class value. Value must be equal to the fully qualified model class name in Crystal (e.g. `MyApp::MyModel`)\"}, {\"model/Polymorphism.md\"})"}},{"html_id":"polymorphic_unknown_class(class_name)-instance-method","name":"polymorphic_unknown_class","abstract":false,"args":[{"name":"class_name","external_name":"class_name","restriction":""}],"args_string":"(class_name)","args_html":"(class_name)","location":{"filename":"src/clear/error_messages.cr","line_number":242,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/error_messages.cr#L242"},"def":{"name":"polymorphic_unknown_class","args":[{"name":"class_name","external_name":"class_name","restriction":""}],"visibility":"Public","body":"build_error_message(\"Impossible to instantiate a new `#{class_name}` using polymorphism.\", {((\"Ensure the type is properly setup in your `polymorphic` helper. \" + \"Any model which can exists in your database needs to manually be setup as in the example below:\\n\") + \"`polymorphic Dog, Cat, through: \\\"type\\\"`\\n\") + \"In this case, if you have a `Cow` object in your database, then add it in the list of allowed polymorphic objects.\", (\"Ensure the name match a fully qualified, with full path, Clear model:\\n\" + \"`polymorphic ::Animal::Dog, ::Animal::Cat, through: \\\"type\\\"`\\n\") + \"The column should then contains `Animal::Dog` and not `Dog`\"}, {\"model/Polymorphism.md\"})"}},{"html_id":"query_building_error(message)-instance-method","name":"query_building_error","abstract":false,"args":[{"name":"message","external_name":"message","restriction":""}],"args_string":"(message)","args_html":"(message)","location":{"filename":"src/clear/error_messages.cr","line_number":271,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/error_messages.cr#L271"},"def":{"name":"query_building_error","args":[{"name":"message","external_name":"message","restriction":""}],"visibility":"Public","body":"Clear::SQL::QueryBuildingError.new(build_error_message({\"You're trying to construct an invalid SQL request:\\n\", message}.join, manual_pages: {\"querying/RequestBuilding.md\"}))"}},{"html_id":"uid_not_found(class_name)-instance-method","name":"uid_not_found","abstract":false,"args":[{"name":"class_name","external_name":"class_name","restriction":""}],"args_string":"(class_name)","args_html":"(class_name)","location":{"filename":"src/clear/error_messages.cr","line_number":131,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/error_messages.cr#L131"},"def":{"name":"uid_not_found","args":[{"name":"class_name","external_name":"class_name","restriction":""}],"visibility":"Public","body":"build_error_message(\"I don't know how to order the migration `#{class_name}`\", {\"Rename your migration class to have the migration UID at the end of the class name\", \"Rename the file where your migration stand to have the migration UID in front of the filename\", \"Override the method `uid`. Be sure the number is immutable (e.g. return constant)\"}, {\"migration/Migration.md\"})"}},{"html_id":"uninitialized_db_connection(connection)-instance-method","name":"uninitialized_db_connection","abstract":false,"args":[{"name":"connection","external_name":"connection","restriction":""}],"args_string":"(connection)","args_html":"(connection)","location":{"filename":"src/clear/error_messages.cr","line_number":278,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/error_messages.cr#L278"},"def":{"name":"uninitialized_db_connection","args":[{"name":"connection","external_name":"connection","restriction":""}],"visibility":"Public","body":"build_error_message(\"You're trying to access the connection #{connection} which is not initialized\", {\"Use `Clear::SQL.init(#{connection}: \\\"postgres://XXX...\\\" )` on startup of your application\", \"The name of the connection (#{connection}) can't be found. It may have been mistyped.\"}, {\"Setup.md\", \"model/MultiConnection.md\"})"}}]},{"html_id":"clear/Clear/Expression","path":"Clear/Expression.html","kind":"class","full_name":"Clear::Expression","name":"Expression","abstract":false,"superclass":{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/expression/expression.cr","line_number":55,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/expression.cr#L55"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"DATABASE_DATE_FORMAT","name":"DATABASE_DATE_FORMAT","value":"\"%Y-%m-%d\""},{"id":"DATABASE_DATE_TIME_FORMAT","name":"DATABASE_DATE_TIME_FORMAT","value":"\"%Y-%m-%d %H:%M:%S.%L %:z\""}],"namespace":{"html_id":"clear/Clear","kind":"module","full_name":"Clear","name":"Clear"},"doc":"## Clear's Expression engine\n\nThe goal of this module is to offer the most natural way to write down your\nquery in crystal.\n\nIf you're familiar with Sequel on Ruby, then here you have !\n\nInstead of writing:\n\n```\nmodel_collection.where(\"created_at BETWEEN ? AND ?\", 1.day.ago, DateTime.local)\n```\n\nYou can write:\n```\nmodel_collection.where { created_at.between(1.day.ago, DateTime.local) }\n```\n\nor even:\n\n```\nmodel_collection.where { created_at.in?(1.day.ago..DateTime.local) }\n```\n\n(Note for the later, it will generate `created_at > 1.day.ago AND created_at < DateTime.local`)\n\n## Limitations\n\nDue to the use of `missing_method` macro, some case can be confusing.\n\n### Existing local variable / instance method\n\n```\nid = 1\nmodel_collection.where { id > 100 } # Will raise an error, because the expression is resolved by Crystal !\n# Should be:\nid = 1\nmodel_collection.where { var(\"id\") > 100 } # Will works\n```\n\n### Usage of AND / OR\n\nAnd/Or can be used using the bitwises operators `&` and `|`.\nDue to the impossibility to reuse `||` and `&&`, beware the operator precendance\nrules are changed.\n\n```\n# v-- This below will not works, as we cannot redefine the `or` operator\nmodel_collection.where { first_name == \"yacine\" || last_name == \"petitprez\" }\n# v-- This will works, but beware of the parenthesis between each terms, as `|` is prioritary on `==`\nmodel.collection.where { (firt_name == \"yacine\") | (last_name == \"petitprez\") }\n# ^-- ... WHERE first_name = 'yacine' OR last_name == ''\n```\n","summary":"

\n \n \nClear's Expression engine

","class_methods":[{"html_id":"[](arg)-class-method","name":"[]","doc":"A fast way to call `self.safe_literal`\nSee `safe_literal(x : _)`","summary":"

A fast way to call self.safe_literal See .safe_literal(x : _)

","abstract":false,"args":[{"name":"arg","external_name":"arg","restriction":""}],"args_string":"(arg)","args_html":"(arg)","location":{"filename":"src/clear/expression/expression.cr","line_number":97,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/expression.cr#L97"},"def":{"name":"[]","args":[{"name":"arg","external_name":"arg","restriction":""}],"visibility":"Public","body":"safe_literal(arg)"}},{"html_id":"ensure_node!(any)-class-method","name":"ensure_node!","doc":"This method will raise error on compilation if discovered in the code.\nThis allow to avoid issues like this one at compile type:\n\n```\nid = 1\n# ... and later\nUser.query.where { id == 2 }\n```\n\nIn this case, the local var id will be evaluated in the expression engine.\nleading to buggy code.\n\nHaving this method prevent the code to compile.\n\nTo be able to pass a literal or values other than node, please use `raw`\nmethod.\n","summary":"

This method will raise error on compilation if discovered in the code.

","abstract":false,"args":[{"name":"any","external_name":"any","restriction":""}],"args_string":"(any)","args_html":"(any)","location":{"filename":"src/clear/expression/expression.cr","line_number":188,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/expression.cr#L188"},"def":{"name":"ensure_node!","args":[{"name":"any","external_name":"any","restriction":""}],"visibility":"Public","body":"{% raise(((((\"The expression engine discovered a runtime-evaluable condition.\\n\" + \"It happens when a test is done with values on both sides.\\n\") + \"Maybe a local variable is breaking the expression engine like here:\\n\") + \"id = 1\\n\") + \"Users.where { id == nil }\\n\\n\") + \"In this case, please use `raw(\\\"id IS NULL\\\")` to allow the expression.\") %}"}},{"html_id":"raw(x:String,*args)-class-method","name":"raw","doc":"In case the name of the variable is a reserved word (e.g. `not`, `var`, `raw`)\nor in case of a complex piece of computation impossible to express with the expression engine\n(e.g. usage of functions) you can use then raw to pass the String.\n\nBE AWARE than the String is pasted AS-IS and can lead to SQL injection if not used properly.\n\n```\nhaving { raw(\"COUNT(*)\") > 5 } # SELECT ... FROM ... HAVING COUNT(*) > 5\nwhere { raw(\"func(?, ?) = ?\", a, b, c) } # SELECT ... FROM ... WHERE function(a, b) = c\n```\n","summary":"

In case the name of the variable is a reserved word (e.g.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"String"},{"name":"args","external_name":"args","restriction":""}],"args_string":"(x : String, *args)","args_html":"(x : String, *args)","location":{"filename":"src/clear/expression/expression.cr","line_number":252,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/expression.cr#L252"},"def":{"name":"raw","args":[{"name":"x","external_name":"x","restriction":"String"},{"name":"args","external_name":"args","restriction":""}],"splat_index":1,"visibility":"Public","body":"raw_enum(x, args)"}},{"html_id":"raw(__template:String,**tuple)-class-method","name":"raw","doc":"In case the name of the variable is a reserved word (e.g. `not`, `var`, `raw`)\nor in case of a complex piece of computation impossible to express with the expression engine\n(e.g. usage of functions) you can use then raw to pass the String.\n\nBE AWARE than the String is pasted AS-IS and can lead to SQL injection if not used properly.\n\n```\nhaving { raw(\"COUNT(*)\") > 5 } # SELECT ... FROM ... HAVING COUNT(*) > 5\nwhere { raw(\"func(:a, :b) = :c\", a: a, b: b, c: c) } # SELECT ... FROM ... WHERE function(a, b) = c\n```\n","summary":"

In case the name of the variable is a reserved word (e.g.

","abstract":false,"args":[{"name":"__template","external_name":"__template","restriction":"String"}],"args_string":"(__template : String, **tuple)","args_html":"(__template : String, **tuple)","location":{"filename":"src/clear/expression/expression.cr","line_number":296,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/expression.cr#L296"},"def":{"name":"raw","args":[{"name":"__template","external_name":"__template","restriction":"String"}],"double_splat":{"name":"tuple","external_name":"tuple","restriction":""},"visibility":"Public","body":"__template.gsub(/(^|[^:])\\:([a-zA-Z0-9_]+)/) do |_, match|\n begin\n sym = match[2]\n match[1] + Clear::Expression[tuple[sym]]\n rescue e : KeyError\n raise(Clear::ErrorMessages.query_building_error(e.message))\n end\nend"}},{"html_id":"raw_enum(x:String,args)-class-method","name":"raw_enum","doc":"See `self.raw`\nCan pass an array to this version","summary":"

See self.raw Can pass an array to this version

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"String"},{"name":"args","external_name":"args","restriction":""}],"args_string":"(x : String, args)","args_html":"(x : String, args)","location":{"filename":"src/clear/expression/expression.cr","line_number":258,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/expression.cr#L258"},"def":{"name":"raw_enum","args":[{"name":"x","external_name":"x","restriction":"String"},{"name":"args","external_name":"args","restriction":""}],"visibility":"Public","body":"idx = -1\nx.gsub(\"?\") do |_|\n begin\n Clear::Expression[args[idx = idx + 1]]\n rescue e : IndexError\n raise(Clear::ErrorMessages.query_building_error(e.message))\n end\nend\n"}},{"html_id":"safe_literal(x:Enumerable(AvailableLiteral)):Enumerable(String)-class-method","name":"safe_literal","doc":"Transform multiple objects into a string which is SQL-Injection safe.","summary":"

Transform multiple objects into a string which is SQL-Injection safe.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Enumerable(AvailableLiteral)"}],"args_string":"(x : Enumerable(AvailableLiteral)) : Enumerable(String)","args_html":"(x : Enumerable(AvailableLiteral)) : Enumerable(String)","location":{"filename":"src/clear/expression/expression.cr","line_number":127,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/expression.cr#L127"},"def":{"name":"safe_literal","args":[{"name":"x","external_name":"x","restriction":"Enumerable(AvailableLiteral)"}],"return_type":"Enumerable(String)","visibility":"Public","body":"x.map do |item|\n safe_literal(item)\nend"}},{"html_id":"safe_literal(x:Time,date:Bool=false):String-class-method","name":"safe_literal","doc":"Safe literal of a time return a string representation of time in the format understood by postgresql.\n\nIf the optional parameter `date` is passed, the time is truncated and only the date is passed:\n\n## Example\n\n```\nClear::Expression[Time.local] # < \"2017-04-03 23:04:43.234 +08:00\"\nClear::Expression[Time.local, date: true] # < \"2017-04-03\"\n```","summary":"

Safe literal of a time return a string representation of time in the format understood by postgresql.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Time"},{"name":"date","default_value":"false","external_name":"date","restriction":"Bool"}],"args_string":"(x : Time, date : Bool = false) : String","args_html":"(x : Time, date : Bool = false) : String","location":{"filename":"src/clear/expression/expression.cr","line_number":147,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/expression.cr#L147"},"def":{"name":"safe_literal","args":[{"name":"x","external_name":"x","restriction":"Time"},{"name":"date","default_value":"false","external_name":"date","restriction":"Bool"}],"return_type":"String","visibility":"Public","body":"{\"'\", x.to_utc.to_s(date ? DATABASE_DATE_FORMAT : DATABASE_DATE_TIME_FORMAT), \"'\"}.join"}},{"html_id":"safe_literal(x:_):String-class-method","name":"safe_literal","doc":"Sanitize an object and return a `String` representation of itself which is proofed against SQL injections.","summary":"

Sanitize an object and return a String representation of itself which is proofed against SQL injections.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"_"}],"args_string":"(x : _) : String","args_html":"(x : _) : String","location":{"filename":"src/clear/expression/expression.cr","line_number":167,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/expression.cr#L167"},"def":{"name":"safe_literal","args":[{"name":"x","external_name":"x","restriction":"_"}],"return_type":"String","visibility":"Public","body":"safe_literal(x.to_s)"}},{"html_id":"unsafe(x)-class-method","name":"unsafe","doc":"Return unsafe string injected to the query.\n can be used for example in `insert` query building","summary":"

Return unsafe string injected to the query.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x)","args_html":"(x)","location":{"filename":"src/clear/expression/expression.cr","line_number":133,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/expression.cr#L133"},"def":{"name":"unsafe","args":[{"name":"x","external_name":"x","restriction":""}],"visibility":"Public","body":"Clear::Expression::UnsafeSql.new(x)"}},{"html_id":"where(&):Node-class-method","name":"where","doc":"Return a node of the expression engine\nThis node can then be combined with others node\nin case of chain request creation `where {...}.where {...}`\nthrough the chaining engine","summary":"

Return a node of the expression engine This node can then be combined with others node in case of chain request creation where {...}.where {...} through the chaining engine

","abstract":false,"location":{"filename":"src/clear/expression/expression.cr","line_number":207,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/expression.cr#L207"},"def":{"name":"where","yields":0,"block_arity":0,"return_type":"Node","visibility":"Public","body":"expression_engine = new\nensure_node!(with expression_engine yield)\n"}}],"instance_methods":[{"html_id":"not(x:Node)-instance-method","name":"not","doc":"`NOT` operator\n\nReturn an logically reversed version of the contained `Node`\n\n## Example\n\n```\nClear::Expression.where { not(a == b) }.resolve # >> \"WHERE NOT( a = b )\n```","summary":"

NOT operator

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Node"}],"args_string":"(x : Node)","args_html":"(x : Node)","location":{"filename":"src/clear/expression/expression.cr","line_number":222,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/expression.cr#L222"},"def":{"name":"not","args":[{"name":"x","external_name":"x","restriction":"Node"}],"visibility":"Public","body":"Node::Not.new(x)"}},{"html_id":"op(a:Node|AvailableLiteral,b:Node|AvailableLiteral,op:String)-instance-method","name":"op","doc":"Because many postgresql operators are not transcriptable in Crystal lang,\nthis helpers helps to write the expressions:\n\n```\nwhere { op(jsonb_field, \"something\", \"?\") } # << Return \"jsonb_field ? 'something'\"\n```\n","summary":"

Because many postgresql operators are not transcriptable in Crystal lang, this helpers helps to write the expressions:

","abstract":false,"args":[{"name":"a","external_name":"a","restriction":"Node | AvailableLiteral"},{"name":"b","external_name":"b","restriction":"Node | AvailableLiteral"},{"name":"op","external_name":"op","restriction":"String"}],"args_string":"(a : Node | AvailableLiteral, b : Node | AvailableLiteral, op : String)","args_html":"(a : Node | AvailableLiteral, b : Node | AvailableLiteral, op : String)","location":{"filename":"src/clear/expression/expression.cr","line_number":337,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/expression.cr#L337"},"def":{"name":"op","args":[{"name":"a","external_name":"a","restriction":"Node | AvailableLiteral"},{"name":"b","external_name":"b","restriction":"Node | AvailableLiteral"},{"name":"op","external_name":"op","restriction":"String"}],"visibility":"Public","body":"if a.is_a?(AvailableLiteral)\n a = Node::Literal.new(a)\nend\nif b.is_a?(AvailableLiteral)\n b = Node::Literal.new(b)\nend\nNode::DoubleOperator.new(a, b, op)\n"}},{"html_id":"raw(x:String,*args)-instance-method","name":"raw","doc":"In case the name of the variable is a reserved word (e.g. `not`, `var`, `raw`)\nor in case of a complex piece of computation impossible to express with the expression engine\n(e.g. usage of functions) you can use then raw to pass the String.\n\nBE AWARE than the String is pasted AS-IS and can lead to SQL injection if not used properly.\n\n```\nhaving { raw(\"COUNT(*)\") > 5 } # SELECT ... FROM ... HAVING COUNT(*) > 5\nwhere { raw(\"func(?, ?) = ?\", a, b, c) } # SELECT ... FROM ... WHERE function(a, b) = c\n```\n","summary":"

In case the name of the variable is a reserved word (e.g.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"String"},{"name":"args","external_name":"args","restriction":""}],"args_string":"(x : String, *args)","args_html":"(x : String, *args)","location":{"filename":"src/clear/expression/expression.cr","line_number":237,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/expression.cr#L237"},"def":{"name":"raw","args":[{"name":"x","external_name":"x","restriction":"String"},{"name":"args","external_name":"args","restriction":""}],"splat_index":1,"visibility":"Public","body":"Node::Raw.new(self.class.raw(x, *args))"}},{"html_id":"raw(__template:String,**tuple)-instance-method","name":"raw","doc":"In case the name of the variable is a reserved word (e.g. `not`, `var`, `raw`)\nor in case of a complex piece of computation impossible to express with the expression engine\n(e.g. usage of functions) you can use then raw to pass the String.\n\nBE AWARE than the String is pasted AS-IS and can lead to SQL injection if not used properly.\n\n```\nhaving { raw(\"COUNT(*)\") > 5 } # SELECT ... FROM ... HAVING COUNT(*) > 5\nwhere { raw(\"func(:a, :b) = :c\", a: a, b: b, c: c) } # SELECT ... FROM ... WHERE function(a, b) = c\n```\n","summary":"

In case the name of the variable is a reserved word (e.g.

","abstract":false,"args":[{"name":"__template","external_name":"__template","restriction":"String"}],"args_string":"(__template : String, **tuple)","args_html":"(__template : String, **tuple)","location":{"filename":"src/clear/expression/expression.cr","line_number":281,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/expression.cr#L281"},"def":{"name":"raw","args":[{"name":"__template","external_name":"__template","restriction":"String"}],"double_splat":{"name":"tuple","external_name":"tuple","restriction":""},"visibility":"Public","body":"Node::Raw.new(self.class.raw(__template, **tuple))"}},{"html_id":"var(*parts)-instance-method","name":"var","doc":"Use var to create expression of variable. Variables are columns with or without the namespace and tablename:\n\nIt escapes each part of the expression with double-quote as requested by PostgreSQL.\nThis is useful to escape SQL keywords or `.` and `\"` character in the name of a column.\n\n```\nvar(\"template1\", \"users\", \"name\") # \"template1\".\"users\".\"name\"\nvar(\"template1\", \"users.table2\", \"name\") # \"template1\".\"users.table2\".\"name\"\nvar(\"order\") # \"order\"\n```","summary":"

Use var to create expression of variable.

","abstract":false,"args":[{"name":"parts","external_name":"parts","restriction":""}],"args_string":"(*parts)","args_html":"(*parts)","location":{"filename":"src/clear/expression/expression.cr","line_number":317,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/expression.cr#L317"},"def":{"name":"var","args":[{"name":"parts","external_name":"parts","restriction":""}],"splat_index":0,"visibility":"Public","body":"_var(parts)"}}],"types":[{"html_id":"clear/Clear/Expression/AvailableLiteral","path":"Clear/Expression/AvailableLiteral.html","kind":"alias","full_name":"Clear::Expression::AvailableLiteral","name":"AvailableLiteral","abstract":false,"locations":[{"filename":"src/clear/expression/expression.cr","line_number":91,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/expression.cr#L91"}],"repository_name":"clear","program":false,"enum":false,"alias":true,"aliased":"(Bool | Clear::Expression::Literal | Float32 | Float64 | Int16 | Int32 | Int64 | Int8 | String | Symbol | Time | UInt16 | UInt32 | UInt64 | UInt8 | Nil)","aliased_html":"Bool | Clear::Expression::Literal | Float32 | Float64 | Int16 | Int32 | Int64 | Int8 | String | Symbol | Time | UInt16 | UInt32 | UInt64 | UInt8 | Nil","const":false,"namespace":{"html_id":"clear/Clear/Expression","kind":"class","full_name":"Clear::Expression","name":"Expression"}},{"html_id":"clear/Clear/Expression/JSONB","path":"Clear/Expression/JSONB.html","kind":"module","full_name":"Clear::Expression::JSONB","name":"JSONB","abstract":false,"locations":[{"filename":"src/clear/extensions/jsonb/node.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/jsonb/node.cr#L1"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Expression","kind":"class","full_name":"Clear::Expression","name":"Expression"},"types":[{"html_id":"clear/Clear/Expression/JSONB/Node","path":"Clear/Expression/JSONB/Node.html","kind":"module","full_name":"Clear::Expression::JSONB::Node","name":"Node","abstract":false,"locations":[{"filename":"src/clear/extensions/jsonb/node.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/jsonb/node.cr#L1"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"}],"namespace":{"html_id":"clear/Clear/Expression/JSONB","kind":"module","full_name":"Clear::Expression::JSONB","name":"JSONB"},"instance_methods":[{"html_id":"jsonb(key:String)-instance-method","name":"jsonb","abstract":false,"args":[{"name":"key","external_name":"key","restriction":"String"}],"args_string":"(key : String)","args_html":"(key : String)","location":{"filename":"src/clear/extensions/jsonb/node.cr","line_number":21,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/jsonb/node.cr#L21"},"def":{"name":"jsonb","args":[{"name":"key","external_name":"key","restriction":"String"}],"visibility":"Public","body":"Clear::Expression::Node::JSONB::Field.new(self, key)"}},{"html_id":"jsonb_all_keys_exists?(keys:Array(T))forallT-instance-method","name":"jsonb_all_keys_exists?","abstract":false,"args":[{"name":"keys","external_name":"keys","restriction":"Array(T)"}],"args_string":"(keys : Array(T)) forall T","args_html":"(keys : Array(T)) forall T","location":{"filename":"src/clear/extensions/jsonb/node.cr","line_number":17,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/jsonb/node.cr#L17"},"def":{"name":"jsonb_all_keys_exists?","args":[{"name":"keys","external_name":"keys","restriction":"Array(T)"}],"visibility":"Public","body":"_jsonb_keys_exists(keys, \"?&\")"}},{"html_id":"jsonb_any_key_exists?(keys:Array(T))forallT-instance-method","name":"jsonb_any_key_exists?","abstract":false,"args":[{"name":"keys","external_name":"keys","restriction":"Array(T)"}],"args_string":"(keys : Array(T)) forall T","args_html":"(keys : Array(T)) forall T","location":{"filename":"src/clear/extensions/jsonb/node.cr","line_number":13,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/jsonb/node.cr#L13"},"def":{"name":"jsonb_any_key_exists?","args":[{"name":"keys","external_name":"keys","restriction":"Array(T)"}],"visibility":"Public","body":"_jsonb_keys_exists(keys, \"?|\")"}},{"html_id":"jsonb_key_exists?(key:String)-instance-method","name":"jsonb_key_exists?","abstract":false,"args":[{"name":"key","external_name":"key","restriction":"String"}],"args_string":"(key : String)","args_html":"(key : String)","location":{"filename":"src/clear/extensions/jsonb/node.cr","line_number":2,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/jsonb/node.cr#L2"},"def":{"name":"jsonb_key_exists?","args":[{"name":"key","external_name":"key","restriction":"String"}],"visibility":"Public","body":"Clear::Expression::Node::DoubleOperator.new(self, Clear::Expression::Node::Literal.new(key), \"?\")"}}]}]},{"html_id":"clear/Clear/Expression/Literal","path":"Clear/Expression/Literal.html","kind":"module","full_name":"Clear::Expression::Literal","name":"Literal","abstract":false,"locations":[{"filename":"src/clear/expression/expression.cr","line_number":62,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/expression.cr#L62"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"clear/Clear/Enum","kind":"struct","full_name":"Clear::Enum","name":"Enum"},{"html_id":"clear/Clear/Expression/UnsafeSql","kind":"class","full_name":"Clear::Expression::UnsafeSql","name":"UnsafeSql"}],"namespace":{"html_id":"clear/Clear/Expression","kind":"class","full_name":"Clear::Expression","name":"Expression"},"doc":"Allow any type to be used into the expression engine\n by including the module Clear::Expression::Literal\n and defining the method `to_sql`.","summary":"

Allow any type to be used into the expression engine by including the module Clear::Expression::Literal and defining the method #to_sql.

","instance_methods":[{"html_id":"to_json(json:JSON::Builder)-instance-method","name":"to_json","abstract":true,"args":[{"name":"json","external_name":"json","restriction":"JSON::Builder"}],"args_string":"(json : JSON::Builder)","args_html":"(json : JSON::Builder)","location":{"filename":"src/clear/expression/expression.cr","line_number":64,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/expression.cr#L64"},"def":{"name":"to_json","args":[{"name":"json","external_name":"json","restriction":"JSON::Builder"}],"visibility":"Public","body":""}},{"html_id":"to_sql-instance-method","name":"to_sql","abstract":true,"location":{"filename":"src/clear/expression/expression.cr","line_number":63,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/expression.cr#L63"},"def":{"name":"to_sql","visibility":"Public","body":""}}]},{"html_id":"clear/Clear/Expression/Node","path":"Clear/Expression/Node.html","kind":"class","full_name":"Clear::Expression::Node","name":"Node","abstract":true,"superclass":{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"clear/Clear/Expression/JSONB/Node","kind":"module","full_name":"Clear::Expression::JSONB::Node","name":"Node"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/expression/nodes/node.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/node.cr#L4"},{"filename":"src/clear/extensions/jsonb/jsonb.cr","line_number":144,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/jsonb/jsonb.cr#L144"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"clear/Clear/Expression/JSONB/Node","kind":"module","full_name":"Clear::Expression::JSONB::Node","name":"Node"}],"subclasses":[{"html_id":"clear/Clear/Expression/Node/Between","kind":"class","full_name":"Clear::Expression::Node::Between","name":"Between"},{"html_id":"clear/Clear/Expression/Node/DoubleOperator","kind":"class","full_name":"Clear::Expression::Node::DoubleOperator","name":"DoubleOperator"},{"html_id":"clear/Clear/Expression/Node/Function","kind":"class","full_name":"Clear::Expression::Node::Function","name":"Function"},{"html_id":"clear/Clear/Expression/Node/InArray","kind":"class","full_name":"Clear::Expression::Node::InArray","name":"InArray"},{"html_id":"clear/Clear/Expression/Node/InRange","kind":"class","full_name":"Clear::Expression::Node::InRange","name":"InRange"},{"html_id":"clear/Clear/Expression/Node/InSelect","kind":"class","full_name":"Clear::Expression::Node::InSelect","name":"InSelect"},{"html_id":"clear/Clear/Expression/Node/JSONB/ArrayContains","kind":"class","full_name":"Clear::Expression::Node::JSONB::ArrayContains","name":"ArrayContains"},{"html_id":"clear/Clear/Expression/Node/JSONB/Equality","kind":"class","full_name":"Clear::Expression::Node::JSONB::Equality","name":"Equality"},{"html_id":"clear/Clear/Expression/Node/JSONB/Field","kind":"class","full_name":"Clear::Expression::Node::JSONB::Field","name":"Field"},{"html_id":"clear/Clear/Expression/Node/Literal","kind":"class","full_name":"Clear::Expression::Node::Literal","name":"Literal"},{"html_id":"clear/Clear/Expression/Node/Minus","kind":"class","full_name":"Clear::Expression::Node::Minus","name":"Minus"},{"html_id":"clear/Clear/Expression/Node/NodeArray","kind":"class","full_name":"Clear::Expression::Node::NodeArray","name":"NodeArray"},{"html_id":"clear/Clear/Expression/Node/Not","kind":"class","full_name":"Clear::Expression::Node::Not","name":"Not"},{"html_id":"clear/Clear/Expression/Node/NotBetween","kind":"class","full_name":"Clear::Expression::Node::NotBetween","name":"NotBetween"},{"html_id":"clear/Clear/Expression/Node/Null","kind":"class","full_name":"Clear::Expression::Node::Null","name":"Null"},{"html_id":"clear/Clear/Expression/Node/PGArray","kind":"class","full_name":"Clear::Expression::Node::PGArray(T)","name":"PGArray"},{"html_id":"clear/Clear/Expression/Node/Raw","kind":"class","full_name":"Clear::Expression::Node::Raw","name":"Raw"},{"html_id":"clear/Clear/Expression/Node/Variable","kind":"class","full_name":"Clear::Expression::Node::Variable","name":"Variable"}],"namespace":{"html_id":"clear/Clear/Expression","kind":"class","full_name":"Clear::Expression","name":"Expression"},"doc":"Mother class of all the rendering nodes","summary":"

Mother class of all the rendering nodes

","instance_methods":[{"html_id":"!=(any:Node):Node-instance-method","name":"!=","abstract":false,"args":[{"name":"any","external_name":"any","restriction":"Node"}],"args_string":"(any : Node) : Node","args_html":"(any : Node) : Node","location":{"filename":"src/clear/expression/nodes/node.cr","line_number":49,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/node.cr#L49"},"def":{"name":"!=","args":[{"name":"any","external_name":"any","restriction":"Node"}],"return_type":"Node","visibility":"Public","body":"Node::DoubleOperator.new(self, any, \"<>\")"}},{"html_id":"!=(some_nil:Nil):Node-instance-method","name":"!=","abstract":false,"args":[{"name":"some_nil","external_name":"some_nil","restriction":"Nil"}],"args_string":"(some_nil : Nil) : Node","args_html":"(some_nil : Nil) : Node","location":{"filename":"src/clear/expression/nodes/node.cr","line_number":49,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/node.cr#L49"},"def":{"name":"!=","args":[{"name":"some_nil","external_name":"some_nil","restriction":"Nil"}],"return_type":"Node","visibility":"Public","body":"Node::DoubleOperator.new(self, Null.new, \"IS NOT\")"}},{"html_id":"!=(any:T):NodeforallT-instance-method","name":"!=","abstract":false,"args":[{"name":"any","external_name":"any","restriction":"T"}],"args_string":"(any : T) : Node forall T","args_html":"(any : T) : Node forall T","location":{"filename":"src/clear/expression/nodes/node.cr","line_number":49,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/node.cr#L49"},"def":{"name":"!=","args":[{"name":"any","external_name":"any","restriction":"T"}],"return_type":"Node","visibility":"Public","body":"Node::DoubleOperator.new(self, Literal.new(any), \"<>\")"}},{"html_id":"!~(any:Node):Node-instance-method","name":"!~","abstract":false,"args":[{"name":"any","external_name":"any","restriction":"Node"}],"args_string":"(any : Node) : Node","args_html":"(any : Node) : Node","location":{"filename":"src/clear/expression/nodes/node.cr","line_number":29,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/node.cr#L29"},"def":{"name":"!~","args":[{"name":"any","external_name":"any","restriction":"Node"}],"return_type":"Node","visibility":"Public","body":"Node::DoubleOperator.new(self, any, \"!~\")"}},{"html_id":"!~(regexp:Regex):Node-instance-method","name":"!~","abstract":false,"args":[{"name":"regexp","external_name":"regexp","restriction":"Regex"}],"args_string":"(regexp : Regex) : Node","args_html":"(regexp : Regex) : Node","location":{"filename":"src/clear/expression/nodes/node.cr","line_number":41,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/node.cr#L41"},"def":{"name":"!~","args":[{"name":"regexp","external_name":"regexp","restriction":"Regex"}],"return_type":"Node","visibility":"Public","body":"if regexp.options.ignore_case?\n Node::DoubleOperator.new(self, Literal.new(regexp.source), \"!~*\")\nelse\n Node::DoubleOperator.new(self, Literal.new(regexp.source), \"!~\")\nend"}},{"html_id":"&(any:Node):Node-instance-method","name":"&","abstract":false,"args":[{"name":"any","external_name":"any","restriction":"Node"}],"args_string":"(any : Node) : Node","args_html":"(any : Node) : Node","location":{"filename":"src/clear/expression/nodes/node.cr","line_number":53,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/node.cr#L53"},"def":{"name":"&","args":[{"name":"any","external_name":"any","restriction":"Node"}],"return_type":"Node","visibility":"Public","body":"Node::DoubleOperator.new(self, any, \"AND\")"}},{"html_id":"&(any:T):NodeforallT-instance-method","name":"&","abstract":false,"args":[{"name":"any","external_name":"any","restriction":"T"}],"args_string":"(any : T) : Node forall T","args_html":"(any : T) : Node forall T","location":{"filename":"src/clear/expression/nodes/node.cr","line_number":53,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/node.cr#L53"},"def":{"name":"&","args":[{"name":"any","external_name":"any","restriction":"T"}],"return_type":"Node","visibility":"Public","body":"Node::DoubleOperator.new(self, Literal.new(any), \"AND\")"}},{"html_id":"*(any:Node):Node-instance-method","name":"*","abstract":false,"args":[{"name":"any","external_name":"any","restriction":"Node"}],"args_string":"(any : Node) : Node","args_html":"(any : Node) : Node","def":{"name":"*","args":[{"name":"any","external_name":"any","restriction":"Node"}],"return_type":"Node","visibility":"Public","body":"Node::DoubleOperator.new(self, any, \"*\")"}},{"html_id":"*(any:T):NodeforallT-instance-method","name":"*","abstract":false,"args":[{"name":"any","external_name":"any","restriction":"T"}],"args_string":"(any : T) : Node forall T","args_html":"(any : T) : Node forall T","def":{"name":"*","args":[{"name":"any","external_name":"any","restriction":"T"}],"return_type":"Node","visibility":"Public","body":"Node::DoubleOperator.new(self, Literal.new(any), \"*\")"}},{"html_id":"+(any:Node):Node-instance-method","name":"+","abstract":false,"args":[{"name":"any","external_name":"any","restriction":"Node"}],"args_string":"(any : Node) : Node","args_html":"(any : Node) : Node","def":{"name":"+","args":[{"name":"any","external_name":"any","restriction":"Node"}],"return_type":"Node","visibility":"Public","body":"Node::DoubleOperator.new(self, any, \"+\")"}},{"html_id":"+(any:T):NodeforallT-instance-method","name":"+","abstract":false,"args":[{"name":"any","external_name":"any","restriction":"T"}],"args_string":"(any : T) : Node forall T","args_html":"(any : T) : Node forall T","def":{"name":"+","args":[{"name":"any","external_name":"any","restriction":"T"}],"return_type":"Node","visibility":"Public","body":"Node::DoubleOperator.new(self, Literal.new(any), \"+\")"}},{"html_id":"-(any:Node):Node-instance-method","name":"-","abstract":false,"args":[{"name":"any","external_name":"any","restriction":"Node"}],"args_string":"(any : Node) : Node","args_html":"(any : Node) : Node","def":{"name":"-","args":[{"name":"any","external_name":"any","restriction":"Node"}],"return_type":"Node","visibility":"Public","body":"Node::DoubleOperator.new(self, any, \"-\")"}},{"html_id":"-(any:T):NodeforallT-instance-method","name":"-","abstract":false,"args":[{"name":"any","external_name":"any","restriction":"T"}],"args_string":"(any : T) : Node forall T","args_html":"(any : T) : Node forall T","def":{"name":"-","args":[{"name":"any","external_name":"any","restriction":"T"}],"return_type":"Node","visibility":"Public","body":"Node::DoubleOperator.new(self, Literal.new(any), \"-\")"}},{"html_id":"--instance-method","name":"-","abstract":false,"location":{"filename":"src/clear/expression/nodes/node.cr","line_number":78,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/node.cr#L78"},"def":{"name":"-","visibility":"Public","body":"Node::Minus.new(self)"}},{"html_id":"/(any:Node):Node-instance-method","name":"/","abstract":false,"args":[{"name":"any","external_name":"any","restriction":"Node"}],"args_string":"(any : Node) : Node","args_html":"(any : Node) : Node","def":{"name":"/","args":[{"name":"any","external_name":"any","restriction":"Node"}],"return_type":"Node","visibility":"Public","body":"Node::DoubleOperator.new(self, any, \"/\")"}},{"html_id":"/(any:T):NodeforallT-instance-method","name":"/","abstract":false,"args":[{"name":"any","external_name":"any","restriction":"T"}],"args_string":"(any : T) : Node forall T","args_html":"(any : T) : Node forall T","def":{"name":"/","args":[{"name":"any","external_name":"any","restriction":"T"}],"return_type":"Node","visibility":"Public","body":"Node::DoubleOperator.new(self, Literal.new(any), \"/\")"}},{"html_id":"<(any:Node):Node-instance-method","name":"<","abstract":false,"args":[{"name":"any","external_name":"any","restriction":"Node"}],"args_string":"(any : Node) : Node","args_html":"(any : Node) : Node","def":{"name":"<","args":[{"name":"any","external_name":"any","restriction":"Node"}],"return_type":"Node","visibility":"Public","body":"Node::DoubleOperator.new(self, any, \"<\")"}},{"html_id":"<(any:T):NodeforallT-instance-method","name":"<","abstract":false,"args":[{"name":"any","external_name":"any","restriction":"T"}],"args_string":"(any : T) : Node forall T","args_html":"(any : T) : Node forall T","def":{"name":"<","args":[{"name":"any","external_name":"any","restriction":"T"}],"return_type":"Node","visibility":"Public","body":"Node::DoubleOperator.new(self, Literal.new(any), \"<\")"}},{"html_id":"<=(any:Node):Node-instance-method","name":"<=","abstract":false,"args":[{"name":"any","external_name":"any","restriction":"Node"}],"args_string":"(any : Node) : Node","args_html":"(any : Node) : Node","def":{"name":"<=","args":[{"name":"any","external_name":"any","restriction":"Node"}],"return_type":"Node","visibility":"Public","body":"Node::DoubleOperator.new(self, any, \"<=\")"}},{"html_id":"<=(any:T):NodeforallT-instance-method","name":"<=","abstract":false,"args":[{"name":"any","external_name":"any","restriction":"T"}],"args_string":"(any : T) : Node forall T","args_html":"(any : T) : Node forall T","def":{"name":"<=","args":[{"name":"any","external_name":"any","restriction":"T"}],"return_type":"Node","visibility":"Public","body":"Node::DoubleOperator.new(self, Literal.new(any), \"<=\")"}},{"html_id":"==(any:Node):Node-instance-method","name":"==","abstract":false,"args":[{"name":"any","external_name":"any","restriction":"Node"}],"args_string":"(any : Node) : Node","args_html":"(any : Node) : Node","location":{"filename":"src/clear/expression/nodes/node.cr","line_number":50,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/node.cr#L50"},"def":{"name":"==","args":[{"name":"any","external_name":"any","restriction":"Node"}],"return_type":"Node","visibility":"Public","body":"Node::DoubleOperator.new(self, any, \"=\")"}},{"html_id":"==(some_nil:Nil):Node-instance-method","name":"==","abstract":false,"args":[{"name":"some_nil","external_name":"some_nil","restriction":"Nil"}],"args_string":"(some_nil : Nil) : Node","args_html":"(some_nil : Nil) : Node","location":{"filename":"src/clear/expression/nodes/node.cr","line_number":50,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/node.cr#L50"},"def":{"name":"==","args":[{"name":"some_nil","external_name":"some_nil","restriction":"Nil"}],"return_type":"Node","visibility":"Public","body":"Node::DoubleOperator.new(self, Null.new, \"IS\")"}},{"html_id":"==(any:T):NodeforallT-instance-method","name":"==","abstract":false,"args":[{"name":"any","external_name":"any","restriction":"T"}],"args_string":"(any : T) : Node forall T","args_html":"(any : T) : Node forall T","location":{"filename":"src/clear/expression/nodes/node.cr","line_number":50,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/node.cr#L50"},"def":{"name":"==","args":[{"name":"any","external_name":"any","restriction":"T"}],"return_type":"Node","visibility":"Public","body":"Node::DoubleOperator.new(self, Literal.new(any), \"=\")"}},{"html_id":"=~(any:Node):Node-instance-method","name":"=~","abstract":false,"args":[{"name":"any","external_name":"any","restriction":"Node"}],"args_string":"(any : Node) : Node","args_html":"(any : Node) : Node","location":{"filename":"src/clear/expression/nodes/node.cr","line_number":25,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/node.cr#L25"},"def":{"name":"=~","args":[{"name":"any","external_name":"any","restriction":"Node"}],"return_type":"Node","visibility":"Public","body":"Node::DoubleOperator.new(self, any, \"~\")"}},{"html_id":"=~(regexp:Regex):Node-instance-method","name":"=~","abstract":false,"args":[{"name":"regexp","external_name":"regexp","restriction":"Regex"}],"args_string":"(regexp : Regex) : Node","args_html":"(regexp : Regex) : Node","location":{"filename":"src/clear/expression/nodes/node.cr","line_number":33,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/node.cr#L33"},"def":{"name":"=~","args":[{"name":"regexp","external_name":"regexp","restriction":"Regex"}],"return_type":"Node","visibility":"Public","body":"if regexp.options.ignore_case?\n Node::DoubleOperator.new(self, Literal.new(regexp.source), \"~*\")\nelse\n Node::DoubleOperator.new(self, Literal.new(regexp.source), \"~\")\nend"}},{"html_id":">(any:Node):Node-instance-method","name":">","abstract":false,"args":[{"name":"any","external_name":"any","restriction":"Node"}],"args_string":"(any : Node) : Node","args_html":"(any : Node) : Node","def":{"name":">","args":[{"name":"any","external_name":"any","restriction":"Node"}],"return_type":"Node","visibility":"Public","body":"Node::DoubleOperator.new(self, any, \">\")"}},{"html_id":">(any:T):NodeforallT-instance-method","name":">","abstract":false,"args":[{"name":"any","external_name":"any","restriction":"T"}],"args_string":"(any : T) : Node forall T","args_html":"(any : T) : Node forall T","def":{"name":">","args":[{"name":"any","external_name":"any","restriction":"T"}],"return_type":"Node","visibility":"Public","body":"Node::DoubleOperator.new(self, Literal.new(any), \">\")"}},{"html_id":">=(any:Node):Node-instance-method","name":">=","abstract":false,"args":[{"name":"any","external_name":"any","restriction":"Node"}],"args_string":"(any : Node) : Node","args_html":"(any : Node) : Node","def":{"name":">=","args":[{"name":"any","external_name":"any","restriction":"Node"}],"return_type":"Node","visibility":"Public","body":"Node::DoubleOperator.new(self, any, \">=\")"}},{"html_id":">=(any:T):NodeforallT-instance-method","name":">=","abstract":false,"args":[{"name":"any","external_name":"any","restriction":"T"}],"args_string":"(any : T) : Node forall T","args_html":"(any : T) : Node forall T","def":{"name":">=","args":[{"name":"any","external_name":"any","restriction":"T"}],"return_type":"Node","visibility":"Public","body":"Node::DoubleOperator.new(self, Literal.new(any), \">=\")"}},{"html_id":"|(any:Node):Node-instance-method","name":"|","abstract":false,"args":[{"name":"any","external_name":"any","restriction":"Node"}],"args_string":"(any : Node) : Node","args_html":"(any : Node) : Node","location":{"filename":"src/clear/expression/nodes/node.cr","line_number":54,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/node.cr#L54"},"def":{"name":"|","args":[{"name":"any","external_name":"any","restriction":"Node"}],"return_type":"Node","visibility":"Public","body":"Node::DoubleOperator.new(self, any, \"OR\")"}},{"html_id":"|(any:T):NodeforallT-instance-method","name":"|","abstract":false,"args":[{"name":"any","external_name":"any","restriction":"T"}],"args_string":"(any : T) : Node forall T","args_html":"(any : T) : Node forall T","location":{"filename":"src/clear/expression/nodes/node.cr","line_number":54,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/node.cr#L54"},"def":{"name":"|","args":[{"name":"any","external_name":"any","restriction":"T"}],"return_type":"Node","visibility":"Public","body":"Node::DoubleOperator.new(self, Literal.new(any), \"OR\")"}},{"html_id":"~-instance-method","name":"~","abstract":false,"location":{"filename":"src/clear/expression/nodes/node.cr","line_number":82,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/node.cr#L82"},"def":{"name":"~","visibility":"Public","body":"Node::Not.new(self)"}},{"html_id":"between(a,b)-instance-method","name":"between","abstract":false,"args":[{"name":"a","external_name":"a","restriction":""},{"name":"b","external_name":"b","restriction":""}],"args_string":"(a, b)","args_html":"(a, b)","location":{"filename":"src/clear/expression/nodes/node.cr","line_number":74,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/node.cr#L74"},"def":{"name":"between","args":[{"name":"a","external_name":"a","restriction":""},{"name":"b","external_name":"b","restriction":""}],"visibility":"Public","body":"Node::Between.new(self, a, b)"}},{"html_id":"ilike(any:Node):Node-instance-method","name":"ilike","abstract":false,"args":[{"name":"any","external_name":"any","restriction":"Node"}],"args_string":"(any : Node) : Node","args_html":"(any : Node) : Node","location":{"filename":"src/clear/expression/nodes/node.cr","line_number":52,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/node.cr#L52"},"def":{"name":"ilike","args":[{"name":"any","external_name":"any","restriction":"Node"}],"return_type":"Node","visibility":"Public","body":"Node::DoubleOperator.new(self, any, \"ILIKE\")"}},{"html_id":"ilike(any:T):NodeforallT-instance-method","name":"ilike","abstract":false,"args":[{"name":"any","external_name":"any","restriction":"T"}],"args_string":"(any : T) : Node forall T","args_html":"(any : T) : Node forall T","location":{"filename":"src/clear/expression/nodes/node.cr","line_number":52,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/node.cr#L52"},"def":{"name":"ilike","args":[{"name":"any","external_name":"any","restriction":"T"}],"return_type":"Node","visibility":"Public","body":"Node::DoubleOperator.new(self, Literal.new(any), \"ILIKE\")"}},{"html_id":"in?(range:Range(B,E))forallB,E-instance-method","name":"in?","abstract":false,"args":[{"name":"range","external_name":"range","restriction":"Range(B, E)"}],"args_string":"(range : Range(B, E)) forall B, E","args_html":"(range : Range(B, E)) forall B, E","location":{"filename":"src/clear/expression/nodes/node.cr","line_number":56,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/node.cr#L56"},"def":{"name":"in?","args":[{"name":"range","external_name":"range","restriction":"Range(B, E)"}],"visibility":"Public","body":"Node::InRange.new(self, Clear::Expression[range.begin]..Clear::Expression[range.end], range.exclusive?)"}},{"html_id":"in?(arr:Array(T))forallT-instance-method","name":"in?","abstract":false,"args":[{"name":"arr","external_name":"arr","restriction":"Array(T)"}],"args_string":"(arr : Array(T)) forall T","args_html":"(arr : Array(T)) forall T","location":{"filename":"src/clear/expression/nodes/node.cr","line_number":62,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/node.cr#L62"},"def":{"name":"in?","args":[{"name":"arr","external_name":"arr","restriction":"Array(T)"}],"visibility":"Public","body":"Node::InArray.new(self, arr.map do |x|\n Clear::Expression[x]\nend)"}},{"html_id":"in?(tuple:Tuple(*T))forallT-instance-method","name":"in?","abstract":false,"args":[{"name":"tuple","external_name":"tuple","restriction":"Tuple(*T)"}],"args_string":"(tuple : Tuple(*T)) forall T","args_html":"(tuple : Tuple(*T)) forall T","location":{"filename":"src/clear/expression/nodes/node.cr","line_number":66,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/node.cr#L66"},"def":{"name":"in?","args":[{"name":"tuple","external_name":"tuple","restriction":"Tuple(*T)"}],"visibility":"Public","body":"in?(tuple.to_a)"}},{"html_id":"in?(request:Clear::SQL::SelectBuilder)-instance-method","name":"in?","abstract":false,"args":[{"name":"request","external_name":"request","restriction":"::Clear::SQL::SelectBuilder"}],"args_string":"(request : Clear::SQL::SelectBuilder)","args_html":"(request : Clear::SQL::SelectBuilder)","location":{"filename":"src/clear/expression/nodes/node.cr","line_number":70,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/node.cr#L70"},"def":{"name":"in?","args":[{"name":"request","external_name":"request","restriction":"::Clear::SQL::SelectBuilder"}],"visibility":"Public","body":"Node::InSelect.new(self, request)"}},{"html_id":"like(any:Node):Node-instance-method","name":"like","abstract":false,"args":[{"name":"any","external_name":"any","restriction":"Node"}],"args_string":"(any : Node) : Node","args_html":"(any : Node) : Node","location":{"filename":"src/clear/expression/nodes/node.cr","line_number":51,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/node.cr#L51"},"def":{"name":"like","args":[{"name":"any","external_name":"any","restriction":"Node"}],"return_type":"Node","visibility":"Public","body":"Node::DoubleOperator.new(self, any, \"LIKE\")"}},{"html_id":"like(any:T):NodeforallT-instance-method","name":"like","abstract":false,"args":[{"name":"any","external_name":"any","restriction":"T"}],"args_string":"(any : T) : Node forall T","args_html":"(any : T) : Node forall T","location":{"filename":"src/clear/expression/nodes/node.cr","line_number":51,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/node.cr#L51"},"def":{"name":"like","args":[{"name":"any","external_name":"any","restriction":"T"}],"return_type":"Node","visibility":"Public","body":"Node::DoubleOperator.new(self, Literal.new(any), \"LIKE\")"}},{"html_id":"resolve:String-instance-method","name":"resolve","abstract":true,"location":{"filename":"src/clear/expression/nodes/node.cr","line_number":86,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/node.cr#L86"},"def":{"name":"resolve","return_type":"String","visibility":"Public","body":""}}],"macros":[{"html_id":"define_operator(op_name,sql_name,null=false)-macro","name":"define_operator","abstract":false,"args":[{"name":"op_name","external_name":"op_name","restriction":""},{"name":"sql_name","external_name":"sql_name","restriction":""},{"name":"null","default_value":"false","external_name":"null","restriction":""}],"args_string":"(op_name, sql_name, null = false)","args_html":"(op_name, sql_name, null = false)","location":{"filename":"src/clear/expression/nodes/node.cr","line_number":5,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/node.cr#L5"},"def":{"name":"define_operator","args":[{"name":"op_name","external_name":"op_name","restriction":""},{"name":"sql_name","external_name":"sql_name","restriction":""},{"name":"null","default_value":"false","external_name":"null","restriction":""}],"visibility":"Public","body":" def \n{{ op_name.id }}\n(any : Node) : Node\n Node::DoubleOperator.new(self, any, \"\n{{ sql_name.id }}\n\")\n \nend\n\n \n{% if null %}\n def {{ op_name.id }}(some_nil : Nil) : Node\n Node::DoubleOperator.new(self, Null.new, {{ null }} )\n end\n {% end %}\n\n\n def \n{{ op_name.id }}\n(any : T) : Node forall T\n Node::DoubleOperator.new(self, Literal.new(any), \"\n{{ sql_name.id }}\n\")\n \nend\n \n"}}],"types":[{"html_id":"clear/Clear/Expression/Node/Between","path":"Clear/Expression/Node/Between.html","kind":"class","full_name":"Clear::Expression::Node::Between","name":"Between","abstract":false,"superclass":{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},"ancestors":[{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},{"html_id":"clear/Clear/Expression/JSONB/Node","kind":"module","full_name":"Clear::Expression::JSONB::Node","name":"Node"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/expression/nodes/between.cr","line_number":5,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/between.cr#L5"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},"doc":"A node managing the rendering of `(var BETWEEN a AND b)`\nexpressions.","summary":"

A node managing the rendering of (var BETWEEN a AND b) expressions.

","constructors":[{"html_id":"new(target:Node,starts:BetweenType,ends:BetweenType)-class-method","name":"new","abstract":false,"args":[{"name":"target","external_name":"target","restriction":"Node"},{"name":"starts","external_name":"starts","restriction":"BetweenType"},{"name":"ends","external_name":"ends","restriction":"BetweenType"}],"args_string":"(target : Node, starts : BetweenType, ends : BetweenType)","args_html":"(target : Node, starts : BetweenType, ends : BetweenType)","location":{"filename":"src/clear/expression/nodes/between.cr","line_number":8,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/between.cr#L8"},"def":{"name":"new","args":[{"name":"target","external_name":"target","restriction":"Node"},{"name":"starts","external_name":"starts","restriction":"BetweenType"},{"name":"ends","external_name":"ends","restriction":"BetweenType"}],"visibility":"Public","body":"_ = allocate\n_.initialize(target, starts, ends)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"resolve:String-instance-method","name":"resolve","abstract":false,"location":{"filename":"src/clear/expression/nodes/between.cr","line_number":11,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/between.cr#L11"},"def":{"name":"resolve","return_type":"String","visibility":"Public","body":"{\"(\", @target.resolve, \" BETWEEN \", Clear::Expression.safe_literal(@starts), \" AND \", Clear::Expression.safe_literal(@ends), \")\"}.join"}}],"types":[{"html_id":"clear/Clear/Expression/Node/Between/BetweenType","path":"Clear/Expression/Node/Between/BetweenType.html","kind":"alias","full_name":"Clear::Expression::Node::Between::BetweenType","name":"BetweenType","abstract":false,"locations":[{"filename":"src/clear/expression/nodes/between.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/between.cr#L6"}],"repository_name":"clear","program":false,"enum":false,"alias":true,"aliased":"(Clear::Expression::Node | Float32 | Float64 | Int32 | Int64 | String | Time)","aliased_html":"Clear::Expression::Node | Float32 | Float64 | Int32 | Int64 | String | Time","const":false,"namespace":{"html_id":"clear/Clear/Expression/Node/Between","kind":"class","full_name":"Clear::Expression::Node::Between","name":"Between"}}]},{"html_id":"clear/Clear/Expression/Node/DoubleOperator","path":"Clear/Expression/Node/DoubleOperator.html","kind":"class","full_name":"Clear::Expression::Node::DoubleOperator","name":"DoubleOperator","abstract":false,"superclass":{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},"ancestors":[{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},{"html_id":"clear/Clear/Expression/JSONB/Node","kind":"module","full_name":"Clear::Expression::JSONB::Node","name":"Node"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/expression/nodes/double_operator.cr","line_number":5,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/double_operator.cr#L5"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},"doc":"A node managing the rendering of\ncombination operations like ` `","summary":"

A node managing the rendering of combination operations like <val1> <op> <val2>

","constructors":[{"html_id":"new(a:Node,b:Node,op:String)-class-method","name":"new","abstract":false,"args":[{"name":"a","external_name":"a","restriction":"Node"},{"name":"b","external_name":"b","restriction":"Node"},{"name":"op","external_name":"op","restriction":"String"}],"args_string":"(a : Node, b : Node, op : String)","args_html":"(a : Node, b : Node, op : String)","location":{"filename":"src/clear/expression/nodes/double_operator.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/double_operator.cr#L6"},"def":{"name":"new","args":[{"name":"a","external_name":"a","restriction":"Node"},{"name":"b","external_name":"b","restriction":"Node"},{"name":"op","external_name":"op","restriction":"String"}],"visibility":"Public","body":"_ = allocate\n_.initialize(a, b, op)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"resolve:String-instance-method","name":"resolve","abstract":false,"location":{"filename":"src/clear/expression/nodes/double_operator.cr","line_number":8,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/double_operator.cr#L8"},"def":{"name":"resolve","return_type":"String","visibility":"Public","body":"{\"(\", @a.resolve, \" \", @op, \" \", @b.resolve, \")\"}.join"}}]},{"html_id":"clear/Clear/Expression/Node/Function","path":"Clear/Expression/Node/Function.html","kind":"class","full_name":"Clear::Expression::Node::Function","name":"Function","abstract":false,"superclass":{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},"ancestors":[{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},{"html_id":"clear/Clear/Expression/JSONB/Node","kind":"module","full_name":"Clear::Expression::JSONB::Node","name":"Node"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/expression/nodes/function.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/function.cr#L4"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},"doc":"A node managing the rendering of functions in Postgres.","summary":"

A node managing the rendering of functions in Postgres.

","constructors":[{"html_id":"new(name:String,args:Array(String))-class-method","name":"new","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"String"},{"name":"args","external_name":"args","restriction":"Array(String)"}],"args_string":"(name : String, args : Array(String))","args_html":"(name : String, args : Array(String))","location":{"filename":"src/clear/expression/nodes/function.cr","line_number":5,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/function.cr#L5"},"def":{"name":"new","args":[{"name":"name","external_name":"name","restriction":"String"},{"name":"args","external_name":"args","restriction":"Array(String)"}],"visibility":"Public","body":"_ = allocate\n_.initialize(name, args)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"resolve:String-instance-method","name":"resolve","abstract":false,"location":{"filename":"src/clear/expression/nodes/function.cr","line_number":7,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/function.cr#L7"},"def":{"name":"resolve","return_type":"String","visibility":"Public","body":"{@name, \"(\", @args.join(\", \"), \")\"}.join"}}]},{"html_id":"clear/Clear/Expression/Node/InArray","path":"Clear/Expression/Node/InArray.html","kind":"class","full_name":"Clear::Expression::Node::InArray","name":"InArray","abstract":false,"superclass":{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},"ancestors":[{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},{"html_id":"clear/Clear/Expression/JSONB/Node","kind":"module","full_name":"Clear::Expression::JSONB::Node","name":"Node"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/expression/nodes/in_array.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/in_array.cr#L6"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},"doc":"A node managing the rendering of array in Postgres.\n- It renders `val IN (...)`.\n- If the array passed as argument is empty, it renders `FALSE` instead.","summary":"

A node managing the rendering of array in Postgres.

","constructors":[{"html_id":"new(target:Node,array:Array(String))-class-method","name":"new","abstract":false,"args":[{"name":"target","external_name":"target","restriction":"Node"},{"name":"array","external_name":"array","restriction":"Array(String)"}],"args_string":"(target : Node, array : Array(String))","args_html":"(target : Node, array : Array(String))","location":{"filename":"src/clear/expression/nodes/in_array.cr","line_number":7,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/in_array.cr#L7"},"def":{"name":"new","args":[{"name":"target","external_name":"target","restriction":"Node"},{"name":"array","external_name":"array","restriction":"Array(String)"}],"visibility":"Public","body":"_ = allocate\n_.initialize(target, array)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"resolve:String-instance-method","name":"resolve","abstract":false,"location":{"filename":"src/clear/expression/nodes/in_array.cr","line_number":9,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/in_array.cr#L9"},"def":{"name":"resolve","return_type":"String","visibility":"Public","body":"if @array.size == 0\n \"FALSE\"\nelse\n {@target.resolve, \" IN (\", @array.join(\", \"), \")\"}.join\nend"}}]},{"html_id":"clear/Clear/Expression/Node/InRange","path":"Clear/Expression/Node/InRange.html","kind":"class","full_name":"Clear::Expression::Node::InRange","name":"InRange","abstract":false,"superclass":{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},"ancestors":[{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},{"html_id":"clear/Clear/Expression/JSONB/Node","kind":"module","full_name":"Clear::Expression::JSONB::Node","name":"Node"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/expression/nodes/in_range.cr","line_number":19,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/in_range.cr#L19"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},"doc":"A node managing the rendering a range in Postgres.\n\nExample:\n\n```\nvalue.in?(1..5)\n```\n\nwill render:\n\n```\nvalue >= 1 AND value < 5\n```\n\nInclusion and exclusion of the last number of the range is featured\n","summary":"

A node managing the rendering a range in Postgres.

","constructors":[{"html_id":"new(target:Node,range:Range(String,String),exclusive:Bool=false)-class-method","name":"new","abstract":false,"args":[{"name":"target","external_name":"target","restriction":"Node"},{"name":"range","external_name":"range","restriction":"Range(String, String)"},{"name":"exclusive","default_value":"false","external_name":"exclusive","restriction":"::Bool"}],"args_string":"(target : Node, range : Range(String, String), exclusive : Bool = false)","args_html":"(target : Node, range : Range(String, String), exclusive : Bool = false)","location":{"filename":"src/clear/expression/nodes/in_range.cr","line_number":20,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/in_range.cr#L20"},"def":{"name":"new","args":[{"name":"target","external_name":"target","restriction":"Node"},{"name":"range","external_name":"range","restriction":"Range(String, String)"},{"name":"exclusive","default_value":"false","external_name":"exclusive","restriction":"::Bool"}],"visibility":"Public","body":"_ = allocate\n_.initialize(target, range, exclusive)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"resolve:String-instance-method","name":"resolve","abstract":false,"location":{"filename":"src/clear/expression/nodes/in_range.cr","line_number":22,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/in_range.cr#L22"},"def":{"name":"resolve","return_type":"String","visibility":"Public","body":"rt = @target.resolve\nfinal_op = @exclusive ? \" < \" : \" <= \"\n{\"(\", rt, \" >= \", @range.begin, \" AND \", rt, final_op, @range.end, \")\"}.join\n"}}]},{"html_id":"clear/Clear/Expression/Node/InSelect","path":"Clear/Expression/Node/InSelect.html","kind":"class","full_name":"Clear::Expression::Node::InSelect","name":"InSelect","abstract":false,"superclass":{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},"ancestors":[{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},{"html_id":"clear/Clear/Expression/JSONB/Node","kind":"module","full_name":"Clear::Expression::JSONB::Node","name":"Node"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/expression/nodes/in_select.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/in_select.cr#L4"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},"doc":" A node managing the rendering of `value IN ( )`","summary":"

A node managing the rendering of value IN ( <SUBQUERY> )

","constructors":[{"html_id":"new(target:Node,select__arg0:Clear::SQL::SelectBuilder)-class-method","name":"new","abstract":false,"args":[{"name":"target","external_name":"target","restriction":"Node"},{"name":"__arg0","external_name":"select","restriction":"Clear::SQL::SelectBuilder"}],"args_string":"(target : Node, select __arg0 : Clear::SQL::SelectBuilder)","args_html":"(target : Node, select __arg0 : Clear::SQL::SelectBuilder)","location":{"filename":"src/clear/expression/nodes/in_select.cr","line_number":5,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/in_select.cr#L5"},"def":{"name":"new","args":[{"name":"target","external_name":"target","restriction":"Node"},{"name":"__arg0","external_name":"select","restriction":"Clear::SQL::SelectBuilder"}],"visibility":"Public","body":"_ = allocate\n_.initialize(target, __arg0)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"resolve:String-instance-method","name":"resolve","abstract":false,"location":{"filename":"src/clear/expression/nodes/in_select.cr","line_number":7,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/in_select.cr#L7"},"def":{"name":"resolve","return_type":"String","visibility":"Public","body":"{@target.resolve, \" IN (\", @select.to_sql, \")\"}.join"}}]},{"html_id":"clear/Clear/Expression/Node/JSONB","path":"Clear/Expression/Node/JSONB.html","kind":"module","full_name":"Clear::Expression::Node::JSONB","name":"JSONB","abstract":false,"locations":[{"filename":"src/clear/extensions/jsonb/expression.cr","line_number":3,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/jsonb/expression.cr#L3"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},"types":[{"html_id":"clear/Clear/Expression/Node/JSONB/ArrayContains","path":"Clear/Expression/Node/JSONB/ArrayContains.html","kind":"class","full_name":"Clear::Expression::Node::JSONB::ArrayContains","name":"ArrayContains","abstract":false,"superclass":{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},"ancestors":[{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},{"html_id":"clear/Clear/Expression/JSONB/Node","kind":"module","full_name":"Clear::Expression::JSONB::Node","name":"Node"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/extensions/jsonb/expression.cr","line_number":58,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/jsonb/expression.cr#L58"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Expression/Node/JSONB","kind":"module","full_name":"Clear::Expression::Node::JSONB","name":"JSONB"},"doc":"Define a __array contains? (?)__ operation between a jsonb column and a json hash","summary":"

Define a array contains? (?) operation between a jsonb column and a json hash

","constructors":[{"html_id":"new(jsonb_field:String,value:String)-class-method","name":"new","abstract":false,"args":[{"name":"jsonb_field","external_name":"jsonb_field","restriction":"::String"},{"name":"value","external_name":"value","restriction":"::String"}],"args_string":"(jsonb_field : String, value : String)","args_html":"(jsonb_field : String, value : String)","location":{"filename":"src/clear/extensions/jsonb/expression.cr","line_number":62,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/jsonb/expression.cr#L62"},"def":{"name":"new","args":[{"name":"jsonb_field","external_name":"jsonb_field","restriction":"::String"},{"name":"value","external_name":"value","restriction":"::String"}],"visibility":"Public","body":"_ = allocate\n_.initialize(jsonb_field, value)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"jsonb_field:String-instance-method","name":"jsonb_field","abstract":false,"location":{"filename":"src/clear/extensions/jsonb/expression.cr","line_number":59,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/jsonb/expression.cr#L59"},"def":{"name":"jsonb_field","return_type":"String","visibility":"Public","body":"@jsonb_field"}},{"html_id":"resolve:String-instance-method","name":"resolve","abstract":false,"location":{"filename":"src/clear/extensions/jsonb/expression.cr","line_number":65,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/jsonb/expression.cr#L65"},"def":{"name":"resolve","return_type":"String","visibility":"Public","body":"{@jsonb_field, @value}.join(\" ? \")"}},{"html_id":"value:String-instance-method","name":"value","abstract":false,"location":{"filename":"src/clear/extensions/jsonb/expression.cr","line_number":60,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/jsonb/expression.cr#L60"},"def":{"name":"value","return_type":"String","visibility":"Public","body":"@value"}}]},{"html_id":"clear/Clear/Expression/Node/JSONB/Equality","path":"Clear/Expression/Node/JSONB/Equality.html","kind":"class","full_name":"Clear::Expression::Node::JSONB::Equality","name":"Equality","abstract":false,"superclass":{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},"ancestors":[{"html_id":"clear/Clear/SQL/JSONB","kind":"module","full_name":"Clear::SQL::JSONB","name":"JSONB"},{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},{"html_id":"clear/Clear/Expression/JSONB/Node","kind":"module","full_name":"Clear::Expression::JSONB::Node","name":"Node"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/extensions/jsonb/expression.cr","line_number":43,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/jsonb/expression.cr#L43"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"clear/Clear/SQL/JSONB","kind":"module","full_name":"Clear::SQL::JSONB","name":"JSONB"}],"namespace":{"html_id":"clear/Clear/Expression/Node/JSONB","kind":"module","full_name":"Clear::Expression::Node::JSONB","name":"JSONB"},"doc":"Define a __value match? (@>)__ operation between a jsonb column and a json hash","summary":"

Define a value match? (@>) operation between a jsonb column and a json hash

","constructors":[{"html_id":"new(jsonb_field:String,value:Hash(String,Clear::SQL::JSONB::JSONBKey))-class-method","name":"new","abstract":false,"args":[{"name":"jsonb_field","external_name":"jsonb_field","restriction":"::String"},{"name":"value","external_name":"value","restriction":"::Hash(::String, ::Clear::SQL::JSONB::JSONBKey)"}],"args_string":"(jsonb_field : String, value : Hash(String, Clear::SQL::JSONB::JSONBKey))","args_html":"(jsonb_field : String, value : Hash(String, Clear::SQL::JSONB::JSONBKey))","location":{"filename":"src/clear/extensions/jsonb/expression.cr","line_number":49,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/jsonb/expression.cr#L49"},"def":{"name":"new","args":[{"name":"jsonb_field","external_name":"jsonb_field","restriction":"::String"},{"name":"value","external_name":"value","restriction":"::Hash(::String, ::Clear::SQL::JSONB::JSONBKey)"}],"visibility":"Public","body":"_ = allocate\n_.initialize(jsonb_field, value)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"jsonb_field:String-instance-method","name":"jsonb_field","abstract":false,"location":{"filename":"src/clear/extensions/jsonb/expression.cr","line_number":46,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/jsonb/expression.cr#L46"},"def":{"name":"jsonb_field","return_type":"String","visibility":"Public","body":"@jsonb_field"}},{"html_id":"resolve:String-instance-method","name":"resolve","abstract":false,"location":{"filename":"src/clear/extensions/jsonb/expression.cr","line_number":52,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/jsonb/expression.cr#L52"},"def":{"name":"resolve","return_type":"String","visibility":"Public","body":"{@jsonb_field, Clear::Expression[@value.to_json]}.join(\" @> \")"}},{"html_id":"value:JSONBHash-instance-method","name":"value","abstract":false,"location":{"filename":"src/clear/extensions/jsonb/expression.cr","line_number":47,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/jsonb/expression.cr#L47"},"def":{"name":"value","return_type":"JSONBHash","visibility":"Public","body":"@value"}}]},{"html_id":"clear/Clear/Expression/Node/JSONB/Field","path":"Clear/Expression/Node/JSONB/Field.html","kind":"class","full_name":"Clear::Expression::Node::JSONB::Field","name":"Field","abstract":false,"superclass":{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},"ancestors":[{"html_id":"clear/Clear/SQL/JSONB","kind":"module","full_name":"Clear::SQL::JSONB","name":"JSONB"},{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},{"html_id":"clear/Clear/Expression/JSONB/Node","kind":"module","full_name":"Clear::Expression::JSONB::Node","name":"Node"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/extensions/jsonb/expression.cr","line_number":3,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/jsonb/expression.cr#L3"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"clear/Clear/SQL/JSONB","kind":"module","full_name":"Clear::SQL::JSONB","name":"JSONB"}],"namespace":{"html_id":"clear/Clear/Expression/Node/JSONB","kind":"module","full_name":"Clear::Expression::Node::JSONB","name":"JSONB"},"constructors":[{"html_id":"new(field:Clear::Expression::Node,key:String,cast:Nil|String=nil)-class-method","name":"new","abstract":false,"args":[{"name":"field","external_name":"field","restriction":"::Clear::Expression::Node"},{"name":"key","external_name":"key","restriction":"::String"},{"name":"cast","default_value":"nil","external_name":"cast","restriction":"::Nil | ::String"}],"args_string":"(field : Clear::Expression::Node, key : String, cast : Nil | String = nil)","args_html":"(field : Clear::Expression::Node, key : String, cast : Nil | String = nil)","location":{"filename":"src/clear/extensions/jsonb/expression.cr","line_number":10,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/jsonb/expression.cr#L10"},"def":{"name":"new","args":[{"name":"field","external_name":"field","restriction":"::Clear::Expression::Node"},{"name":"key","external_name":"key","restriction":"::String"},{"name":"cast","default_value":"nil","external_name":"cast","restriction":"::Nil | ::String"}],"visibility":"Public","body":"_ = allocate\n_.initialize(field, key, cast)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"==(value:Clear::Expression::Node)-instance-method","name":"==","abstract":false,"args":[{"name":"value","external_name":"value","restriction":"Clear::Expression::Node"}],"args_string":"(value : Clear::Expression::Node)","args_html":"(value : Clear::Expression::Node)","location":{"filename":"src/clear/extensions/jsonb/expression.cr","line_number":21,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/jsonb/expression.cr#L21"},"def":{"name":"==","args":[{"name":"value","external_name":"value","restriction":"Clear::Expression::Node"}],"visibility":"Public","body":"super(value)"}},{"html_id":"==(value:_)-instance-method","name":"==","abstract":false,"args":[{"name":"value","external_name":"value","restriction":"_"}],"args_string":"(value : _)","args_html":"(value : _)","location":{"filename":"src/clear/extensions/jsonb/expression.cr","line_number":25,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/jsonb/expression.cr#L25"},"def":{"name":"==","args":[{"name":"value","external_name":"value","restriction":"_"}],"visibility":"Public","body":"if @cast\n super(value)\nelse\n Clear::Expression::Node::JSONB::Equality.new(field.resolve, jsonb_k2h(key, value))\nend"}},{"html_id":"cast(cast:Nil|String)-instance-method","name":"cast","abstract":false,"args":[{"name":"cast","external_name":"cast","restriction":"::Nil | ::String"}],"args_string":"(cast : Nil | String)","args_html":"(cast : Nil | String)","location":{"filename":"src/clear/extensions/jsonb/expression.cr","line_number":17,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/jsonb/expression.cr#L17"},"def":{"name":"cast","args":[{"name":"cast","external_name":"cast","restriction":"::Nil | ::String"}],"visibility":"Public","body":"@cast = cast\nself\n"}},{"html_id":"cast:String|Nil-instance-method","name":"cast","abstract":false,"location":{"filename":"src/clear/extensions/jsonb/expression.cr","line_number":8,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/jsonb/expression.cr#L8"},"def":{"name":"cast","return_type":"String | ::Nil","visibility":"Public","body":"@cast"}},{"html_id":"contains?(expression:Clear::Expression::Node)-instance-method","name":"contains?","abstract":false,"args":[{"name":"expression","external_name":"expression","restriction":"Clear::Expression::Node"}],"args_string":"(expression : Clear::Expression::Node)","args_html":"(expression : Clear::Expression::Node)","location":{"filename":"src/clear/extensions/jsonb/expression.cr","line_number":33,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/jsonb/expression.cr#L33"},"def":{"name":"contains?","args":[{"name":"expression","external_name":"expression","restriction":"Clear::Expression::Node"}],"visibility":"Public","body":"Clear::Expression::Node::JSONB::ArrayContains.new(resolve, expression.resolve)"}},{"html_id":"contains?(expression)-instance-method","name":"contains?","abstract":false,"args":[{"name":"expression","external_name":"expression","restriction":""}],"args_string":"(expression)","args_html":"(expression)","location":{"filename":"src/clear/extensions/jsonb/expression.cr","line_number":37,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/jsonb/expression.cr#L37"},"def":{"name":"contains?","args":[{"name":"expression","external_name":"expression","restriction":""}],"visibility":"Public","body":"Clear::Expression::Node::JSONB::ArrayContains.new(resolve, Clear::Expression[expression])"}},{"html_id":"field:Node-instance-method","name":"field","abstract":false,"location":{"filename":"src/clear/extensions/jsonb/expression.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/jsonb/expression.cr#L6"},"def":{"name":"field","return_type":"Node","visibility":"Public","body":"@field"}},{"html_id":"key:String-instance-method","name":"key","abstract":false,"location":{"filename":"src/clear/extensions/jsonb/expression.cr","line_number":7,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/jsonb/expression.cr#L7"},"def":{"name":"key","return_type":"String","visibility":"Public","body":"@key"}},{"html_id":"resolve:String-instance-method","name":"resolve","abstract":false,"location":{"filename":"src/clear/extensions/jsonb/expression.cr","line_number":13,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/jsonb/expression.cr#L13"},"def":{"name":"resolve","return_type":"String","visibility":"Public","body":"jsonb_resolve(@field.resolve, jsonb_k2a(key), @cast)"}}]}]},{"html_id":"clear/Clear/Expression/Node/Literal","path":"Clear/Expression/Node/Literal.html","kind":"class","full_name":"Clear::Expression::Node::Literal","name":"Literal","abstract":false,"superclass":{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},"ancestors":[{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},{"html_id":"clear/Clear/Expression/JSONB/Node","kind":"module","full_name":"Clear::Expression::JSONB::Node","name":"Node"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/expression/nodes/literal.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/literal.cr#L4"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},"doc":"Management of rendering of literal values.","summary":"

Management of rendering of literal values.

","constructors":[{"html_id":"new(value)-class-method","name":"new","abstract":false,"args":[{"name":"value","external_name":"value","restriction":""}],"args_string":"(value)","args_html":"(value)","location":{"filename":"src/clear/expression/nodes/literal.cr","line_number":7,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/literal.cr#L7"},"def":{"name":"new","args":[{"name":"value","external_name":"value","restriction":""}],"visibility":"Public","body":"_ = allocate\n_.initialize(value)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"resolve:String-instance-method","name":"resolve","abstract":false,"location":{"filename":"src/clear/expression/nodes/literal.cr","line_number":17,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/literal.cr#L17"},"def":{"name":"resolve","return_type":"String","visibility":"Public","body":"Clear::Expression[@value]"}},{"html_id":"value:AvailableLiteral-instance-method","name":"value","abstract":false,"location":{"filename":"src/clear/expression/nodes/literal.cr","line_number":5,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/literal.cr#L5"},"def":{"name":"value","return_type":"AvailableLiteral","visibility":"Public","body":"@value"}}]},{"html_id":"clear/Clear/Expression/Node/Minus","path":"Clear/Expression/Node/Minus.html","kind":"class","full_name":"Clear::Expression::Node::Minus","name":"Minus","abstract":false,"superclass":{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},"ancestors":[{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},{"html_id":"clear/Clear/Expression/JSONB/Node","kind":"module","full_name":"Clear::Expression::JSONB::Node","name":"Node"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/expression/nodes/minus.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/minus.cr#L4"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},"doc":"A node managing the unary `-` operator.","summary":"

A node managing the unary - operator.

","constructors":[{"html_id":"new(a:Node)-class-method","name":"new","abstract":false,"args":[{"name":"a","external_name":"a","restriction":"Node"}],"args_string":"(a : Node)","args_html":"(a : Node)","location":{"filename":"src/clear/expression/nodes/minus.cr","line_number":5,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/minus.cr#L5"},"def":{"name":"new","args":[{"name":"a","external_name":"a","restriction":"Node"}],"visibility":"Public","body":"_ = allocate\n_.initialize(a)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"resolve:String-instance-method","name":"resolve","abstract":false,"location":{"filename":"src/clear/expression/nodes/minus.cr","line_number":7,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/minus.cr#L7"},"def":{"name":"resolve","return_type":"String","visibility":"Public","body":"{\"-\", @a.resolve}.join"}}]},{"html_id":"clear/Clear/Expression/Node/NodeArray","path":"Clear/Expression/Node/NodeArray.html","kind":"class","full_name":"Clear::Expression::Node::NodeArray","name":"NodeArray","abstract":false,"superclass":{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},"ancestors":[{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},{"html_id":"clear/Clear/Expression/JSONB/Node","kind":"module","full_name":"Clear::Expression::JSONB::Node","name":"Node"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/expression/nodes/node_array.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/node_array.cr#L4"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},"doc":"This node is used to generate expression like `( a AND b AND ... AND k )`","summary":"

This node is used to generate expression like `( a AND b AND ...

","constructors":[{"html_id":"new(expression:Array(Node),link:String)-class-method","name":"new","abstract":false,"args":[{"name":"expression","external_name":"expression","restriction":"Array(Node)"},{"name":"link","external_name":"link","restriction":"::String"}],"args_string":"(expression : Array(Node), link : String)","args_html":"(expression : Array(Node), link : String)","location":{"filename":"src/clear/expression/nodes/node_array.cr","line_number":8,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/node_array.cr#L8"},"def":{"name":"new","args":[{"name":"expression","external_name":"expression","restriction":"Array(Node)"},{"name":"link","external_name":"link","restriction":"::String"}],"visibility":"Public","body":"_ = allocate\n_.initialize(expression, link)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"expression:Array(Node)-instance-method","name":"expression","abstract":false,"location":{"filename":"src/clear/expression/nodes/node_array.cr","line_number":5,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/node_array.cr#L5"},"def":{"name":"expression","return_type":"Array(Node)","visibility":"Public","body":"@expression"}},{"html_id":"expression=(expression:Array(Node))-instance-method","name":"expression=","abstract":false,"args":[{"name":"expression","external_name":"expression","restriction":"Array(Node)"}],"args_string":"(expression : Array(Node))","args_html":"(expression : Array(Node))","location":{"filename":"src/clear/expression/nodes/node_array.cr","line_number":5,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/node_array.cr#L5"},"def":{"name":"expression=","args":[{"name":"expression","external_name":"expression","restriction":"Array(Node)"}],"visibility":"Public","body":"@expression = expression"}},{"html_id":"link:String-instance-method","name":"link","abstract":false,"location":{"filename":"src/clear/expression/nodes/node_array.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/node_array.cr#L6"},"def":{"name":"link","return_type":"String","visibility":"Public","body":"@link"}},{"html_id":"link=(link:String)-instance-method","name":"link=","abstract":false,"args":[{"name":"link","external_name":"link","restriction":"String"}],"args_string":"(link : String)","args_html":"(link : String)","location":{"filename":"src/clear/expression/nodes/node_array.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/node_array.cr#L6"},"def":{"name":"link=","args":[{"name":"link","external_name":"link","restriction":"String"}],"visibility":"Public","body":"@link = link"}},{"html_id":"resolve:String-instance-method","name":"resolve","abstract":false,"location":{"filename":"src/clear/expression/nodes/node_array.cr","line_number":12,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/node_array.cr#L12"},"def":{"name":"resolve","return_type":"String","visibility":"Public","body":"if !@expression.empty?\n {\"(\", @expression.join(\" #{@link} \", &.resolve), \")\"}.join\nelse\n \"\"\nend"}}]},{"html_id":"clear/Clear/Expression/Node/Not","path":"Clear/Expression/Node/Not.html","kind":"class","full_name":"Clear::Expression::Node::Not","name":"Not","abstract":false,"superclass":{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},"ancestors":[{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},{"html_id":"clear/Clear/Expression/JSONB/Node","kind":"module","full_name":"Clear::Expression::JSONB::Node","name":"Node"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/expression/nodes/not.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/not.cr#L4"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},"doc":"A node managing the unary `NOT` operator.","summary":"

A node managing the unary NOT operator.

","constructors":[{"html_id":"new(a:Node)-class-method","name":"new","abstract":false,"args":[{"name":"a","external_name":"a","restriction":"Node"}],"args_string":"(a : Node)","args_html":"(a : Node)","location":{"filename":"src/clear/expression/nodes/not.cr","line_number":5,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/not.cr#L5"},"def":{"name":"new","args":[{"name":"a","external_name":"a","restriction":"Node"}],"visibility":"Public","body":"_ = allocate\n_.initialize(a)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"resolve:String-instance-method","name":"resolve","abstract":false,"location":{"filename":"src/clear/expression/nodes/not.cr","line_number":7,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/not.cr#L7"},"def":{"name":"resolve","return_type":"String","visibility":"Public","body":"{\"NOT \", @a.resolve}.join"}}]},{"html_id":"clear/Clear/Expression/Node/NotBetween","path":"Clear/Expression/Node/NotBetween.html","kind":"class","full_name":"Clear::Expression::Node::NotBetween","name":"NotBetween","abstract":false,"superclass":{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},"ancestors":[{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},{"html_id":"clear/Clear/Expression/JSONB/Node","kind":"module","full_name":"Clear::Expression::JSONB::Node","name":"Node"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/expression/nodes/not_between.cr","line_number":5,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/not_between.cr#L5"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},"doc":"A node managing the rendering of `(var NOT BETWEEN a AND b)`\nexpressions.","summary":"

A node managing the rendering of (var NOT BETWEEN a AND b) expressions.

","constructors":[{"html_id":"new(target:Node,starts:BetweenType,ends:BetweenType)-class-method","name":"new","abstract":false,"args":[{"name":"target","external_name":"target","restriction":"Node"},{"name":"starts","external_name":"starts","restriction":"BetweenType"},{"name":"ends","external_name":"ends","restriction":"BetweenType"}],"args_string":"(target : Node, starts : BetweenType, ends : BetweenType)","args_html":"(target : Node, starts : BetweenType, ends : BetweenType)","location":{"filename":"src/clear/expression/nodes/not_between.cr","line_number":8,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/not_between.cr#L8"},"def":{"name":"new","args":[{"name":"target","external_name":"target","restriction":"Node"},{"name":"starts","external_name":"starts","restriction":"BetweenType"},{"name":"ends","external_name":"ends","restriction":"BetweenType"}],"visibility":"Public","body":"_ = allocate\n_.initialize(target, starts, ends)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"resolve:String-instance-method","name":"resolve","abstract":false,"location":{"filename":"src/clear/expression/nodes/not_between.cr","line_number":11,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/not_between.cr#L11"},"def":{"name":"resolve","return_type":"String","visibility":"Public","body":"{\"(\", @target.resolve, \" NOT BETWEEN \", Clear::Expression[@starts], \" AND \", Clear::Expression[@ends], \")\"}.join"}}],"types":[{"html_id":"clear/Clear/Expression/Node/NotBetween/BetweenType","path":"Clear/Expression/Node/NotBetween/BetweenType.html","kind":"alias","full_name":"Clear::Expression::Node::NotBetween::BetweenType","name":"BetweenType","abstract":false,"locations":[{"filename":"src/clear/expression/nodes/not_between.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/not_between.cr#L6"}],"repository_name":"clear","program":false,"enum":false,"alias":true,"aliased":"(Clear::Expression::Node | Float32 | Float64 | Int32 | Int64 | String | Time)","aliased_html":"Clear::Expression::Node | Float32 | Float64 | Int32 | Int64 | String | Time","const":false,"namespace":{"html_id":"clear/Clear/Expression/Node/NotBetween","kind":"class","full_name":"Clear::Expression::Node::NotBetween","name":"NotBetween"}}]},{"html_id":"clear/Clear/Expression/Node/Null","path":"Clear/Expression/Node/Null.html","kind":"class","full_name":"Clear::Expression::Node::Null","name":"Null","abstract":false,"superclass":{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},"ancestors":[{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},{"html_id":"clear/Clear/Expression/JSONB/Node","kind":"module","full_name":"Clear::Expression::JSONB::Node","name":"Node"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/expression/nodes/null.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/null.cr#L4"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},"doc":"Render NULL !","summary":"

Render NULL !

","constructors":[{"html_id":"new-class-method","name":"new","abstract":false,"location":{"filename":"src/clear/expression/nodes/null.cr","line_number":5,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/null.cr#L5"},"def":{"name":"new","visibility":"Public","body":"_ = allocate\n_.initialize\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"resolve:String-instance-method","name":"resolve","abstract":false,"location":{"filename":"src/clear/expression/nodes/null.cr","line_number":8,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/null.cr#L8"},"def":{"name":"resolve","return_type":"String","visibility":"Public","body":"\"NULL\""}}]},{"html_id":"clear/Clear/Expression/Node/PGArray","path":"Clear/Expression/Node/PGArray.html","kind":"class","full_name":"Clear::Expression::Node::PGArray(T)","name":"PGArray","abstract":false,"superclass":{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},"ancestors":[{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},{"html_id":"clear/Clear/Expression/JSONB/Node","kind":"module","full_name":"Clear::Expression::JSONB::Node","name":"Node"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/expression/nodes/pg_array.cr","line_number":5,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/pg_array.cr#L5"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},"doc":"A node managing PG structure `array[args...]`\nNamed PGArray instead of Array to avoid issue with naming","summary":"

A node managing PG structure array[args...] Named PGArray instead of Array to avoid issue with naming

","constructors":[{"html_id":"new(arr:Array(T))-class-method","name":"new","abstract":false,"args":[{"name":"arr","external_name":"arr","restriction":"Array(T)"}],"args_string":"(arr : Array(T))","args_html":"(arr : Array(T))","location":{"filename":"src/clear/expression/nodes/pg_array.cr","line_number":8,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/pg_array.cr#L8"},"def":{"name":"new","args":[{"name":"arr","external_name":"arr","restriction":"Array(T)"}],"visibility":"Public","body":"_ = PGArray(T).allocate\n_.initialize(arr)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"resolve:String-instance-method","name":"resolve","abstract":false,"location":{"filename":"src/clear/expression/nodes/pg_array.cr","line_number":11,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/pg_array.cr#L11"},"def":{"name":"resolve","return_type":"String","visibility":"Public","body":"{\"array[\", Clear::Expression[@arr].join(\", \"), \"]\"}.join"}}]},{"html_id":"clear/Clear/Expression/Node/Raw","path":"Clear/Expression/Node/Raw.html","kind":"class","full_name":"Clear::Expression::Node::Raw","name":"Raw","abstract":false,"superclass":{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},"ancestors":[{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},{"html_id":"clear/Clear/Expression/JSONB/Node","kind":"module","full_name":"Clear::Expression::JSONB::Node","name":"Node"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/expression/nodes/raw.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/raw.cr#L4"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},"doc":"This node manage the rendering of a raw SQL fragment.","summary":"

This node manage the rendering of a raw SQL fragment.

","constructors":[{"html_id":"new(raw:String)-class-method","name":"new","abstract":false,"args":[{"name":"raw","external_name":"raw","restriction":"String"}],"args_string":"(raw : String)","args_html":"(raw : String)","location":{"filename":"src/clear/expression/nodes/raw.cr","line_number":5,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/raw.cr#L5"},"def":{"name":"new","args":[{"name":"raw","external_name":"raw","restriction":"String"}],"visibility":"Public","body":"_ = allocate\n_.initialize(raw)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"resolve:String-instance-method","name":"resolve","abstract":false,"location":{"filename":"src/clear/expression/nodes/raw.cr","line_number":7,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/raw.cr#L7"},"def":{"name":"resolve","return_type":"String","visibility":"Public","body":"@raw"}}]},{"html_id":"clear/Clear/Expression/Node/Variable","path":"Clear/Expression/Node/Variable.html","kind":"class","full_name":"Clear::Expression::Node::Variable","name":"Variable","abstract":false,"superclass":{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},"ancestors":[{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},{"html_id":"clear/Clear/Expression/JSONB/Node","kind":"module","full_name":"Clear::Expression::JSONB::Node","name":"Node"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/expression/nodes/variable.cr","line_number":16,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/variable.cr#L16"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Expression/Node","kind":"class","full_name":"Clear::Expression::Node","name":"Node"},"doc":"A variable AST node.\nIt's what's created under the hood when you use a non-existent variable:\n\n```\nwhere { users.id != nil }\n\nwill produce this tree:\n\n# => double_operator('<>')\n# # => variable('id', parent: 'users')\n# # => null\n\n```","summary":"

A variable AST node.

","constructors":[{"html_id":"new(name:String,parent:Variable|Nil=nil)-class-method","name":"new","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"String"},{"name":"parent","default_value":"nil","external_name":"parent","restriction":"Variable | ::Nil"}],"args_string":"(name : String, parent : Variable | Nil = nil)","args_html":"(name : String, parent : Variable | Nil = nil)","location":{"filename":"src/clear/expression/nodes/variable.cr","line_number":17,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/variable.cr#L17"},"def":{"name":"new","args":[{"name":"name","external_name":"name","restriction":"String"},{"name":"parent","default_value":"nil","external_name":"parent","restriction":"Variable | ::Nil"}],"visibility":"Public","body":"_ = allocate\n_.initialize(name, parent)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"resolve:String-instance-method","name":"resolve","abstract":false,"location":{"filename":"src/clear/expression/nodes/variable.cr","line_number":28,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/variable.cr#L28"},"def":{"name":"resolve","return_type":"String","visibility":"Public","body":"parent = @parent\nif parent\n {parent.resolve, \".\", Clear::SQL.escape(@name)}.join\nelse\n Clear::SQL.escape(@name)\nend\n"}}],"macros":[{"html_id":"method_missing(call)-macro","name":"method_missing","abstract":false,"args":[{"name":"call","external_name":"call","restriction":""}],"args_string":"(call)","args_html":"(call)","location":{"filename":"src/clear/expression/nodes/variable.cr","line_number":19,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/nodes/variable.cr#L19"},"def":{"name":"method_missing","args":[{"name":"call","external_name":"call","restriction":""}],"visibility":"Public","body":" \n{% if call.args.size > 0 %}\n args = Clear::Expression[{{ call.args }}].join(\", \")\n return Node::Variable.new(\"{{ call.name.id }}(#{args})\", self)\n {% else %}\n return Node::Variable.new({{ call.name.id.stringify }}, self)\n {% end %}\n\n \n"}}]}]},{"html_id":"clear/Clear/Expression/UnsafeSql","path":"Clear/Expression/UnsafeSql.html","kind":"class","full_name":"Clear::Expression::UnsafeSql","name":"UnsafeSql","abstract":false,"superclass":{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"clear/Clear/Expression/Literal","kind":"module","full_name":"Clear::Expression::Literal","name":"Literal"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/expression/expression.cr","line_number":70,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/expression.cr#L70"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"clear/Clear/Expression/Literal","kind":"module","full_name":"Clear::Expression::Literal","name":"Literal"}],"namespace":{"html_id":"clear/Clear/Expression","kind":"class","full_name":"Clear::Expression","name":"Expression"},"doc":"Wrap an unsafe string. Useful to cancel-out the\nsafe_literal function used internally.\nObviously, this can lead to SQL injection, so beware!","summary":"

Wrap an unsafe string.

","constructors":[{"html_id":"new(value:String)-class-method","name":"new","abstract":false,"args":[{"name":"value","external_name":"value","restriction":"::String"}],"args_string":"(value : String)","args_html":"(value : String)","location":{"filename":"src/clear/expression/expression.cr","line_number":75,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/expression.cr#L75"},"def":{"name":"new","args":[{"name":"value","external_name":"value","restriction":"::String"}],"visibility":"Public","body":"_ = allocate\n_.initialize(value)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"to_json(json=nil):String-instance-method","name":"to_json","abstract":false,"args":[{"name":"json","default_value":"nil","external_name":"json","restriction":""}],"args_string":"(json = nil) : String","args_html":"(json = nil) : String","location":{"filename":"src/clear/expression/expression.cr","line_number":86,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/expression.cr#L86"},"def":{"name":"to_json","args":[{"name":"json","default_value":"nil","external_name":"json","restriction":""}],"visibility":"Public","body":"@value"}},{"html_id":"to_s:String-instance-method","name":"to_s","doc":"Returns a nicely readable and concise string representation of this object,\ntypically intended for users.\n\nThis method should usually **not** be overridden. It delegates to\n`#to_s(IO)` which can be overridden for custom implementations.\n\nAlso see `#inspect`.","summary":"

Returns a nicely readable and concise string representation of this object, typically intended for users.

","abstract":false,"location":{"filename":"src/clear/expression/expression.cr","line_number":78,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/expression.cr#L78"},"def":{"name":"to_s","visibility":"Public","body":"@value"}},{"html_id":"to_sql:String-instance-method","name":"to_sql","abstract":false,"location":{"filename":"src/clear/expression/expression.cr","line_number":82,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/expression/expression.cr#L82"},"def":{"name":"to_sql","visibility":"Public","body":"@value"}}]}]},{"html_id":"clear/Clear/IllegalEnumValueError","path":"Clear/IllegalEnumValueError.html","kind":"class","full_name":"Clear::IllegalEnumValueError","name":"IllegalEnumValueError","abstract":false,"superclass":{"html_id":"clear/Exception","kind":"class","full_name":"Exception","name":"Exception"},"ancestors":[{"html_id":"clear/Exception","kind":"class","full_name":"Exception","name":"Exception"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/extensions/enum/enum.cr","line_number":2,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/enum/enum.cr#L2"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear","kind":"module","full_name":"Clear","name":"Clear"}},{"html_id":"clear/Clear/Interval","path":"Clear/Interval.html","kind":"struct","full_name":"Clear::Interval","name":"Interval","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/extensions/interval/interval.cr","line_number":17,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/interval/interval.cr#L17"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear","kind":"module","full_name":"Clear","name":"Clear"},"doc":"It can be converted automatically from/to a `interval` column.\n\n## Usage example\n\n```\nclass MyModel\n include Clear::Model\n\n column interval : Clear::TimeInDay\nend\n\ninterval = Clear::Interval.new(60.days)\nrecord = MyModel.create!(interval: interval)\n```","summary":"

It can be converted automatically from/to a interval column.

","class_methods":[{"html_id":"decode(x:Slice(UInt8))-class-method","name":"decode","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Slice(UInt8)"}],"args_string":"(x : Slice(UInt8))","args_html":"(x : Slice(UInt8))","location":{"filename":"src/clear/extensions/interval/interval.cr","line_number":109,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/interval/interval.cr#L109"},"def":{"name":"decode","args":[{"name":"x","external_name":"x","restriction":"Slice(UInt8)"}],"visibility":"Public","body":"io = IO::Memory.new(x, writeable: false)\nnew(io)\n"}}],"constructors":[{"html_id":"new(months:Int32=0,days:Int32=0,hours:Int32=0,minutes:Int32=0,seconds:Int32=0,milliseconds:Int32=0,microseconds:Int64=0)-class-method","name":"new","abstract":false,"args":[{"name":"months","default_value":"0","external_name":"months","restriction":"Int32"},{"name":"days","default_value":"0","external_name":"days","restriction":"Int32"},{"name":"hours","default_value":"0","external_name":"hours","restriction":"Int32"},{"name":"minutes","default_value":"0","external_name":"minutes","restriction":"Int32"},{"name":"seconds","default_value":"0","external_name":"seconds","restriction":"Int32"},{"name":"milliseconds","default_value":"0","external_name":"milliseconds","restriction":"Int32"},{"name":"microseconds","default_value":"0","external_name":"microseconds","restriction":"Int64"}],"args_string":"(months : Int32 = 0, days : Int32 = 0, hours : Int32 = 0, minutes : Int32 = 0, seconds : Int32 = 0, milliseconds : Int32 = 0, microseconds : Int64 = 0)","args_html":"(months : Int32 = 0, days : Int32 = 0, hours : Int32 = 0, minutes : Int32 = 0, seconds : Int32 = 0, milliseconds : Int32 = 0, microseconds : Int64 = 0)","location":{"filename":"src/clear/extensions/interval/interval.cr","line_number":55,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/interval/interval.cr#L55"},"def":{"name":"new","args":[{"name":"months","default_value":"0","external_name":"months","restriction":"Int32"},{"name":"days","default_value":"0","external_name":"days","restriction":"Int32"},{"name":"hours","default_value":"0","external_name":"hours","restriction":"Int32"},{"name":"minutes","default_value":"0","external_name":"minutes","restriction":"Int32"},{"name":"seconds","default_value":"0","external_name":"seconds","restriction":"Int32"},{"name":"milliseconds","default_value":"0","external_name":"milliseconds","restriction":"Int32"},{"name":"microseconds","default_value":"0","external_name":"microseconds","restriction":"Int64"}],"visibility":"Public","body":"_ = allocate\n_.initialize(months, days, hours, minutes, seconds, milliseconds, microseconds)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new(months:Int32,days:Int32,microseconds:Number)-class-method","name":"new","doc":"For `PG::Interval`","summary":"

For PG::Interval

","abstract":false,"args":[{"name":"months","external_name":"months","restriction":"Int32"},{"name":"days","external_name":"days","restriction":"Int32"},{"name":"microseconds","external_name":"microseconds","restriction":"Number"}],"args_string":"(months : Int32, days : Int32, microseconds : Number)","args_html":"(months : Int32, days : Int32, microseconds : Number)","location":{"filename":"src/clear/extensions/interval/interval.cr","line_number":41,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/interval/interval.cr#L41"},"def":{"name":"new","args":[{"name":"months","external_name":"months","restriction":"Int32"},{"name":"days","external_name":"days","restriction":"Int32"},{"name":"microseconds","external_name":"microseconds","restriction":"Number"}],"visibility":"Public","body":"_ = allocate\n_.initialize(months, days, microseconds)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new(span:Time::Span)-class-method","name":"new","abstract":false,"args":[{"name":"span","external_name":"span","restriction":"Time::Span"}],"args_string":"(span : Time::Span)","args_html":"(span : Time::Span)","location":{"filename":"src/clear/extensions/interval/interval.cr","line_number":27,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/interval/interval.cr#L27"},"def":{"name":"new","args":[{"name":"span","external_name":"span","restriction":"Time::Span"}],"visibility":"Public","body":"_ = allocate\n_.initialize(span)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new(span:Time::MonthSpan)-class-method","name":"new","abstract":false,"args":[{"name":"span","external_name":"span","restriction":"Time::MonthSpan"}],"args_string":"(span : Time::MonthSpan)","args_html":"(span : Time::MonthSpan)","location":{"filename":"src/clear/extensions/interval/interval.cr","line_number":36,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/interval/interval.cr#L36"},"def":{"name":"new","args":[{"name":"span","external_name":"span","restriction":"Time::MonthSpan"}],"visibility":"Public","body":"_ = allocate\n_.initialize(span)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new(io:IO)-class-method","name":"new","abstract":false,"args":[{"name":"io","external_name":"io","restriction":"IO"}],"args_string":"(io : IO)","args_html":"(io : IO)","location":{"filename":"src/clear/extensions/interval/interval.cr","line_number":66,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/interval/interval.cr#L66"},"def":{"name":"new","args":[{"name":"io","external_name":"io","restriction":"IO"}],"visibility":"Public","body":"_ = allocate\n_.initialize(io)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"+(interval:self)-instance-method","name":"+","abstract":false,"args":[{"name":"interval","external_name":"interval","restriction":"self"}],"args_string":"(interval : self)","args_html":"(interval : self)","location":{"filename":"src/clear/extensions/interval/interval.cr","line_number":97,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/interval/interval.cr#L97"},"def":{"name":"+","args":[{"name":"interval","external_name":"interval","restriction":"self"}],"visibility":"Public","body":"new(months: self.months + interval.months, day: self.days + interval.days, hours: self.hours + interval.hours, minutes: self.minutes + interval.minutes, seconds: self.seconds + interval.seconds, milliseconds: self.milliseconds + interval.milliseconds, microseconds: self.microseconds + interval.microseconds)"}},{"html_id":"days:Int32-instance-method","name":"days","abstract":false,"location":{"filename":"src/clear/extensions/interval/interval.cr","line_number":19,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/interval/interval.cr#L19"},"def":{"name":"days","return_type":"Int32","visibility":"Public","body":"@days"}},{"html_id":"hours:Int32-instance-method","name":"hours","abstract":false,"location":{"filename":"src/clear/extensions/interval/interval.cr","line_number":22,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/interval/interval.cr#L22"},"def":{"name":"hours","return_type":"Int32","visibility":"Public","body":"@hours"}},{"html_id":"microseconds:Int64-instance-method","name":"microseconds","abstract":false,"location":{"filename":"src/clear/extensions/interval/interval.cr","line_number":20,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/interval/interval.cr#L20"},"def":{"name":"microseconds","return_type":"Int64","visibility":"Public","body":"@microseconds"}},{"html_id":"milliseconds:Int32-instance-method","name":"milliseconds","abstract":false,"location":{"filename":"src/clear/extensions/interval/interval.cr","line_number":25,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/interval/interval.cr#L25"},"def":{"name":"milliseconds","return_type":"Int32","visibility":"Public","body":"@milliseconds"}},{"html_id":"minutes:Int32-instance-method","name":"minutes","abstract":false,"location":{"filename":"src/clear/extensions/interval/interval.cr","line_number":23,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/interval/interval.cr#L23"},"def":{"name":"minutes","return_type":"Int32","visibility":"Public","body":"@minutes"}},{"html_id":"months:Int32-instance-method","name":"months","abstract":false,"location":{"filename":"src/clear/extensions/interval/interval.cr","line_number":18,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/interval/interval.cr#L18"},"def":{"name":"months","return_type":"Int32","visibility":"Public","body":"@months"}},{"html_id":"seconds:Int32-instance-method","name":"seconds","abstract":false,"location":{"filename":"src/clear/extensions/interval/interval.cr","line_number":24,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/interval/interval.cr#L24"},"def":{"name":"seconds","return_type":"Int32","visibility":"Public","body":"@seconds"}},{"html_id":"to_json(json:JSON::Builder):Nil-instance-method","name":"to_json","abstract":false,"args":[{"name":"json","external_name":"json","restriction":"JSON::Builder"}],"args_string":"(json : JSON::Builder) : Nil","args_html":"(json : JSON::Builder) : Nil","location":{"filename":"src/clear/extensions/interval/interval.cr","line_number":76,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/interval/interval.cr#L76"},"def":{"name":"to_json","args":[{"name":"json","external_name":"json","restriction":"JSON::Builder"}],"return_type":"Nil","visibility":"Public","body":"json.string(to_s)"}},{"html_id":"to_s(io)-instance-method","name":"to_s","abstract":false,"args":[{"name":"io","external_name":"io","restriction":""}],"args_string":"(io)","args_html":"(io)","location":{"filename":"src/clear/extensions/interval/interval.cr","line_number":72,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/interval/interval.cr#L72"},"def":{"name":"to_s","args":[{"name":"io","external_name":"io","restriction":""}],"visibility":"Public","body":"\"\""}},{"html_id":"to_sql-instance-method","name":"to_sql","abstract":false,"location":{"filename":"src/clear/extensions/interval/interval.cr","line_number":80,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/interval/interval.cr#L80"},"def":{"name":"to_sql","visibility":"Public","body":"o = [] of String\nif @months.zero?\nelse\n ((o << @months.to_s) << \"months\")\nend\nif @days.zero?\nelse\n ((o << @days.to_s) << \"days\")\nend\nif @hours.zero?\nelse\n ((o << @hours.to_s) << \"hours\")\nend\nif @minutes.zero?\nelse\n ((o << @minutes.to_s) << \"minutes\")\nend\nif @seconds.zero?\nelse\n ((o << @seconds.to_s) << \"seconds\")\nend\nif @milliseconds.zero?\nelse\n ((o << @milliseconds.to_s) << \"milliseconds\")\nend\nif @microseconds.zero?\nelse\n ((o << @microseconds.to_s) << \"microseconds\")\nend\nClear::SQL.unsafe({\"INTERVAL\", Clear::Expression[o.join(\" \")]}.join(\" \"))\n"}}],"types":[{"html_id":"clear/Clear/Interval/Converter","path":"Clear/Interval/Converter.html","kind":"class","full_name":"Clear::Interval::Converter","name":"Converter","abstract":false,"superclass":{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/extensions/interval/interval_converter.cr","line_number":27,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/interval/interval_converter.cr#L27"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Interval","kind":"struct","full_name":"Clear::Interval","name":"Interval"},"class_methods":[{"html_id":"to_column(x):Clear::Interval|Nil-class-method","name":"to_column","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x) : Clear::Interval | Nil","args_html":"(x) : Clear::Interval | Nil","location":{"filename":"src/clear/extensions/interval/interval_converter.cr","line_number":28,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/interval/interval_converter.cr#L28"},"def":{"name":"to_column","args":[{"name":"x","external_name":"x","restriction":""}],"return_type":"Clear::Interval | ::Nil","visibility":"Public","body":"case x\nwhen PG::Interval\n Clear::Interval.new(x.months, x.days, x.microseconds)\nwhen Slice(UInt8)\n Clear::Interval.decode(x.as(Slice(UInt8)))\nwhen Clear::Interval\n x\nwhen Nil\n nil\nelse\n raise(Clear::ErrorMessages.converter_error(x.class, \"Interval\"))\nend"}},{"html_id":"to_db(x:Clear::Interval|Nil)-class-method","name":"to_db","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Clear::Interval | ::Nil"}],"args_string":"(x : Clear::Interval | Nil)","args_html":"(x : Clear::Interval | Nil)","location":{"filename":"src/clear/extensions/interval/interval_converter.cr","line_number":43,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/interval/interval_converter.cr#L43"},"def":{"name":"to_db","args":[{"name":"x","external_name":"x","restriction":"Clear::Interval | ::Nil"}],"visibility":"Public","body":"x.try(&.to_sql)"}}]}]},{"html_id":"clear/Clear/Migration","path":"Clear/Migration.html","kind":"module","full_name":"Clear::Migration","name":"Migration","abstract":false,"ancestors":[{"html_id":"clear/Clear/Migration/Helper","kind":"module","full_name":"Clear::Migration::Helper","name":"Helper"},{"html_id":"clear/Clear/Migration/FullTextSearchableHelpers","kind":"module","full_name":"Clear::Migration::FullTextSearchableHelpers","name":"FullTextSearchableHelpers"},{"html_id":"clear/Clear/ErrorMessages","kind":"module","full_name":"Clear::ErrorMessages","name":"ErrorMessages"}],"locations":[{"filename":"src/clear/extensions/enum/migration.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/enum/migration.cr#L1"},{"filename":"src/clear/migration/direction.cr","line_number":22,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/direction.cr#L22"},{"filename":"src/clear/migration/migration.cr","line_number":57,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/migration.cr#L57"},{"filename":"src/clear/migration/operation/columns.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/columns.cr#L1"},{"filename":"src/clear/migration/operation/execute.cr","line_number":3,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/execute.cr#L3"},{"filename":"src/clear/migration/operation/indexes.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/indexes.cr#L1"},{"filename":"src/clear/migration/operation/operation.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/operation.cr#L1"},{"filename":"src/clear/migration/operation/table.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L1"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"Log","name":"Log","value":"::Log.for(\"clear.migration\")"}],"included_modules":[{"html_id":"clear/Clear/ErrorMessages","kind":"module","full_name":"Clear::ErrorMessages","name":"ErrorMessages"},{"html_id":"clear/Clear/Migration/Helper","kind":"module","full_name":"Clear::Migration::Helper","name":"Helper"}],"namespace":{"html_id":"clear/Clear","kind":"module","full_name":"Clear","name":"Clear"},"doc":"# Clear's migration system\n\nMigrations in Clear are very similar to active record's migrations.\nMigrations are two-way modification of the database.\n\nIt helps to keep a consistent database state during development lifecycle\nof your application.\n\nTo create a migration, two ways:\n\n## Clear command\n\n### TL;DR\n\nYou can create a new file which will be present in `src/db/migrate` using:\n\n`clear-cli migration:g migration_name`\n\nThus will create a migration in `src/db/migration/[:uid]_migration_name.cr`\n(with uid number) and a class `MigrationName`\n\n### Advanced options\n\nYou can use `clear-cli migration help` to get advanced options.\n\n## Manually\n\nYou can create a class following this naming convention:\n`Anything + Number.`\nThe number is then used to order the migration between each others and must be unique.\n\nFollowing the rule than inclusion is often better than inheritance, just\ninclude the module `Clear::Migration` to your class.\n\n## Methods of migration\n\n### Migration direction\n\nOnly one method must be overrided: `change`. In comparison to ActiveRecord, there's no\nup and down methods, instead you can put specific up/down code like this:\n\n```\ndef change(dir)\n dir.down { irreversible! }\nend\n```\n\n```\ndef change(dir)\n add_column :users, :full_name, :string\n\n dir.up do\n execute(\"UPDATE users SET full_name = (SELECT first_name || ' ' || last_name) from users\")\n end\nend\n```","summary":"

\n \n \nClear's migration system

","instance_methods":[{"html_id":"uid:Int64-instance-method","name":"uid","abstract":true,"location":{"filename":"src/clear/migration/migration.cr","line_number":62,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/migration.cr#L62"},"def":{"name":"uid","return_type":"Int64","visibility":"Public","body":""}}],"types":[{"html_id":"clear/Clear/Migration/AddColumn","path":"Clear/Migration/AddColumn.html","kind":"class","full_name":"Clear::Migration::AddColumn","name":"AddColumn","abstract":false,"superclass":{"html_id":"clear/Clear/Migration/Operation","kind":"class","full_name":"Clear::Migration::Operation","name":"Operation"},"ancestors":[{"html_id":"clear/Clear/Migration/Operation","kind":"class","full_name":"Clear::Migration::Operation","name":"Operation"},{"html_id":"clear/Clear/ErrorMessages","kind":"module","full_name":"Clear::ErrorMessages","name":"ErrorMessages"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/migration/operation/columns.cr","line_number":2,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/columns.cr#L2"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Migration","kind":"module","full_name":"Clear::Migration","name":"Migration"},"constructors":[{"html_id":"new(table:String,column:String,datatype,nullable:Bool=false,constraint:Nil|String=nil,default:Nil|String=nil,with_values:Bool=false)-class-method","name":"new","abstract":false,"args":[{"name":"table","external_name":"table","restriction":"::String"},{"name":"column","external_name":"column","restriction":"::String"},{"name":"datatype","external_name":"datatype","restriction":""},{"name":"nullable","default_value":"false","external_name":"nullable","restriction":"::Bool"},{"name":"constraint","default_value":"nil","external_name":"constraint","restriction":"::Nil | ::String"},{"name":"default","default_value":"nil","external_name":"default","restriction":"::Nil | ::String"},{"name":"with_values","default_value":"false","external_name":"with_values","restriction":"::Bool"}],"args_string":"(table : String, column : String, datatype, nullable : Bool = false, constraint : Nil | String = nil, default : Nil | String = nil, with_values : Bool = false)","args_html":"(table : String, column : String, datatype, nullable : Bool = false, constraint : Nil | String = nil, default : Nil | String = nil, with_values : Bool = false)","location":{"filename":"src/clear/migration/operation/columns.cr","line_number":18,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/columns.cr#L18"},"def":{"name":"new","args":[{"name":"table","external_name":"table","restriction":"::String"},{"name":"column","external_name":"column","restriction":"::String"},{"name":"datatype","external_name":"datatype","restriction":""},{"name":"nullable","default_value":"false","external_name":"nullable","restriction":"::Bool"},{"name":"constraint","default_value":"nil","external_name":"constraint","restriction":"::Nil | ::String"},{"name":"default","default_value":"nil","external_name":"default","restriction":"::Nil | ::String"},{"name":"with_values","default_value":"false","external_name":"with_values","restriction":"::Bool"}],"visibility":"Public","body":"_ = allocate\n_.initialize(table, column, datatype, nullable, constraint, default, with_values)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"down:Array(String)-instance-method","name":"down","abstract":false,"location":{"filename":"src/clear/migration/operation/columns.cr","line_number":34,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/columns.cr#L34"},"def":{"name":"down","return_type":"Array(String)","visibility":"Public","body":"[\"ALTER TABLE #{@table} DROP #{@column}\"]"}},{"html_id":"up:Array(String)-instance-method","name":"up","abstract":false,"location":{"filename":"src/clear/migration/operation/columns.cr","line_number":22,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/columns.cr#L22"},"def":{"name":"up","return_type":"Array(String)","visibility":"Public","body":"constraint = @constraint\ndefault = @default\nwith_values = @with_values\n[[\"ALTER TABLE\", @table, \"ADD\", @column, @datatype, @nullable ? \"NULL\" : \"NOT NULL\", constraint ? \"CONSTRAINT #{constraint}\" : nil, default ? \"DEFAULT #{default}\" : nil, with_values ? \"WITH VALUES\" : nil].compact.join(\" \")]\n"}}]},{"html_id":"clear/Clear/Migration/AddTable","path":"Clear/Migration/AddTable.html","kind":"class","full_name":"Clear::Migration::AddTable","name":"AddTable","abstract":false,"superclass":{"html_id":"clear/Clear/Migration/Operation","kind":"class","full_name":"Clear::Migration::Operation","name":"Operation"},"ancestors":[{"html_id":"clear/Clear/Migration/Operation","kind":"class","full_name":"Clear::Migration::Operation","name":"Operation"},{"html_id":"clear/Clear/ErrorMessages","kind":"module","full_name":"Clear::ErrorMessages","name":"ErrorMessages"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/migration/operation/table.cr","line_number":189,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L189"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Migration","kind":"module","full_name":"Clear::Migration","name":"Migration"},"constructors":[{"html_id":"new(table:String,schema:String)-class-method","name":"new","abstract":false,"args":[{"name":"table","external_name":"table","restriction":"::String"},{"name":"schema","external_name":"schema","restriction":"::String"}],"args_string":"(table : String, schema : String)","args_html":"(table : String, schema : String)","location":{"filename":"src/clear/migration/operation/table.cr","line_number":193,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L193"},"def":{"name":"new","args":[{"name":"table","external_name":"table","restriction":"::String"},{"name":"schema","external_name":"schema","restriction":"::String"}],"visibility":"Public","body":"_ = allocate\n_.initialize(table, schema)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"down:Array(String)-instance-method","name":"down","abstract":false,"location":{"filename":"src/clear/migration/operation/table.cr","line_number":204,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L204"},"def":{"name":"down","return_type":"Array(String)","visibility":"Public","body":"[\"DROP TABLE #{@table}\"]"}},{"html_id":"full_name-instance-method","name":"full_name","abstract":false,"location":{"filename":"src/clear/migration/operation/table.cr","line_number":196,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L196"},"def":{"name":"full_name","visibility":"Public","body":"{Clear::SQL.escape(@schema), Clear::SQL.escape(@name)}.join(\".\")"}},{"html_id":"schema:String-instance-method","name":"schema","abstract":false,"location":{"filename":"src/clear/migration/operation/table.cr","line_number":191,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L191"},"def":{"name":"schema","return_type":"String","visibility":"Public","body":"@schema"}},{"html_id":"table:String-instance-method","name":"table","abstract":false,"location":{"filename":"src/clear/migration/operation/table.cr","line_number":190,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L190"},"def":{"name":"table","return_type":"String","visibility":"Public","body":"@table"}},{"html_id":"up:Array(String)-instance-method","name":"up","abstract":false,"location":{"filename":"src/clear/migration/operation/table.cr","line_number":200,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L200"},"def":{"name":"up","return_type":"Array(String)","visibility":"Public","body":"[\"CREATE TABLE #{@table}\"]"}}]},{"html_id":"clear/Clear/Migration/ChangeColumnType","path":"Clear/Migration/ChangeColumnType.html","kind":"class","full_name":"Clear::Migration::ChangeColumnType","name":"ChangeColumnType","abstract":false,"superclass":{"html_id":"clear/Clear/Migration/Operation","kind":"class","full_name":"Clear::Migration::Operation","name":"Operation"},"ancestors":[{"html_id":"clear/Clear/Migration/Operation","kind":"class","full_name":"Clear::Migration::Operation","name":"Operation"},{"html_id":"clear/Clear/ErrorMessages","kind":"module","full_name":"Clear::ErrorMessages","name":"ErrorMessages"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/migration/operation/columns.cr","line_number":74,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/columns.cr#L74"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Migration","kind":"module","full_name":"Clear::Migration","name":"Migration"},"constructors":[{"html_id":"new(table:String,column_name:String,old_column_type,new_column_type)-class-method","name":"new","abstract":false,"args":[{"name":"table","external_name":"table","restriction":"::String"},{"name":"column_name","external_name":"column_name","restriction":"::String"},{"name":"old_column_type","external_name":"old_column_type","restriction":""},{"name":"new_column_type","external_name":"new_column_type","restriction":""}],"args_string":"(table : String, column_name : String, old_column_type, new_column_type)","args_html":"(table : String, column_name : String, old_column_type, new_column_type)","location":{"filename":"src/clear/migration/operation/columns.cr","line_number":80,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/columns.cr#L80"},"def":{"name":"new","args":[{"name":"table","external_name":"table","restriction":"::String"},{"name":"column_name","external_name":"column_name","restriction":"::String"},{"name":"old_column_type","external_name":"old_column_type","restriction":""},{"name":"new_column_type","external_name":"new_column_type","restriction":""}],"visibility":"Public","body":"_ = allocate\n_.initialize(table, column_name, old_column_type, new_column_type)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"down:Array(String)-instance-method","name":"down","abstract":false,"location":{"filename":"src/clear/migration/operation/columns.cr","line_number":89,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/columns.cr#L89"},"def":{"name":"down","return_type":"Array(String)","visibility":"Public","body":"[\"ALTER TABLE #{@table} ALTER COLUMN #{@column_name} SET DATA TYPE #{@old_column_type};\"]"}},{"html_id":"up:Array(String)-instance-method","name":"up","abstract":false,"location":{"filename":"src/clear/migration/operation/columns.cr","line_number":85,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/columns.cr#L85"},"def":{"name":"up","return_type":"Array(String)","visibility":"Public","body":"[\"ALTER TABLE #{@table} ALTER COLUMN #{@column_name} SET DATA TYPE #{@new_column_type};\"]"}}]},{"html_id":"clear/Clear/Migration/CreateEnum","path":"Clear/Migration/CreateEnum.html","kind":"class","full_name":"Clear::Migration::CreateEnum","name":"CreateEnum","abstract":false,"superclass":{"html_id":"clear/Clear/Migration/Operation","kind":"class","full_name":"Clear::Migration::Operation","name":"Operation"},"ancestors":[{"html_id":"clear/Clear/Migration/Operation","kind":"class","full_name":"Clear::Migration::Operation","name":"Operation"},{"html_id":"clear/Clear/ErrorMessages","kind":"module","full_name":"Clear::ErrorMessages","name":"ErrorMessages"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/extensions/enum/migration.cr","line_number":2,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/enum/migration.cr#L2"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Migration","kind":"module","full_name":"Clear::Migration","name":"Migration"},"constructors":[{"html_id":"new(name:String,values:Array(String))-class-method","name":"new","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"::String"},{"name":"values","external_name":"values","restriction":"::Array(::String)"}],"args_string":"(name : String, values : Array(String))","args_html":"(name : String, values : Array(String))","location":{"filename":"src/clear/extensions/enum/migration.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/enum/migration.cr#L6"},"def":{"name":"new","args":[{"name":"name","external_name":"name","restriction":"::String"},{"name":"values","external_name":"values","restriction":"::Array(::String)"}],"visibility":"Public","body":"_ = allocate\n_.initialize(name, values)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"down:Array(String)-instance-method","name":"down","abstract":false,"location":{"filename":"src/clear/extensions/enum/migration.cr","line_number":13,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/enum/migration.cr#L13"},"def":{"name":"down","return_type":"Array(String)","visibility":"Public","body":"[\"DROP TYPE #{@name}\"]"}},{"html_id":"up:Array(String)-instance-method","name":"up","abstract":false,"location":{"filename":"src/clear/extensions/enum/migration.cr","line_number":9,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/enum/migration.cr#L9"},"def":{"name":"up","return_type":"Array(String)","visibility":"Public","body":"[\"CREATE TYPE #{@name} AS ENUM (#{Clear::Expression[@values].join(\", \")})\"]"}}]},{"html_id":"clear/Clear/Migration/CreateIndex","path":"Clear/Migration/CreateIndex.html","kind":"class","full_name":"Clear::Migration::CreateIndex","name":"CreateIndex","abstract":false,"superclass":{"html_id":"clear/Clear/Migration/Operation","kind":"class","full_name":"Clear::Migration::Operation","name":"Operation"},"ancestors":[{"html_id":"clear/Clear/Migration/Operation","kind":"class","full_name":"Clear::Migration::Operation","name":"Operation"},{"html_id":"clear/Clear/ErrorMessages","kind":"module","full_name":"Clear::ErrorMessages","name":"ErrorMessages"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/migration/operation/indexes.cr","line_number":2,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/indexes.cr#L2"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Migration","kind":"module","full_name":"Clear::Migration","name":"Migration"},"constructors":[{"html_id":"new(table:String,fields:Array(String),name=nil,using:Nil|String=nil,unique:Bool=false)-class-method","name":"new","abstract":false,"args":[{"name":"table","external_name":"table","restriction":"::String"},{"name":"fields","external_name":"fields","restriction":"Array(String)"},{"name":"name","default_value":"nil","external_name":"name","restriction":""},{"name":"using","default_value":"nil","external_name":"using","restriction":"::Nil | ::String"},{"name":"unique","default_value":"false","external_name":"unique","restriction":"::Bool"}],"args_string":"(table : String, fields : Array(String), name = nil, using : Nil | String = nil, unique : Bool = false)","args_html":"(table : String, fields : Array(String), name = nil, using : Nil | String = nil, unique : Bool = false)","location":{"filename":"src/clear/migration/operation/indexes.cr","line_number":9,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/indexes.cr#L9"},"def":{"name":"new","args":[{"name":"table","external_name":"table","restriction":"::String"},{"name":"fields","external_name":"fields","restriction":"Array(String)"},{"name":"name","default_value":"nil","external_name":"name","restriction":""},{"name":"using","default_value":"nil","external_name":"using","restriction":"::Nil | ::String"},{"name":"unique","default_value":"false","external_name":"unique","restriction":"::Bool"}],"visibility":"Public","body":"_ = allocate\n_.initialize(table, fields, name, using, unique)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new(table:String,field:String|Symbol,name=nil,using:Nil|String=nil,unique:Bool=false)-class-method","name":"new","abstract":false,"args":[{"name":"table","external_name":"table","restriction":"::String"},{"name":"field","external_name":"field","restriction":"String | Symbol"},{"name":"name","default_value":"nil","external_name":"name","restriction":""},{"name":"using","default_value":"nil","external_name":"using","restriction":"::Nil | ::String"},{"name":"unique","default_value":"false","external_name":"unique","restriction":"::Bool"}],"args_string":"(table : String, field : String | Symbol, name = nil, using : Nil | String = nil, unique : Bool = false)","args_html":"(table : String, field : String | Symbol, name = nil, using : Nil | String = nil, unique : Bool = false)","location":{"filename":"src/clear/migration/operation/indexes.cr","line_number":13,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/indexes.cr#L13"},"def":{"name":"new","args":[{"name":"table","external_name":"table","restriction":"::String"},{"name":"field","external_name":"field","restriction":"String | Symbol"},{"name":"name","default_value":"nil","external_name":"name","restriction":""},{"name":"using","default_value":"nil","external_name":"using","restriction":"::Nil | ::String"},{"name":"unique","default_value":"false","external_name":"unique","restriction":"::Bool"}],"visibility":"Public","body":"_ = allocate\n_.initialize(table, field, name, using, unique)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"down:Array(String)-instance-method","name":"down","abstract":false,"location":{"filename":"src/clear/migration/operation/indexes.cr","line_number":38,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/indexes.cr#L38"},"def":{"name":"down","return_type":"Array(String)","visibility":"Public","body":"[\"DROP INDEX IF EXISTS #{@name}\"]"}},{"html_id":"safe_name(x)-instance-method","name":"safe_name","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x)","args_html":"(x)","location":{"filename":"src/clear/migration/operation/indexes.cr","line_number":18,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/indexes.cr#L18"},"def":{"name":"safe_name","args":[{"name":"x","external_name":"x","restriction":""}],"visibility":"Public","body":"x.gsub(/[^A-Za-z_0-9]/, \"_\")"}},{"html_id":"up:Array(String)-instance-method","name":"up","abstract":false,"location":{"filename":"src/clear/migration/operation/indexes.cr","line_number":34,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/indexes.cr#L34"},"def":{"name":"up","return_type":"Array(String)","visibility":"Public","body":"[[\"CREATE\", print_unique, \"INDEX\", safe_name(@name), \"ON\", @table, print_using, print_columns].compact.join(\" \")]"}}]},{"html_id":"clear/Clear/Migration/Direction","path":"Clear/Migration/Direction.html","kind":"enum","full_name":"Clear::Migration::Direction","name":"Direction","abstract":false,"ancestors":[{"html_id":"clear/Enum","kind":"struct","full_name":"Enum","name":"Enum"},{"html_id":"clear/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/migration/direction.cr","line_number":23,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/direction.cr#L23"}],"repository_name":"clear","program":false,"enum":true,"alias":false,"const":false,"constants":[{"id":"Up","name":"Up","value":"0"},{"id":"Down","name":"Down","value":"1"}],"namespace":{"html_id":"clear/Clear/Migration","kind":"module","full_name":"Clear::Migration","name":"Migration"},"instance_methods":[{"html_id":"down(&)-instance-method","name":"down","doc":"Run the block given in parameter if the direction is a rollback","summary":"

Run the block given in parameter if the direction is a rollback

","abstract":false,"location":{"filename":"src/clear/migration/direction.cr","line_number":38,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/direction.cr#L38"},"def":{"name":"down","yields":0,"block_arity":0,"visibility":"Public","body":"if down?\n yield\nend"}},{"html_id":"down?-instance-method","name":"down?","doc":"Return true whether the migration is a rollback","summary":"

Return true whether the migration is a rollback

","abstract":false,"location":{"filename":"src/clear/migration/direction.cr","line_number":43,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/direction.cr#L43"},"def":{"name":"down?","visibility":"Public","body":"self == Down"}},{"html_id":"up(&)-instance-method","name":"up","doc":"Run the block given in parameter if the direction is a upstream","summary":"

Run the block given in parameter if the direction is a upstream

","abstract":false,"location":{"filename":"src/clear/migration/direction.cr","line_number":28,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/direction.cr#L28"},"def":{"name":"up","yields":0,"block_arity":0,"visibility":"Public","body":"if self == Up\n yield\nend"}},{"html_id":"up?-instance-method","name":"up?","doc":"Return true whether the migration is a upstream","summary":"

Return true whether the migration is a upstream

","abstract":false,"location":{"filename":"src/clear/migration/direction.cr","line_number":33,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/direction.cr#L33"},"def":{"name":"up?","visibility":"Public","body":"self == Up"}}]},{"html_id":"clear/Clear/Migration/DropEnum","path":"Clear/Migration/DropEnum.html","kind":"class","full_name":"Clear::Migration::DropEnum","name":"DropEnum","abstract":false,"superclass":{"html_id":"clear/Clear/Migration/Operation","kind":"class","full_name":"Clear::Migration::Operation","name":"Operation"},"ancestors":[{"html_id":"clear/Clear/Migration/Operation","kind":"class","full_name":"Clear::Migration::Operation","name":"Operation"},{"html_id":"clear/Clear/ErrorMessages","kind":"module","full_name":"Clear::ErrorMessages","name":"ErrorMessages"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/extensions/enum/migration.cr","line_number":18,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/enum/migration.cr#L18"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Migration","kind":"module","full_name":"Clear::Migration","name":"Migration"},"constructors":[{"html_id":"new(name:String,values:Nil|Array(String))-class-method","name":"new","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"::String"},{"name":"values","external_name":"values","restriction":"::Nil | ::Array(::String)"}],"args_string":"(name : String, values : Nil | Array(String))","args_html":"(name : String, values : Nil | Array(String))","location":{"filename":"src/clear/extensions/enum/migration.cr","line_number":22,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/enum/migration.cr#L22"},"def":{"name":"new","args":[{"name":"name","external_name":"name","restriction":"::String"},{"name":"values","external_name":"values","restriction":"::Nil | ::Array(::String)"}],"visibility":"Public","body":"_ = allocate\n_.initialize(name, values)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"down:Array(String)-instance-method","name":"down","abstract":false,"location":{"filename":"src/clear/extensions/enum/migration.cr","line_number":29,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/enum/migration.cr#L29"},"def":{"name":"down","return_type":"Array(String)","visibility":"Public","body":"if values = @values\n [\"CREATE TYPE #{@name} AS ENUM (#{Clear::Expression[values].join(\", \")})\"]\nelse\n irreversible!\nend"}},{"html_id":"up:Array(String)-instance-method","name":"up","abstract":false,"location":{"filename":"src/clear/extensions/enum/migration.cr","line_number":25,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/enum/migration.cr#L25"},"def":{"name":"up","return_type":"Array(String)","visibility":"Public","body":"[\"DROP TYPE #{@name}\"]"}}]},{"html_id":"clear/Clear/Migration/DropTable","path":"Clear/Migration/DropTable.html","kind":"class","full_name":"Clear::Migration::DropTable","name":"DropTable","abstract":false,"superclass":{"html_id":"clear/Clear/Migration/Operation","kind":"class","full_name":"Clear::Migration::Operation","name":"Operation"},"ancestors":[{"html_id":"clear/Clear/Migration/Operation","kind":"class","full_name":"Clear::Migration::Operation","name":"Operation"},{"html_id":"clear/Clear/ErrorMessages","kind":"module","full_name":"Clear::ErrorMessages","name":"ErrorMessages"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/migration/operation/table.cr","line_number":209,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L209"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Migration","kind":"module","full_name":"Clear::Migration","name":"Migration"},"constructors":[{"html_id":"new(table:String,schema:String)-class-method","name":"new","abstract":false,"args":[{"name":"table","external_name":"table","restriction":"::String"},{"name":"schema","external_name":"schema","restriction":"::String"}],"args_string":"(table : String, schema : String)","args_html":"(table : String, schema : String)","location":{"filename":"src/clear/migration/operation/table.cr","line_number":213,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L213"},"def":{"name":"new","args":[{"name":"table","external_name":"table","restriction":"::String"},{"name":"schema","external_name":"schema","restriction":"::String"}],"visibility":"Public","body":"_ = allocate\n_.initialize(table, schema)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"down:Array(String)-instance-method","name":"down","abstract":false,"location":{"filename":"src/clear/migration/operation/table.cr","line_number":224,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L224"},"def":{"name":"down","return_type":"Array(String)","visibility":"Public","body":"[\"CREATE TABLE #{@table}\"]"}},{"html_id":"full_name-instance-method","name":"full_name","abstract":false,"location":{"filename":"src/clear/migration/operation/table.cr","line_number":216,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L216"},"def":{"name":"full_name","visibility":"Public","body":"{Clear::SQL.escape(@schema), Clear::SQL.escape(@name)}.join(\".\")"}},{"html_id":"schema:String-instance-method","name":"schema","abstract":false,"location":{"filename":"src/clear/migration/operation/table.cr","line_number":211,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L211"},"def":{"name":"schema","return_type":"String","visibility":"Public","body":"@schema"}},{"html_id":"table:String-instance-method","name":"table","abstract":false,"location":{"filename":"src/clear/migration/operation/table.cr","line_number":210,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L210"},"def":{"name":"table","return_type":"String","visibility":"Public","body":"@table"}},{"html_id":"up:Array(String)-instance-method","name":"up","abstract":false,"location":{"filename":"src/clear/migration/operation/table.cr","line_number":220,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L220"},"def":{"name":"up","return_type":"Array(String)","visibility":"Public","body":"[\"DROP TABLE #{@table}\"]"}}]},{"html_id":"clear/Clear/Migration/Execute","path":"Clear/Migration/Execute.html","kind":"class","full_name":"Clear::Migration::Execute","name":"Execute","abstract":false,"superclass":{"html_id":"clear/Clear/Migration/Operation","kind":"class","full_name":"Clear::Migration::Operation","name":"Operation"},"ancestors":[{"html_id":"clear/Clear/Migration/Operation","kind":"class","full_name":"Clear::Migration::Operation","name":"Operation"},{"html_id":"clear/Clear/ErrorMessages","kind":"module","full_name":"Clear::ErrorMessages","name":"ErrorMessages"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/migration/operation/execute.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/execute.cr#L4"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Migration","kind":"module","full_name":"Clear::Migration","name":"Migration"},"constructors":[{"html_id":"new(sql:String,irreversible:Bool|Nil=false)-class-method","name":"new","abstract":false,"args":[{"name":"sql","external_name":"sql","restriction":"String"},{"name":"irreversible","default_value":"false","external_name":"irreversible","restriction":"Bool | ::Nil"}],"args_string":"(sql : String, irreversible : Bool | Nil = false)","args_html":"(sql : String, irreversible : Bool | Nil = false)","location":{"filename":"src/clear/migration/operation/execute.cr","line_number":5,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/execute.cr#L5"},"def":{"name":"new","args":[{"name":"sql","external_name":"sql","restriction":"String"},{"name":"irreversible","default_value":"false","external_name":"irreversible","restriction":"Bool | ::Nil"}],"visibility":"Public","body":"_ = allocate\n_.initialize(sql, irreversible)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"down:Array(String)-instance-method","name":"down","abstract":false,"location":{"filename":"src/clear/migration/operation/execute.cr","line_number":12,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/execute.cr#L12"},"def":{"name":"down","return_type":"Array(String)","visibility":"Public","body":"if @irreversible\n irreversible!\nend\n[@sql].compact\n"}},{"html_id":"up:Array(String)-instance-method","name":"up","abstract":false,"location":{"filename":"src/clear/migration/operation/execute.cr","line_number":8,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/execute.cr#L8"},"def":{"name":"up","return_type":"Array(String)","visibility":"Public","body":"[@sql].compact"}}]},{"html_id":"clear/Clear/Migration/FullTextSearchableHelpers","path":"Clear/Migration/FullTextSearchableHelpers.html","kind":"module","full_name":"Clear::Migration::FullTextSearchableHelpers","name":"FullTextSearchableHelpers","abstract":false,"locations":[{"filename":"src/clear/extensions/full_text_searchable/migration.cr","line_number":83,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/full_text_searchable/migration.cr#L83"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"clear/Clear/Migration/Helper","kind":"module","full_name":"Clear::Migration::Helper","name":"Helper"}],"namespace":{"html_id":"clear/Clear/Migration","kind":"module","full_name":"Clear::Migration","name":"Migration"},"instance_methods":[{"html_id":"add_full_text_searchable(table,on:Array(Tuple(String,Char)),column_name=\"full_text_vector\",catalog=\"pg_catalog.english\",trigger_name=nil,function_name=nil)-instance-method","name":"add_full_text_searchable","doc":"Add a `tsvector` field to a table.\nCreate column, index and trigger.","summary":"

Add a tsvector field to a table.

","abstract":false,"args":[{"name":"table","external_name":"table","restriction":""},{"name":"on","external_name":"on","restriction":"Array(Tuple(String, Char))"},{"name":"column_name","default_value":"\"full_text_vector\"","external_name":"column_name","restriction":""},{"name":"catalog","default_value":"\"pg_catalog.english\"","external_name":"catalog","restriction":""},{"name":"trigger_name","default_value":"nil","external_name":"trigger_name","restriction":""},{"name":"function_name","default_value":"nil","external_name":"function_name","restriction":""}],"args_string":"(table, on : Array(Tuple(String, Char)), column_name = \"full_text_vector\", catalog = \"pg_catalog.english\", trigger_name = nil, function_name = nil)","args_html":"(table, on : Array(Tuple(String, Char)), column_name = "full_text_vector", catalog = "pg_catalog.english", trigger_name = nil, function_name = nil)","location":{"filename":"src/clear/extensions/full_text_searchable/migration.cr","line_number":86,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/full_text_searchable/migration.cr#L86"},"def":{"name":"add_full_text_searchable","args":[{"name":"table","external_name":"table","restriction":""},{"name":"on","external_name":"on","restriction":"Array(Tuple(String, Char))"},{"name":"column_name","default_value":"\"full_text_vector\"","external_name":"column_name","restriction":""},{"name":"catalog","default_value":"\"pg_catalog.english\"","external_name":"catalog","restriction":""},{"name":"trigger_name","default_value":"nil","external_name":"trigger_name","restriction":""},{"name":"function_name","default_value":"nil","external_name":"function_name","restriction":""}],"visibility":"Public","body":"add_column(table, column_name, \"tsvector\")\ncreate_index(table, column_name, using: \"gin\")\nmigration.add_operation(Clear::Migration::FullTextSearchableOperation.new(table, on, catalog, trigger_name, function_name, column_name))\n"}}]},{"html_id":"clear/Clear/Migration/FullTextSearchableOperation","path":"Clear/Migration/FullTextSearchableOperation.html","kind":"class","full_name":"Clear::Migration::FullTextSearchableOperation","name":"FullTextSearchableOperation","abstract":false,"superclass":{"html_id":"clear/Clear/Migration/Operation","kind":"class","full_name":"Clear::Migration::Operation","name":"Operation"},"ancestors":[{"html_id":"clear/Clear/Migration/Operation","kind":"class","full_name":"Clear::Migration::Operation","name":"Operation"},{"html_id":"clear/Clear/ErrorMessages","kind":"module","full_name":"Clear::ErrorMessages","name":"ErrorMessages"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/extensions/full_text_searchable/migration.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/full_text_searchable/migration.cr#L1"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Migration","kind":"module","full_name":"Clear::Migration","name":"Migration"},"constructors":[{"html_id":"new(table:String,src_fields:Array(Tuple(String,Char)),catalog:String=\"pg_catalog.english\",trigger_name=nil,function_name=nil,dest_field:String=\"full_text_vector\")-class-method","name":"new","abstract":false,"args":[{"name":"table","external_name":"table","restriction":"::String"},{"name":"src_fields","external_name":"src_fields","restriction":"::Array(::Tuple(::String, ::Char))"},{"name":"catalog","default_value":"\"pg_catalog.english\"","external_name":"catalog","restriction":"::String"},{"name":"trigger_name","default_value":"nil","external_name":"trigger_name","restriction":""},{"name":"function_name","default_value":"nil","external_name":"function_name","restriction":""},{"name":"dest_field","default_value":"\"full_text_vector\"","external_name":"dest_field","restriction":"::String"}],"args_string":"(table : String, src_fields : Array(Tuple(String, Char)), catalog : String = \"pg_catalog.english\", trigger_name = nil, function_name = nil, dest_field : String = \"full_text_vector\")","args_html":"(table : String, src_fields : Array(Tuple(String, Char)), catalog : String = "pg_catalog.english", trigger_name = nil, function_name = nil, dest_field : String = "full_text_vector")","location":{"filename":"src/clear/extensions/full_text_searchable/migration.cr","line_number":17,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/full_text_searchable/migration.cr#L17"},"def":{"name":"new","args":[{"name":"table","external_name":"table","restriction":"::String"},{"name":"src_fields","external_name":"src_fields","restriction":"::Array(::Tuple(::String, ::Char))"},{"name":"catalog","default_value":"\"pg_catalog.english\"","external_name":"catalog","restriction":"::String"},{"name":"trigger_name","default_value":"nil","external_name":"trigger_name","restriction":""},{"name":"function_name","default_value":"nil","external_name":"function_name","restriction":""},{"name":"dest_field","default_value":"\"full_text_vector\"","external_name":"dest_field","restriction":"::String"}],"visibility":"Public","body":"_ = allocate\n_.initialize(table, src_fields, catalog, trigger_name, function_name, dest_field)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"catalog:String-instance-method","name":"catalog","abstract":false,"location":{"filename":"src/clear/extensions/full_text_searchable/migration.cr","line_number":12,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/full_text_searchable/migration.cr#L12"},"def":{"name":"catalog","return_type":"String","visibility":"Public","body":"@catalog"}},{"html_id":"dest_field:String-instance-method","name":"dest_field","abstract":false,"location":{"filename":"src/clear/extensions/full_text_searchable/migration.cr","line_number":13,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/full_text_searchable/migration.cr#L13"},"def":{"name":"dest_field","return_type":"String","visibility":"Public","body":"@dest_field"}},{"html_id":"down:Array(String)-instance-method","name":"down","abstract":false,"location":{"filename":"src/clear/extensions/full_text_searchable/migration.cr","line_number":78,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/full_text_searchable/migration.cr#L78"},"def":{"name":"down","return_type":"Array(String)","visibility":"Public","body":"print_delete_trigger"}},{"html_id":"function_name:String-instance-method","name":"function_name","abstract":false,"location":{"filename":"src/clear/extensions/full_text_searchable/migration.cr","line_number":11,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/full_text_searchable/migration.cr#L11"},"def":{"name":"function_name","return_type":"String","visibility":"Public","body":"@function_name"}},{"html_id":"src_fields:Array(Tuple(String,Char))-instance-method","name":"src_fields","abstract":false,"location":{"filename":"src/clear/extensions/full_text_searchable/migration.cr","line_number":15,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/full_text_searchable/migration.cr#L15"},"def":{"name":"src_fields","return_type":"Array(::Tuple(String, Char))","visibility":"Public","body":"@src_fields"}},{"html_id":"table:String-instance-method","name":"table","abstract":false,"location":{"filename":"src/clear/extensions/full_text_searchable/migration.cr","line_number":9,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/full_text_searchable/migration.cr#L9"},"def":{"name":"table","return_type":"String","visibility":"Public","body":"@table"}},{"html_id":"trigger_name:String-instance-method","name":"trigger_name","abstract":false,"location":{"filename":"src/clear/extensions/full_text_searchable/migration.cr","line_number":10,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/full_text_searchable/migration.cr#L10"},"def":{"name":"trigger_name","return_type":"String","visibility":"Public","body":"@trigger_name"}},{"html_id":"up:Array(String)-instance-method","name":"up","abstract":false,"location":{"filename":"src/clear/extensions/full_text_searchable/migration.cr","line_number":74,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/full_text_searchable/migration.cr#L74"},"def":{"name":"up","return_type":"Array(String)","visibility":"Public","body":"print_trigger + print_update_current_data"}}],"types":[{"html_id":"clear/Clear/Migration/FullTextSearchableOperation/Priority","path":"Clear/Migration/FullTextSearchableOperation/Priority.html","kind":"module","full_name":"Clear::Migration::FullTextSearchableOperation::Priority","name":"Priority","abstract":false,"locations":[{"filename":"src/clear/extensions/full_text_searchable/migration.cr","line_number":2,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/full_text_searchable/migration.cr#L2"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"IMPORTANT","name":"IMPORTANT","value":"'B'"},{"id":"LOW","name":"LOW","value":"'D'"},{"id":"NORMAL","name":"NORMAL","value":"'C'"},{"id":"VERY_IMPORTANT","name":"VERY_IMPORTANT","value":"'A'"}],"namespace":{"html_id":"clear/Clear/Migration/FullTextSearchableOperation","kind":"class","full_name":"Clear::Migration::FullTextSearchableOperation","name":"FullTextSearchableOperation"}}]},{"html_id":"clear/Clear/Migration/FullTextSearchableTableHelpers","path":"Clear/Migration/FullTextSearchableTableHelpers.html","kind":"module","full_name":"Clear::Migration::FullTextSearchableTableHelpers","name":"FullTextSearchableTableHelpers","abstract":false,"locations":[{"filename":"src/clear/extensions/full_text_searchable/migration.cr","line_number":104,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/full_text_searchable/migration.cr#L104"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"clear/Clear/Migration/Table","kind":"class","full_name":"Clear::Migration::Table","name":"Table"}],"namespace":{"html_id":"clear/Clear/Migration","kind":"module","full_name":"Clear::Migration","name":"Migration"},"instance_methods":[{"html_id":"full_text_searchable(on:Array(Tuple(String,Char)),column_name=\"full_text_vector\",catalog=\"pg_catalog.english\",trigger_name=nil,function_name=nil)-instance-method","name":"full_text_searchable","abstract":false,"args":[{"name":"on","external_name":"on","restriction":"Array(Tuple(String, Char))"},{"name":"column_name","default_value":"\"full_text_vector\"","external_name":"column_name","restriction":""},{"name":"catalog","default_value":"\"pg_catalog.english\"","external_name":"catalog","restriction":""},{"name":"trigger_name","default_value":"nil","external_name":"trigger_name","restriction":""},{"name":"function_name","default_value":"nil","external_name":"function_name","restriction":""}],"args_string":"(on : Array(Tuple(String, Char)), column_name = \"full_text_vector\", catalog = \"pg_catalog.english\", trigger_name = nil, function_name = nil)","args_html":"(on : Array(Tuple(String, Char)), column_name = "full_text_vector", catalog = "pg_catalog.english", trigger_name = nil, function_name = nil)","location":{"filename":"src/clear/extensions/full_text_searchable/migration.cr","line_number":105,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/full_text_searchable/migration.cr#L105"},"def":{"name":"full_text_searchable","args":[{"name":"on","external_name":"on","restriction":"Array(Tuple(String, Char))"},{"name":"column_name","default_value":"\"full_text_vector\"","external_name":"column_name","restriction":""},{"name":"catalog","default_value":"\"pg_catalog.english\"","external_name":"catalog","restriction":""},{"name":"trigger_name","default_value":"nil","external_name":"trigger_name","restriction":""},{"name":"function_name","default_value":"nil","external_name":"function_name","restriction":""}],"visibility":"Public","body":"column(column_name, \"tsvector\", index: \"gin\")\nmigration.try(&.add_operation(Clear::Migration::FullTextSearchableOperation.new(name, on, catalog, trigger_name, function_name, column_name)))\n"}},{"html_id":"full_text_searchable(on:String,column_name=\"full_text_vector\",catalog=\"pg_catalog.english\",trigger_name=nil,function_name=nil)-instance-method","name":"full_text_searchable","abstract":false,"args":[{"name":"on","external_name":"on","restriction":"String"},{"name":"column_name","default_value":"\"full_text_vector\"","external_name":"column_name","restriction":""},{"name":"catalog","default_value":"\"pg_catalog.english\"","external_name":"catalog","restriction":""},{"name":"trigger_name","default_value":"nil","external_name":"trigger_name","restriction":""},{"name":"function_name","default_value":"nil","external_name":"function_name","restriction":""}],"args_string":"(on : String, column_name = \"full_text_vector\", catalog = \"pg_catalog.english\", trigger_name = nil, function_name = nil)","args_html":"(on : String, column_name = "full_text_vector", catalog = "pg_catalog.english", trigger_name = nil, function_name = nil)","location":{"filename":"src/clear/extensions/full_text_searchable/migration.cr","line_number":122,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/full_text_searchable/migration.cr#L122"},"def":{"name":"full_text_searchable","args":[{"name":"on","external_name":"on","restriction":"String"},{"name":"column_name","default_value":"\"full_text_vector\"","external_name":"column_name","restriction":""},{"name":"catalog","default_value":"\"pg_catalog.english\"","external_name":"catalog","restriction":""},{"name":"trigger_name","default_value":"nil","external_name":"trigger_name","restriction":""},{"name":"function_name","default_value":"nil","external_name":"function_name","restriction":""}],"visibility":"Public","body":"full_text_searchable([{on, 'C'}], column_name, catalog, trigger_name, function_name)"}},{"html_id":"full_text_searchable(on:Array(String),column_name=\"full_text_vector\",catalog=\"pg_catalog.english\",trigger_name=nil,function_name=nil)-instance-method","name":"full_text_searchable","abstract":false,"args":[{"name":"on","external_name":"on","restriction":"Array(String)"},{"name":"column_name","default_value":"\"full_text_vector\"","external_name":"column_name","restriction":""},{"name":"catalog","default_value":"\"pg_catalog.english\"","external_name":"catalog","restriction":""},{"name":"trigger_name","default_value":"nil","external_name":"trigger_name","restriction":""},{"name":"function_name","default_value":"nil","external_name":"function_name","restriction":""}],"args_string":"(on : Array(String), column_name = \"full_text_vector\", catalog = \"pg_catalog.english\", trigger_name = nil, function_name = nil)","args_html":"(on : Array(String), column_name = "full_text_vector", catalog = "pg_catalog.english", trigger_name = nil, function_name = nil)","location":{"filename":"src/clear/extensions/full_text_searchable/migration.cr","line_number":128,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/full_text_searchable/migration.cr#L128"},"def":{"name":"full_text_searchable","args":[{"name":"on","external_name":"on","restriction":"Array(String)"},{"name":"column_name","default_value":"\"full_text_vector\"","external_name":"column_name","restriction":""},{"name":"catalog","default_value":"\"pg_catalog.english\"","external_name":"catalog","restriction":""},{"name":"trigger_name","default_value":"nil","external_name":"trigger_name","restriction":""},{"name":"function_name","default_value":"nil","external_name":"function_name","restriction":""}],"visibility":"Public","body":"if on.empty?\n raise(\"cannot implement tsv_searchable because empty array was given\")\nend\nfields = on.map do |name|\n {name, 'C'}\nend\nfull_text_searchable(fields, column_name, catalog, trigger_name, function_name)\n"}}]},{"html_id":"clear/Clear/Migration/Helper","path":"Clear/Migration/Helper.html","kind":"module","full_name":"Clear::Migration::Helper","name":"Helper","abstract":false,"ancestors":[{"html_id":"clear/Clear/Migration/FullTextSearchableHelpers","kind":"module","full_name":"Clear::Migration::FullTextSearchableHelpers","name":"FullTextSearchableHelpers"}],"locations":[{"filename":"src/clear/extensions/enum/migration.cr","line_number":38,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/enum/migration.cr#L38"},{"filename":"src/clear/extensions/full_text_searchable/full_text_searchable.cr","line_number":12,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/full_text_searchable/full_text_searchable.cr#L12"},{"filename":"src/clear/migration/migration.cr","line_number":67,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/migration.cr#L67"},{"filename":"src/clear/migration/operation/columns.cr","line_number":95,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/columns.cr#L95"},{"filename":"src/clear/migration/operation/indexes.cr","line_number":48,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/indexes.cr#L48"},{"filename":"src/clear/migration/operation/table.cr","line_number":229,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L229"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"TYPE_MAPPING","name":"TYPE_MAPPING","value":"{\"string\" => \"text\", \"int32\" => \"int\", \"int64\" => \"bigint\", \"long\" => \"bigint\", \"bigdecimal\" => \"numeric\", \"datetime\" => \"timestamp without time zone\"}"}],"included_modules":[{"html_id":"clear/Clear/Migration/FullTextSearchableHelpers","kind":"module","full_name":"Clear::Migration::FullTextSearchableHelpers","name":"FullTextSearchableHelpers"}],"including_types":[{"html_id":"clear/Clear/Migration","kind":"module","full_name":"Clear::Migration","name":"Migration"}],"namespace":{"html_id":"clear/Clear/Migration","kind":"module","full_name":"Clear::Migration","name":"Migration"},"class_methods":[{"html_id":"datatype(type:String)-class-method","name":"datatype","doc":"Replace some common type to their equivalent in postgresql\nif the type is not found in the correspondance table, then return\nitself","summary":"

Replace some common type to their equivalent in postgresql if the type is not found in the correspondance table, then return itself

","abstract":false,"args":[{"name":"type","external_name":"type","restriction":"String"}],"args_string":"(type : String)","args_html":"(type : String)","location":{"filename":"src/clear/migration/migration.cr","line_number":82,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/migration.cr#L82"},"def":{"name":"datatype","args":[{"name":"type","external_name":"type","restriction":"String"}],"visibility":"Public","body":"ts = type\nTYPE_MAPPING[type]? || ts\n"}}],"instance_methods":[{"html_id":"add_column(table,column,datatype,nullable=false,constraint=nil,default=nil,with_values=false)-instance-method","name":"add_column","doc":"Add a column to a specific table","summary":"

Add a column to a specific table

","abstract":false,"args":[{"name":"table","external_name":"table","restriction":""},{"name":"column","external_name":"column","restriction":""},{"name":"datatype","external_name":"datatype","restriction":""},{"name":"nullable","default_value":"false","external_name":"nullable","restriction":""},{"name":"constraint","default_value":"nil","external_name":"constraint","restriction":""},{"name":"default","default_value":"nil","external_name":"default","restriction":""},{"name":"with_values","default_value":"false","external_name":"with_values","restriction":""}],"args_string":"(table, column, datatype, nullable = false, constraint = nil, default = nil, with_values = false)","args_html":"(table, column, datatype, nullable = false, constraint = nil, default = nil, with_values = false)","location":{"filename":"src/clear/migration/operation/columns.cr","line_number":97,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/columns.cr#L97"},"def":{"name":"add_column","args":[{"name":"table","external_name":"table","restriction":""},{"name":"column","external_name":"column","restriction":""},{"name":"datatype","external_name":"datatype","restriction":""},{"name":"nullable","default_value":"false","external_name":"nullable","restriction":""},{"name":"constraint","default_value":"nil","external_name":"constraint","restriction":""},{"name":"default","default_value":"nil","external_name":"default","restriction":""},{"name":"with_values","default_value":"false","external_name":"with_values","restriction":""}],"visibility":"Public","body":"add_operation(Clear::Migration::AddColumn.new(table, column, datatype, nullable, constraint, default, with_values))"}},{"html_id":"add_operation(op:Operation)-instance-method","name":"add_operation","abstract":false,"args":[{"name":"op","external_name":"op","restriction":"Operation"}],"args_string":"(op : Operation)","args_html":"(op : Operation)","location":{"filename":"src/clear/migration/migration.cr","line_number":95,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/migration.cr#L95"},"def":{"name":"add_operation","args":[{"name":"op","external_name":"op","restriction":"Operation"}],"visibility":"Public","body":"op.migration = self\n@operations << op\n"}},{"html_id":"apply(dir:Direction=Clear::Migration::Direction::Up)-instance-method","name":"apply","doc":"This will apply the migration in a given direction (up or down)","summary":"

This will apply the migration in a given direction (up or down)

","abstract":false,"args":[{"name":"dir","default_value":"Clear::Migration::Direction::Up","external_name":"dir","restriction":"Direction"}],"args_string":"(dir : Direction = Clear::Migration::Direction::Up)","args_html":"(dir : Direction = Clear::Migration::Direction::Up)","location":{"filename":"src/clear/migration/migration.cr","line_number":103,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/migration.cr#L103"},"def":{"name":"apply","args":[{"name":"dir","default_value":"Clear::Migration::Direction::Up","external_name":"dir","restriction":"Direction"}],"visibility":"Public","body":"Clear::Migration::Manager.instance.ensure_ready\nClear::SQL.transaction do\n Log.info do\n \"[#{dir}] #{self.class.name}\"\n end\n @operations.clear\n change(dir)\n dir.up do\n @operations.each do |op|\n op.up.each do |x|\n Clear::SQL.execute(x.as(String))\n end\n end\n (SQL.insert(\"__clear_metadatas\", {metatype: \"migration\", value: uid.to_s})).execute\n end\n dir.down do\n @operations.reverse_each do |op|\n op.down.each do |x|\n Clear::SQL.execute(x.as(String))\n end\n end\n ((SQL.delete(\"__clear_metadatas\")).where({metatype: \"migration\", value: uid.to_s})).execute\n end\n self\nend\n"}},{"html_id":"change(dir)-instance-method","name":"change","abstract":true,"args":[{"name":"dir","external_name":"dir","restriction":""}],"args_string":"(dir)","args_html":"(dir)","location":{"filename":"src/clear/migration/migration.cr","line_number":100,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/migration.cr#L100"},"def":{"name":"change","args":[{"name":"dir","external_name":"dir","restriction":""}],"visibility":"Public","body":""}},{"html_id":"change_column_type(table,column,from,to)-instance-method","name":"change_column_type","abstract":false,"args":[{"name":"table","external_name":"table","restriction":""},{"name":"column","external_name":"column","restriction":""},{"name":"from","external_name":"from","restriction":""},{"name":"to","external_name":"to","restriction":""}],"args_string":"(table, column, from, to)","args_html":"(table, column, from, to)","location":{"filename":"src/clear/migration/operation/columns.cr","line_number":110,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/columns.cr#L110"},"def":{"name":"change_column_type","args":[{"name":"table","external_name":"table","restriction":""},{"name":"column","external_name":"column","restriction":""},{"name":"from","external_name":"from","restriction":""},{"name":"to","external_name":"to","restriction":""}],"visibility":"Public","body":"add_operation(Clear::Migration::ChangeColumnType.new(table, column, from, to))"}},{"html_id":"create_enum(name,arr:Enumerable(T))forallT-instance-method","name":"create_enum","abstract":false,"args":[{"name":"name","external_name":"name","restriction":""},{"name":"arr","external_name":"arr","restriction":"Enumerable(T)"}],"args_string":"(name, arr : Enumerable(T)) forall T","args_html":"(name, arr : Enumerable(T)) forall T","location":{"filename":"src/clear/extensions/enum/migration.cr","line_number":39,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/enum/migration.cr#L39"},"def":{"name":"create_enum","args":[{"name":"name","external_name":"name","restriction":""},{"name":"arr","external_name":"arr","restriction":"Enumerable(T)"}],"visibility":"Public","body":"add_operation(CreateEnum.new(name.to_s, arr.map(&.to_s)))"}},{"html_id":"create_enum(name,e)-instance-method","name":"create_enum","abstract":false,"args":[{"name":"name","external_name":"name","restriction":""},{"name":"e","external_name":"e","restriction":""}],"args_string":"(name, e)","args_html":"(name, e)","location":{"filename":"src/clear/extensions/enum/migration.cr","line_number":47,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/enum/migration.cr#L47"},"def":{"name":"create_enum","args":[{"name":"name","external_name":"name","restriction":""},{"name":"e","external_name":"e","restriction":""}],"visibility":"Public","body":"add_operation(CreateEnum.new(name.to_s, e.authorized_values))"}},{"html_id":"create_index(table,columns:Array(String),name=nil,using=nil,unique=false)-instance-method","name":"create_index","abstract":false,"args":[{"name":"table","external_name":"table","restriction":""},{"name":"columns","external_name":"columns","restriction":"Array(String)"},{"name":"name","default_value":"nil","external_name":"name","restriction":""},{"name":"using","default_value":"nil","external_name":"using","restriction":""},{"name":"unique","default_value":"false","external_name":"unique","restriction":""}],"args_string":"(table, columns : Array(String), name = nil, using = nil, unique = false)","args_html":"(table, columns : Array(String), name = nil, using = nil, unique = false)","location":{"filename":"src/clear/migration/operation/indexes.cr","line_number":56,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/indexes.cr#L56"},"def":{"name":"create_index","args":[{"name":"table","external_name":"table","restriction":""},{"name":"columns","external_name":"columns","restriction":"Array(String)"},{"name":"name","default_value":"nil","external_name":"name","restriction":""},{"name":"using","default_value":"nil","external_name":"using","restriction":""},{"name":"unique","default_value":"false","external_name":"unique","restriction":""}],"visibility":"Public","body":"add_operation(Clear::Migration::CreateIndex.new(table, fields: columns, name: name, using: using, unique: unique))"}},{"html_id":"create_index(table,column,name=nil,using=nil,unique=false)-instance-method","name":"create_index","doc":"Add a column to a specific table","summary":"

Add a column to a specific table

","abstract":false,"args":[{"name":"table","external_name":"table","restriction":""},{"name":"column","external_name":"column","restriction":""},{"name":"name","default_value":"nil","external_name":"name","restriction":""},{"name":"using","default_value":"nil","external_name":"using","restriction":""},{"name":"unique","default_value":"false","external_name":"unique","restriction":""}],"args_string":"(table, column, name = nil, using = nil, unique = false)","args_html":"(table, column, name = nil, using = nil, unique = false)","location":{"filename":"src/clear/migration/operation/indexes.cr","line_number":50,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/indexes.cr#L50"},"def":{"name":"create_index","args":[{"name":"table","external_name":"table","restriction":""},{"name":"column","external_name":"column","restriction":""},{"name":"name","default_value":"nil","external_name":"name","restriction":""},{"name":"using","default_value":"nil","external_name":"using","restriction":""},{"name":"unique","default_value":"false","external_name":"unique","restriction":""}],"visibility":"Public","body":"add_operation(Clear::Migration::CreateIndex.new(table, fields: [column], name: name, using: using, unique: unique))"}},{"html_id":"create_table(name,id:Symbol|Bool=true,schema=\"public\",&)-instance-method","name":"create_table","doc":"\nHelper used in migration to create a new table.\n\nUsage:\n\n```\ncreate_table(:users) do |t|\n t.column :first_name, :string\n t.column :last_name, :string\n t.column :email, :string, unique: true\n t.timestamps\nend\n```\n\nBy default, a column `id` of type `integer` will be created as primary key of the table.\nThis can be prevented using `primary: false`\n\n```\ncreate_table(:users, id: false) do |t|\n t.column :user_id, :integer, primary: true # Use custom name for the primary key\n t.column :first_name, :string\n t.column :last_name, :string\n t.column :email, :string, unique: true\n t.timestamps\nend\n```\n","summary":"

Helper used in migration to create a new table.

","abstract":false,"args":[{"name":"name","external_name":"name","restriction":""},{"name":"id","default_value":"true","external_name":"id","restriction":"Symbol | Bool"},{"name":"schema","default_value":"\"public\"","external_name":"schema","restriction":""}],"args_string":"(name, id : Symbol | Bool = true, schema = \"public\", &)","args_html":"(name, id : Symbol | Bool = true, schema = "public", &)","location":{"filename":"src/clear/migration/operation/table.cr","line_number":257,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L257"},"def":{"name":"create_table","args":[{"name":"name","external_name":"name","restriction":""},{"name":"id","default_value":"true","external_name":"id","restriction":"Symbol | Bool"},{"name":"schema","default_value":"\"public\"","external_name":"schema","restriction":""}],"yields":1,"block_arity":1,"visibility":"Public","body":"table = Table.new(name.to_s, schema.to_s, is_create: true)\nadd_operation(table)\ncase id\nwhen true, :bigserial\n table.column(\"id\", \"bigserial\", primary: true, null: false)\nwhen :serial\n table.column(\"id\", \"serial\", primary: true, null: false)\nwhen :uuid\n table.column(\"id\", \"uuid\", primary: true, null: false)\nwhen false\nelse\n raise(\"Unknown key type while try to create new table: `#{id}`. Candidates are :bigserial, :serial and :uuid\" + \"Please proceed with `id: false` and add the column manually\")\nend\nyield(table)\n"}},{"html_id":"drop_column(table,column,type)-instance-method","name":"drop_column","abstract":false,"args":[{"name":"table","external_name":"table","restriction":""},{"name":"column","external_name":"column","restriction":""},{"name":"type","external_name":"type","restriction":""}],"args_string":"(table, column, type)","args_html":"(table, column, type)","location":{"filename":"src/clear/migration/operation/columns.cr","line_number":102,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/columns.cr#L102"},"def":{"name":"drop_column","args":[{"name":"table","external_name":"table","restriction":""},{"name":"column","external_name":"column","restriction":""},{"name":"type","external_name":"type","restriction":""}],"visibility":"Public","body":"add_operation(Clear::Migration::RemoveColumn.new(table, column, type))"}},{"html_id":"drop_enum(name,arr:Enumerable(T)|Nil=nil)forallT-instance-method","name":"drop_enum","abstract":false,"args":[{"name":"name","external_name":"name","restriction":""},{"name":"arr","default_value":"nil","external_name":"arr","restriction":"Enumerable(T) | ::Nil"}],"args_string":"(name, arr : Enumerable(T) | Nil = nil) forall T","args_html":"(name, arr : Enumerable(T) | Nil = nil) forall T","location":{"filename":"src/clear/extensions/enum/migration.cr","line_number":43,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/enum/migration.cr#L43"},"def":{"name":"drop_enum","args":[{"name":"name","external_name":"name","restriction":""},{"name":"arr","default_value":"nil","external_name":"arr","restriction":"Enumerable(T) | ::Nil"}],"visibility":"Public","body":"add_operation(DropEnum.new(name.to_s, arr.try(&.map(&.to_s))))"}},{"html_id":"execute(sql:String)-instance-method","name":"execute","abstract":false,"args":[{"name":"sql","external_name":"sql","restriction":"String"}],"args_string":"(sql : String)","args_html":"(sql : String)","location":{"filename":"src/clear/migration/migration.cr","line_number":91,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/migration.cr#L91"},"def":{"name":"execute","args":[{"name":"sql","external_name":"sql","restriction":"String"}],"visibility":"Public","body":"@operations << (Clear::Migration::Execute.new(sql))"}},{"html_id":"irreversible!-instance-method","name":"irreversible!","abstract":false,"location":{"filename":"src/clear/migration/migration.cr","line_number":87,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/migration.cr#L87"},"def":{"name":"irreversible!","visibility":"Public","body":"raise(IrreversibleMigration.new(migration_irreversible(self.class.name)))"}},{"html_id":"rename_column(table,from,to)-instance-method","name":"rename_column","abstract":false,"args":[{"name":"table","external_name":"table","restriction":""},{"name":"from","external_name":"from","restriction":""},{"name":"to","external_name":"to","restriction":""}],"args_string":"(table, from, to)","args_html":"(table, from, to)","location":{"filename":"src/clear/migration/operation/columns.cr","line_number":106,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/columns.cr#L106"},"def":{"name":"rename_column","args":[{"name":"table","external_name":"table","restriction":""},{"name":"from","external_name":"from","restriction":""},{"name":"to","external_name":"to","restriction":""}],"visibility":"Public","body":"add_operation(Clear::Migration::RenameColumn.new(table, from, to))"}}]},{"html_id":"clear/Clear/Migration/IrreversibleMigration","path":"Clear/Migration/IrreversibleMigration.html","kind":"class","full_name":"Clear::Migration::IrreversibleMigration","name":"IrreversibleMigration","abstract":false,"superclass":{"html_id":"clear/Exception","kind":"class","full_name":"Exception","name":"Exception"},"ancestors":[{"html_id":"clear/Exception","kind":"class","full_name":"Exception","name":"Exception"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/migration/migration.cr","line_number":65,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/migration.cr#L65"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Migration","kind":"module","full_name":"Clear::Migration","name":"Migration"},"doc":"This error is throw when you try to revert a migration which is irreversible.","summary":"

This error is throw when you try to revert a migration which is irreversible.

"},{"html_id":"clear/Clear/Migration/Manager","path":"Clear/Migration/Manager.html","kind":"class","full_name":"Clear::Migration::Manager","name":"Manager","abstract":false,"superclass":{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"clear/Clear/ErrorMessages","kind":"module","full_name":"Clear::ErrorMessages","name":"ErrorMessages"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/migration/manager.cr","line_number":11,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/manager.cr#L11"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"METADATA_VERSION","name":"METADATA_VERSION","value":"\"1\"","doc":"Used to migrate between metadata version, in case we need it in the future.","summary":"

Used to migrate between metadata version, in case we need it in the future.

"}],"included_modules":[{"html_id":"clear/Clear/ErrorMessages","kind":"module","full_name":"Clear::ErrorMessages","name":"ErrorMessages"}],"namespace":{"html_id":"clear/Clear/Migration","kind":"module","full_name":"Clear::Migration","name":"Migration"},"doc":"The migration manager is a singleton, it load all the migrations,\ncheck which one are `up` and `down`, and can trigger one or multiple\ndowngrade / upgrade of the database.\n\nThe migration system needs the creation of a table named `__clear_metadatas`\nin your database. This table will be created automatically on the first\ninitialization of the Migration Manager.\n","summary":"

The migration manager is a singleton, it load all the migrations, check which one are #up and #down, and can trigger one or multiple downgrade / upgrade of the database.

","class_methods":[{"html_id":"instance-class-method","name":"instance","doc":"To access to the manager\n\n```\nClear::Migration::Manager.instance\n```","summary":"

To access to the manager

","abstract":false,"location":{"filename":"src/clear/migration/manager.cr","line_number":22,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/manager.cr#L22"},"def":{"name":"instance","visibility":"Public","body":"@@instance || (@@instance = Manager.new)"}}],"instance_methods":[{"html_id":"apply_all-instance-method","name":"apply_all","doc":"Apply all the migrations not yet applied.","summary":"

Apply all the migrations not yet applied.

","abstract":false,"location":{"filename":"src/clear/migration/manager.cr","line_number":141,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/manager.cr#L141"},"def":{"name":"apply_all","visibility":"Public","body":"ensure_ready\nClear::View.apply(:drop)\nlist_of_migrations = @migrations.sort do |a, b|\n a.uid <=> b.uid\nend\nlist_of_migrations.reject! do |x|\n @migrations_up.includes?(x.uid)\nend\nlist_of_migrations.each do |migration|\n migration.apply\n @migrations_up.add(migration.uid)\nend\nClear::View.apply(:create)\n"}},{"html_id":"apply_to(version,direction=:both)-instance-method","name":"apply_to","abstract":false,"args":[{"name":"version","external_name":"version","restriction":""},{"name":"direction","default_value":":both","external_name":"direction","restriction":""}],"args_string":"(version, direction = :both)","args_html":"(version, direction = :both)","location":{"filename":"src/clear/migration/manager.cr","line_number":73,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/manager.cr#L73"},"def":{"name":"apply_to","args":[{"name":"version","external_name":"version","restriction":""},{"name":"direction","default_value":":both","external_name":"direction","restriction":""}],"visibility":"Public","body":"ensure_ready\nlist_of_migrations = @migrations.sort do |a, b|\n a.uid <=> b.uid\nend\nversion = compute_version(version, list_of_migrations)\noperations = [] of ::Tuple(Int64, Migration::Direction)\nuid_to_apply = list_of_migrations.map(&.uid).reject(&.>(version)) - @migrations_up.to_a\nuid_to_apply.each do |uid|\n operations << {uid, Migration::Direction::Up}\nend\nuid_to_apply = list_of_migrations.map(&.uid).select(&.>(version)) & @migrations_up.to_a\nuid_to_apply.each do |uid|\n operations << {uid, Migration::Direction::Down}\nend\noperations.sort! do |a, b|\n if a[1].up?\n if b[1].down?\n 1\n else\n a[0] <=> b[0]\n end\n else\n if b[1].down?\n b[0] <=> a[0]\n else\n 0\n end\n end\nend\nif operations.empty?\n Log.info do\n \"Nothing to do.\"\n end\n return\nend\nLog.info do\n \"Migrations will be applied (in this order):\"\nend\noperations.each do |__temp_94|\n uid, d = __temp_94\n Log.info do\n \"#{d.up? ? \"[ UP ]\" : \"[DOWN]\"} #{uid} - #{(find(uid)).class.name}\"\n end\nend\noperations.each do |__temp_95|\n uid, d = __temp_95\n if (direction == (:both)) || (direction == (:up))\n d.up do\n up(uid)\n end\n end\n if (direction == (:both)) || (direction == (:down))\n d.down do\n down(uid)\n end\n end\nend\n"}},{"html_id":"commited?(m:Clear::Migration)-instance-method","name":"commited?","doc":"Return `true` if the migration has been commited (already applied into the database)\nor `false` otherwise","summary":"

Return true if the migration has been commited (already applied into the database) or false otherwise

","abstract":false,"args":[{"name":"m","external_name":"m","restriction":"Clear::Migration"}],"args_string":"(m : Clear::Migration)","args_html":"(m : Clear::Migration)","location":{"filename":"src/clear/migration/manager.cr","line_number":159,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/manager.cr#L159"},"def":{"name":"commited?","args":[{"name":"m","external_name":"m","restriction":"Clear::Migration"}],"visibility":"Public","body":"@migrations_up.includes?(m.uid)"}},{"html_id":"current_version-instance-method","name":"current_version","abstract":false,"location":{"filename":"src/clear/migration/manager.cr","line_number":46,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/manager.cr#L46"},"def":{"name":"current_version","visibility":"Public","body":"ensure_ready\nif @migrations_up.empty?\n return nil\nend\n@migrations_up.max\n"}},{"html_id":"down(number:Int64):Nil-instance-method","name":"down","doc":"Force down a migration; throw error if the mgiration is already down","summary":"

Force down a migration; throw error if the mgiration is already down

","abstract":false,"args":[{"name":"number","external_name":"number","restriction":"Int64"}],"args_string":"(number : Int64) : Nil","args_html":"(number : Int64) : Nil","location":{"filename":"src/clear/migration/manager.cr","line_number":232,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/manager.cr#L232"},"def":{"name":"down","args":[{"name":"number","external_name":"number","restriction":"Int64"}],"return_type":"Nil","visibility":"Public","body":"m = find(number)\nif migrations_up.includes?(number)\nelse\n raise(migration_already_down(number))\nend\nm.apply(Clear::Migration::Direction::Down)\n@migrations_up.delete(m.uid)\n"}},{"html_id":"ensure_ready-instance-method","name":"ensure_ready","doc":"Create if needed the metadata table\nto save the migrations.","summary":"

Create if needed the metadata table to save the migrations.

","abstract":false,"location":{"filename":"src/clear/migration/manager.cr","line_number":165,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/manager.cr#L165"},"def":{"name":"ensure_ready","visibility":"Public","body":"if @loaded\nelse\n Clear::SQL.execute(\" CREATE TABLE IF NOT EXISTS __clear_metadatas ( metatype text NOT NULL, value text NOT NULL );\")\n Clear::SQL.execute(\" CREATE UNIQUE INDEX IF NOT EXISTS __clear_metadatas_idx ON __clear_metadatas (metatype, value);\")\n load_existing_migrations\n ensure_unicity!\n @loaded = true\nend"}},{"html_id":"find(number)-instance-method","name":"find","doc":"Fetch the migration instance with the selected number","summary":"

Fetch the migration instance with the selected number

","abstract":false,"args":[{"name":"number","external_name":"number","restriction":""}],"args_string":"(number)","args_html":"(number)","location":{"filename":"src/clear/migration/manager.cr","line_number":216,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/manager.cr#L216"},"def":{"name":"find","args":[{"name":"number","external_name":"number","restriction":""}],"visibility":"Public","body":"number = Int64.new(number)\n@migrations.find() do |__arg6|\n __arg6.uid == number\nend || (raise(migration_not_found(number)))\n"}},{"html_id":"load_existing_migrations-instance-method","name":"load_existing_migrations","doc":"Fetch all the migrations already activated on the database.","summary":"

Fetch all the migrations already activated on the database.

","abstract":false,"location":{"filename":"src/clear/migration/manager.cr","line_number":203,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/manager.cr#L203"},"def":{"name":"load_existing_migrations","visibility":"Public","body":"@migrations_up.clear\n((Clear::SQL.select(\"*\")).from(\"__clear_metadatas\")).where(metatype: \"migration\").map do |m|\n @migrations_up.add(Int64.new(m[\"value\"].as(String)))\nend\n"}},{"html_id":"max_version-instance-method","name":"max_version","abstract":false,"location":{"filename":"src/clear/migration/manager.cr","line_number":54,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/manager.cr#L54"},"def":{"name":"max_version","visibility":"Public","body":"if @migrations.size > 0\n @migrations.max_of(&.uid)\nelse\n nil\nend"}},{"html_id":"migrations_up-instance-method","name":"migrations_up","abstract":false,"location":{"filename":"src/clear/migration/manager.cr","line_number":33,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/manager.cr#L33"},"def":{"name":"migrations_up","visibility":"Public","body":"ensure_ready\n@migrations_up\n"}},{"html_id":"print_status:String-instance-method","name":"print_status","doc":"Print out the status ( up | down ) of all migrations found by the manager.","summary":"

Print out the status ( up | down ) of all migrations found by the manager.

","abstract":false,"location":{"filename":"src/clear/migration/manager.cr","line_number":242,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/manager.cr#L242"},"def":{"name":"print_status","return_type":"String","visibility":"Public","body":"ensure_ready\n@migrations.sort do |a, b|\n (a.as(Clear::Migration)).uid <=> (b.as(Clear::Migration)).uid\nend.join(\"\\n\") do |m|\n active = @migrations_up.includes?(m.uid)\n \"[#{active ? \"✓\".colorize.green : \"✗\".colorize.red}] #{m.uid} - #{m.class.name}\"\nend\n"}},{"html_id":"refresh-instance-method","name":"refresh","abstract":false,"location":{"filename":"src/clear/migration/manager.cr","line_number":211,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/manager.cr#L211"},"def":{"name":"refresh","visibility":"Public","body":"load_existing_migrations"}},{"html_id":"reinit!-instance-method","name":"reinit!","doc":"Force reloading the migration system\nRecheck all the current up migrations\nand the metadata table.\nThis is useful if you access to the migration process\nthrough another program, or during specs","summary":"

Force reloading the migration system Recheck all the current up migrations and the metadata table.

","abstract":false,"location":{"filename":"src/clear/migration/manager.cr","line_number":187,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/manager.cr#L187"},"def":{"name":"reinit!","visibility":"Public","body":"@loaded = false\nensure_ready\nself\n"}},{"html_id":"up(number:Int64):Nil-instance-method","name":"up","doc":"Force up a migration; throw error if the migration is already up","summary":"

Force up a migration; throw error if the migration is already up

","abstract":false,"args":[{"name":"number","external_name":"number","restriction":"Int64"}],"args_string":"(number : Int64) : Nil","args_html":"(number : Int64) : Nil","location":{"filename":"src/clear/migration/manager.cr","line_number":222,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/manager.cr#L222"},"def":{"name":"up","args":[{"name":"number","external_name":"number","restriction":"Int64"}],"return_type":"Nil","visibility":"Public","body":"m = find(number)\nif migrations_up.includes?(number)\n raise(migration_already_up(number))\nend\nm.apply\n@migrations_up.add(m.uid)\n"}}]},{"html_id":"clear/Clear/Migration/Operation","path":"Clear/Migration/Operation.html","kind":"class","full_name":"Clear::Migration::Operation","name":"Operation","abstract":true,"superclass":{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"clear/Clear/ErrorMessages","kind":"module","full_name":"Clear::ErrorMessages","name":"ErrorMessages"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/migration/operation/operation.cr","line_number":2,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/operation.cr#L2"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"clear/Clear/ErrorMessages","kind":"module","full_name":"Clear::ErrorMessages","name":"ErrorMessages"}],"subclasses":[{"html_id":"clear/Clear/Migration/AddColumn","kind":"class","full_name":"Clear::Migration::AddColumn","name":"AddColumn"},{"html_id":"clear/Clear/Migration/AddTable","kind":"class","full_name":"Clear::Migration::AddTable","name":"AddTable"},{"html_id":"clear/Clear/Migration/ChangeColumnType","kind":"class","full_name":"Clear::Migration::ChangeColumnType","name":"ChangeColumnType"},{"html_id":"clear/Clear/Migration/CreateEnum","kind":"class","full_name":"Clear::Migration::CreateEnum","name":"CreateEnum"},{"html_id":"clear/Clear/Migration/CreateIndex","kind":"class","full_name":"Clear::Migration::CreateIndex","name":"CreateIndex"},{"html_id":"clear/Clear/Migration/DropEnum","kind":"class","full_name":"Clear::Migration::DropEnum","name":"DropEnum"},{"html_id":"clear/Clear/Migration/DropTable","kind":"class","full_name":"Clear::Migration::DropTable","name":"DropTable"},{"html_id":"clear/Clear/Migration/Execute","kind":"class","full_name":"Clear::Migration::Execute","name":"Execute"},{"html_id":"clear/Clear/Migration/FullTextSearchableOperation","kind":"class","full_name":"Clear::Migration::FullTextSearchableOperation","name":"FullTextSearchableOperation"},{"html_id":"clear/Clear/Migration/RemoveColumn","kind":"class","full_name":"Clear::Migration::RemoveColumn","name":"RemoveColumn"},{"html_id":"clear/Clear/Migration/RenameColumn","kind":"class","full_name":"Clear::Migration::RenameColumn","name":"RenameColumn"},{"html_id":"clear/Clear/Migration/Table","kind":"class","full_name":"Clear::Migration::Table","name":"Table"}],"namespace":{"html_id":"clear/Clear/Migration","kind":"module","full_name":"Clear::Migration","name":"Migration"},"instance_methods":[{"html_id":"down:Array(String)-instance-method","name":"down","abstract":true,"location":{"filename":"src/clear/migration/operation/operation.cr","line_number":8,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/operation.cr#L8"},"def":{"name":"down","return_type":"Array(String)","visibility":"Public","body":""}},{"html_id":"irreversible!(operation_name:String|Nil=nil)-instance-method","name":"irreversible!","abstract":false,"args":[{"name":"operation_name","default_value":"nil","external_name":"operation_name","restriction":"String | ::Nil"}],"args_string":"(operation_name : String | Nil = nil)","args_html":"(operation_name : String | Nil = nil)","location":{"filename":"src/clear/migration/operation/operation.cr","line_number":10,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/operation.cr#L10"},"def":{"name":"irreversible!","args":[{"name":"operation_name","default_value":"nil","external_name":"operation_name","restriction":"String | ::Nil"}],"visibility":"Public","body":"operation_name || (operation_name = self.class.name)\nmigration_name = migration ? migration.class.name : nil\nraise(IrreversibleMigration.new(migration_irreversible(migration_name, operation_name)))\n"}},{"html_id":"migration:Clear::Migration|Nil-instance-method","name":"migration","abstract":false,"location":{"filename":"src/clear/migration/operation/operation.cr","line_number":5,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/operation.cr#L5"},"def":{"name":"migration","return_type":"Clear::Migration | ::Nil","visibility":"Public","body":"@migration"}},{"html_id":"migration=(migration:Clear::Migration|Nil)-instance-method","name":"migration=","abstract":false,"args":[{"name":"migration","external_name":"migration","restriction":"Clear::Migration | ::Nil"}],"args_string":"(migration : Clear::Migration | Nil)","args_html":"(migration : Clear::Migration | Nil)","location":{"filename":"src/clear/migration/operation/operation.cr","line_number":5,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/operation.cr#L5"},"def":{"name":"migration=","args":[{"name":"migration","external_name":"migration","restriction":"Clear::Migration | ::Nil"}],"visibility":"Public","body":"@migration = migration"}},{"html_id":"up:Array(String)-instance-method","name":"up","abstract":true,"location":{"filename":"src/clear/migration/operation/operation.cr","line_number":7,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/operation.cr#L7"},"def":{"name":"up","return_type":"Array(String)","visibility":"Public","body":""}}]},{"html_id":"clear/Clear/Migration/RemoveColumn","path":"Clear/Migration/RemoveColumn.html","kind":"class","full_name":"Clear::Migration::RemoveColumn","name":"RemoveColumn","abstract":false,"superclass":{"html_id":"clear/Clear/Migration/Operation","kind":"class","full_name":"Clear::Migration::Operation","name":"Operation"},"ancestors":[{"html_id":"clear/Clear/Migration/Operation","kind":"class","full_name":"Clear::Migration::Operation","name":"Operation"},{"html_id":"clear/Clear/ErrorMessages","kind":"module","full_name":"Clear::ErrorMessages","name":"ErrorMessages"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/migration/operation/columns.cr","line_number":39,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/columns.cr#L39"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Migration","kind":"module","full_name":"Clear::Migration","name":"Migration"},"constructors":[{"html_id":"new(table:String,column:String,datatype)-class-method","name":"new","abstract":false,"args":[{"name":"table","external_name":"table","restriction":"::String"},{"name":"column","external_name":"column","restriction":"::String"},{"name":"datatype","external_name":"datatype","restriction":""}],"args_string":"(table : String, column : String, datatype)","args_html":"(table : String, column : String, datatype)","location":{"filename":"src/clear/migration/operation/columns.cr","line_number":44,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/columns.cr#L44"},"def":{"name":"new","args":[{"name":"table","external_name":"table","restriction":"::String"},{"name":"column","external_name":"column","restriction":"::String"},{"name":"datatype","external_name":"datatype","restriction":""}],"visibility":"Public","body":"_ = allocate\n_.initialize(table, column, datatype)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"down:Array(String)-instance-method","name":"down","abstract":false,"location":{"filename":"src/clear/migration/operation/columns.cr","line_number":52,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/columns.cr#L52"},"def":{"name":"down","return_type":"Array(String)","visibility":"Public","body":"[\"ALTER TABLE #{@table} ADD #{@column} #{@datatype}\"]"}},{"html_id":"up:Array(String)-instance-method","name":"up","abstract":false,"location":{"filename":"src/clear/migration/operation/columns.cr","line_number":48,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/columns.cr#L48"},"def":{"name":"up","return_type":"Array(String)","visibility":"Public","body":"[\"ALTER TABLE #{@table} DROP #{@column}\"]"}}]},{"html_id":"clear/Clear/Migration/RenameColumn","path":"Clear/Migration/RenameColumn.html","kind":"class","full_name":"Clear::Migration::RenameColumn","name":"RenameColumn","abstract":false,"superclass":{"html_id":"clear/Clear/Migration/Operation","kind":"class","full_name":"Clear::Migration::Operation","name":"Operation"},"ancestors":[{"html_id":"clear/Clear/Migration/Operation","kind":"class","full_name":"Clear::Migration::Operation","name":"Operation"},{"html_id":"clear/Clear/ErrorMessages","kind":"module","full_name":"Clear::ErrorMessages","name":"ErrorMessages"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/migration/operation/columns.cr","line_number":57,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/columns.cr#L57"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Migration","kind":"module","full_name":"Clear::Migration","name":"Migration"},"constructors":[{"html_id":"new(table:String,old_column_name:String,new_column_name:String)-class-method","name":"new","abstract":false,"args":[{"name":"table","external_name":"table","restriction":"::String"},{"name":"old_column_name","external_name":"old_column_name","restriction":"::String"},{"name":"new_column_name","external_name":"new_column_name","restriction":"::String"}],"args_string":"(table : String, old_column_name : String, new_column_name : String)","args_html":"(table : String, old_column_name : String, new_column_name : String)","location":{"filename":"src/clear/migration/operation/columns.cr","line_number":62,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/columns.cr#L62"},"def":{"name":"new","args":[{"name":"table","external_name":"table","restriction":"::String"},{"name":"old_column_name","external_name":"old_column_name","restriction":"::String"},{"name":"new_column_name","external_name":"new_column_name","restriction":"::String"}],"visibility":"Public","body":"_ = allocate\n_.initialize(table, old_column_name, new_column_name)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"down:Array(String)-instance-method","name":"down","abstract":false,"location":{"filename":"src/clear/migration/operation/columns.cr","line_number":69,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/columns.cr#L69"},"def":{"name":"down","return_type":"Array(String)","visibility":"Public","body":"[\"ALTER TABLE #{@table} RENAME COLUMN #{@new_column_name} TO #{@old_column_name};\"]"}},{"html_id":"up:Array(String)-instance-method","name":"up","abstract":false,"location":{"filename":"src/clear/migration/operation/columns.cr","line_number":65,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/columns.cr#L65"},"def":{"name":"up","return_type":"Array(String)","visibility":"Public","body":"[\"ALTER TABLE #{@table} RENAME COLUMN #{@old_column_name} TO #{@new_column_name};\"]"}}]},{"html_id":"clear/Clear/Migration/Table","path":"Clear/Migration/Table.html","kind":"class","full_name":"Clear::Migration::Table","name":"Table","abstract":false,"superclass":{"html_id":"clear/Clear/Migration/Operation","kind":"class","full_name":"Clear::Migration::Operation","name":"Operation"},"ancestors":[{"html_id":"clear/Clear/Migration/FullTextSearchableTableHelpers","kind":"module","full_name":"Clear::Migration::FullTextSearchableTableHelpers","name":"FullTextSearchableTableHelpers"},{"html_id":"clear/Clear/Migration/Operation","kind":"class","full_name":"Clear::Migration::Operation","name":"Operation"},{"html_id":"clear/Clear/ErrorMessages","kind":"module","full_name":"Clear::ErrorMessages","name":"ErrorMessages"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/extensions/full_text_searchable/full_text_searchable.cr","line_number":8,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/full_text_searchable/full_text_searchable.cr#L8"},{"filename":"src/clear/migration/operation/table.cr","line_number":3,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L3"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"clear/Clear/Migration/FullTextSearchableTableHelpers","kind":"module","full_name":"Clear::Migration::FullTextSearchableTableHelpers","name":"FullTextSearchableTableHelpers"}],"namespace":{"html_id":"clear/Clear/Migration","kind":"module","full_name":"Clear::Migration","name":"Migration"},"doc":"Reopen Table to add the helpers","summary":"

Reopen Table to add the helpers

","constructors":[{"html_id":"new(name:String,schema:String,is_create:Bool)-class-method","name":"new","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"::String"},{"name":"schema","external_name":"schema","restriction":"::String"},{"name":"is_create","external_name":"is_create","restriction":"::Bool"}],"args_string":"(name : String, schema : String, is_create : Bool)","args_html":"(name : String, schema : String, is_create : Bool)","location":{"filename":"src/clear/migration/operation/table.cr","line_number":23,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L23"},"def":{"name":"new","args":[{"name":"name","external_name":"name","restriction":"::String"},{"name":"schema","external_name":"schema","restriction":"::String"},{"name":"is_create","external_name":"is_create","restriction":"::Bool"}],"visibility":"Public","body":"_ = allocate\n_.initialize(name, schema, is_create)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"add_column(column,type,default=nil,null=true,primary=false,index=false,unique=false,array=false)-instance-method","name":"add_column","doc":"Add/alter a column for this table.","summary":"

Add/alter a column for this table.

","abstract":false,"args":[{"name":"column","external_name":"column","restriction":""},{"name":"type","external_name":"type","restriction":""},{"name":"default","default_value":"nil","external_name":"default","restriction":""},{"name":"null","default_value":"true","external_name":"null","restriction":""},{"name":"primary","default_value":"false","external_name":"primary","restriction":""},{"name":"index","default_value":"false","external_name":"index","restriction":""},{"name":"unique","default_value":"false","external_name":"unique","restriction":""},{"name":"array","default_value":"false","external_name":"array","restriction":""}],"args_string":"(column, type, default = nil, null = true, primary = false, index = false, unique = false, array = false)","args_html":"(column, type, default = nil, null = true, primary = false, index = false, unique = false, array = false)","location":{"filename":"src/clear/migration/operation/table.cr","line_number":52,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L52"},"def":{"name":"add_column","args":[{"name":"column","external_name":"column","restriction":""},{"name":"type","external_name":"type","restriction":""},{"name":"default","default_value":"nil","external_name":"default","restriction":""},{"name":"null","default_value":"true","external_name":"null","restriction":""},{"name":"primary","default_value":"false","external_name":"primary","restriction":""},{"name":"index","default_value":"false","external_name":"index","restriction":""},{"name":"unique","default_value":"false","external_name":"unique","restriction":""},{"name":"array","default_value":"false","external_name":"array","restriction":""}],"visibility":"Public","body":"self.column_operations << ColumnOperation.new(column: column.to_s, type: type.to_s, default: default, null: null, primary: primary, array: array)\nif unique\n add_index(fields: [column.to_s], unique: true)\nelse\n if index\n if index.is_a?(Bool)\n add_index(fields: [column.to_s], unique: false)\n else\n add_index(fields: [column.to_s], unique: false, using: index)\n end\n end\nend\n"}},{"html_id":"add_fkey(fields:Array(String),table:String,foreign_fields:Array(String),on_delete:String,primary:Bool)-instance-method","name":"add_fkey","abstract":false,"args":[{"name":"fields","external_name":"fields","restriction":"Array(String)"},{"name":"table","external_name":"table","restriction":"String"},{"name":"foreign_fields","external_name":"foreign_fields","restriction":"Array(String)"},{"name":"on_delete","external_name":"on_delete","restriction":"String"},{"name":"primary","external_name":"primary","restriction":"Bool"}],"args_string":"(fields : Array(String), table : String, foreign_fields : Array(String), on_delete : String, primary : Bool)","args_html":"(fields : Array(String), table : String, foreign_fields : Array(String), on_delete : String, primary : Bool)","location":{"filename":"src/clear/migration/operation/table.cr","line_number":45,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L45"},"def":{"name":"add_fkey","args":[{"name":"fields","external_name":"fields","restriction":"Array(String)"},{"name":"table","external_name":"table","restriction":"String"},{"name":"foreign_fields","external_name":"foreign_fields","restriction":"Array(String)"},{"name":"on_delete","external_name":"on_delete","restriction":"String"},{"name":"primary","external_name":"primary","restriction":"Bool"}],"visibility":"Public","body":"self.fkey_operations << FkeyOperation.new(fields: fields, table: table, foreign_fields: foreign_fields, on_delete: on_delete, primary: primary)"}},{"html_id":"column(name,type,default=nil,null=true,primary=false,index=false,unique=false,array=false)-instance-method","name":"column","abstract":false,"args":[{"name":"name","external_name":"name","restriction":""},{"name":"type","external_name":"type","restriction":""},{"name":"default","default_value":"nil","external_name":"default","restriction":""},{"name":"null","default_value":"true","external_name":"null","restriction":""},{"name":"primary","default_value":"false","external_name":"primary","restriction":""},{"name":"index","default_value":"false","external_name":"index","restriction":""},{"name":"unique","default_value":"false","external_name":"unique","restriction":""},{"name":"array","default_value":"false","external_name":"array","restriction":""}],"args_string":"(name, type, default = nil, null = true, primary = false, index = false, unique = false, array = false)","args_html":"(name, type, default = nil, null = true, primary = false, index = false, unique = false, array = false)","location":{"filename":"src/clear/migration/operation/table.cr","line_number":167,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L167"},"def":{"name":"column","args":[{"name":"name","external_name":"name","restriction":""},{"name":"type","external_name":"type","restriction":""},{"name":"default","default_value":"nil","external_name":"default","restriction":""},{"name":"null","default_value":"true","external_name":"null","restriction":""},{"name":"primary","default_value":"false","external_name":"primary","restriction":""},{"name":"index","default_value":"false","external_name":"index","restriction":""},{"name":"unique","default_value":"false","external_name":"unique","restriction":""},{"name":"array","default_value":"false","external_name":"array","restriction":""}],"visibility":"Public","body":"type = case type.to_s\nwhen \"string\"\n \"text\"\nwhen \"int32\", \"integer\"\n \"integer\"\nwhen \"int64\", \"long\"\n \"bigint\"\nwhen \"bigdecimal\", \"numeric\"\n \"numeric\"\nwhen \"datetime\"\n \"timestamp without time zone\"\nelse\n type.to_s\nend\nadd_column(name.to_s, type: type, default: default, null: null, primary: primary, index: index, unique: unique, array: array)\n"}},{"html_id":"column_operations:Array(ColumnOperation)-instance-method","name":"column_operations","abstract":false,"location":{"filename":"src/clear/migration/operation/table.cr","line_number":19,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L19"},"def":{"name":"column_operations","return_type":"Array(ColumnOperation)","visibility":"Public","body":"@column_operations"}},{"html_id":"down:Array(String)-instance-method","name":"down","abstract":false,"location":{"filename":"src/clear/migration/operation/table.cr","line_number":113,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L113"},"def":{"name":"down","return_type":"Array(String)","visibility":"Public","body":"[(if is_create?\n [\"DROP TABLE\", full_name].join(\" \")\nend)].compact"}},{"html_id":"fkey_operations:Array(FkeyOperation)-instance-method","name":"fkey_operations","abstract":false,"location":{"filename":"src/clear/migration/operation/table.cr","line_number":21,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L21"},"def":{"name":"fkey_operations","return_type":"Array(FkeyOperation)","visibility":"Public","body":"@fkey_operations"}},{"html_id":"full_name-instance-method","name":"full_name","abstract":false,"location":{"filename":"src/clear/migration/operation/table.cr","line_number":68,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L68"},"def":{"name":"full_name","visibility":"Public","body":"{Clear::SQL.escape(@schema), Clear::SQL.escape(@name)}.join(\".\")"}},{"html_id":"index(field:String|Symbol,name=nil,using=nil,unique=false)-instance-method","name":"index","doc":"Add or replace an index for this table.\nAlias for `add_index`","summary":"

Add or replace an index for this table.

","abstract":false,"args":[{"name":"field","external_name":"field","restriction":"String | Symbol"},{"name":"name","default_value":"nil","external_name":"name","restriction":""},{"name":"using","default_value":"nil","external_name":"using","restriction":""},{"name":"unique","default_value":"false","external_name":"unique","restriction":""}],"args_string":"(field : String | Symbol, name = nil, using = nil, unique = false)","args_html":"(field : String | Symbol, name = nil, using = nil, unique = false)","location":{"filename":"src/clear/migration/operation/table.cr","line_number":74,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L74"},"def":{"name":"index","args":[{"name":"field","external_name":"field","restriction":"String | Symbol"},{"name":"name","default_value":"nil","external_name":"name","restriction":""},{"name":"using","default_value":"nil","external_name":"using","restriction":""},{"name":"unique","default_value":"false","external_name":"unique","restriction":""}],"visibility":"Public","body":"add_index(fields: [field.to_s], name: name, using: using, unique: unique)"}},{"html_id":"index(fields:Array,name=nil,using=nil,unique=false)-instance-method","name":"index","abstract":false,"args":[{"name":"fields","external_name":"fields","restriction":"Array"},{"name":"name","default_value":"nil","external_name":"name","restriction":""},{"name":"using","default_value":"nil","external_name":"using","restriction":""},{"name":"unique","default_value":"false","external_name":"unique","restriction":""}],"args_string":"(fields : Array, name = nil, using = nil, unique = false)","args_html":"(fields : Array, name = nil, using = nil, unique = false)","location":{"filename":"src/clear/migration/operation/table.cr","line_number":78,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L78"},"def":{"name":"index","args":[{"name":"fields","external_name":"fields","restriction":"Array"},{"name":"name","default_value":"nil","external_name":"name","restriction":""},{"name":"using","default_value":"nil","external_name":"using","restriction":""},{"name":"unique","default_value":"false","external_name":"unique","restriction":""}],"visibility":"Public","body":"add_index(fields: fields.map(&.to_s), name: name, using: using, unique: unique)"}},{"html_id":"index_operations:Array(IndexOperation)-instance-method","name":"index_operations","abstract":false,"location":{"filename":"src/clear/migration/operation/table.cr","line_number":20,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L20"},"def":{"name":"index_operations","return_type":"Array(IndexOperation)","visibility":"Public","body":"@index_operations"}},{"html_id":"is_create?:Bool-instance-method","name":"is_create?","abstract":false,"location":{"filename":"src/clear/migration/operation/table.cr","line_number":17,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L17"},"def":{"name":"is_create?","return_type":"Bool","visibility":"Public","body":"@is_create"}},{"html_id":"name:String-instance-method","name":"name","abstract":false,"location":{"filename":"src/clear/migration/operation/table.cr","line_number":14,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L14"},"def":{"name":"name","return_type":"String","visibility":"Public","body":"@name"}},{"html_id":"references(to,name:String|Nil=nil,on_delete=\"restrict\",type=\"bigint\",null=false,foreign_key=\"id\",primary=false)-instance-method","name":"references","abstract":false,"args":[{"name":"to","external_name":"to","restriction":""},{"name":"name","default_value":"nil","external_name":"name","restriction":"String | ::Nil"},{"name":"on_delete","default_value":"\"restrict\"","external_name":"on_delete","restriction":""},{"name":"type","default_value":"\"bigint\"","external_name":"type","restriction":""},{"name":"null","default_value":"false","external_name":"null","restriction":""},{"name":"foreign_key","default_value":"\"id\"","external_name":"foreign_key","restriction":""},{"name":"primary","default_value":"false","external_name":"primary","restriction":""}],"args_string":"(to, name : String | Nil = nil, on_delete = \"restrict\", type = \"bigint\", null = false, foreign_key = \"id\", primary = false)","args_html":"(to, name : String | Nil = nil, on_delete = "restrict", type = "bigint", null = false, foreign_key = "id", primary = false)","location":{"filename":"src/clear/migration/operation/table.cr","line_number":35,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L35"},"def":{"name":"references","args":[{"name":"to","external_name":"to","restriction":""},{"name":"name","default_value":"nil","external_name":"name","restriction":"String | ::Nil"},{"name":"on_delete","default_value":"\"restrict\"","external_name":"on_delete","restriction":""},{"name":"type","default_value":"\"bigint\"","external_name":"type","restriction":""},{"name":"null","default_value":"false","external_name":"null","restriction":""},{"name":"foreign_key","default_value":"\"id\"","external_name":"foreign_key","restriction":""},{"name":"primary","default_value":"false","external_name":"primary","restriction":""}],"visibility":"Public","body":"name || (name = to.singularize.underscore + \"_id\")\nadd_column(name, type, null: null, index: true)\nadd_fkey(fields: [name.to_s], table: to.to_s, foreign_fields: [foreign_key.to_s], on_delete: on_delete.to_s, primary: primary)\n"}},{"html_id":"schema:String-instance-method","name":"schema","abstract":false,"location":{"filename":"src/clear/migration/operation/table.cr","line_number":15,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L15"},"def":{"name":"schema","return_type":"String","visibility":"Public","body":"@schema"}},{"html_id":"timestamps(null=false)-instance-method","name":"timestamps","doc":"Add the timestamps to the field.","summary":"

Add the timestamps to the field.

","abstract":false,"args":[{"name":"null","default_value":"false","external_name":"null","restriction":""}],"args_string":"(null = false)","args_html":"(null = false)","location":{"filename":"src/clear/migration/operation/table.cr","line_number":28,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L28"},"def":{"name":"timestamps","args":[{"name":"null","default_value":"false","external_name":"null","restriction":""}],"visibility":"Public","body":"add_column(:created_at, \"timestamp without time zone\", null: null, default: \"NOW()\")\nadd_column(:updated_at, \"timestamp without time zone\", null: null, default: \"NOW()\")\nadd_index([\"created_at\"])\nadd_index([\"updated_at\"])\n"}},{"html_id":"up:Array(String)-instance-method","name":"up","abstract":false,"location":{"filename":"src/clear/migration/operation/table.cr","line_number":97,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L97"},"def":{"name":"up","return_type":"Array(String)","visibility":"Public","body":"columns_and_fkeys = print_columns + print_fkeys\nif columns_and_fkeys.empty?\nelse\n content = \"(#{columns_and_fkeys.join(\", \")})\"\nend\narr = if is_create?\n [[\"CREATE TABLE\", full_name, content].compact.join(\" \")]\nelse\n [] of String\nend\narr + print_indexes\n"}}],"macros":[{"html_id":"method_missing(caller)-macro","name":"method_missing","doc":"DEPRECATED\nMethod missing is used to generate add_column using the method name as\ncolumn type (ActiveRecord's style)","summary":"

DEPRECATED Method missing is used to generate add_column using the method name as column type (ActiveRecord's style)

","abstract":false,"args":[{"name":"caller","external_name":"caller","restriction":""}],"args_string":"(caller)","args_html":"(caller)","location":{"filename":"src/clear/migration/operation/table.cr","line_number":162,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L162"},"def":{"name":"method_missing","args":[{"name":"caller","external_name":"caller","restriction":""}],"visibility":"Public","body":" \n{% raise(\"Migration: usage of Table##{caller.name} is deprecated.\\n\" + \"Tip: use instead `self.column(NAME, \\\"#{caller.name}\\\", ...)`\") %}\n\n \n"}}],"types":[{"html_id":"clear/Clear/Migration/Table/ColumnOperation","path":"Clear/Migration/Table/ColumnOperation.html","kind":"struct","full_name":"Clear::Migration::Table::ColumnOperation","name":"ColumnOperation","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/migration/operation/table.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L4"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Migration/Table","kind":"class","full_name":"Clear::Migration::Table","name":"Table"},"constructors":[{"html_id":"new(column:String,type:String,null:Bool=false,default:SQL::Any=nil,primary:Bool=false,array:Bool=false)-class-method","name":"new","abstract":false,"args":[{"name":"column","external_name":"column","restriction":"String"},{"name":"type","external_name":"type","restriction":"String"},{"name":"null","default_value":"false","external_name":"null","restriction":"Bool"},{"name":"default","default_value":"nil","external_name":"default","restriction":"SQL::Any"},{"name":"primary","default_value":"false","external_name":"primary","restriction":"Bool"},{"name":"array","default_value":"false","external_name":"array","restriction":"Bool"}],"args_string":"(column : String, type : String, null : Bool = false, default : SQL::Any = nil, primary : Bool = false, array : Bool = false)","args_html":"(column : String, type : String, null : Bool = false, default : SQL::Any = nil, primary : Bool = false, array : Bool = false)","location":{"filename":"src/clear/migration/operation/table.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L4"},"def":{"name":"new","args":[{"name":"column","external_name":"column","restriction":"String"},{"name":"type","external_name":"type","restriction":"String"},{"name":"null","default_value":"false","external_name":"null","restriction":"Bool"},{"name":"default","default_value":"nil","external_name":"default","restriction":"SQL::Any"},{"name":"primary","default_value":"false","external_name":"primary","restriction":"Bool"},{"name":"array","default_value":"false","external_name":"array","restriction":"Bool"}],"visibility":"Public","body":"_ = allocate\n_.initialize(column, type, null, default, primary, array)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"array:Bool-instance-method","name":"array","abstract":false,"def":{"name":"array","return_type":"Bool","visibility":"Public","body":"@array"}},{"html_id":"clone-instance-method","name":"clone","abstract":false,"location":{"filename":"src/clear/migration/operation/table.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L4"},"def":{"name":"clone","visibility":"Public","body":"self.class.new(@column.clone, @type.clone, @null.clone, @default.clone, @primary.clone, @array.clone)"}},{"html_id":"column:String-instance-method","name":"column","abstract":false,"def":{"name":"column","return_type":"String","visibility":"Public","body":"@column"}},{"html_id":"copy_with(column_column=@column,type_type=@type,null_null=@null,default_default=@default,primary_primary=@primary,array_array=@array)-instance-method","name":"copy_with","abstract":false,"args":[{"name":"_column","default_value":"@column","external_name":"column","restriction":""},{"name":"_type","default_value":"@type","external_name":"type","restriction":""},{"name":"_null","default_value":"@null","external_name":"null","restriction":""},{"name":"_default","default_value":"@default","external_name":"default","restriction":""},{"name":"_primary","default_value":"@primary","external_name":"primary","restriction":""},{"name":"_array","default_value":"@array","external_name":"array","restriction":""}],"args_string":"(column _column = @column, type _type = @type, null _null = @null, default _default = @default, primary _primary = @primary, array _array = @array)","args_html":"(column _column = @column, type _type = @type, null _null = @null, default _default = @default, primary _primary = @primary, array _array = @array)","location":{"filename":"src/clear/migration/operation/table.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L4"},"def":{"name":"copy_with","args":[{"name":"_column","default_value":"@column","external_name":"column","restriction":""},{"name":"_type","default_value":"@type","external_name":"type","restriction":""},{"name":"_null","default_value":"@null","external_name":"null","restriction":""},{"name":"_default","default_value":"@default","external_name":"default","restriction":""},{"name":"_primary","default_value":"@primary","external_name":"primary","restriction":""},{"name":"_array","default_value":"@array","external_name":"array","restriction":""}],"visibility":"Public","body":"self.class.new(_column, _type, _null, _default, _primary, _array)"}},{"html_id":"default:SQL::Any-instance-method","name":"default","abstract":false,"def":{"name":"default","return_type":"SQL::Any","visibility":"Public","body":"@default"}},{"html_id":"null:Bool-instance-method","name":"null","abstract":false,"def":{"name":"null","return_type":"Bool","visibility":"Public","body":"@null"}},{"html_id":"primary:Bool-instance-method","name":"primary","abstract":false,"def":{"name":"primary","return_type":"Bool","visibility":"Public","body":"@primary"}},{"html_id":"type:String-instance-method","name":"type","abstract":false,"def":{"name":"type","return_type":"String","visibility":"Public","body":"@type"}}]},{"html_id":"clear/Clear/Migration/Table/FkeyOperation","path":"Clear/Migration/Table/FkeyOperation.html","kind":"struct","full_name":"Clear::Migration::Table::FkeyOperation","name":"FkeyOperation","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/migration/operation/table.cr","line_number":11,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L11"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Migration/Table","kind":"class","full_name":"Clear::Migration::Table","name":"Table"},"constructors":[{"html_id":"new(fields:Array(String),table:String,foreign_fields:Array(String),on_delete:String,primary:Bool)-class-method","name":"new","abstract":false,"args":[{"name":"fields","external_name":"fields","restriction":"Array(String)"},{"name":"table","external_name":"table","restriction":"String"},{"name":"foreign_fields","external_name":"foreign_fields","restriction":"Array(String)"},{"name":"on_delete","external_name":"on_delete","restriction":"String"},{"name":"primary","external_name":"primary","restriction":"Bool"}],"args_string":"(fields : Array(String), table : String, foreign_fields : Array(String), on_delete : String, primary : Bool)","args_html":"(fields : Array(String), table : String, foreign_fields : Array(String), on_delete : String, primary : Bool)","location":{"filename":"src/clear/migration/operation/table.cr","line_number":11,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L11"},"def":{"name":"new","args":[{"name":"fields","external_name":"fields","restriction":"Array(String)"},{"name":"table","external_name":"table","restriction":"String"},{"name":"foreign_fields","external_name":"foreign_fields","restriction":"Array(String)"},{"name":"on_delete","external_name":"on_delete","restriction":"String"},{"name":"primary","external_name":"primary","restriction":"Bool"}],"visibility":"Public","body":"_ = allocate\n_.initialize(fields, table, foreign_fields, on_delete, primary)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"clone-instance-method","name":"clone","abstract":false,"location":{"filename":"src/clear/migration/operation/table.cr","line_number":11,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L11"},"def":{"name":"clone","visibility":"Public","body":"self.class.new(@fields.clone, @table.clone, @foreign_fields.clone, @on_delete.clone, @primary.clone)"}},{"html_id":"copy_with(fields_fields=@fields,table_table=@table,foreign_fields_foreign_fields=@foreign_fields,on_delete_on_delete=@on_delete,primary_primary=@primary)-instance-method","name":"copy_with","abstract":false,"args":[{"name":"_fields","default_value":"@fields","external_name":"fields","restriction":""},{"name":"_table","default_value":"@table","external_name":"table","restriction":""},{"name":"_foreign_fields","default_value":"@foreign_fields","external_name":"foreign_fields","restriction":""},{"name":"_on_delete","default_value":"@on_delete","external_name":"on_delete","restriction":""},{"name":"_primary","default_value":"@primary","external_name":"primary","restriction":""}],"args_string":"(fields _fields = @fields, table _table = @table, foreign_fields _foreign_fields = @foreign_fields, on_delete _on_delete = @on_delete, primary _primary = @primary)","args_html":"(fields _fields = @fields, table _table = @table, foreign_fields _foreign_fields = @foreign_fields, on_delete _on_delete = @on_delete, primary _primary = @primary)","location":{"filename":"src/clear/migration/operation/table.cr","line_number":11,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L11"},"def":{"name":"copy_with","args":[{"name":"_fields","default_value":"@fields","external_name":"fields","restriction":""},{"name":"_table","default_value":"@table","external_name":"table","restriction":""},{"name":"_foreign_fields","default_value":"@foreign_fields","external_name":"foreign_fields","restriction":""},{"name":"_on_delete","default_value":"@on_delete","external_name":"on_delete","restriction":""},{"name":"_primary","default_value":"@primary","external_name":"primary","restriction":""}],"visibility":"Public","body":"self.class.new(_fields, _table, _foreign_fields, _on_delete, _primary)"}},{"html_id":"fields:Array(String)-instance-method","name":"fields","abstract":false,"def":{"name":"fields","return_type":"Array(String)","visibility":"Public","body":"@fields"}},{"html_id":"foreign_fields:Array(String)-instance-method","name":"foreign_fields","abstract":false,"def":{"name":"foreign_fields","return_type":"Array(String)","visibility":"Public","body":"@foreign_fields"}},{"html_id":"on_delete:String-instance-method","name":"on_delete","abstract":false,"def":{"name":"on_delete","return_type":"String","visibility":"Public","body":"@on_delete"}},{"html_id":"primary:Bool-instance-method","name":"primary","abstract":false,"def":{"name":"primary","return_type":"Bool","visibility":"Public","body":"@primary"}},{"html_id":"table:String-instance-method","name":"table","abstract":false,"def":{"name":"table","return_type":"String","visibility":"Public","body":"@table"}}]},{"html_id":"clear/Clear/Migration/Table/IndexOperation","path":"Clear/Migration/Table/IndexOperation.html","kind":"struct","full_name":"Clear::Migration::Table::IndexOperation","name":"IndexOperation","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/migration/operation/table.cr","line_number":8,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L8"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Migration/Table","kind":"class","full_name":"Clear::Migration::Table","name":"Table"},"constructors":[{"html_id":"new(fields:Array(String),name:String,using:String|Nil=nil,unique:Bool=false)-class-method","name":"new","abstract":false,"args":[{"name":"fields","external_name":"fields","restriction":"Array(String)"},{"name":"name","external_name":"name","restriction":"String"},{"name":"using","default_value":"nil","external_name":"using","restriction":"String | ::Nil"},{"name":"unique","default_value":"false","external_name":"unique","restriction":"Bool"}],"args_string":"(fields : Array(String), name : String, using : String | Nil = nil, unique : Bool = false)","args_html":"(fields : Array(String), name : String, using : String | Nil = nil, unique : Bool = false)","location":{"filename":"src/clear/migration/operation/table.cr","line_number":8,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L8"},"def":{"name":"new","args":[{"name":"fields","external_name":"fields","restriction":"Array(String)"},{"name":"name","external_name":"name","restriction":"String"},{"name":"using","default_value":"nil","external_name":"using","restriction":"String | ::Nil"},{"name":"unique","default_value":"false","external_name":"unique","restriction":"Bool"}],"visibility":"Public","body":"_ = allocate\n_.initialize(fields, name, using, unique)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"clone-instance-method","name":"clone","abstract":false,"location":{"filename":"src/clear/migration/operation/table.cr","line_number":8,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L8"},"def":{"name":"clone","visibility":"Public","body":"self.class.new(@fields.clone, @name.clone, @using.clone, @unique.clone)"}},{"html_id":"copy_with(fields_fields=@fields,name_name=@name,using_using=@using,unique_unique=@unique)-instance-method","name":"copy_with","abstract":false,"args":[{"name":"_fields","default_value":"@fields","external_name":"fields","restriction":""},{"name":"_name","default_value":"@name","external_name":"name","restriction":""},{"name":"_using","default_value":"@using","external_name":"using","restriction":""},{"name":"_unique","default_value":"@unique","external_name":"unique","restriction":""}],"args_string":"(fields _fields = @fields, name _name = @name, using _using = @using, unique _unique = @unique)","args_html":"(fields _fields = @fields, name _name = @name, using _using = @using, unique _unique = @unique)","location":{"filename":"src/clear/migration/operation/table.cr","line_number":8,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/migration/operation/table.cr#L8"},"def":{"name":"copy_with","args":[{"name":"_fields","default_value":"@fields","external_name":"fields","restriction":""},{"name":"_name","default_value":"@name","external_name":"name","restriction":""},{"name":"_using","default_value":"@using","external_name":"using","restriction":""},{"name":"_unique","default_value":"@unique","external_name":"unique","restriction":""}],"visibility":"Public","body":"self.class.new(_fields, _name, _using, _unique)"}},{"html_id":"fields:Array(String)-instance-method","name":"fields","abstract":false,"def":{"name":"fields","return_type":"Array(String)","visibility":"Public","body":"@fields"}},{"html_id":"name:String-instance-method","name":"name","abstract":false,"def":{"name":"name","return_type":"String","visibility":"Public","body":"@name"}},{"html_id":"unique:Bool-instance-method","name":"unique","abstract":false,"def":{"name":"unique","return_type":"Bool","visibility":"Public","body":"@unique"}},{"html_id":"using:String|Nil-instance-method","name":"using","abstract":false,"def":{"name":"using","return_type":"String | ::Nil","visibility":"Public","body":"@using"}}]}]}]},{"html_id":"clear/Clear/Model","path":"Clear/Model.html","kind":"module","full_name":"Clear::Model","name":"Model","abstract":false,"ancestors":[{"html_id":"clear/Clear/Model/FullTextSearchable","kind":"module","full_name":"Clear::Model::FullTextSearchable","name":"FullTextSearchable"},{"html_id":"clear/Clear/Model/JSONDeserialize","kind":"module","full_name":"Clear::Model::JSONDeserialize","name":"JSONDeserialize"},{"html_id":"clear/Clear/Model/Initializer","kind":"module","full_name":"Clear::Model::Initializer","name":"Initializer"},{"html_id":"clear/Clear/Model/HasFactory","kind":"module","full_name":"Clear::Model::HasFactory","name":"HasFactory"},{"html_id":"clear/Clear/Model/ClassMethods","kind":"module","full_name":"Clear::Model::ClassMethods","name":"ClassMethods"},{"html_id":"clear/Clear/Model/HasScope","kind":"module","full_name":"Clear::Model::HasScope","name":"HasScope"},{"html_id":"clear/Clear/Model/HasRelations","kind":"module","full_name":"Clear::Model::HasRelations","name":"HasRelations"},{"html_id":"clear/Clear/Model/HasValidation","kind":"module","full_name":"Clear::Model::HasValidation","name":"HasValidation"},{"html_id":"clear/Clear/Validation/Helper","kind":"module","full_name":"Clear::Validation::Helper","name":"Helper"},{"html_id":"clear/Clear/Model/HasSaving","kind":"module","full_name":"Clear::Model::HasSaving","name":"HasSaving"},{"html_id":"clear/Clear/Model/HasSerialPkey","kind":"module","full_name":"Clear::Model::HasSerialPkey","name":"HasSerialPkey"},{"html_id":"clear/Clear/Model/HasTimestamps","kind":"module","full_name":"Clear::Model::HasTimestamps","name":"HasTimestamps"},{"html_id":"clear/Clear/Model/HasColumns","kind":"module","full_name":"Clear::Model::HasColumns","name":"HasColumns"},{"html_id":"clear/Clear/Model/HasHooks","kind":"module","full_name":"Clear::Model::HasHooks","name":"HasHooks"},{"html_id":"clear/Clear/Model/Connection","kind":"module","full_name":"Clear::Model::Connection","name":"Connection"},{"html_id":"clear/Clear/ErrorMessages","kind":"module","full_name":"Clear::ErrorMessages","name":"ErrorMessages"}],"locations":[{"filename":"src/clear/extensions/full_text_searchable/full_text_searchable.cr","line_number":3,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/full_text_searchable/full_text_searchable.cr#L3"},{"filename":"src/clear/model/collection.cr","line_number":158,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L158"},{"filename":"src/clear/model/errors.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/errors.cr#L1"},{"filename":"src/clear/model/model.cr","line_number":9,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/model.cr#L9"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"clear/Clear/ErrorMessages","kind":"module","full_name":"Clear::ErrorMessages","name":"ErrorMessages"},{"html_id":"clear/Clear/Model/ClassMethods","kind":"module","full_name":"Clear::Model::ClassMethods","name":"ClassMethods"},{"html_id":"clear/Clear/Model/Connection","kind":"module","full_name":"Clear::Model::Connection","name":"Connection"},{"html_id":"clear/Clear/Model/FullTextSearchable","kind":"module","full_name":"Clear::Model::FullTextSearchable","name":"FullTextSearchable"},{"html_id":"clear/Clear/Model/HasColumns","kind":"module","full_name":"Clear::Model::HasColumns","name":"HasColumns"},{"html_id":"clear/Clear/Model/HasFactory","kind":"module","full_name":"Clear::Model::HasFactory","name":"HasFactory"},{"html_id":"clear/Clear/Model/HasHooks","kind":"module","full_name":"Clear::Model::HasHooks","name":"HasHooks"},{"html_id":"clear/Clear/Model/HasRelations","kind":"module","full_name":"Clear::Model::HasRelations","name":"HasRelations"},{"html_id":"clear/Clear/Model/HasSaving","kind":"module","full_name":"Clear::Model::HasSaving","name":"HasSaving"},{"html_id":"clear/Clear/Model/HasScope","kind":"module","full_name":"Clear::Model::HasScope","name":"HasScope"},{"html_id":"clear/Clear/Model/HasSerialPkey","kind":"module","full_name":"Clear::Model::HasSerialPkey","name":"HasSerialPkey"},{"html_id":"clear/Clear/Model/HasTimestamps","kind":"module","full_name":"Clear::Model::HasTimestamps","name":"HasTimestamps"},{"html_id":"clear/Clear/Model/HasValidation","kind":"module","full_name":"Clear::Model::HasValidation","name":"HasValidation"},{"html_id":"clear/Clear/Model/Initializer","kind":"module","full_name":"Clear::Model::Initializer","name":"Initializer"},{"html_id":"clear/Clear/Model/JSONDeserialize","kind":"module","full_name":"Clear::Model::JSONDeserialize","name":"JSONDeserialize"}],"including_types":[{"html_id":"clear/Clear/Reflection/Column","kind":"class","full_name":"Clear::Reflection::Column","name":"Column"},{"html_id":"clear/Clear/Reflection/Table","kind":"class","full_name":"Clear::Reflection::Table","name":"Table"}],"namespace":{"html_id":"clear/Clear","kind":"module","full_name":"Clear","name":"Clear"},"doc":"Model definition is made by adding the `Clear::Model` mixin in your class.\n## Simple Model\n\n```\nclass MyModel\n include Clear::Model\n\n column my_column : String\nend\n```\n\nWe just created a new model, linked to your database, mapping the column `my_column` of type String (`text` in postgres).\n\nNow, you can play with your model:\n\n```\nrow = MyModel.new # create an empty row\nrow.my_column = \"This is a content\"\nrow.save! # insert the new row in the database !\n```\n\nBy convention, the table name will follow an underscore, plural version of your model: `my_models`.\nA model into a module will prepend the module name before, so `Logistic::MyModel` will check for `logistic_my_models` in your database.\nYou can force a specific table name using:\n\n```\nclass MyModel\n include Clear::Model\n self.table = \"another_table_name\"\nend\n```\n\n## Presence validation\n\nUnlike many ORM around, Clear carry about non-nullable pattern in crystal. Meaning `column my_column : String` assume than a call to `row.my_column` will return a String.\n\nBut it exists cases where the column is not yet initialized:\n- When the object is built with constructor without providing the value (See above).\n- When an object is semi-fetched through the database query. This is useful to ignore some large fields non-interesting in the body of the current operation.\n\nFor example, this code will compile:\n\n```\nrow = MyModel.new # create an empty row\nputs row.my_column\n```\n\nHowever, it will throw a runtime exception `You cannot access to the field 'my_column' because it never has been initialized`\n\nSame way, trying to save the object will raise an error:\n\n```\nrow.save # Will return false\npp row.errors # Will tell you than `my_column` presence is mandatory.\n```\n\nThanks to expressiveness of the Crystal language, we can handle presence validation by simply using the `Nilable` type in crystal:\n\n```\nclass MyModel\n include Clear::Model\n\n column my_column : String? # Now, the column can be NULL or text in postgres.\nend\n```\n\nThis time, the code above will works; in case of no value, my_column will be `nil` by default.\n\n## Querying your code\n\nWhenever you want to fetch data from your database, you must create a new collection query:\n\n`MyModel.query #Will setup a vanilla 'SELECT * FROM my_models'`\n\nQueries are fetchable using `each`:\n\n```\nMyModel.query.each do |model|\n # Do something with your model here.\nend\n```\n\n## Refining your query\n\nA collection query offers a lot of functionalities. You can read the [API](https://anykeyh.github.io/clear/Clear/Model/CollectionBase.html) for more informations.\n\n## Column type\n\nBy default, Clear map theses columns types:\n\n- `String` => `text`\n- `Numbers` (any from 8 to 64 bits, float, double, big number, big float) => `int, large int etc... (depends of your choice)`\n- `Bool` => `text or bool`\n- `Time` => `timestamp without timezone or text`\n- `JSON::Any` => `json and jsonb`\n- `Nilable` => `NULL` (treated as special !)\n\n_NOTE_: The `crystal-pg` gems map also some structures like GIS coordinates, but their implementation is not tested in Clear. Use them at your own risk. Tell me if it's working 😉\n\nIf you need to map special structure, see [Mapping Your Data](Mapping) guides for more informations.\n\n## Primary key\n\nPrimary key is essential for relational mapping. Currently Clear support only one column primary key.\n\nA model without primary key can work in sort of degraded mode, throwing error in case of using some methods on them:\n- `collection#first` will be throwing error if no `order_by` has been setup\n\nTo setup a primary key, you can add the modifier `primary: true` to the column:\n\n```\nclass MyModel\n include Clear::Model\n\n column id : Int32, primary: true, presence: false\n column my_column : String?\nend\n```\n\nNote the flag `presence: false` added to the column. This tells Clear than presence checking on save is not mandatory. Usually this happens if you setup a default value in postgres. In the case of our primary key `id`, we use a serial auto-increment default value.\nTherefore, saving the model without primary key will works. The id will be fetched after insertion:\n\n```\nm = MyModel\nm.save!\nm.id # Now the id value is setup.\n```\n\n## Helpers\n\nClear provides various built-in helpers to facilitate your life:\n\n### Timestamps\n\n```\nclass MyModel\n include Clear::Model\n timestamps # Will map the two columns 'created_at' and 'updated_at', and map some hooks to update their values.\nend\n```\n\nTheses fields are automatically updated whenever you call `save` methods, and works as Rails ActiveRecord.\n\n### With Serial Pkey\n\n```\nclass MyModel\n include Clear::Model\n primary_key \"my_primary_key\"\nend\n```\n\nBasically rewrite `column id : UInt64, primary: true, presence: false`\n\nArgument is optional (default = id)","summary":"

Model definition is made by adding the Clear::Model mixin in your class.

","instance_methods":[{"html_id":"__pkey__-instance-method","name":"__pkey__","doc":"Alias method for primary key.\n\nIf `Model#id` IS the primary key, then calling `Model#__pkey__` is exactly the same as `Model#id`.\n\nThis method exists to tremendously simplify the meta-programming code.\nIf no primary key has been setup to this model, raise an exception.","summary":"

Alias method for primary key.

","abstract":false,"location":{"filename":"src/clear/model/model.cr","line_number":33,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/model.cr#L33"},"def":{"name":"__pkey__","visibility":"Public","body":"raise(lack_of_primary_key(self.class.name))"}},{"html_id":"cache:Clear::Model::QueryCache|Nil-instance-method","name":"cache","abstract":false,"location":{"filename":"src/clear/model/model.cr","line_number":25,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/model.cr#L25"},"def":{"name":"cache","return_type":"Clear::Model::QueryCache | ::Nil","visibility":"Public","body":"@cache"}}],"macros":[{"html_id":"scope(name,&block)-macro","name":"scope","doc":"A scope allow you to filter in a very human way a set of data.\n\nUsage:\n\n```\nscope(\"admin\") { where({role: \"admin\"}) }\n```\n\nfor example, instead of writing:\n\n```\nUser.query.where { (role == \"admin\") & (active == true) }\n```\n\nYou can write:\n\n```\nUser.admin.active\n```\n\nScope can be used for other purpose than just filter (e.g. ordering),\nbut I would not recommend it.","summary":"

A scope allow you to filter in a very human way a set of data.

","abstract":false,"args":[{"name":"name","external_name":"name","restriction":""}],"args_string":"(name, &block)","args_html":"(name, &block)","location":{"filename":"src/clear/model/model.cr","line_number":19,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/model.cr#L19"},"def":{"name":"scope","args":[{"name":"name","external_name":"name","restriction":""}],"block_arg":{"name":"block","external_name":"block","restriction":""},"visibility":"Public","body":" \n{% parameters = \"\" %}\n\n \n{% for arg, idx in block.args %}\n {% if (block.splat_index && (idx == block.splat_index))\n parameters = parameters + \"*\"\nend %}\n {% parameters = parameters + \"#{arg}\" %}\n {% unless (idx == (block.args.size - 1))\n parameters = parameters + \", \"\nend %}\n {% end %}\n\n \n{% parameters = parameters.id %}\n\n\n def self.\n{{ name.id }}\n(\n{{ parameters }}\n)\n query.\n{{ name.id }}\n(\n{{ parameters }}\n)\n \nend\n\n class Collection < Clear::Model::CollectionBase(\n{{ @type }}\n);\n def \n{{ name.id }}\n(\n{{ parameters }}\n)\n \n{{ yield }}\n\n\n return self\n \nend\n \nend\n \n"}}],"types":[{"html_id":"clear/Clear/Model/ClassMethods","path":"Clear/Model/ClassMethods.html","kind":"module","full_name":"Clear::Model::ClassMethods","name":"ClassMethods","abstract":false,"locations":[{"filename":"src/clear/model/modules/class_methods.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/class_methods.cr#L1"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"clear/Clear/Model","kind":"module","full_name":"Clear::Model","name":"Model"}],"namespace":{"html_id":"clear/Clear/Model","kind":"module","full_name":"Clear::Model","name":"Model"}},{"html_id":"clear/Clear/Model/CollectionBase","path":"Clear/Model/CollectionBase.html","kind":"class","full_name":"Clear::Model::CollectionBase(T)","name":"CollectionBase","abstract":false,"superclass":{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"clear/Clear/SQL/SelectBuilder","kind":"module","full_name":"Clear::SQL::SelectBuilder","name":"SelectBuilder"},{"html_id":"clear/Clear/SQL/Query/WithPagination","kind":"module","full_name":"Clear::SQL::Query::WithPagination","name":"WithPagination"},{"html_id":"clear/Clear/SQL/Query/BeforeQuery","kind":"module","full_name":"Clear::SQL::Query::BeforeQuery","name":"BeforeQuery"},{"html_id":"clear/Clear/SQL/Query/Change","kind":"module","full_name":"Clear::SQL::Query::Change","name":"Change"},{"html_id":"clear/Clear/SQL/Query/Connection","kind":"module","full_name":"Clear::SQL::Query::Connection","name":"Connection"},{"html_id":"clear/Clear/SQL/Query/Pluck","kind":"module","full_name":"Clear::SQL::Query::Pluck","name":"Pluck"},{"html_id":"clear/Clear/SQL/Query/Fetch","kind":"module","full_name":"Clear::SQL::Query::Fetch","name":"Fetch"},{"html_id":"clear/Clear/SQL/Query/Execute","kind":"module","full_name":"Clear::SQL::Query::Execute","name":"Execute"},{"html_id":"clear/Clear/SQL/Query/Lock","kind":"module","full_name":"Clear::SQL::Query::Lock","name":"Lock"},{"html_id":"clear/Clear/SQL/Query/Window","kind":"module","full_name":"Clear::SQL::Query::Window","name":"Window"},{"html_id":"clear/Clear/SQL/Query/CTE","kind":"module","full_name":"Clear::SQL::Query::CTE","name":"CTE"},{"html_id":"clear/Clear/SQL/Query/Aggregate","kind":"module","full_name":"Clear::SQL::Query::Aggregate","name":"Aggregate"},{"html_id":"clear/Clear/SQL/Query/OffsetLimit","kind":"module","full_name":"Clear::SQL::Query::OffsetLimit","name":"OffsetLimit"},{"html_id":"clear/Clear/SQL/Query/GroupBy","kind":"module","full_name":"Clear::SQL::Query::GroupBy","name":"GroupBy"},{"html_id":"clear/Clear/SQL/Query/OrderBy","kind":"module","full_name":"Clear::SQL::Query::OrderBy","name":"OrderBy"},{"html_id":"clear/Clear/SQL/Query/Having","kind":"module","full_name":"Clear::SQL::Query::Having","name":"Having"},{"html_id":"clear/Clear/SQL/Query/Where","kind":"module","full_name":"Clear::SQL::Query::Where","name":"Where"},{"html_id":"clear/Clear/SQL/Query/Join","kind":"module","full_name":"Clear::SQL::Query::Join","name":"Join"},{"html_id":"clear/Clear/SQL/Query/From","kind":"module","full_name":"Clear::SQL::Query::From","name":"From"},{"html_id":"clear/Clear/SQL/Query/Select","kind":"module","full_name":"Clear::SQL::Query::Select","name":"Select"},{"html_id":"clear/Enumerable","kind":"module","full_name":"Enumerable","name":"Enumerable"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/model/collection.cr","line_number":168,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L168"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"clear/Clear/SQL/SelectBuilder","kind":"module","full_name":"Clear::SQL::SelectBuilder","name":"SelectBuilder"},{"html_id":"clear/Enumerable","kind":"module","full_name":"Enumerable","name":"Enumerable"}],"subclasses":[{"html_id":"clear/Clear/Reflection/Column/Collection","kind":"class","full_name":"Clear::Reflection::Column::Collection","name":"Collection"},{"html_id":"clear/Clear/Reflection/Table/Collection","kind":"class","full_name":"Clear::Reflection::Table::Collection","name":"Collection"}],"namespace":{"html_id":"clear/Clear/Model","kind":"module","full_name":"Clear::Model","name":"Model"},"doc":"`CollectionBase(T)` is the base class for collection of model.\nCollection of model are a SQL `SELECT` query mapping & building system. They are Enumerable and are\n`Clear::SQL::SelectBuilder` behavior; therefore, they can be used array-like and are working with low-level SQL\nBuilding.\n\nThe `CollectionBase(T)` is extended by each model. For example, generating the model `MyModel` will generate the\nclass `MyModel::Collection` which inherits from `CollectionBase(MyModel)`\n\nCollection are instantiated using `Model.query` method.","summary":"

CollectionBase(T) is the base class for collection of model.

","instance_methods":[{"html_id":"<<(item:T)-instance-method","name":"<<","doc":"Add an item to the current collection.\n\nIf the current collection is not originated from a `has_many` or `has_many through:` relation, calling `<<` over\nthe collection will raise a `Clear::SQL::OperationNotPermittedError`\n\nReturns `self` and therefore can be chained","summary":"

Add an item to the current collection.

","abstract":false,"args":[{"name":"item","external_name":"item","restriction":"T"}],"args_string":"(item : T)","args_html":"(item : T)","location":{"filename":"src/clear/model/collection.cr","line_number":494,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L494"},"def":{"name":"<<","args":[{"name":"item","external_name":"item","restriction":"T"}],"visibility":"Public","body":"append_operation = self.append_operation\nif append_operation\nelse\n raise(\"Operation not permitted on this collection.\")\nend\nappend_operation.call(item)\n@cached_result.try(&.<<(item))\nself\n"}},{"html_id":"[](range:Range(Number,Number),fetch_columns=false):Array(T)-instance-method","name":"[]","doc":"Get a range of models","summary":"

Get a range of models

","abstract":false,"args":[{"name":"range","external_name":"range","restriction":"Range(Number, Number)"},{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"args_string":"(range : Range(Number, Number), fetch_columns = false) : Array(T)","args_html":"(range : Range(Number, Number), fetch_columns = false) : Array(T)","location":{"filename":"src/clear/model/collection.cr","line_number":550,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L550"},"def":{"name":"[]","args":[{"name":"range","external_name":"range","restriction":"Range(Number, Number)"},{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"return_type":"Array(T)","visibility":"Public","body":"((offset(range.begin)).limit(range.end - range.begin)).to_a(fetch_columns)"}},{"html_id":"[](off,fetch_columns=false):T-instance-method","name":"[]","doc":"Basically a fancy way to write `OFFSET x LIMIT 1`","summary":"

Basically a fancy way to write OFFSET x LIMIT 1

","abstract":false,"args":[{"name":"off","external_name":"off","restriction":""},{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"args_string":"(off, fetch_columns = false) : T","args_html":"(off, fetch_columns = false) : T","location":{"filename":"src/clear/model/collection.cr","line_number":540,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L540"},"def":{"name":"[]","args":[{"name":"off","external_name":"off","restriction":""},{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"return_type":"T","visibility":"Public","body":"self[off, fetch_columns]? || (raise(Clear::SQL::RecordNotFoundError.new))"}},{"html_id":"[]?(off,fetch_columns=false):T|Nil-instance-method","name":"[]?","doc":"Basically a fancy way to write `OFFSET x LIMIT 1`","summary":"

Basically a fancy way to write OFFSET x LIMIT 1

","abstract":false,"args":[{"name":"off","external_name":"off","restriction":""},{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"args_string":"(off, fetch_columns = false) : T | Nil","args_html":"(off, fetch_columns = false) : T | Nil","location":{"filename":"src/clear/model/collection.cr","line_number":545,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L545"},"def":{"name":"[]?","args":[{"name":"off","external_name":"off","restriction":""},{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"return_type":"T | ::Nil","visibility":"Public","body":"(offset(off)).first(fetch_columns)"}},{"html_id":"add(item:T)-instance-method","name":"add","doc":"Alias for `Collection#<<`","summary":"

Alias for Collection#<<

","abstract":false,"args":[{"name":"item","external_name":"item","restriction":"T"}],"args_string":"(item : T)","args_html":"(item : T)","location":{"filename":"src/clear/model/collection.cr","line_number":506,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L506"},"def":{"name":"add","args":[{"name":"item","external_name":"item","restriction":"T"}],"visibility":"Public","body":"self << item"}},{"html_id":"any?-instance-method","name":"any?","doc":"Check whether the query return any row.","summary":"

Check whether the query return any row.

","abstract":false,"location":{"filename":"src/clear/model/collection.cr","line_number":464,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L464"},"def":{"name":"any?","visibility":"Public","body":"cr = @cached_result\nif cr\n return !cr.empty?\nend\n((clear_select.select(\"1\")).limit(1)).fetch do |_|\n return true\nend\nfalse\n"}},{"html_id":"build(x:NamedTuple,&block:T->Nil):T-instance-method","name":"build","doc":"Build a new collection; if the collection comes from a has_many relation\n(e.g. `my_model.associations.build`), the foreign column which store\nthe primary key of `my_model` will be setup by default, preventing you\nto forget it.\nYou can pass extra parameters using a named tuple:\n`my_model.associations.build({a_column: \"value\"}) `","summary":"

Build a new collection; if the collection comes from a has_many relation (e.g.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"args_string":"(x : NamedTuple, &block : T -> Nil) : T","args_html":"(x : NamedTuple, &block : T -> Nil) : T","location":{"filename":"src/clear/model/collection.cr","line_number":405,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L405"},"def":{"name":"build","args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(T -> Nil)"},"return_type":"T","visibility":"Public","body":"build(**x, &block)"}},{"html_id":"build(**tuple,&:T->Nil):T-instance-method","name":"build","doc":"Build a new collection; if the collection comes from a has_many relation\n(e.g. `my_model.associations.build`), the foreign column which store\nthe primary key of `my_model` will be setup by default, preventing you\nto forget it.\nYou can pass extra parameters using a named tuple:\n`my_model.associations.build({a_column: \"value\"}) `","summary":"

Build a new collection; if the collection comes from a has_many relation (e.g.

","abstract":false,"location":{"filename":"src/clear/model/collection.cr","line_number":383,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L383"},"def":{"name":"build","double_splat":{"name":"tuple","external_name":"tuple","restriction":""},"yields":1,"block_arity":1,"block_arg":{"name":"","external_name":"","restriction":"(T -> Nil)"},"return_type":"T","visibility":"Public","body":"str_hash = @tags.dup\ntuple.map do |k, v|\n str_hash[k.to_s] = v\nend\nr = Clear::Model::Factory.build(T, str_hash, persisted: false)\nyield(r)\nr\n"}},{"html_id":"build(x:NamedTuple):T-instance-method","name":"build","doc":"Build a new collection; if the collection comes from a has_many relation\n(e.g. `my_model.associations.build`), the foreign column which store\nthe primary key of `my_model` will be setup by default, preventing you\nto forget it.\nYou can pass extra parameters using a named tuple:\n`my_model.associations.build({a_column: \"value\"}) `","summary":"

Build a new collection; if the collection comes from a has_many relation (e.g.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"args_string":"(x : NamedTuple) : T","args_html":"(x : NamedTuple) : T","location":{"filename":"src/clear/model/collection.cr","line_number":400,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L400"},"def":{"name":"build","args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"return_type":"T","visibility":"Public","body":"build(**x) do\nend"}},{"html_id":"build(**tuple):T-instance-method","name":"build","doc":"Build a new collection; if the collection comes from a has_many relation\n(e.g. `my_model.associations.build`), the foreign column which store\nthe primary key of `my_model` will be setup by default, preventing you\nto forget it.\nYou can pass extra parameters using a named tuple:\n`my_model.associations.build({a_column: \"value\"}) `","summary":"

Build a new collection; if the collection comes from a has_many relation (e.g.

","abstract":false,"location":{"filename":"src/clear/model/collection.cr","line_number":395,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L395"},"def":{"name":"build","double_splat":{"name":"tuple","external_name":"tuple","restriction":""},"return_type":"T","visibility":"Public","body":"build(**tuple) do\nend"}},{"html_id":"count(type:X.class=Int64)forallX-instance-method","name":"count","doc":"Use SQL `COUNT` over your query, and return this number as a Int64","summary":"

Use SQL COUNT over your query, and return this number as a Int64

","abstract":false,"args":[{"name":"type","default_value":"Int64","external_name":"type","restriction":"X.class"}],"args_string":"(type : X.class = Int64) forall X","args_html":"(type : X.class = Int64) forall X","location":{"filename":"src/clear/model/collection.cr","line_number":480,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L480"},"def":{"name":"count","args":[{"name":"type","default_value":"Int64","external_name":"type","restriction":"X.class"}],"visibility":"Public","body":"cr = @cached_result\nif cr.nil?\nelse\n return X.new(cr.size)\nend\nsuper(type)\n"}},{"html_id":"create(x:NamedTuple,&block:T->Nil):T-instance-method","name":"create","doc":"Build a new object and setup\nthe fields like setup in the condition tuple.\nJust after building, save the object.","summary":"

Build a new object and setup the fields like setup in the condition tuple.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"args_string":"(x : NamedTuple, &block : T -> Nil) : T","args_html":"(x : NamedTuple, &block : T -> Nil) : T","location":{"filename":"src/clear/model/collection.cr","line_number":431,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L431"},"def":{"name":"create","args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(T -> Nil)"},"return_type":"T","visibility":"Public","body":"create(**x, &block)"}},{"html_id":"create(**tuple,&:T->Nil):T-instance-method","name":"create","doc":"Build a new object and setup\nthe fields like setup in the condition tuple.\nJust after building, save the object.","summary":"

Build a new object and setup the fields like setup in the condition tuple.

","abstract":false,"location":{"filename":"src/clear/model/collection.cr","line_number":412,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L412"},"def":{"name":"create","double_splat":{"name":"tuple","external_name":"tuple","restriction":""},"yields":1,"block_arity":1,"block_arg":{"name":"","external_name":"","restriction":"(T -> Nil)"},"return_type":"T","visibility":"Public","body":"r = build(**tuple) do |mdl|\n yield(mdl)\nend\nr.save\nr\n"}},{"html_id":"create(x:NamedTuple):T-instance-method","name":"create","doc":"Build a new object and setup\nthe fields like setup in the condition tuple.\nJust after building, save the object.","summary":"

Build a new object and setup the fields like setup in the condition tuple.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"args_string":"(x : NamedTuple) : T","args_html":"(x : NamedTuple) : T","location":{"filename":"src/clear/model/collection.cr","line_number":426,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L426"},"def":{"name":"create","args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"return_type":"T","visibility":"Public","body":"create(**x)"}},{"html_id":"create(**tuple):T-instance-method","name":"create","doc":"Build a new object and setup\nthe fields like setup in the condition tuple.\nJust after building, save the object.","summary":"

Build a new object and setup the fields like setup in the condition tuple.

","abstract":false,"location":{"filename":"src/clear/model/collection.cr","line_number":421,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L421"},"def":{"name":"create","double_splat":{"name":"tuple","external_name":"tuple","restriction":""},"return_type":"T","visibility":"Public","body":"create(**tuple) do\nend"}},{"html_id":"create!(x:NamedTuple,&block:T->Nil):T-instance-method","name":"create!","doc":"Build a new object and setup\nthe fields like setup in the condition tuple.\nJust after building, save the object.\nBut instead of returning self if validation failed,\nraise `Clear::Model::InvalidError` exception","summary":"

Build a new object and setup the fields like setup in the condition tuple.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"args_string":"(x : NamedTuple, &block : T -> Nil) : T","args_html":"(x : NamedTuple, &block : T -> Nil) : T","location":{"filename":"src/clear/model/collection.cr","line_number":459,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L459"},"def":{"name":"create!","args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(T -> Nil)"},"return_type":"T","visibility":"Public","body":"create(**x, &block)"}},{"html_id":"create!(**tuple,&:T->Nil):T-instance-method","name":"create!","doc":"Build a new object and setup\nthe fields like setup in the condition tuple.\nJust after building, save the object.\nBut instead of returning self if validation failed,\nraise `Clear::Model::InvalidError` exception","summary":"

Build a new object and setup the fields like setup in the condition tuple.

","abstract":false,"location":{"filename":"src/clear/model/collection.cr","line_number":440,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L440"},"def":{"name":"create!","double_splat":{"name":"tuple","external_name":"tuple","restriction":""},"yields":1,"block_arity":1,"block_arg":{"name":"","external_name":"","restriction":"(T -> Nil)"},"return_type":"T","visibility":"Public","body":"r = build(**tuple) do |mdl|\n yield(mdl)\nend\nr.save!\nr\n"}},{"html_id":"create!(x:NamedTuple):T-instance-method","name":"create!","doc":"Build a new object and setup\nthe fields like setup in the condition tuple.\nJust after building, save the object.\nBut instead of returning self if validation failed,\nraise `Clear::Model::InvalidError` exception","summary":"

Build a new object and setup the fields like setup in the condition tuple.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"args_string":"(x : NamedTuple) : T","args_html":"(x : NamedTuple) : T","location":{"filename":"src/clear/model/collection.cr","line_number":454,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L454"},"def":{"name":"create!","args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"return_type":"T","visibility":"Public","body":"create(**x)"}},{"html_id":"create!(**tuple):T-instance-method","name":"create!","doc":"Build a new object and setup\nthe fields like setup in the condition tuple.\nJust after building, save the object.\nBut instead of returning self if validation failed,\nraise `Clear::Model::InvalidError` exception","summary":"

Build a new object and setup the fields like setup in the condition tuple.

","abstract":false,"location":{"filename":"src/clear/model/collection.cr","line_number":449,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L449"},"def":{"name":"create!","double_splat":{"name":"tuple","external_name":"tuple","restriction":""},"return_type":"T","visibility":"Public","body":"create!(**tuple) do\nend"}},{"html_id":"delete_all:self-instance-method","name":"delete_all","doc":"Delete all the rows which would have been returned by this collection.\nIs equivalent to `collection.to_delete.execute`","summary":"

Delete all the rows which would have been returned by this collection.

","abstract":false,"location":{"filename":"src/clear/model/collection.cr","line_number":704,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L704"},"def":{"name":"delete_all","return_type":"self","visibility":"Public","body":"to_delete.execute\nchange!\n"}},{"html_id":"dup-instance-method","name":"dup","doc":"Duplicate the query","summary":"

Duplicate the query

","abstract":false,"location":{"filename":"src/clear/model/collection.cr","line_number":220,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L220"},"def":{"name":"dup","visibility":"Public","body":"if (@polymorphic && (polymorphic_key = @polymorphic_key)) && (polymorphic_scope = @polymorphic_scope)\n super().flag_as_polymorphic!(polymorphic_key, polymorphic_scope)\nelse\n super()\nend"}},{"html_id":"each(fetch_columns=false,&:T->):Nil-instance-method","name":"each","doc":"Build the SQL, send the query then iterate through each models\ngathered by the request.","summary":"

Build the SQL, send the query then iterate through each models gathered by the request.

","abstract":false,"args":[{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"args_string":"(fetch_columns = false, & : T -> ) : Nil","args_html":"(fetch_columns = false, & : T -> ) : Nil","location":{"filename":"src/clear/model/collection.cr","line_number":322,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L322"},"def":{"name":"each","args":[{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"yields":1,"block_arity":1,"block_arg":{"name":"","external_name":"","restriction":"(T ->)"},"return_type":"Nil","visibility":"Public","body":"result = @cached_result\nif result\nelse\n result = [] of T\n if @polymorphic\n fetch(fetch_all: false) do |hash|\n type = hash[@polymorphic_key].as(String)\n result << ((Clear::Model::Factory.build(type, hash, persisted: true, fetch_columns: fetch_columns, cache: @cache)).as(T))\n end\n else\n fetch(fetch_all: false) do |hash|\n result << (Clear::Model::Factory.build(T, hash, persisted: true, fetch_columns: fetch_columns, cache: @cache))\n end\n end\nend\nresult.each do |value|\n yield value\nend\n"}},{"html_id":"each_with_cursor(batch=1000,fetch_columns=false,&block:T->)-instance-method","name":"each_with_cursor","doc":"Build the SQL, send the query then iterate through each models\ngathered by the request.\nUse a postgres cursor to avoid memory bloating.\nUseful to fetch millions of rows at once.","summary":"

Build the SQL, send the query then iterate through each models gathered by the request.

","abstract":false,"args":[{"name":"batch","default_value":"1000","external_name":"batch","restriction":""},{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"args_string":"(batch = 1000, fetch_columns = false, &block : T -> )","args_html":"(batch = 1000, fetch_columns = false, &block : T -> )","location":{"filename":"src/clear/model/collection.cr","line_number":358,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L358"},"def":{"name":"each_with_cursor","args":[{"name":"batch","default_value":"1000","external_name":"batch","restriction":""},{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(T ->)"},"visibility":"Public","body":"cr = @cached_result\nif cr\n cr.each(&block)\nelse\n if @polymorphic\n fetch_with_cursor(count: batch) do |hash|\n type = hash[@polymorphic_key].as(String)\n yield((Clear::Model::Factory.build(type, hash, persisted: true, fetch_columns: fetch_columns, cache: @cache)).as(T))\n end\n else\n fetch_with_cursor(count: batch) do |hash|\n yield(Clear::Model::Factory.build(T, hash, persisted: true, fetch_columns: fetch_columns, cache: @cache))\n end\n end\nend\n"}},{"html_id":"empty?-instance-method","name":"empty?","doc":"Inverse of `any?`, return true if the request return no rows.","summary":"

Inverse of #any?, return true if the request return no rows.

","abstract":false,"location":{"filename":"src/clear/model/collection.cr","line_number":475,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L475"},"def":{"name":"empty?","visibility":"Public","body":"!any?"}},{"html_id":"find(fetch_columns=false,&):T|Nil-instance-method","name":"find","doc":"A convenient way to write `where { condition }.first(fetch_columns)`","summary":"

A convenient way to write where { condition }.first(fetch_columns)

","abstract":false,"args":[{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"args_string":"(fetch_columns = false, &) : T | Nil","args_html":"(fetch_columns = false, &) : T | Nil","location":{"filename":"src/clear/model/collection.cr","line_number":555,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L555"},"def":{"name":"find","args":[{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"yields":0,"block_arity":0,"return_type":"T | ::Nil","visibility":"Public","body":"x = Clear::Expression.ensure_node!(with Clear::Expression.new yield)\n(where(x)).first(fetch_columns)\n"}},{"html_id":"find(tuple:NamedTuple,fetch_columns=false):T|Nil-instance-method","name":"find","doc":"A convenient way to write `where({any_column: \"any_value\"}).first(fetch_columns)`","summary":"

A convenient way to write where({any_column: "any_value"}).first(fetch_columns)

","abstract":false,"args":[{"name":"tuple","external_name":"tuple","restriction":"NamedTuple"},{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"args_string":"(tuple : NamedTuple, fetch_columns = false) : T | Nil","args_html":"(tuple : NamedTuple, fetch_columns = false) : T | Nil","location":{"filename":"src/clear/model/collection.cr","line_number":562,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L562"},"def":{"name":"find","args":[{"name":"tuple","external_name":"tuple","restriction":"NamedTuple"},{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"return_type":"T | ::Nil","visibility":"Public","body":"(where(tuple)).first(fetch_columns)"}},{"html_id":"find(**tuple):T|Nil-instance-method","name":"find","doc":"A convenient way to write `where({any_column: \"any_value\"}).first`","summary":"

A convenient way to write where({any_column: "any_value"}).first

","abstract":false,"location":{"filename":"src/clear/model/collection.cr","line_number":567,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L567"},"def":{"name":"find","double_splat":{"name":"tuple","external_name":"tuple","restriction":""},"return_type":"T | ::Nil","visibility":"Public","body":"(where(tuple)).first"}},{"html_id":"find!(fetch_columns=false,&):T-instance-method","name":"find!","doc":"A convenient way to write `where { condition }.first!(fetch_columns)`","summary":"

A convenient way to write where { condition }.first!(fetch_columns)

","abstract":false,"args":[{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"args_string":"(fetch_columns = false, &) : T","args_html":"(fetch_columns = false, &) : T","location":{"filename":"src/clear/model/collection.cr","line_number":572,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L572"},"def":{"name":"find!","args":[{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"yields":0,"block_arity":0,"return_type":"T","visibility":"Public","body":"x = Clear::Expression.ensure_node!(with Clear::Expression.new yield)\n(where(x)).first!(fetch_columns)\n"}},{"html_id":"find!(tuple:NamedTuple,fetch_columns=false):T-instance-method","name":"find!","doc":"A convenient way to write `where({any_column: \"any_value\"}).first!(fetch_columns)`","summary":"

A convenient way to write where({any_column: "any_value"}).first!(fetch_columns)

","abstract":false,"args":[{"name":"tuple","external_name":"tuple","restriction":"NamedTuple"},{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"args_string":"(tuple : NamedTuple, fetch_columns = false) : T","args_html":"(tuple : NamedTuple, fetch_columns = false) : T","location":{"filename":"src/clear/model/collection.cr","line_number":579,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L579"},"def":{"name":"find!","args":[{"name":"tuple","external_name":"tuple","restriction":"NamedTuple"},{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"return_type":"T","visibility":"Public","body":"(where(tuple)).first!(fetch_columns)"}},{"html_id":"find!(**tuple):T-instance-method","name":"find!","doc":"A convenient way to write `where({any_column: \"any_value\"}).first!`","summary":"

A convenient way to write where({any_column: "any_value"}).first!

","abstract":false,"location":{"filename":"src/clear/model/collection.cr","line_number":584,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L584"},"def":{"name":"find!","double_splat":{"name":"tuple","external_name":"tuple","restriction":""},"return_type":"T","visibility":"Public","body":"(where(tuple)).first!"}},{"html_id":"find_or_build(x:NamedTuple,&block:T->Nil):T-instance-method","name":"find_or_build","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"args_string":"(x : NamedTuple, &block : T -> Nil) : T","args_html":"(x : NamedTuple, &block : T -> Nil) : T","location":{"filename":"src/clear/model/collection.cr","line_number":615,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L615"},"def":{"name":"find_or_build","args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(T -> Nil)"},"return_type":"T","visibility":"Public","body":"find_or_build(**x, &block)"}},{"html_id":"find_or_build(**tuple,&:T->Nil):T-instance-method","name":"find_or_build","doc":"Try to fetch a row. If not found, build a new object and setup\nthe fields like setup in the condition tuple.","summary":"

Try to fetch a row.

","abstract":false,"location":{"filename":"src/clear/model/collection.cr","line_number":590,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L590"},"def":{"name":"find_or_build","double_splat":{"name":"tuple","external_name":"tuple","restriction":""},"yields":1,"block_arity":1,"block_arg":{"name":"","external_name":"","restriction":"(T -> Nil)"},"return_type":"T","visibility":"Public","body":"if tuple.size == 0\nelse\n where(tuple)\nend\nr = first\nif r\n return r\nend\nstr_hash = @tags.dup\ntuple.map do |k, v|\n str_hash[k.to_s] = v\nend\nr = Clear::Model::Factory.build(T, str_hash)\nyield(r)\nr\n"}},{"html_id":"find_or_build(x:NamedTuple):T-instance-method","name":"find_or_build","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"args_string":"(x : NamedTuple) : T","args_html":"(x : NamedTuple) : T","location":{"filename":"src/clear/model/collection.cr","line_number":610,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L610"},"def":{"name":"find_or_build","args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"return_type":"T","visibility":"Public","body":"find_or_build(**x)"}},{"html_id":"find_or_build(**tuple):T-instance-method","name":"find_or_build","abstract":false,"location":{"filename":"src/clear/model/collection.cr","line_number":605,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L605"},"def":{"name":"find_or_build","double_splat":{"name":"tuple","external_name":"tuple","restriction":""},"return_type":"T","visibility":"Public","body":"find_or_build(**tuple) do\nend"}},{"html_id":"find_or_create(x:NamedTuple,&block:T->Nil):T-instance-method","name":"find_or_create","doc":"Try to fetch a row. If not found, build a new object and setup\nthe fields like setup in the condition tuple.\nJust after building, save the object.","summary":"

Try to fetch a row.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"args_string":"(x : NamedTuple, &block : T -> Nil) : T","args_html":"(x : NamedTuple, &block : T -> Nil) : T","location":{"filename":"src/clear/model/collection.cr","line_number":641,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L641"},"def":{"name":"find_or_create","args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(T -> Nil)"},"return_type":"T","visibility":"Public","body":"find_or_create(**x, &block)"}},{"html_id":"find_or_create(**tuple,&:T->Nil):T-instance-method","name":"find_or_create","doc":"Try to fetch a row. If not found, build a new object and setup\nthe fields like setup in the condition tuple.\nJust after building, save the object.","summary":"

Try to fetch a row.

","abstract":false,"location":{"filename":"src/clear/model/collection.cr","line_number":622,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L622"},"def":{"name":"find_or_create","double_splat":{"name":"tuple","external_name":"tuple","restriction":""},"yields":1,"block_arity":1,"block_arg":{"name":"","external_name":"","restriction":"(T -> Nil)"},"return_type":"T","visibility":"Public","body":"r = find_or_build(**tuple) do |mdl|\n yield(mdl)\nend\nr.save!\nr\n"}},{"html_id":"find_or_create(x:NamedTuple):T-instance-method","name":"find_or_create","doc":"Try to fetch a row. If not found, build a new object and setup\nthe fields like setup in the condition tuple.\nJust after building, save the object.","summary":"

Try to fetch a row.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"args_string":"(x : NamedTuple) : T","args_html":"(x : NamedTuple) : T","location":{"filename":"src/clear/model/collection.cr","line_number":636,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L636"},"def":{"name":"find_or_create","args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"return_type":"T","visibility":"Public","body":"find_or_create(**x)"}},{"html_id":"find_or_create(**tuple):T-instance-method","name":"find_or_create","doc":"Try to fetch a row. If not found, build a new object and setup\nthe fields like setup in the condition tuple.\nJust after building, save the object.","summary":"

Try to fetch a row.

","abstract":false,"location":{"filename":"src/clear/model/collection.cr","line_number":631,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L631"},"def":{"name":"find_or_create","double_splat":{"name":"tuple","external_name":"tuple","restriction":""},"return_type":"T","visibility":"Public","body":"find_or_create(**tuple) do\nend"}},{"html_id":"first(fetch_columns=false):T|Nil-instance-method","name":"first","doc":"Get the first row from the collection query.\nif not found, return `nil`","summary":"

Get the first row from the collection query.

","abstract":false,"args":[{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"args_string":"(fetch_columns = false) : T | Nil","args_html":"(fetch_columns = false) : T | Nil","location":{"filename":"src/clear/model/collection.cr","line_number":647,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L647"},"def":{"name":"first","args":[{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"return_type":"T | ::Nil","visibility":"Public","body":"if T.__pkey__ || order_bys.empty?\n order_by(Clear::SQL.escape(\"#{T.__pkey__}\"), :asc)\nend\n(limit(1)).fetch do |hash|\n return Clear::Model::Factory.build(T, hash, persisted: true, cache: @cache, fetch_columns: fetch_columns)\nend\nnil\n"}},{"html_id":"first!(fetch_columns=false):T-instance-method","name":"first!","doc":"Get the first row from the collection query.\nif not found, throw an error","summary":"

Get the first row from the collection query.

","abstract":false,"args":[{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"args_string":"(fetch_columns = false) : T","args_html":"(fetch_columns = false) : T","location":{"filename":"src/clear/model/collection.cr","line_number":659,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L659"},"def":{"name":"first!","args":[{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"return_type":"T","visibility":"Public","body":"(first(fetch_columns)) || (raise(Clear::SQL::RecordNotFoundError.new))"}},{"html_id":"item_class-instance-method","name":"item_class","doc":"Return the model class for this collection","summary":"

Return the model class for this collection

","abstract":false,"location":{"filename":"src/clear/model/collection.cr","line_number":235,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L235"},"def":{"name":"item_class","visibility":"Public","body":"T"}},{"html_id":"last(fetch_columns=false):T|Nil-instance-method","name":"last","doc":"Get the last row from the collection query.\nif not found, return `nil`","summary":"

Get the last row from the collection query.

","abstract":false,"args":[{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"args_string":"(fetch_columns = false) : T | Nil","args_html":"(fetch_columns = false) : T | Nil","location":{"filename":"src/clear/model/collection.cr","line_number":665,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L665"},"def":{"name":"last","args":[{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"return_type":"T | ::Nil","visibility":"Public","body":"if T.__pkey__ || order_bys.empty?\n order_by(\"#{T.__pkey__}\", :asc)\nend\narr = order_bys.dup\nbegin\n new_order = arr.map do |x|\n Clear::SQL::Query::OrderBy::Record.new(x.op, (x.dir == (:asc) ? :desc : :asc), nil)\n end\n clear_order_bys.order_by(new_order)\n (limit(1)).fetch do |hash|\n return Clear::Model::Factory.build(T, hash, persisted: true, cache: @cache, fetch_columns: fetch_columns)\n end\n nil\nensure\n clear_order_bys.order_by(order_bys)\nend\n"}},{"html_id":"last!(fetch_columns=false):T-instance-method","name":"last!","doc":"Get the last row from the collection query.\nif not found, throw an error","summary":"

Get the last row from the collection query.

","abstract":false,"args":[{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"args_string":"(fetch_columns = false) : T","args_html":"(fetch_columns = false) : T","location":{"filename":"src/clear/model/collection.cr","line_number":690,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L690"},"def":{"name":"last!","args":[{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"return_type":"T","visibility":"Public","body":"(last(fetch_columns)) || (raise(Clear::SQL::RecordNotFoundError.new))"}},{"html_id":"map(fetch_columns=false,&block:T->X):Array(X)forallX-instance-method","name":"map","doc":"Build the SQL, send the query then build and array by applying the\nblock transformation over it.","summary":"

Build the SQL, send the query then build and array by applying the block transformation over it.

","abstract":false,"args":[{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"args_string":"(fetch_columns = false, &block : T -> X) : Array(X) forall X","args_html":"(fetch_columns = false, &block : T -> X) : Array(X) forall X","location":{"filename":"src/clear/model/collection.cr","line_number":347,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L347"},"def":{"name":"map","args":[{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(T -> X)"},"return_type":"Array(X)","visibility":"Public","body":"o = [] of X\neach(fetch_columns) do |mdl|\n o << (block.call(mdl))\nend\no\n"}},{"html_id":"tags-instance-method","name":"tags","abstract":false,"location":{"filename":"src/clear/model/collection.cr","line_number":292,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L292"},"def":{"name":"tags","visibility":"Public","body":"@tags"}},{"html_id":"to_a(fetch_columns=false):Array(T)-instance-method","name":"to_a","doc":"Create an array from the query.","summary":"

Create an array from the query.

","abstract":false,"args":[{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"args_string":"(fetch_columns = false) : Array(T)","args_html":"(fetch_columns = false) : Array(T)","location":{"filename":"src/clear/model/collection.cr","line_number":528,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L528"},"def":{"name":"to_a","args":[{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"return_type":"Array(T)","visibility":"Public","body":"cr = @cached_result\nif cr\n return cr\nend\no = [] of T\neach(fetch_columns: fetch_columns) do |m|\n o << m\nend\no\n"}},{"html_id":"unlink(item:T)-instance-method","name":"unlink","doc":"Unlink the model currently referenced through a relation `has_many through`\n\nIf the current colleciton doesn't come from a `has_many through` relation,\nthis method will throw `Clear::SQL::OperationNotPermittedError`\n\nReturns `true` if unlinking is successful (e.g. one or more rows have been updated), or `false` otherwise","summary":"

Unlink the model currently referenced through a relation has_many through

","abstract":false,"args":[{"name":"item","external_name":"item","restriction":"T"}],"args_string":"(item : T)","args_html":"(item : T)","location":{"filename":"src/clear/model/collection.cr","line_number":516,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/collection.cr#L516"},"def":{"name":"unlink","args":[{"name":"item","external_name":"item","restriction":"T"}],"visibility":"Public","body":"unlink_operation = self.unlink_operation\nif unlink_operation\nelse\n raise(\"Operation not permitted on this collection.\")\nend\nunlink_operation.call(item)\n@cached_result.try(&.delete(item))\nself\n"}}]},{"html_id":"clear/Clear/Model/Column","path":"Clear/Model/Column.html","kind":"class","full_name":"Clear::Model::Column(T, C)","name":"Column","abstract":false,"superclass":{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"clear/Clear/ErrorMessages","kind":"module","full_name":"Clear::ErrorMessages","name":"ErrorMessages"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/model/column.cr","line_number":9,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/column.cr#L9"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"UNKNOWN","name":"UNKNOWN","value":"UnknownClass.new"}],"included_modules":[{"html_id":"clear/Clear/ErrorMessages","kind":"module","full_name":"Clear::ErrorMessages","name":"ErrorMessages"}],"namespace":{"html_id":"clear/Clear/Model","kind":"module","full_name":"Clear::Model","name":"Model"},"doc":"A column of a Model\nProvide some methods like:\n - Informations persistance (value before, value changed?)\n - Raise error if we try to access the value of a field\n which is not gathered through the query system (uninitialized column).\n Or use the `get_def` to get with default value","summary":"

A column of a Model Provide some methods like: - Informations persistance (value before, value changed?) - Raise error if we try to access the value of a field which is not gathered through the query system (uninitialized column).

","constructors":[{"html_id":"new(name:String,value:T|UnknownClass=UNKNOWN,has_db_default:Bool=false)-class-method","name":"new","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"String"},{"name":"value","default_value":"UNKNOWN","external_name":"value","restriction":"T | UnknownClass"},{"name":"has_db_default","default_value":"false","external_name":"has_db_default","restriction":"::Bool"}],"args_string":"(name : String, value : T | UnknownClass = UNKNOWN, has_db_default : Bool = false)","args_html":"(name : String, value : T | UnknownClass = UNKNOWN, has_db_default : Bool = false)","location":{"filename":"src/clear/model/column.cr","line_number":24,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/column.cr#L24"},"def":{"name":"new","args":[{"name":"name","external_name":"name","restriction":"String"},{"name":"value","default_value":"UNKNOWN","external_name":"value","restriction":"T | UnknownClass"},{"name":"has_db_default","default_value":"false","external_name":"has_db_default","restriction":"::Bool"}],"visibility":"Public","body":"_ = Column(T, C).allocate\n_.initialize(name, value, has_db_default)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"changed?:Bool-instance-method","name":"changed?","abstract":false,"location":{"filename":"src/clear/model/column.cr","line_number":21,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/column.cr#L21"},"def":{"name":"changed?","return_type":"Bool","visibility":"Public","body":"@changed"}},{"html_id":"clear-instance-method","name":"clear","doc":"Completely clear the column, remove both `value` and `old_value` and turning the column in a non-defined state.","summary":"

Completely clear the column, remove both #value and #old_value and turning the column in a non-defined state.

","abstract":false,"location":{"filename":"src/clear/model/column.cr","line_number":140,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/column.cr#L140"},"def":{"name":"clear","visibility":"Public","body":"self.value = UNKNOWN\n@old_value = UNKNOWN\n@changed = false\nself\n"}},{"html_id":"clear_change_flag-instance-method","name":"clear_change_flag","doc":"Reset `changed?` flag to `false`. See `Column(T)#dirty!` for the counter part.","summary":"

Reset #changed? flag to false.

","abstract":false,"location":{"filename":"src/clear/model/column.cr","line_number":156,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/column.cr#L156"},"def":{"name":"clear_change_flag","visibility":"Public","body":"@changed = false\n@old_value = @value\nself\n"}},{"html_id":"defined?-instance-method","name":"defined?","doc":"Check whether the column is defined or not.","summary":"

Check whether the column is defined or not.

","abstract":false,"location":{"filename":"src/clear/model/column.cr","line_number":128,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/column.cr#L128"},"def":{"name":"defined?","visibility":"Public","body":"UNKNOWN != @value"}},{"html_id":"dirty!-instance-method","name":"dirty!","doc":"Reset `changed?` flag to `true`. See `Column(T)#clear_change_flag` for the counter part.","summary":"

Reset #changed? flag to true.

","abstract":false,"location":{"filename":"src/clear/model/column.cr","line_number":150,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/column.cr#L150"},"def":{"name":"dirty!","visibility":"Public","body":"@changed = true\nself\n"}},{"html_id":"has_db_default?:Bool-instance-method","name":"has_db_default?","abstract":false,"location":{"filename":"src/clear/model/column.cr","line_number":22,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/column.cr#L22"},"def":{"name":"has_db_default?","return_type":"Bool","visibility":"Public","body":"@has_db_default"}},{"html_id":"inspect-instance-method","name":"inspect","doc":"Inspect this column.\nIf a column is not loaded (e.g. not defined once), it will show \"#undef\".\nIf a column is dirty (e.g. change hasn't be saved), it will show a \"*\" after the value.","summary":"

Inspect this column.

","abstract":false,"location":{"filename":"src/clear/model/column.cr","line_number":114,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/column.cr#L114"},"def":{"name":"inspect","visibility":"Public","body":"if defined?\n @value.inspect + (changed? ? \"*\" : \"\")\nelse\n \"#undef\"\nend"}},{"html_id":"name:String-instance-method","name":"name","abstract":false,"location":{"filename":"src/clear/model/column.cr","line_number":20,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/column.cr#L20"},"def":{"name":"name","return_type":"String","visibility":"Public","body":"@name"}},{"html_id":"nilable?-instance-method","name":"nilable?","doc":"Return `true` if the value is an union of a Type with Nilable, `false` otherwise.","summary":"

Return true if the value is an union of a Type with Nilable, false otherwise.

","abstract":false,"location":{"filename":"src/clear/model/column.cr","line_number":107,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/column.cr#L107"},"def":{"name":"nilable?","visibility":"Public","body":"T.nilable?"}},{"html_id":"old_value:T|UnknownClass-instance-method","name":"old_value","abstract":false,"location":{"filename":"src/clear/model/column.cr","line_number":19,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/column.cr#L19"},"def":{"name":"old_value","return_type":"T | UnknownClass","visibility":"Public","body":"@old_value"}},{"html_id":"reset(x:T|Nil)-instance-method","name":"reset","doc":"Reset the current field.\nRestore the `old_value` state to current value.\nReset the flag `changed` to false.","summary":"

Reset the current field.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"T | ::Nil"}],"args_string":"(x : T | Nil)","args_html":"(x : T | Nil)","location":{"filename":"src/clear/model/column.cr","line_number":79,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/column.cr#L79"},"def":{"name":"reset","args":[{"name":"x","external_name":"x","restriction":"T | ::Nil"}],"visibility":"Public","body":"{% if T.nilable? %}\n @value = x.as(T)\n {% else %}\n raise null_column_mapping_error(@name, T) if x.nil?\n @value = x.not_nil!\n {% end %}\n@changed = false\n@old_value = @value\n"}},{"html_id":"reset_convert(x)-instance-method","name":"reset_convert","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x)","args_html":"(x)","location":{"filename":"src/clear/model/column.cr","line_number":55,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/column.cr#L55"},"def":{"name":"reset_convert","args":[{"name":"x","external_name":"x","restriction":""}],"visibility":"Public","body":"reset(C.to_column(x))"}},{"html_id":"revert-instance-method","name":"revert","doc":"If the column is dirty (e.g the value has been changed), return to the previous state.","summary":"

If the column is dirty (e.g the value has been changed), return to the previous state.

","abstract":false,"location":{"filename":"src/clear/model/column.cr","line_number":46,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/column.cr#L46"},"def":{"name":"revert","visibility":"Public","body":"if (@value != @old_value) && (@old_value != UNKNOWN)\n @changed = true\n @value = @old_value\nend\n@value\n"}},{"html_id":"set(x:T|Nil)-instance-method","name":"set","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"T | ::Nil"}],"args_string":"(x : T | Nil)","args_html":"(x : T | Nil)","location":{"filename":"src/clear/model/column.cr","line_number":63,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/column.cr#L63"},"def":{"name":"set","args":[{"name":"x","external_name":"x","restriction":"T | ::Nil"}],"visibility":"Public","body":"old_value = @value\n{% if T.nilable? %}\n @value = x.as(T)\n {% else %}\n raise null_column_mapping_error(@name, T) if x.nil?\n @value = x.not_nil!\n {% end %}\n@old_value = old_value\n@changed = true\n"}},{"html_id":"set_convert(x)-instance-method","name":"set_convert","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x)","args_html":"(x)","location":{"filename":"src/clear/model/column.cr","line_number":59,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/column.cr#L59"},"def":{"name":"set_convert","args":[{"name":"x","external_name":"x","restriction":""}],"visibility":"Public","body":"set(C.to_column(x))"}},{"html_id":"to_sql_value(default=nil):Clear::SQL::Any-instance-method","name":"to_sql_value","doc":"Return the database converted value using the converter","summary":"

Return the database converted value using the converter

","abstract":false,"args":[{"name":"default","default_value":"nil","external_name":"default","restriction":""}],"args_string":"(default = nil) : Clear::SQL::Any","args_html":"(default = nil) : Clear::SQL::Any","location":{"filename":"src/clear/model/column.cr","line_number":36,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/column.cr#L36"},"def":{"name":"to_sql_value","args":[{"name":"default","default_value":"nil","external_name":"default","restriction":""}],"return_type":"Clear::SQL::Any","visibility":"Public","body":"C.to_db(value(default))"}},{"html_id":"value(default:X):T|XforallX-instance-method","name":"value","doc":"Returns the current value of this column or `default` if the value is undefined.","summary":"

Returns the current value of this column or default if the value is undefined.

","abstract":false,"args":[{"name":"default","external_name":"default","restriction":"X"}],"args_string":"(default : X) : T | X forall X","args_html":"(default : X) : T | X forall X","location":{"filename":"src/clear/model/column.cr","line_number":41,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/column.cr#L41"},"def":{"name":"value","args":[{"name":"default","external_name":"default","restriction":"X"}],"return_type":"T | X","visibility":"Public","body":"defined? ? @value.as(T) : default"}},{"html_id":"value:T-instance-method","name":"value","doc":"Returns the current value of this column.\nIf the value has never been initialized, throw an exception","summary":"

Returns the current value of this column.

","abstract":false,"location":{"filename":"src/clear/model/column.cr","line_number":30,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/column.cr#L30"},"def":{"name":"value","return_type":"T","visibility":"Public","body":"if defined?\nelse\n raise(illegal_setter_access_to_undefined_column(@name))\nend\n@value.as(T)\n"}},{"html_id":"value=(x:T)-instance-method","name":"value=","doc":"Set the value of the column to the value `x`. If `x` is not equal to the old value, then the column `changed?`\nflag is set to `true`.","summary":"

Set the value of the column to the value x.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"T"}],"args_string":"(x : T)","args_html":"(x : T)","location":{"filename":"src/clear/model/column.cr","line_number":101,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/column.cr#L101"},"def":{"name":"value=","args":[{"name":"x","external_name":"x","restriction":"T"}],"visibility":"Public","body":"@changed = (@old_value != x)\n@value = x\n"}}],"types":[{"html_id":"clear/Clear/Model/Column/UnknownClass","path":"Clear/Model/Column/UnknownClass.html","kind":"struct","full_name":"Clear::Model::Column::UnknownClass","name":"UnknownClass","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/model/column.cr","line_number":12,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/column.cr#L12"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Model/Column","kind":"class","full_name":"Clear::Model::Column(T, C)","name":"Column"},"constructors":[{"html_id":"new-class-method","name":"new","abstract":false,"location":{"filename":"src/clear/model/column.cr","line_number":12,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/column.cr#L12"},"def":{"name":"new","visibility":"Public","body":"x = allocate\nif x.responds_to?(:finalize)\n ::GC.add_finalizer(x)\nend\nx\n"}}],"instance_methods":[{"html_id":"initialize-instance-method","name":"initialize","abstract":false,"location":{"filename":"src/clear/model/column.cr","line_number":12,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/column.cr#L12"},"def":{"name":"initialize","visibility":"Public","body":""}}]}]},{"html_id":"clear/Clear/Model/Connection","path":"Clear/Model/Connection.html","kind":"module","full_name":"Clear::Model::Connection","name":"Connection","abstract":false,"locations":[{"filename":"src/clear/model/modules/connection.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/connection.cr#L1"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"clear/Clear/Model","kind":"module","full_name":"Clear::Model","name":"Model"}],"namespace":{"html_id":"clear/Clear/Model","kind":"module","full_name":"Clear::Model","name":"Model"}},{"html_id":"clear/Clear/Model/Converter","path":"Clear/Model/Converter.html","kind":"module","full_name":"Clear::Model::Converter","name":"Converter","abstract":false,"locations":[{"filename":"src/clear/model/converters/base.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/base.cr#L4"},{"filename":"src/clear/model/converters/number_converters.cr","line_number":3,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/number_converters.cr#L3"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"CONVERTERS","name":"CONVERTERS","value":"{\"Array(Bool)\" => Clear::Model::Converter::ArrayConverterBool, \"Array(Bool | Nil)\" => Clear::Model::Converter::ArrayConverterBool, \"Array(String)\" => Clear::Model::Converter::ArrayConverterString, \"Array(String | Nil)\" => Clear::Model::Converter::ArrayConverterString, \"Array(Float32)\" => Clear::Model::Converter::ArrayConverterFloat32, \"Array(Float32 | Nil)\" => Clear::Model::Converter::ArrayConverterFloat32, \"Array(Float64)\" => Clear::Model::Converter::ArrayConverterFloat64, \"Array(Float64 | Nil)\" => Clear::Model::Converter::ArrayConverterFloat64, \"Array(Int32)\" => Clear::Model::Converter::ArrayConverterInt32, \"Array(Int32 | Nil)\" => Clear::Model::Converter::ArrayConverterInt32, \"Array(Int64)\" => Clear::Model::Converter::ArrayConverterInt64, \"Array(Int64 | Nil)\" => Clear::Model::Converter::ArrayConverterInt64, \"Bool\" => Clear::Model::Converter::BoolConverter, \"JSON::Any\" => Clear::Model::Converter::JSON::AnyConverter, \"Int8\" => ::Clear::Model::Converter::Int8Converter, \"Int16\" => ::Clear::Model::Converter::Int16Converter, \"Int32\" => ::Clear::Model::Converter::Int32Converter, \"Int64\" => ::Clear::Model::Converter::Int64Converter, \"UInt8\" => ::Clear::Model::Converter::UInt8Converter, \"UInt16\" => ::Clear::Model::Converter::UInt16Converter, \"UInt32\" => ::Clear::Model::Converter::UInt32Converter, \"UInt64\" => ::Clear::Model::Converter::UInt64Converter, \"Float32\" => ::Clear::Model::Converter::Float32Converter, \"Float64\" => ::Clear::Model::Converter::Float64Converter, \"BigInt\" => ::Clear::Model::Converter::BigIntConverter, \"BigFloat\" => ::Clear::Model::Converter::BigFloatConverter, \"BigDecimal\" => ::Clear::Model::Converter::BigDecimalConverter, \"String\" => Clear::Model::Converter::StringConverter, \"Time\" => Clear::Model::Converter::TimeConverter, \"Crypto::Bcrypt::Password\" => Clear::Model::Converter::BcryptPasswordConverter, \"Clear::TSVector\" => Clear::TSVector::Converter, \"Clear::Interval\" => Clear::Interval::Converter, \"Clear::TimeInDay\" => Clear::TimeInDay::Converter, \"UUID\" => Clear::Model::Converter::UUIDConverter} of String => Base.class"}],"namespace":{"html_id":"clear/Clear/Model","kind":"module","full_name":"Clear::Model","name":"Model"},"macros":[{"html_id":"add_converter(name,klazz)-macro","name":"add_converter","abstract":false,"args":[{"name":"name","external_name":"name","restriction":""},{"name":"klazz","external_name":"klazz","restriction":""}],"args_string":"(name, klazz)","args_html":"(name, klazz)","location":{"filename":"src/clear/model/converters/base.cr","line_number":10,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/base.cr#L10"},"def":{"name":"add_converter","args":[{"name":"name","external_name":"name","restriction":""},{"name":"klazz","external_name":"klazz","restriction":""}],"visibility":"Public","body":" \n{% CONVERTERS[name] = klazz %}\n\n \n"}},{"html_id":"to_column(name,value)-macro","name":"to_column","abstract":false,"args":[{"name":"name","external_name":"name","restriction":""},{"name":"value","external_name":"value","restriction":""}],"args_string":"(name, value)","args_html":"(name, value)","location":{"filename":"src/clear/model/converters/base.cr","line_number":14,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/base.cr#L14"},"def":{"name":"to_column","args":[{"name":"name","external_name":"name","restriction":""},{"name":"value","external_name":"value","restriction":""}],"visibility":"Public","body":" \n{% if !name.is_a?(StringLiteral) %}\n {% name = \"#{name}\" %}\n {% end %}\n\n\n \n{% if CONVERTERS[name] == nil %}\n {% raise(\"Unknown converter: #{name}\") %}\n {% end %}\n\n\n \n{{ CONVERTERS[name] }}\n.to_column(\n{{ value }}\n)\n \n"}},{"html_id":"to_db(name,value)-macro","name":"to_db","abstract":false,"args":[{"name":"name","external_name":"name","restriction":""},{"name":"value","external_name":"value","restriction":""}],"args_string":"(name, value)","args_html":"(name, value)","location":{"filename":"src/clear/model/converters/base.cr","line_number":26,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/base.cr#L26"},"def":{"name":"to_db","args":[{"name":"name","external_name":"name","restriction":""},{"name":"value","external_name":"value","restriction":""}],"visibility":"Public","body":" \n{% if !name.is_a?(StringLiteral) %}\n {% name = \"#{name.resolve}\" %}\n {% end %}\n\n\n \n{% if CONVERTERS[name] == nil %}\n {% raise(\"Unknown converter: #{name}\") %}\n {% end %}\n\n\n \n{{ CONVERTERS[name] }}\n.to_db(\n{{ value }}\n)\n \n"}}],"types":[{"html_id":"clear/Clear/Model/Converter/ArrayConverterBool","path":"Clear/Model/Converter/ArrayConverterBool.html","kind":"module","full_name":"Clear::Model::Converter::ArrayConverterBool","name":"ArrayConverterBool","abstract":false,"locations":[{"filename":"src/clear/model/converters/array_converter.cr","line_number":21,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/array_converter.cr#L21"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Model/Converter","kind":"module","full_name":"Clear::Model::Converter","name":"Converter"},"class_methods":[{"html_id":"to_column(x):Array(Bool)|Nil-class-method","name":"to_column","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x) : Array(Bool) | Nil","args_html":"(x) : Array(Bool) | Nil","location":{"filename":"src/clear/model/converters/array_converter.cr","line_number":21,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/array_converter.cr#L21"},"def":{"name":"to_column","args":[{"name":"x","external_name":"x","restriction":""}],"return_type":"Array(::Bool) | ::Nil","visibility":"Public","body":"case x\nwhen Nil\n nil\nwhen ::Bool\n [x]\nwhen Array(::Bool)\n x\nwhen Array(::PG::BoolArray)\n x.map do |i|\n case i\n when ::Bool\n i\n else\n nil\n end\n end.compact\nwhen Array(::JSON::Any)\n x.map(&.as_bool)\nwhen ::JSON::Any\n if arr = x.as_a?\n arr.map(&.as_bool)\n else\n raise(\"Cannot convert from #{x.class} to Array(Bool) [1]\")\n end\nelse\n raise(\"Cannot convert from #{x.class} to Array(Bool) [2]\")\nend"}},{"html_id":"to_db(x:Array(Bool)|Nil):Clear::SQL::Any-class-method","name":"to_db","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Array(::Bool) | ::Nil"}],"args_string":"(x : Array(Bool) | Nil) : Clear::SQL::Any","args_html":"(x : Array(Bool) | Nil) : Clear::SQL::Any","location":{"filename":"src/clear/model/converters/array_converter.cr","line_number":21,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/array_converter.cr#L21"},"def":{"name":"to_db","args":[{"name":"x","external_name":"x","restriction":"Array(::Bool) | ::Nil"}],"return_type":"Clear::SQL::Any","visibility":"Public","body":"if x\nelse\n return\nend\nClear::Expression.unsafe({\"Array[\", to_string(x), \"]::boolean[]\"}.join)\n"}},{"html_id":"to_string(x):String-class-method","name":"to_string","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x) : String","args_html":"(x) : String","location":{"filename":"src/clear/model/converters/array_converter.cr","line_number":21,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/array_converter.cr#L21"},"def":{"name":"to_string","args":[{"name":"x","external_name":"x","restriction":""}],"return_type":"String","visibility":"Public","body":"case x\nwhen Array\n x.join(\", \") do |it|\n to_string(it)\n end\nelse\n \"\" + Clear::Expression[x]\nend"}}]},{"html_id":"clear/Clear/Model/Converter/ArrayConverterFloat32","path":"Clear/Model/Converter/ArrayConverterFloat32.html","kind":"module","full_name":"Clear::Model::Converter::ArrayConverterFloat32","name":"ArrayConverterFloat32","abstract":false,"locations":[{"filename":"src/clear/model/converters/array_converter.cr","line_number":21,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/array_converter.cr#L21"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Model/Converter","kind":"module","full_name":"Clear::Model::Converter","name":"Converter"},"class_methods":[{"html_id":"to_column(x):Array(Float32)|Nil-class-method","name":"to_column","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x) : Array(Float32) | Nil","args_html":"(x) : Array(Float32) | Nil","location":{"filename":"src/clear/model/converters/array_converter.cr","line_number":21,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/array_converter.cr#L21"},"def":{"name":"to_column","args":[{"name":"x","external_name":"x","restriction":""}],"return_type":"Array(::Float32) | ::Nil","visibility":"Public","body":"case x\nwhen Nil\n nil\nwhen ::Float32\n [x]\nwhen Array(::Float32)\n x\nwhen Array(::PG::Float32Array)\n x.map do |i|\n case i\n when ::Float32\n i\n else\n nil\n end\n end.compact\nwhen Array(::JSON::Any)\n x.map(&.as_f32)\nwhen ::JSON::Any\n if arr = x.as_a?\n arr.map(&.as_f32)\n else\n raise(\"Cannot convert from #{x.class} to Array(Float32) [1]\")\n end\nelse\n raise(\"Cannot convert from #{x.class} to Array(Float32) [2]\")\nend"}},{"html_id":"to_db(x:Array(Float32)|Nil):Clear::SQL::Any-class-method","name":"to_db","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Array(::Float32) | ::Nil"}],"args_string":"(x : Array(Float32) | Nil) : Clear::SQL::Any","args_html":"(x : Array(Float32) | Nil) : Clear::SQL::Any","location":{"filename":"src/clear/model/converters/array_converter.cr","line_number":21,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/array_converter.cr#L21"},"def":{"name":"to_db","args":[{"name":"x","external_name":"x","restriction":"Array(::Float32) | ::Nil"}],"return_type":"Clear::SQL::Any","visibility":"Public","body":"if x\nelse\n return\nend\nClear::Expression.unsafe({\"Array[\", to_string(x), \"]::real[]\"}.join)\n"}},{"html_id":"to_string(x):String-class-method","name":"to_string","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x) : String","args_html":"(x) : String","location":{"filename":"src/clear/model/converters/array_converter.cr","line_number":21,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/array_converter.cr#L21"},"def":{"name":"to_string","args":[{"name":"x","external_name":"x","restriction":""}],"return_type":"String","visibility":"Public","body":"case x\nwhen Array\n x.join(\", \") do |it|\n to_string(it)\n end\nelse\n \"\" + Clear::Expression[x]\nend"}}]},{"html_id":"clear/Clear/Model/Converter/ArrayConverterFloat64","path":"Clear/Model/Converter/ArrayConverterFloat64.html","kind":"module","full_name":"Clear::Model::Converter::ArrayConverterFloat64","name":"ArrayConverterFloat64","abstract":false,"locations":[{"filename":"src/clear/model/converters/array_converter.cr","line_number":21,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/array_converter.cr#L21"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Model/Converter","kind":"module","full_name":"Clear::Model::Converter","name":"Converter"},"class_methods":[{"html_id":"to_column(x):Array(Float64)|Nil-class-method","name":"to_column","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x) : Array(Float64) | Nil","args_html":"(x) : Array(Float64) | Nil","location":{"filename":"src/clear/model/converters/array_converter.cr","line_number":21,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/array_converter.cr#L21"},"def":{"name":"to_column","args":[{"name":"x","external_name":"x","restriction":""}],"return_type":"Array(::Float64) | ::Nil","visibility":"Public","body":"case x\nwhen Nil\n nil\nwhen ::Float64\n [x]\nwhen Array(::Float64)\n x\nwhen Array(::PG::Float64Array)\n x.map do |i|\n case i\n when ::Float64\n i\n else\n nil\n end\n end.compact\nwhen Array(::JSON::Any)\n x.map(&.as_f)\nwhen ::JSON::Any\n if arr = x.as_a?\n arr.map(&.as_f)\n else\n raise(\"Cannot convert from #{x.class} to Array(Float64) [1]\")\n end\nelse\n raise(\"Cannot convert from #{x.class} to Array(Float64) [2]\")\nend"}},{"html_id":"to_db(x:Array(Float64)|Nil):Clear::SQL::Any-class-method","name":"to_db","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Array(::Float64) | ::Nil"}],"args_string":"(x : Array(Float64) | Nil) : Clear::SQL::Any","args_html":"(x : Array(Float64) | Nil) : Clear::SQL::Any","location":{"filename":"src/clear/model/converters/array_converter.cr","line_number":21,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/array_converter.cr#L21"},"def":{"name":"to_db","args":[{"name":"x","external_name":"x","restriction":"Array(::Float64) | ::Nil"}],"return_type":"Clear::SQL::Any","visibility":"Public","body":"if x\nelse\n return\nend\nClear::Expression.unsafe({\"Array[\", to_string(x), \"]::double precision[]\"}.join)\n"}},{"html_id":"to_string(x):String-class-method","name":"to_string","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x) : String","args_html":"(x) : String","location":{"filename":"src/clear/model/converters/array_converter.cr","line_number":21,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/array_converter.cr#L21"},"def":{"name":"to_string","args":[{"name":"x","external_name":"x","restriction":""}],"return_type":"String","visibility":"Public","body":"case x\nwhen Array\n x.join(\", \") do |it|\n to_string(it)\n end\nelse\n \"\" + Clear::Expression[x]\nend"}}]},{"html_id":"clear/Clear/Model/Converter/ArrayConverterInt32","path":"Clear/Model/Converter/ArrayConverterInt32.html","kind":"module","full_name":"Clear::Model::Converter::ArrayConverterInt32","name":"ArrayConverterInt32","abstract":false,"locations":[{"filename":"src/clear/model/converters/array_converter.cr","line_number":21,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/array_converter.cr#L21"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Model/Converter","kind":"module","full_name":"Clear::Model::Converter","name":"Converter"},"class_methods":[{"html_id":"to_column(x):Array(Int32)|Nil-class-method","name":"to_column","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x) : Array(Int32) | Nil","args_html":"(x) : Array(Int32) | Nil","location":{"filename":"src/clear/model/converters/array_converter.cr","line_number":21,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/array_converter.cr#L21"},"def":{"name":"to_column","args":[{"name":"x","external_name":"x","restriction":""}],"return_type":"Array(::Int32) | ::Nil","visibility":"Public","body":"case x\nwhen Nil\n nil\nwhen ::Int32\n [x]\nwhen Array(::Int32)\n x\nwhen Array(::PG::Int32Array)\n x.map do |i|\n case i\n when ::Int32\n i\n else\n nil\n end\n end.compact\nwhen Array(::JSON::Any)\n x.map(&.as_i)\nwhen ::JSON::Any\n if arr = x.as_a?\n arr.map(&.as_i)\n else\n raise(\"Cannot convert from #{x.class} to Array(Int32) [1]\")\n end\nelse\n raise(\"Cannot convert from #{x.class} to Array(Int32) [2]\")\nend"}},{"html_id":"to_db(x:Array(Int32)|Nil):Clear::SQL::Any-class-method","name":"to_db","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Array(::Int32) | ::Nil"}],"args_string":"(x : Array(Int32) | Nil) : Clear::SQL::Any","args_html":"(x : Array(Int32) | Nil) : Clear::SQL::Any","location":{"filename":"src/clear/model/converters/array_converter.cr","line_number":21,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/array_converter.cr#L21"},"def":{"name":"to_db","args":[{"name":"x","external_name":"x","restriction":"Array(::Int32) | ::Nil"}],"return_type":"Clear::SQL::Any","visibility":"Public","body":"if x\nelse\n return\nend\nClear::Expression.unsafe({\"Array[\", to_string(x), \"]::int[]\"}.join)\n"}},{"html_id":"to_string(x):String-class-method","name":"to_string","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x) : String","args_html":"(x) : String","location":{"filename":"src/clear/model/converters/array_converter.cr","line_number":21,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/array_converter.cr#L21"},"def":{"name":"to_string","args":[{"name":"x","external_name":"x","restriction":""}],"return_type":"String","visibility":"Public","body":"case x\nwhen Array\n x.join(\", \") do |it|\n to_string(it)\n end\nelse\n \"\" + Clear::Expression[x]\nend"}}]},{"html_id":"clear/Clear/Model/Converter/ArrayConverterInt64","path":"Clear/Model/Converter/ArrayConverterInt64.html","kind":"module","full_name":"Clear::Model::Converter::ArrayConverterInt64","name":"ArrayConverterInt64","abstract":false,"locations":[{"filename":"src/clear/model/converters/array_converter.cr","line_number":21,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/array_converter.cr#L21"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Model/Converter","kind":"module","full_name":"Clear::Model::Converter","name":"Converter"},"class_methods":[{"html_id":"to_column(x):Array(Int64)|Nil-class-method","name":"to_column","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x) : Array(Int64) | Nil","args_html":"(x) : Array(Int64) | Nil","location":{"filename":"src/clear/model/converters/array_converter.cr","line_number":21,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/array_converter.cr#L21"},"def":{"name":"to_column","args":[{"name":"x","external_name":"x","restriction":""}],"return_type":"Array(::Int64) | ::Nil","visibility":"Public","body":"case x\nwhen Nil\n nil\nwhen ::Int64\n [x]\nwhen Array(::Int64)\n x\nwhen Array(::PG::Int64Array)\n x.map do |i|\n case i\n when ::Int64\n i\n else\n nil\n end\n end.compact\nwhen Array(::JSON::Any)\n x.map(&.as_i64)\nwhen ::JSON::Any\n if arr = x.as_a?\n arr.map(&.as_i64)\n else\n raise(\"Cannot convert from #{x.class} to Array(Int64) [1]\")\n end\nelse\n raise(\"Cannot convert from #{x.class} to Array(Int64) [2]\")\nend"}},{"html_id":"to_db(x:Array(Int64)|Nil):Clear::SQL::Any-class-method","name":"to_db","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Array(::Int64) | ::Nil"}],"args_string":"(x : Array(Int64) | Nil) : Clear::SQL::Any","args_html":"(x : Array(Int64) | Nil) : Clear::SQL::Any","location":{"filename":"src/clear/model/converters/array_converter.cr","line_number":21,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/array_converter.cr#L21"},"def":{"name":"to_db","args":[{"name":"x","external_name":"x","restriction":"Array(::Int64) | ::Nil"}],"return_type":"Clear::SQL::Any","visibility":"Public","body":"if x\nelse\n return\nend\nClear::Expression.unsafe({\"Array[\", to_string(x), \"]::bigint[]\"}.join)\n"}},{"html_id":"to_string(x):String-class-method","name":"to_string","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x) : String","args_html":"(x) : String","location":{"filename":"src/clear/model/converters/array_converter.cr","line_number":21,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/array_converter.cr#L21"},"def":{"name":"to_string","args":[{"name":"x","external_name":"x","restriction":""}],"return_type":"String","visibility":"Public","body":"case x\nwhen Array\n x.join(\", \") do |it|\n to_string(it)\n end\nelse\n \"\" + Clear::Expression[x]\nend"}}]},{"html_id":"clear/Clear/Model/Converter/ArrayConverterString","path":"Clear/Model/Converter/ArrayConverterString.html","kind":"module","full_name":"Clear::Model::Converter::ArrayConverterString","name":"ArrayConverterString","abstract":false,"locations":[{"filename":"src/clear/model/converters/array_converter.cr","line_number":21,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/array_converter.cr#L21"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Model/Converter","kind":"module","full_name":"Clear::Model::Converter","name":"Converter"},"class_methods":[{"html_id":"to_column(x):Array(String)|Nil-class-method","name":"to_column","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x) : Array(String) | Nil","args_html":"(x) : Array(String) | Nil","location":{"filename":"src/clear/model/converters/array_converter.cr","line_number":21,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/array_converter.cr#L21"},"def":{"name":"to_column","args":[{"name":"x","external_name":"x","restriction":""}],"return_type":"Array(::String) | ::Nil","visibility":"Public","body":"case x\nwhen Nil\n nil\nwhen ::String\n [x]\nwhen Array(::String)\n x\nwhen Array(::PG::StringArray)\n x.map do |i|\n case i\n when ::String\n i\n else\n nil\n end\n end.compact\nwhen Array(::JSON::Any)\n x.map(&.as_s)\nwhen ::JSON::Any\n if arr = x.as_a?\n arr.map(&.as_s)\n else\n raise(\"Cannot convert from #{x.class} to Array(String) [1]\")\n end\nelse\n raise(\"Cannot convert from #{x.class} to Array(String) [2]\")\nend"}},{"html_id":"to_db(x:Array(String)|Nil):Clear::SQL::Any-class-method","name":"to_db","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Array(::String) | ::Nil"}],"args_string":"(x : Array(String) | Nil) : Clear::SQL::Any","args_html":"(x : Array(String) | Nil) : Clear::SQL::Any","location":{"filename":"src/clear/model/converters/array_converter.cr","line_number":21,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/array_converter.cr#L21"},"def":{"name":"to_db","args":[{"name":"x","external_name":"x","restriction":"Array(::String) | ::Nil"}],"return_type":"Clear::SQL::Any","visibility":"Public","body":"if x\nelse\n return\nend\nClear::Expression.unsafe({\"Array[\", to_string(x), \"]::text[]\"}.join)\n"}},{"html_id":"to_string(x):String-class-method","name":"to_string","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x) : String","args_html":"(x) : String","location":{"filename":"src/clear/model/converters/array_converter.cr","line_number":21,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/array_converter.cr#L21"},"def":{"name":"to_string","args":[{"name":"x","external_name":"x","restriction":""}],"return_type":"String","visibility":"Public","body":"case x\nwhen Array\n x.join(\", \") do |it|\n to_string(it)\n end\nelse\n \"\" + Clear::Expression[x]\nend"}}]},{"html_id":"clear/Clear/Model/Converter/Base","path":"Clear/Model/Converter/Base.html","kind":"class","full_name":"Clear::Model::Converter::Base","name":"Base","abstract":true,"superclass":{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/model/converters/base.cr","line_number":5,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/base.cr#L5"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Model/Converter","kind":"module","full_name":"Clear::Model::Converter","name":"Converter"}},{"html_id":"clear/Clear/Model/Converter/BcryptPasswordConverter","path":"Clear/Model/Converter/BcryptPasswordConverter.html","kind":"module","full_name":"Clear::Model::Converter::BcryptPasswordConverter","name":"BcryptPasswordConverter","abstract":false,"locations":[{"filename":"src/clear/extensions/bcrypt/bcrypt.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/bcrypt/bcrypt.cr#L1"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Model/Converter","kind":"module","full_name":"Clear::Model::Converter","name":"Converter"},"class_methods":[{"html_id":"to_column(x):Crypto::Bcrypt::Password|Nil-class-method","name":"to_column","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x) : Crypto::Bcrypt::Password | Nil","args_html":"(x) : Crypto::Bcrypt::Password | Nil","location":{"filename":"src/clear/extensions/bcrypt/bcrypt.cr","line_number":2,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/bcrypt/bcrypt.cr#L2"},"def":{"name":"to_column","args":[{"name":"x","external_name":"x","restriction":""}],"return_type":"::Crypto::Bcrypt::Password | ::Nil","visibility":"Public","body":"case x\nwhen String\n ::Crypto::Bcrypt::Password.new(x)\nwhen ::Crypto::Bcrypt::Password\n x\nwhen Nil\n nil\nelse\n raise(Clear::ErrorMessages.converter_error(x.class.name, \"Crypto::Bcrypt::Password\"))\nend"}},{"html_id":"to_db(x:Crypto::Bcrypt::Password|Nil)-class-method","name":"to_db","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"::Crypto::Bcrypt::Password | ::Nil"}],"args_string":"(x : Crypto::Bcrypt::Password | Nil)","args_html":"(x : Crypto::Bcrypt::Password | Nil)","location":{"filename":"src/clear/extensions/bcrypt/bcrypt.cr","line_number":15,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/bcrypt/bcrypt.cr#L15"},"def":{"name":"to_db","args":[{"name":"x","external_name":"x","restriction":"::Crypto::Bcrypt::Password | ::Nil"}],"visibility":"Public","body":"case x\nwhen ::Union(::Crypto::Bcrypt::Password, ::Nil)\n x.to_s\nwhen Nil\n nil\nend"}}]},{"html_id":"clear/Clear/Model/Converter/BigDecimalConverter","path":"Clear/Model/Converter/BigDecimalConverter.html","kind":"class","full_name":"Clear::Model::Converter::BigDecimalConverter","name":"BigDecimalConverter","abstract":false,"superclass":{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/model/converters/number_converters.cr","line_number":43,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/number_converters.cr#L43"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Model/Converter","kind":"module","full_name":"Clear::Model::Converter","name":"Converter"},"doc":"Convert from and to BigDecimal","summary":"

Convert from and to BigDecimal

","class_methods":[{"html_id":"to_column(x):BigDecimal|Nil-class-method","name":"to_column","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x) : BigDecimal | Nil","args_html":"(x) : BigDecimal | Nil","location":{"filename":"src/clear/model/converters/number_converters.cr","line_number":43,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/number_converters.cr#L43"},"def":{"name":"to_column","args":[{"name":"x","external_name":"x","restriction":""}],"return_type":"BigDecimal | ::Nil","visibility":"Public","body":"case x\nwhen Nil\n nil\nwhen Number\n BigDecimal.new(x)\nelse\n BigDecimal.new(x.to_s)\nend"}},{"html_id":"to_db(x:BigDecimal|Nil)-class-method","name":"to_db","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"BigDecimal | ::Nil"}],"args_string":"(x : BigDecimal | Nil)","args_html":"(x : BigDecimal | Nil)","location":{"filename":"src/clear/model/converters/number_converters.cr","line_number":43,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/number_converters.cr#L43"},"def":{"name":"to_db","args":[{"name":"x","external_name":"x","restriction":"BigDecimal | ::Nil"}],"visibility":"Public","body":"x"}}]},{"html_id":"clear/Clear/Model/Converter/BigFloatConverter","path":"Clear/Model/Converter/BigFloatConverter.html","kind":"class","full_name":"Clear::Model::Converter::BigFloatConverter","name":"BigFloatConverter","abstract":false,"superclass":{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/model/converters/number_converters.cr","line_number":42,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/number_converters.cr#L42"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Model/Converter","kind":"module","full_name":"Clear::Model::Converter","name":"Converter"},"doc":"Convert from and to BigFloat","summary":"

Convert from and to BigFloat

","class_methods":[{"html_id":"to_column(x):BigFloat|Nil-class-method","name":"to_column","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x) : BigFloat | Nil","args_html":"(x) : BigFloat | Nil","location":{"filename":"src/clear/model/converters/number_converters.cr","line_number":42,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/number_converters.cr#L42"},"def":{"name":"to_column","args":[{"name":"x","external_name":"x","restriction":""}],"return_type":"BigFloat | ::Nil","visibility":"Public","body":"case x\nwhen Nil\n nil\nwhen Number\n BigFloat.new(x)\nelse\n BigFloat.new(x.to_s)\nend"}},{"html_id":"to_db(x:BigFloat|Nil)-class-method","name":"to_db","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"BigFloat | ::Nil"}],"args_string":"(x : BigFloat | Nil)","args_html":"(x : BigFloat | Nil)","location":{"filename":"src/clear/model/converters/number_converters.cr","line_number":42,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/number_converters.cr#L42"},"def":{"name":"to_db","args":[{"name":"x","external_name":"x","restriction":"BigFloat | ::Nil"}],"visibility":"Public","body":"x"}}]},{"html_id":"clear/Clear/Model/Converter/BigIntConverter","path":"Clear/Model/Converter/BigIntConverter.html","kind":"class","full_name":"Clear::Model::Converter::BigIntConverter","name":"BigIntConverter","abstract":false,"superclass":{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/model/converters/number_converters.cr","line_number":41,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/number_converters.cr#L41"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Model/Converter","kind":"module","full_name":"Clear::Model::Converter","name":"Converter"},"doc":"Convert from and to BigInt","summary":"

Convert from and to BigInt

","class_methods":[{"html_id":"to_column(x):BigInt|Nil-class-method","name":"to_column","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x) : BigInt | Nil","args_html":"(x) : BigInt | Nil","location":{"filename":"src/clear/model/converters/number_converters.cr","line_number":41,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/number_converters.cr#L41"},"def":{"name":"to_column","args":[{"name":"x","external_name":"x","restriction":""}],"return_type":"BigInt | ::Nil","visibility":"Public","body":"case x\nwhen Nil\n nil\nwhen Number\n BigInt.new(x)\nelse\n BigInt.new(x.to_s)\nend"}},{"html_id":"to_db(x:BigInt|Nil)-class-method","name":"to_db","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"BigInt | ::Nil"}],"args_string":"(x : BigInt | Nil)","args_html":"(x : BigInt | Nil)","location":{"filename":"src/clear/model/converters/number_converters.cr","line_number":41,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/number_converters.cr#L41"},"def":{"name":"to_db","args":[{"name":"x","external_name":"x","restriction":"BigInt | ::Nil"}],"visibility":"Public","body":"x"}}]},{"html_id":"clear/Clear/Model/Converter/BoolConverter","path":"Clear/Model/Converter/BoolConverter.html","kind":"module","full_name":"Clear::Model::Converter::BoolConverter","name":"BoolConverter","abstract":false,"locations":[{"filename":"src/clear/model/converters/bool_converter.cr","line_number":11,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/bool_converter.cr#L11"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Model/Converter","kind":"module","full_name":"Clear::Model::Converter","name":"Converter"},"doc":"Convert the column to a boolean\nIf value is not boolean (e.g. string or number), rules of `falsey`\nvalue is used:\n\nfalsey's values are:\n`false`, `nil`, `0`, `\"0\"`, `\"\"` (empty string), `\"false\"`, `\"f\"`\n\nAnything else is considered `true`","summary":"

Convert the column to a boolean If value is not boolean (e.g.

","class_methods":[{"html_id":"to_column(x):Bool|Nil-class-method","name":"to_column","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x) : Bool | Nil","args_html":"(x) : Bool | Nil","location":{"filename":"src/clear/model/converters/bool_converter.cr","line_number":12,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/bool_converter.cr#L12"},"def":{"name":"to_column","args":[{"name":"x","external_name":"x","restriction":""}],"return_type":"Bool | ::Nil","visibility":"Public","body":"case x\nwhen Nil\n nil\nwhen Bool\n x\nwhen Number\n x != 0\nwhen String\n x = x.downcase\n (((x != \"f\") && (x != \"false\")) && (x != \"\")) && (x != \"0\")\nelse\n true\nend"}},{"html_id":"to_db(x:Bool|Nil)-class-method","name":"to_db","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Bool | ::Nil"}],"args_string":"(x : Bool | Nil)","args_html":"(x : Bool | Nil)","location":{"filename":"src/clear/model/converters/bool_converter.cr","line_number":28,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/bool_converter.cr#L28"},"def":{"name":"to_db","args":[{"name":"x","external_name":"x","restriction":"Bool | ::Nil"}],"visibility":"Public","body":"x.nil? ? nil : (x ? \"t\" : \"f\")"}}]},{"html_id":"clear/Clear/Model/Converter/Float32Converter","path":"Clear/Model/Converter/Float32Converter.html","kind":"class","full_name":"Clear::Model::Converter::Float32Converter","name":"Float32Converter","abstract":false,"superclass":{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/model/converters/number_converters.cr","line_number":38,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/number_converters.cr#L38"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Model/Converter","kind":"module","full_name":"Clear::Model::Converter","name":"Converter"},"doc":"Convert from and to Float32","summary":"

Convert from and to Float32

","class_methods":[{"html_id":"to_column(x):Float32|Nil-class-method","name":"to_column","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x) : Float32 | Nil","args_html":"(x) : Float32 | Nil","location":{"filename":"src/clear/model/converters/number_converters.cr","line_number":38,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/number_converters.cr#L38"},"def":{"name":"to_column","args":[{"name":"x","external_name":"x","restriction":""}],"return_type":"Float32 | ::Nil","visibility":"Public","body":"case x\nwhen Nil\n nil\nwhen Number\n Float32.new(x)\nelse\n Float32.new(x.to_s)\nend"}},{"html_id":"to_db(x:Float32|Nil)-class-method","name":"to_db","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Float32 | ::Nil"}],"args_string":"(x : Float32 | Nil)","args_html":"(x : Float32 | Nil)","location":{"filename":"src/clear/model/converters/number_converters.cr","line_number":38,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/number_converters.cr#L38"},"def":{"name":"to_db","args":[{"name":"x","external_name":"x","restriction":"Float32 | ::Nil"}],"visibility":"Public","body":"x"}}]},{"html_id":"clear/Clear/Model/Converter/Float64Converter","path":"Clear/Model/Converter/Float64Converter.html","kind":"class","full_name":"Clear::Model::Converter::Float64Converter","name":"Float64Converter","abstract":false,"superclass":{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/model/converters/number_converters.cr","line_number":39,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/number_converters.cr#L39"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Model/Converter","kind":"module","full_name":"Clear::Model::Converter","name":"Converter"},"doc":"Convert from and to Float64","summary":"

Convert from and to Float64

","class_methods":[{"html_id":"to_column(x):Float64|Nil-class-method","name":"to_column","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x) : Float64 | Nil","args_html":"(x) : Float64 | Nil","location":{"filename":"src/clear/model/converters/number_converters.cr","line_number":39,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/number_converters.cr#L39"},"def":{"name":"to_column","args":[{"name":"x","external_name":"x","restriction":""}],"return_type":"Float64 | ::Nil","visibility":"Public","body":"case x\nwhen Nil\n nil\nwhen Number\n Float64.new(x)\nelse\n Float64.new(x.to_s)\nend"}},{"html_id":"to_db(x:Float64|Nil)-class-method","name":"to_db","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Float64 | ::Nil"}],"args_string":"(x : Float64 | Nil)","args_html":"(x : Float64 | Nil)","location":{"filename":"src/clear/model/converters/number_converters.cr","line_number":39,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/number_converters.cr#L39"},"def":{"name":"to_db","args":[{"name":"x","external_name":"x","restriction":"Float64 | ::Nil"}],"visibility":"Public","body":"x"}}]},{"html_id":"clear/Clear/Model/Converter/Int16Converter","path":"Clear/Model/Converter/Int16Converter.html","kind":"class","full_name":"Clear::Model::Converter::Int16Converter","name":"Int16Converter","abstract":false,"superclass":{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/model/converters/number_converters.cr","line_number":29,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/number_converters.cr#L29"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Model/Converter","kind":"module","full_name":"Clear::Model::Converter","name":"Converter"},"doc":"Convert from and to Int16","summary":"

Convert from and to Int16

","class_methods":[{"html_id":"to_column(x):Int16|Nil-class-method","name":"to_column","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x) : Int16 | Nil","args_html":"(x) : Int16 | Nil","location":{"filename":"src/clear/model/converters/number_converters.cr","line_number":29,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/number_converters.cr#L29"},"def":{"name":"to_column","args":[{"name":"x","external_name":"x","restriction":""}],"return_type":"Int16 | ::Nil","visibility":"Public","body":"case x\nwhen Nil\n nil\nwhen Number\n Int16.new(x)\nelse\n Int16.new(x.to_s)\nend"}},{"html_id":"to_db(x:Int16|Nil)-class-method","name":"to_db","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Int16 | ::Nil"}],"args_string":"(x : Int16 | Nil)","args_html":"(x : Int16 | Nil)","location":{"filename":"src/clear/model/converters/number_converters.cr","line_number":29,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/number_converters.cr#L29"},"def":{"name":"to_db","args":[{"name":"x","external_name":"x","restriction":"Int16 | ::Nil"}],"visibility":"Public","body":"x"}}]},{"html_id":"clear/Clear/Model/Converter/Int32Converter","path":"Clear/Model/Converter/Int32Converter.html","kind":"class","full_name":"Clear::Model::Converter::Int32Converter","name":"Int32Converter","abstract":false,"superclass":{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/model/converters/number_converters.cr","line_number":30,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/number_converters.cr#L30"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Model/Converter","kind":"module","full_name":"Clear::Model::Converter","name":"Converter"},"doc":"Convert from and to Int32","summary":"

Convert from and to Int32

","class_methods":[{"html_id":"to_column(x):Int32|Nil-class-method","name":"to_column","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x) : Int32 | Nil","args_html":"(x) : Int32 | Nil","location":{"filename":"src/clear/model/converters/number_converters.cr","line_number":30,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/number_converters.cr#L30"},"def":{"name":"to_column","args":[{"name":"x","external_name":"x","restriction":""}],"return_type":"Int32 | ::Nil","visibility":"Public","body":"case x\nwhen Nil\n nil\nwhen Number\n Int32.new(x)\nelse\n Int32.new(x.to_s)\nend"}},{"html_id":"to_db(x:Int32|Nil)-class-method","name":"to_db","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Int32 | ::Nil"}],"args_string":"(x : Int32 | Nil)","args_html":"(x : Int32 | Nil)","location":{"filename":"src/clear/model/converters/number_converters.cr","line_number":30,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/number_converters.cr#L30"},"def":{"name":"to_db","args":[{"name":"x","external_name":"x","restriction":"Int32 | ::Nil"}],"visibility":"Public","body":"x"}}]},{"html_id":"clear/Clear/Model/Converter/Int64Converter","path":"Clear/Model/Converter/Int64Converter.html","kind":"class","full_name":"Clear::Model::Converter::Int64Converter","name":"Int64Converter","abstract":false,"superclass":{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/model/converters/number_converters.cr","line_number":31,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/number_converters.cr#L31"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Model/Converter","kind":"module","full_name":"Clear::Model::Converter","name":"Converter"},"doc":"Convert from and to Int64","summary":"

Convert from and to Int64

","class_methods":[{"html_id":"to_column(x):Int64|Nil-class-method","name":"to_column","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x) : Int64 | Nil","args_html":"(x) : Int64 | Nil","location":{"filename":"src/clear/model/converters/number_converters.cr","line_number":31,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/number_converters.cr#L31"},"def":{"name":"to_column","args":[{"name":"x","external_name":"x","restriction":""}],"return_type":"Int64 | ::Nil","visibility":"Public","body":"case x\nwhen Nil\n nil\nwhen Number\n Int64.new(x)\nelse\n Int64.new(x.to_s)\nend"}},{"html_id":"to_db(x:Int64|Nil)-class-method","name":"to_db","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Int64 | ::Nil"}],"args_string":"(x : Int64 | Nil)","args_html":"(x : Int64 | Nil)","location":{"filename":"src/clear/model/converters/number_converters.cr","line_number":31,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/number_converters.cr#L31"},"def":{"name":"to_db","args":[{"name":"x","external_name":"x","restriction":"Int64 | ::Nil"}],"visibility":"Public","body":"x"}}]},{"html_id":"clear/Clear/Model/Converter/Int8Converter","path":"Clear/Model/Converter/Int8Converter.html","kind":"class","full_name":"Clear::Model::Converter::Int8Converter","name":"Int8Converter","abstract":false,"superclass":{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/model/converters/number_converters.cr","line_number":28,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/number_converters.cr#L28"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Model/Converter","kind":"module","full_name":"Clear::Model::Converter","name":"Converter"},"doc":"Convert from and to Int8","summary":"

Convert from and to Int8

","class_methods":[{"html_id":"to_column(x):Int8|Nil-class-method","name":"to_column","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x) : Int8 | Nil","args_html":"(x) : Int8 | Nil","location":{"filename":"src/clear/model/converters/number_converters.cr","line_number":28,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/number_converters.cr#L28"},"def":{"name":"to_column","args":[{"name":"x","external_name":"x","restriction":""}],"return_type":"Int8 | ::Nil","visibility":"Public","body":"case x\nwhen Nil\n nil\nwhen Number\n Int8.new(x)\nelse\n Int8.new(x.to_s)\nend"}},{"html_id":"to_db(x:Int8|Nil)-class-method","name":"to_db","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Int8 | ::Nil"}],"args_string":"(x : Int8 | Nil)","args_html":"(x : Int8 | Nil)","location":{"filename":"src/clear/model/converters/number_converters.cr","line_number":28,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/number_converters.cr#L28"},"def":{"name":"to_db","args":[{"name":"x","external_name":"x","restriction":"Int8 | ::Nil"}],"visibility":"Public","body":"x"}}]},{"html_id":"clear/Clear/Model/Converter/JSON","path":"Clear/Model/Converter/JSON.html","kind":"module","full_name":"Clear::Model::Converter::JSON","name":"JSON","abstract":false,"locations":[{"filename":"src/clear/model/converters/json_any_converter.cr","line_number":3,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/json_any_converter.cr#L3"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Model/Converter","kind":"module","full_name":"Clear::Model::Converter","name":"Converter"},"types":[{"html_id":"clear/Clear/Model/Converter/JSON/AnyConverter","path":"Clear/Model/Converter/JSON/AnyConverter.html","kind":"module","full_name":"Clear::Model::Converter::JSON::AnyConverter","name":"AnyConverter","abstract":false,"locations":[{"filename":"src/clear/model/converters/json_any_converter.cr","line_number":3,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/json_any_converter.cr#L3"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Model/Converter/JSON","kind":"module","full_name":"Clear::Model::Converter::JSON","name":"JSON"},"class_methods":[{"html_id":"to_column(x):::JSON::Any|Nil-class-method","name":"to_column","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x) : ::JSON::Any | Nil","args_html":"(x) : ::JSON::Any | Nil","location":{"filename":"src/clear/model/converters/json_any_converter.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/json_any_converter.cr#L4"},"def":{"name":"to_column","args":[{"name":"x","external_name":"x","restriction":""}],"return_type":"::JSON::Any | ::Nil","visibility":"Public","body":"case x\nwhen Nil\n nil\nwhen ::JSON::Any\n x\nwhen ::JSON::PullParser\n ::JSON::Any.new(x)\nelse\n ::JSON.parse(x.to_s)\nend"}},{"html_id":"to_db(x:::JSON::Any|Nil)-class-method","name":"to_db","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"::JSON::Any | ::Nil"}],"args_string":"(x : ::JSON::Any | Nil)","args_html":"(x : ::JSON::Any | Nil)","location":{"filename":"src/clear/model/converters/json_any_converter.cr","line_number":17,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/json_any_converter.cr#L17"},"def":{"name":"to_db","args":[{"name":"x","external_name":"x","restriction":"::JSON::Any | ::Nil"}],"visibility":"Public","body":"x.to_json"}}]}]},{"html_id":"clear/Clear/Model/Converter/StringConverter","path":"Clear/Model/Converter/StringConverter.html","kind":"class","full_name":"Clear::Model::Converter::StringConverter","name":"StringConverter","abstract":false,"superclass":{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/model/converters/string_converter.cr","line_number":3,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/string_converter.cr#L3"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Model/Converter","kind":"module","full_name":"Clear::Model::Converter","name":"Converter"},"class_methods":[{"html_id":"to_column(x):String|Nil-class-method","name":"to_column","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x) : String | Nil","args_html":"(x) : String | Nil","location":{"filename":"src/clear/model/converters/string_converter.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/string_converter.cr#L4"},"def":{"name":"to_column","args":[{"name":"x","external_name":"x","restriction":""}],"return_type":"String | ::Nil","visibility":"Public","body":"case x\nwhen Nil\n nil\nwhen Slice(UInt8)\n String.new(x)\nelse\n x.to_s\nend"}},{"html_id":"to_db(x:String|Nil)-class-method","name":"to_db","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"String | ::Nil"}],"args_string":"(x : String | Nil)","args_html":"(x : String | Nil)","location":{"filename":"src/clear/model/converters/string_converter.cr","line_number":15,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/string_converter.cr#L15"},"def":{"name":"to_db","args":[{"name":"x","external_name":"x","restriction":"String | ::Nil"}],"visibility":"Public","body":"x"}}]},{"html_id":"clear/Clear/Model/Converter/TimeConverter","path":"Clear/Model/Converter/TimeConverter.html","kind":"class","full_name":"Clear::Model::Converter::TimeConverter","name":"TimeConverter","abstract":false,"superclass":{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/model/converters/time_converter.cr","line_number":3,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/time_converter.cr#L3"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Model/Converter","kind":"module","full_name":"Clear::Model::Converter","name":"Converter"},"class_methods":[{"html_id":"to_column(x):Time|Nil-class-method","name":"to_column","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x) : Time | Nil","args_html":"(x) : Time | Nil","location":{"filename":"src/clear/model/converters/time_converter.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/time_converter.cr#L4"},"def":{"name":"to_column","args":[{"name":"x","external_name":"x","restriction":""}],"return_type":"Time | ::Nil","visibility":"Public","body":"case x\nwhen Nil\n nil\nwhen Time\n x.to_local\nelse\n time = x.to_s\n case time\n when /[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]+/\n Time.parse_local(x.to_s, \"%F %X.%L\")\n else\n Time::Format::RFC_3339.parse(time)\n end\nend"}},{"html_id":"to_db(x:Time|Nil)-class-method","name":"to_db","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Time | ::Nil"}],"args_string":"(x : Time | Nil)","args_html":"(x : Time | Nil)","location":{"filename":"src/clear/model/converters/time_converter.cr","line_number":21,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/time_converter.cr#L21"},"def":{"name":"to_db","args":[{"name":"x","external_name":"x","restriction":"Time | ::Nil"}],"visibility":"Public","body":"case x\nwhen Nil\n nil\nelse\n x.to_utc.to_s(Clear::Expression::DATABASE_DATE_TIME_FORMAT)\nend"}}]},{"html_id":"clear/Clear/Model/Converter/UInt16Converter","path":"Clear/Model/Converter/UInt16Converter.html","kind":"class","full_name":"Clear::Model::Converter::UInt16Converter","name":"UInt16Converter","abstract":false,"superclass":{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/model/converters/number_converters.cr","line_number":34,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/number_converters.cr#L34"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Model/Converter","kind":"module","full_name":"Clear::Model::Converter","name":"Converter"},"doc":"Convert from and to UInt16","summary":"

Convert from and to UInt16

","class_methods":[{"html_id":"to_column(x):UInt16|Nil-class-method","name":"to_column","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x) : UInt16 | Nil","args_html":"(x) : UInt16 | Nil","location":{"filename":"src/clear/model/converters/number_converters.cr","line_number":34,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/number_converters.cr#L34"},"def":{"name":"to_column","args":[{"name":"x","external_name":"x","restriction":""}],"return_type":"UInt16 | ::Nil","visibility":"Public","body":"case x\nwhen Nil\n nil\nwhen Number\n UInt16.new(x)\nelse\n UInt16.new(x.to_s)\nend"}},{"html_id":"to_db(x:UInt16|Nil)-class-method","name":"to_db","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"UInt16 | ::Nil"}],"args_string":"(x : UInt16 | Nil)","args_html":"(x : UInt16 | Nil)","location":{"filename":"src/clear/model/converters/number_converters.cr","line_number":34,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/number_converters.cr#L34"},"def":{"name":"to_db","args":[{"name":"x","external_name":"x","restriction":"UInt16 | ::Nil"}],"visibility":"Public","body":"x"}}]},{"html_id":"clear/Clear/Model/Converter/UInt32Converter","path":"Clear/Model/Converter/UInt32Converter.html","kind":"class","full_name":"Clear::Model::Converter::UInt32Converter","name":"UInt32Converter","abstract":false,"superclass":{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/model/converters/number_converters.cr","line_number":35,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/number_converters.cr#L35"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Model/Converter","kind":"module","full_name":"Clear::Model::Converter","name":"Converter"},"doc":"Convert from and to UInt32","summary":"

Convert from and to UInt32

","class_methods":[{"html_id":"to_column(x):UInt32|Nil-class-method","name":"to_column","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x) : UInt32 | Nil","args_html":"(x) : UInt32 | Nil","location":{"filename":"src/clear/model/converters/number_converters.cr","line_number":35,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/number_converters.cr#L35"},"def":{"name":"to_column","args":[{"name":"x","external_name":"x","restriction":""}],"return_type":"UInt32 | ::Nil","visibility":"Public","body":"case x\nwhen Nil\n nil\nwhen Number\n UInt32.new(x)\nelse\n UInt32.new(x.to_s)\nend"}},{"html_id":"to_db(x:UInt32|Nil)-class-method","name":"to_db","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"UInt32 | ::Nil"}],"args_string":"(x : UInt32 | Nil)","args_html":"(x : UInt32 | Nil)","location":{"filename":"src/clear/model/converters/number_converters.cr","line_number":35,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/number_converters.cr#L35"},"def":{"name":"to_db","args":[{"name":"x","external_name":"x","restriction":"UInt32 | ::Nil"}],"visibility":"Public","body":"x"}}]},{"html_id":"clear/Clear/Model/Converter/UInt64Converter","path":"Clear/Model/Converter/UInt64Converter.html","kind":"class","full_name":"Clear::Model::Converter::UInt64Converter","name":"UInt64Converter","abstract":false,"superclass":{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/model/converters/number_converters.cr","line_number":36,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/number_converters.cr#L36"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Model/Converter","kind":"module","full_name":"Clear::Model::Converter","name":"Converter"},"doc":"Convert from and to UInt64","summary":"

Convert from and to UInt64

","class_methods":[{"html_id":"to_column(x):UInt64|Nil-class-method","name":"to_column","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x) : UInt64 | Nil","args_html":"(x) : UInt64 | Nil","location":{"filename":"src/clear/model/converters/number_converters.cr","line_number":36,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/number_converters.cr#L36"},"def":{"name":"to_column","args":[{"name":"x","external_name":"x","restriction":""}],"return_type":"UInt64 | ::Nil","visibility":"Public","body":"case x\nwhen Nil\n nil\nwhen Number\n UInt64.new(x)\nelse\n UInt64.new(x.to_s)\nend"}},{"html_id":"to_db(x:UInt64|Nil)-class-method","name":"to_db","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"UInt64 | ::Nil"}],"args_string":"(x : UInt64 | Nil)","args_html":"(x : UInt64 | Nil)","location":{"filename":"src/clear/model/converters/number_converters.cr","line_number":36,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/number_converters.cr#L36"},"def":{"name":"to_db","args":[{"name":"x","external_name":"x","restriction":"UInt64 | ::Nil"}],"visibility":"Public","body":"x"}}]},{"html_id":"clear/Clear/Model/Converter/UInt8Converter","path":"Clear/Model/Converter/UInt8Converter.html","kind":"class","full_name":"Clear::Model::Converter::UInt8Converter","name":"UInt8Converter","abstract":false,"superclass":{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/model/converters/number_converters.cr","line_number":33,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/number_converters.cr#L33"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Model/Converter","kind":"module","full_name":"Clear::Model::Converter","name":"Converter"},"doc":"Convert from and to UInt8","summary":"

Convert from and to UInt8

","class_methods":[{"html_id":"to_column(x):UInt8|Nil-class-method","name":"to_column","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x) : UInt8 | Nil","args_html":"(x) : UInt8 | Nil","location":{"filename":"src/clear/model/converters/number_converters.cr","line_number":33,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/number_converters.cr#L33"},"def":{"name":"to_column","args":[{"name":"x","external_name":"x","restriction":""}],"return_type":"UInt8 | ::Nil","visibility":"Public","body":"case x\nwhen Nil\n nil\nwhen Number\n UInt8.new(x)\nelse\n UInt8.new(x.to_s)\nend"}},{"html_id":"to_db(x:UInt8|Nil)-class-method","name":"to_db","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"UInt8 | ::Nil"}],"args_string":"(x : UInt8 | Nil)","args_html":"(x : UInt8 | Nil)","location":{"filename":"src/clear/model/converters/number_converters.cr","line_number":33,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/converters/number_converters.cr#L33"},"def":{"name":"to_db","args":[{"name":"x","external_name":"x","restriction":"UInt8 | ::Nil"}],"visibility":"Public","body":"x"}}]},{"html_id":"clear/Clear/Model/Converter/UUIDConverter","path":"Clear/Model/Converter/UUIDConverter.html","kind":"class","full_name":"Clear::Model::Converter::UUIDConverter","name":"UUIDConverter","abstract":false,"superclass":{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/extensions/uuid/uuid.cr","line_number":8,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/uuid/uuid.cr#L8"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Model/Converter","kind":"module","full_name":"Clear::Model::Converter","name":"Converter"},"doc":"Convert from UUID column to Crystal's UUID","summary":"

Convert from UUID column to Crystal's UUID

","class_methods":[{"html_id":"to_column(x):UUID|Nil-class-method","name":"to_column","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x) : UUID | Nil","args_html":"(x) : UUID | Nil","location":{"filename":"src/clear/extensions/uuid/uuid.cr","line_number":9,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/uuid/uuid.cr#L9"},"def":{"name":"to_column","args":[{"name":"x","external_name":"x","restriction":""}],"return_type":"UUID | ::Nil","visibility":"Public","body":"case x\nwhen String\n UUID.new(x)\nwhen Slice(UInt8)\n UUID.new(x)\nwhen UUID\n x\nwhen Nil\n nil\nelse\n raise(Clear::ErrorMessages.converter_error(x.class.name, \"UUID\"))\nend"}},{"html_id":"to_db(x:UUID|Nil)-class-method","name":"to_db","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"UUID | ::Nil"}],"args_string":"(x : UUID | Nil)","args_html":"(x : UUID | Nil)","location":{"filename":"src/clear/extensions/uuid/uuid.cr","line_number":24,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/uuid/uuid.cr#L24"},"def":{"name":"to_db","args":[{"name":"x","external_name":"x","restriction":"UUID | ::Nil"}],"visibility":"Public","body":"if x.nil?\n nil\nelse\n x.to_s\nend"}}]}]},{"html_id":"clear/Clear/Model/Error","path":"Clear/Model/Error.html","kind":"class","full_name":"Clear::Model::Error","name":"Error","abstract":false,"superclass":{"html_id":"clear/Exception","kind":"class","full_name":"Exception","name":"Exception"},"ancestors":[{"html_id":"clear/Exception","kind":"class","full_name":"Exception","name":"Exception"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/model/errors.cr","line_number":2,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/errors.cr#L2"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"subclasses":[{"html_id":"clear/Clear/Model/InvalidError","kind":"class","full_name":"Clear::Model::InvalidError","name":"InvalidError"},{"html_id":"clear/Clear/Model/ReadOnlyError","kind":"class","full_name":"Clear::Model::ReadOnlyError","name":"ReadOnlyError"}],"namespace":{"html_id":"clear/Clear/Model","kind":"module","full_name":"Clear::Model","name":"Model"}},{"html_id":"clear/Clear/Model/EventManager","path":"Clear/Model/EventManager.html","kind":"class","full_name":"Clear::Model::EventManager","name":"EventManager","abstract":false,"superclass":{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/model/event_manager.cr","line_number":5,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/event_manager.cr#L5"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"EVENT_CALLBACKS","name":"EVENT_CALLBACKS","value":"{} of EventKey => Array(HookFunction)"},{"id":"INHERITANCE_MAP","name":"INHERITANCE_MAP","value":"{} of String => String"}],"namespace":{"html_id":"clear/Clear/Model","kind":"module","full_name":"Clear::Model","name":"Model"},"doc":"Global storage for model lifecycle event management\n\nThis class acts as a storage and can trigger events\nThis class a singleton.","summary":"

Global storage for model lifecycle event management

","class_methods":[{"html_id":"add_inheritance(parent,child)-class-method","name":"add_inheritance","doc":"Map the inheritance between models. Events which belongs to parent model are triggered when child model lifecycle\nactions occurs","summary":"

Map the inheritance between models.

","abstract":false,"args":[{"name":"parent","external_name":"parent","restriction":""},{"name":"child","external_name":"child","restriction":""}],"args_string":"(parent, child)","args_html":"(parent, child)","location":{"filename":"src/clear/model/event_manager.cr","line_number":43,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/event_manager.cr#L43"},"def":{"name":"add_inheritance","args":[{"name":"parent","external_name":"parent","restriction":""},{"name":"child","external_name":"child","restriction":""}],"visibility":"Public","body":"INHERITANCE_MAP[child.to_s] = parent.to_s"}},{"html_id":"attach(klazz,direction:Symbol,event:Symbol,block:HookFunction)-class-method","name":"attach","doc":"Add an event for a specific class, to a specific direction (after or before), a specific event Symbol (validate, save, commit...)","summary":"

Add an event for a specific class, to a specific direction (after or before), a specific event Symbol (validate, save, commit...)

","abstract":false,"args":[{"name":"klazz","external_name":"klazz","restriction":""},{"name":"direction","external_name":"direction","restriction":"Symbol"},{"name":"event","external_name":"event","restriction":"Symbol"},{"name":"block","external_name":"block","restriction":"HookFunction"}],"args_string":"(klazz, direction : Symbol, event : Symbol, block : HookFunction)","args_html":"(klazz, direction : Symbol, event : Symbol, block : HookFunction)","location":{"filename":"src/clear/model/event_manager.cr","line_number":48,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/event_manager.cr#L48"},"def":{"name":"attach","args":[{"name":"klazz","external_name":"klazz","restriction":""},{"name":"direction","external_name":"direction","restriction":"Symbol"},{"name":"event","external_name":"event","restriction":"Symbol"},{"name":"block","external_name":"block","restriction":"HookFunction"}],"visibility":"Public","body":"tuple = {klazz.to_s, direction, event}\narr = EVENT_CALLBACKS.fetch(tuple) do\n [] of HookFunction\nend\narr.push(block)\nEVENT_CALLBACKS[tuple] = arr\n"}},{"html_id":"trigger(klazz,direction:Symbol,event:Symbol,mdl:Clear::Model)-class-method","name":"trigger","doc":"Trigger events callback for a specific model.\nDirection can be `:before` and `:after`\nIn case of `:before` direction, the events are called in reverse order:\n\n```\nbefore:\n- Last defined event\n- First defined event\naction\nafter:\n- First defined events\n- Last defined events\n```","summary":"

Trigger events callback for a specific model.

","abstract":false,"args":[{"name":"klazz","external_name":"klazz","restriction":""},{"name":"direction","external_name":"direction","restriction":"Symbol"},{"name":"event","external_name":"event","restriction":"Symbol"},{"name":"mdl","external_name":"mdl","restriction":"Clear::Model"}],"args_string":"(klazz, direction : Symbol, event : Symbol, mdl : Clear::Model)","args_html":"(klazz, direction : Symbol, event : Symbol, mdl : Clear::Model)","location":{"filename":"src/clear/model/event_manager.cr","line_number":25,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/event_manager.cr#L25"},"def":{"name":"trigger","args":[{"name":"klazz","external_name":"klazz","restriction":""},{"name":"direction","external_name":"direction","restriction":"Symbol"},{"name":"event","external_name":"event","restriction":"Symbol"},{"name":"mdl","external_name":"mdl","restriction":"Clear::Model"}],"visibility":"Public","body":"arr = EVENT_CALLBACKS.fetch({klazz.to_s, direction, event}) do\n [] of HookFunction\nend\nparent = INHERITANCE_MAP[klazz.to_s]?\nif direction == (:after)\n arr = arr.reverse\n arr.each(&.call(mdl))\n if parent.nil?\n else\n trigger(parent, direction, event, mdl)\n end\nelse\n if parent.nil?\n else\n trigger(parent, direction, event, mdl)\n end\n arr.each(&.call(mdl))\nend\n"}}],"types":[{"html_id":"clear/Clear/Model/EventManager/EventKey","path":"Clear/Model/EventManager/EventKey.html","kind":"alias","full_name":"Clear::Model::EventManager::EventKey","name":"EventKey","abstract":false,"locations":[{"filename":"src/clear/model/event_manager.cr","line_number":7,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/event_manager.cr#L7"}],"repository_name":"clear","program":false,"enum":false,"alias":true,"aliased":"Tuple(String, Symbol, Symbol)","aliased_html":"{String, Symbol, Symbol}","const":false,"namespace":{"html_id":"clear/Clear/Model/EventManager","kind":"class","full_name":"Clear::Model::EventManager","name":"EventManager"}},{"html_id":"clear/Clear/Model/EventManager/HookFunction","path":"Clear/Model/EventManager/HookFunction.html","kind":"alias","full_name":"Clear::Model::EventManager::HookFunction","name":"HookFunction","abstract":false,"locations":[{"filename":"src/clear/model/event_manager.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/event_manager.cr#L6"}],"repository_name":"clear","program":false,"enum":false,"alias":true,"aliased":"Proc(Clear::Model, Nil)","aliased_html":"Clear::Model -> Nil","const":false,"namespace":{"html_id":"clear/Clear/Model/EventManager","kind":"class","full_name":"Clear::Model::EventManager","name":"EventManager"}}]},{"html_id":"clear/Clear/Model/Factory","path":"Clear/Model/Factory.html","kind":"module","full_name":"Clear::Model::Factory","name":"Factory","abstract":false,"locations":[{"filename":"src/clear/model/factories/base.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/factories/base.cr#L1"},{"filename":"src/clear/model/factories/polymorphic_factory.cr","line_number":3,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/factories/polymorphic_factory.cr#L3"},{"filename":"src/clear/model/factories/simple_factory.cr","line_number":3,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/factories/simple_factory.cr#L3"},{"filename":"src/clear/model/factory.cr","line_number":3,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/factory.cr#L3"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"FACTORIES","name":"FACTORIES","value":"{\"Clear::Reflection::Column\" => ::Clear::Model::Factory::SimpleFactory(Clear::Reflection::Column).new, \"Clear::Reflection::Table\" => ::Clear::Model::Factory::SimpleFactory(Clear::Reflection::Table).new} of String => Clear::Model::Factory::Base"}],"namespace":{"html_id":"clear/Clear/Model","kind":"module","full_name":"Clear::Model","name":"Model"},"class_methods":[{"html_id":"build(type:String,h:Hash,cache:Clear::Model::QueryCache|Nil=nil,persisted=false,fetch_columns=false):Clear::Model-class-method","name":"build","abstract":false,"args":[{"name":"type","external_name":"type","restriction":"String"},{"name":"h","external_name":"h","restriction":"Hash"},{"name":"cache","default_value":"nil","external_name":"cache","restriction":"Clear::Model::QueryCache | ::Nil"},{"name":"persisted","default_value":"false","external_name":"persisted","restriction":""},{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"args_string":"(type : String, h : Hash, cache : Clear::Model::QueryCache | Nil = nil, persisted = false, fetch_columns = false) : Clear::Model","args_html":"(type : String, h : Hash, cache : Clear::Model::QueryCache | Nil = nil, persisted = false, fetch_columns = false) : Clear::Model","location":{"filename":"src/clear/model/factory.cr","line_number":10,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/factory.cr#L10"},"def":{"name":"build","args":[{"name":"type","external_name":"type","restriction":"String"},{"name":"h","external_name":"h","restriction":"Hash"},{"name":"cache","default_value":"nil","external_name":"cache","restriction":"Clear::Model::QueryCache | ::Nil"},{"name":"persisted","default_value":"false","external_name":"persisted","restriction":""},{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"return_type":"Clear::Model","visibility":"Public","body":"factory = FACTORIES[type].as(Base)\nfactory.build(h, cache, persisted, fetch_columns)\n"}},{"html_id":"build(type:T.class,h:Hash,cache:Clear::Model::QueryCache|Nil=nil,persisted=false,fetch_columns=false):TforallT-class-method","name":"build","abstract":false,"args":[{"name":"type","external_name":"type","restriction":"T.class"},{"name":"h","external_name":"h","restriction":"Hash"},{"name":"cache","default_value":"nil","external_name":"cache","restriction":"Clear::Model::QueryCache | ::Nil"},{"name":"persisted","default_value":"false","external_name":"persisted","restriction":""},{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"args_string":"(type : T.class, h : Hash, cache : Clear::Model::QueryCache | Nil = nil, persisted = false, fetch_columns = false) : T forall T","args_html":"(type : T.class, h : Hash, cache : Clear::Model::QueryCache | Nil = nil, persisted = false, fetch_columns = false) : T forall T","location":{"filename":"src/clear/model/factory.cr","line_number":22,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/factory.cr#L22"},"def":{"name":"build","args":[{"name":"type","external_name":"type","restriction":"T.class"},{"name":"h","external_name":"h","restriction":"Hash"},{"name":"cache","default_value":"nil","external_name":"cache","restriction":"Clear::Model::QueryCache | ::Nil"},{"name":"persisted","default_value":"false","external_name":"persisted","restriction":""},{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"return_type":"T","visibility":"Public","body":"(build(T.name, h, cache, persisted, fetch_columns)).as(T)"}}],"macros":[{"html_id":"add(type,factory)-macro","name":"add","abstract":false,"args":[{"name":"type","external_name":"type","restriction":""},{"name":"factory","external_name":"factory","restriction":""}],"args_string":"(type, factory)","args_html":"(type, factory)","location":{"filename":"src/clear/model/factory.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/factory.cr#L6"},"def":{"name":"add","args":[{"name":"type","external_name":"type","restriction":""},{"name":"factory","external_name":"factory","restriction":""}],"visibility":"Public","body":" \n{% Clear::Model::Factory::FACTORIES[type] = factory %}\n\n \n"}}],"types":[{"html_id":"clear/Clear/Model/Factory/Base","path":"Clear/Model/Factory/Base.html","kind":"module","full_name":"Clear::Model::Factory::Base","name":"Base","abstract":false,"locations":[{"filename":"src/clear/model/factories/base.cr","line_number":2,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/factories/base.cr#L2"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"clear/Clear/Model/Factory/PolymorphicFactory","kind":"class","full_name":"Clear::Model::Factory::PolymorphicFactory(T)","name":"PolymorphicFactory"},{"html_id":"clear/Clear/Model/Factory/SimpleFactory","kind":"class","full_name":"Clear::Model::Factory::SimpleFactory(T)","name":"SimpleFactory"}],"namespace":{"html_id":"clear/Clear/Model/Factory","kind":"module","full_name":"Clear::Model::Factory","name":"Factory"},"instance_methods":[{"html_id":"build(h:Hash(String,Clear::SQL::Any),cache:Clear::Model::QueryCache|Nil=nil,persisted:Bool=false,fetch_columns:Bool=false):Clear::Model-instance-method","name":"build","abstract":true,"args":[{"name":"h","external_name":"h","restriction":"Hash(String, ::Clear::SQL::Any)"},{"name":"cache","default_value":"nil","external_name":"cache","restriction":"Clear::Model::QueryCache | ::Nil"},{"name":"persisted","default_value":"false","external_name":"persisted","restriction":"Bool"},{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":"Bool"}],"args_string":"(h : Hash(String, Clear::SQL::Any), cache : Clear::Model::QueryCache | Nil = nil, persisted : Bool = false, fetch_columns : Bool = false) : Clear::Model","args_html":"(h : Hash(String, Clear::SQL::Any), cache : Clear::Model::QueryCache | Nil = nil, persisted : Bool = false, fetch_columns : Bool = false) : Clear::Model","location":{"filename":"src/clear/model/factories/base.cr","line_number":3,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/factories/base.cr#L3"},"def":{"name":"build","args":[{"name":"h","external_name":"h","restriction":"Hash(String, ::Clear::SQL::Any)"},{"name":"cache","default_value":"nil","external_name":"cache","restriction":"Clear::Model::QueryCache | ::Nil"},{"name":"persisted","default_value":"false","external_name":"persisted","restriction":"Bool"},{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":"Bool"}],"return_type":"Clear::Model","visibility":"Public","body":""}}]},{"html_id":"clear/Clear/Model/Factory/PolymorphicFactory","path":"Clear/Model/Factory/PolymorphicFactory.html","kind":"class","full_name":"Clear::Model::Factory::PolymorphicFactory(T)","name":"PolymorphicFactory","abstract":false,"superclass":{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"clear/Clear/Model/Factory/Base","kind":"module","full_name":"Clear::Model::Factory::Base","name":"Base"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/model/factories/polymorphic_factory.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/factories/polymorphic_factory.cr#L4"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"clear/Clear/Model/Factory/Base","kind":"module","full_name":"Clear::Model::Factory::Base","name":"Base"}],"namespace":{"html_id":"clear/Clear/Model/Factory","kind":"module","full_name":"Clear::Model::Factory","name":"Factory"},"constructors":[{"html_id":"new(type_field:String,self_class:String)-class-method","name":"new","abstract":false,"args":[{"name":"type_field","external_name":"type_field","restriction":"::String"},{"name":"self_class","external_name":"self_class","restriction":"::String"}],"args_string":"(type_field : String, self_class : String)","args_html":"(type_field : String, self_class : String)","location":{"filename":"src/clear/model/factories/polymorphic_factory.cr","line_number":9,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/factories/polymorphic_factory.cr#L9"},"def":{"name":"new","args":[{"name":"type_field","external_name":"type_field","restriction":"::String"},{"name":"self_class","external_name":"self_class","restriction":"::String"}],"visibility":"Public","body":"_ = PolymorphicFactory(T).allocate\n_.initialize(type_field, self_class)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"build(h:Hash(String,Clear::SQL::Any),cache:Clear::Model::QueryCache|Nil=nil,persisted:Bool=false,fetch_columns:Bool=false):Clear::Model-instance-method","name":"build","abstract":false,"args":[{"name":"h","external_name":"h","restriction":"Hash(String, ::Clear::SQL::Any)"},{"name":"cache","default_value":"nil","external_name":"cache","restriction":"Clear::Model::QueryCache | ::Nil"},{"name":"persisted","default_value":"false","external_name":"persisted","restriction":"Bool"},{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":"Bool"}],"args_string":"(h : Hash(String, Clear::SQL::Any), cache : Clear::Model::QueryCache | Nil = nil, persisted : Bool = false, fetch_columns : Bool = false) : Clear::Model","args_html":"(h : Hash(String, Clear::SQL::Any), cache : Clear::Model::QueryCache | Nil = nil, persisted : Bool = false, fetch_columns : Bool = false) : Clear::Model","location":{"filename":"src/clear/model/factories/polymorphic_factory.cr","line_number":12,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/factories/polymorphic_factory.cr#L12"},"def":{"name":"build","args":[{"name":"h","external_name":"h","restriction":"Hash(String, ::Clear::SQL::Any)"},{"name":"cache","default_value":"nil","external_name":"cache","restriction":"Clear::Model::QueryCache | ::Nil"},{"name":"persisted","default_value":"false","external_name":"persisted","restriction":"Bool"},{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":"Bool"}],"return_type":"Clear::Model","visibility":"Public","body":"v = h[@type_field]\ncase v\nwhen String\n if v == T.name\n {% if T.abstract? %}\n raise \"Cannot instantiate #{@type_field} because it is abstract class\"\n {% else %}\n T.new(v, h, cache, persisted, fetch_columns).as(Clear::Model)\n {% end %}\n else\n (Clear::Model::Factory.build(v, h, cache, persisted, fetch_columns)).as(Clear::Model)\n end\nwhen Nil\n raise(Clear::ErrorMessages.polymorphic_nil(@type_field))\nelse\n raise(Clear::ErrorMessages.polymorphic_nil(@type_field))\nend\n"}},{"html_id":"self_class:String-instance-method","name":"self_class","abstract":false,"location":{"filename":"src/clear/model/factories/polymorphic_factory.cr","line_number":7,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/factories/polymorphic_factory.cr#L7"},"def":{"name":"self_class","return_type":"String","visibility":"Public","body":"@self_class"}},{"html_id":"self_class=(self_class:String)-instance-method","name":"self_class=","abstract":false,"args":[{"name":"self_class","external_name":"self_class","restriction":"String"}],"args_string":"(self_class : String)","args_html":"(self_class : String)","location":{"filename":"src/clear/model/factories/polymorphic_factory.cr","line_number":7,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/factories/polymorphic_factory.cr#L7"},"def":{"name":"self_class=","args":[{"name":"self_class","external_name":"self_class","restriction":"String"}],"visibility":"Public","body":"@self_class = self_class"}},{"html_id":"type_field:String-instance-method","name":"type_field","abstract":false,"location":{"filename":"src/clear/model/factories/polymorphic_factory.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/factories/polymorphic_factory.cr#L6"},"def":{"name":"type_field","return_type":"String","visibility":"Public","body":"@type_field"}},{"html_id":"type_field=(type_field:String)-instance-method","name":"type_field=","abstract":false,"args":[{"name":"type_field","external_name":"type_field","restriction":"String"}],"args_string":"(type_field : String)","args_html":"(type_field : String)","location":{"filename":"src/clear/model/factories/polymorphic_factory.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/factories/polymorphic_factory.cr#L6"},"def":{"name":"type_field=","args":[{"name":"type_field","external_name":"type_field","restriction":"String"}],"visibility":"Public","body":"@type_field = type_field"}}]},{"html_id":"clear/Clear/Model/Factory/SimpleFactory","path":"Clear/Model/Factory/SimpleFactory.html","kind":"class","full_name":"Clear::Model::Factory::SimpleFactory(T)","name":"SimpleFactory","abstract":false,"superclass":{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"clear/Clear/Model/Factory/Base","kind":"module","full_name":"Clear::Model::Factory::Base","name":"Base"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/model/factories/simple_factory.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/factories/simple_factory.cr#L4"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"clear/Clear/Model/Factory/Base","kind":"module","full_name":"Clear::Model::Factory::Base","name":"Base"}],"namespace":{"html_id":"clear/Clear/Model/Factory","kind":"module","full_name":"Clear::Model::Factory","name":"Factory"},"instance_methods":[{"html_id":"build(h:Hash(String,Clear::SQL::Any),cache:Clear::Model::QueryCache|Nil=nil,persisted:Bool=false,fetch_columns:Bool=false):Clear::Model-instance-method","name":"build","abstract":false,"args":[{"name":"h","external_name":"h","restriction":"Hash(String, ::Clear::SQL::Any)"},{"name":"cache","default_value":"nil","external_name":"cache","restriction":"Clear::Model::QueryCache | ::Nil"},{"name":"persisted","default_value":"false","external_name":"persisted","restriction":"Bool"},{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":"Bool"}],"args_string":"(h : Hash(String, Clear::SQL::Any), cache : Clear::Model::QueryCache | Nil = nil, persisted : Bool = false, fetch_columns : Bool = false) : Clear::Model","args_html":"(h : Hash(String, Clear::SQL::Any), cache : Clear::Model::QueryCache | Nil = nil, persisted : Bool = false, fetch_columns : Bool = false) : Clear::Model","location":{"filename":"src/clear/model/factories/simple_factory.cr","line_number":7,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/factories/simple_factory.cr#L7"},"def":{"name":"build","args":[{"name":"h","external_name":"h","restriction":"Hash(String, ::Clear::SQL::Any)"},{"name":"cache","default_value":"nil","external_name":"cache","restriction":"Clear::Model::QueryCache | ::Nil"},{"name":"persisted","default_value":"false","external_name":"persisted","restriction":"Bool"},{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":"Bool"}],"return_type":"Clear::Model","visibility":"Public","body":"(T.new(h, cache, persisted, fetch_columns)).as(Clear::Model)"}}]}]},{"html_id":"clear/Clear/Model/FullTextSearchable","path":"Clear/Model/FullTextSearchable.html","kind":"module","full_name":"Clear::Model::FullTextSearchable","name":"FullTextSearchable","abstract":false,"locations":[{"filename":"src/clear/extensions/full_text_searchable/model.cr","line_number":87,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/full_text_searchable/model.cr#L87"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"clear/Clear/Model","kind":"module","full_name":"Clear::Model","name":"Model"}],"namespace":{"html_id":"clear/Clear/Model","kind":"module","full_name":"Clear::Model","name":"Model"},"doc":"Full text search plugin offers full integration with `tsvector` capabilities of\nPostgresql.\n\nIt allows you to query models through the text content of one or multiple fields.\n\n### The blog example\n\nLet's assume we have a blog and want to implement full text search over title and content:\n\n```\ncreate_table \"posts\" do |t|\n t.column :title, :string, null: false\n t.column :content, :string, null: false\n\n t.full_text_searchable on: [{\"title\", 'A'}, {\"content\", 'C'}]\nend\n```\n\nThis migration will create a 3rd column named `full_text_vector` of type `tsvector`,\na gin index, a trigger and a function to update automatically this column.\n\nOver the `on` keyword, `'{\"title\", 'A'}'` means it allows search of the content of \"title\", with level of priority (weight) \"A\", which tells postgres than title content is more meaningful than the article content itself.\n\nNow, let's build some models:\n\n```\n\n model Post\n include Clear::Model\n #...\n\n full_text_searchable\n end\n\n Post.create!({title: \"About poney\", content: \"Poney are cool\"})\n Post.create!({title: \"About dog and cat\", content: \"Cat and dog are cool. But not as much as poney\"})\n Post.create!({title: \"You won't believe: She raises her poney like as star!\", content: \"She's cool because poney are cool\"})\n```\n\nSearch is now easily done\n\n```\nPost.query.search(\"poney\") # Return all the articles !\n```\n\nObviously, search call can be chained:\n\n```\nuser = User.find! { email == \"some_email@example.com\" }\nPost.query.from_user(user).search(\"orm\")\n```\n\n### Additional parameters\n\n#### `catalog`\n\nSelect the catalog to use to build the tsquery. By default, `pg_catalog.english` is used.\n\n```\n# in your migration:\nt.full_text_searchable on: [{\"title\", 'A'}, {\"content\", 'C'}], catalog: \"pg_catalog.french\"\n\n# in your model\nfull_text_searchable catalog: \"pg_catalog.french\"\n```\n\nNote: For now, Clear doesn't offers dynamic selection of catalog (for let's say multi-lang service).\nIf your app need this feature, do not hesitate to open an issue.\n\n#### `trigger_name`, `function_name`\n\nIn migration, you can change the name generated for the trigger and the function, using theses two keys.\n\n#### `dest_field`\n\nThe field created in the database, which will contains your ts vector. Default is `full_text_vector`.\n\n```\n# in your migration\nt.full_text_searchable on: [{\"title\", 'A'}, {\"content\", 'C'}], dest_field: \"tsv\"\n\n# in your model\nfull_text_searchable \"tsv\"\n```","summary":"

Full text search plugin offers full integration with tsvector capabilities of Postgresql.

","class_methods":[{"html_id":"to_tsq(text)-class-method","name":"to_tsq","doc":"Parse client side text and generate string ready to be ingested by PG's `to_tsquery`.\n\nAuthor note: pg `to_tsquery` is awesome but can easily fail to parse.\n `search` method use then a wrapper text_to_search used to ensure than\n request is understood and produce ALWAYS legal string for `to_tsquery`\nThis is a good helper then to use with the input of your end-users !\n\nHowever, this helper can be improved, as it doesn't use all the features\nof tsvector (parentesis, OR operator etc...)","summary":"

Parse client side text and generate string ready to be ingested by PG's to_tsquery.

","abstract":false,"args":[{"name":"text","external_name":"text","restriction":""}],"args_string":"(text)","args_html":"(text)","location":{"filename":"src/clear/extensions/full_text_searchable/model.cr","line_number":185,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/full_text_searchable/model.cr#L185"},"def":{"name":"to_tsq","args":[{"name":"text","external_name":"text","restriction":""}],"visibility":"Public","body":"text = text.gsub(/\\+/, \" \")\ntokens = split_to_exp(text)\ntokens.join(\" & \") do |__temp_97|\n modifier, value = __temp_97\n if modifier == (:-)\n \"!\" + Clear::Expression[value]\n else\n Clear::Expression[value]\n end\nend\n"}}],"macros":[{"html_id":"full_text_searchable(through=\"full_text_vector\",catalog=\"pg_catalog.english\",scope_name=\"search\")-macro","name":"full_text_searchable","doc":"Set this model as searchable using tsvector","summary":"

Set this model as searchable using tsvector

","abstract":false,"args":[{"name":"through","default_value":"\"full_text_vector\"","external_name":"through","restriction":""},{"name":"catalog","default_value":"\"pg_catalog.english\"","external_name":"catalog","restriction":""},{"name":"scope_name","default_value":"\"search\"","external_name":"scope_name","restriction":""}],"args_string":"(through = \"full_text_vector\", catalog = \"pg_catalog.english\", scope_name = \"search\")","args_html":"(through = "full_text_vector", catalog = "pg_catalog.english", scope_name = "search")","location":{"filename":"src/clear/extensions/full_text_searchable/model.cr","line_number":89,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/full_text_searchable/model.cr#L89"},"def":{"name":"full_text_searchable","args":[{"name":"through","default_value":"\"full_text_vector\"","external_name":"through","restriction":""},{"name":"catalog","default_value":"\"pg_catalog.english\"","external_name":"catalog","restriction":""},{"name":"scope_name","default_value":"\"search\"","external_name":"scope_name","restriction":""}],"visibility":"Public","body":" column( \n{{ through.id }}\n : Clear::TSVector, presence: false)\n\n scope \"\n{{ scope_name.id }}\n\" do |str|\n table = self.item_class.table\n where \n{\n op(\n var(table, \"\n{{ through.id }}\n\"),\n to_tsquery(\n{{ catalog }}\n, Clear::Model::FullTextSearchable.to_tsq(str)),\n \"@@\"\n )\n }\n \nend\n \n"}}]},{"html_id":"clear/Clear/Model/HasColumns","path":"Clear/Model/HasColumns.html","kind":"module","full_name":"Clear::Model::HasColumns","name":"HasColumns","abstract":false,"locations":[{"filename":"src/clear/model/modules/has_columns.cr","line_number":5,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_columns.cr#L5"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"clear/Clear/Model","kind":"module","full_name":"Clear::Model","name":"Model"}],"namespace":{"html_id":"clear/Clear/Model","kind":"module","full_name":"Clear::Model","name":"Model"},"doc":"This module declare all the methods and macro related to columns in `Clear::Model`","summary":"

This module declare all the methods and macro related to columns in Clear::Model

","instance_methods":[{"html_id":"[](x):Clear::SQL::Any-instance-method","name":"[]","doc":"Access to direct SQL attributes given by the request used to build the model.\nAccess is read only and updating the model columns will not apply change to theses columns.\n\n```\nmodel = Model.query.select(\"MIN(id) as min_id\").first(fetch_columns: true)\nid = model[\"min_id\"].to_i32\n```","summary":"

Access to direct SQL attributes given by the request used to build the model.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x) : Clear::SQL::Any","args_html":"(x) : Clear::SQL::Any","location":{"filename":"src/clear/model/modules/has_columns.cr","line_number":72,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_columns.cr#L72"},"def":{"name":"[]","args":[{"name":"x","external_name":"x","restriction":""}],"return_type":"::Clear::SQL::Any","visibility":"Public","body":"attributes[x]"}},{"html_id":"[]?(x):Clear::SQL::Any-instance-method","name":"[]?","doc":"Access to direct SQL attributes given by the request and used to build the model\nor Nil if not found.\n\nAccess is read only and updating the model columns will not apply change to theses columns.\nYou must set `fetch_column: true` in your model to access the attributes.","summary":"

Access to direct SQL attributes given by the request and used to build the model or Nil if not found.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x) : Clear::SQL::Any","args_html":"(x) : Clear::SQL::Any","location":{"filename":"src/clear/model/modules/has_columns.cr","line_number":81,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_columns.cr#L81"},"def":{"name":"[]?","args":[{"name":"x","external_name":"x","restriction":""}],"return_type":"::Clear::SQL::Any","visibility":"Public","body":"attributes[x]?"}},{"html_id":"reset(h:Hash(String,_))-instance-method","name":"reset","doc":"See `reset(**t : **T)`","summary":"

See #reset(**t : **T)

","abstract":false,"args":[{"name":"h","external_name":"h","restriction":"Hash(String, _)"}],"args_string":"(h : Hash(String, _))","args_html":"(h : Hash(String, _))","location":{"filename":"src/clear/model/modules/has_columns.cr","line_number":35,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_columns.cr#L35"},"def":{"name":"reset","args":[{"name":"h","external_name":"h","restriction":"Hash(String, _)"}],"visibility":"Public","body":""}},{"html_id":"reset(h:Hash(Symbol,_))-instance-method","name":"reset","doc":"See `reset(**t : **T)`","summary":"

See #reset(**t : **T)

","abstract":false,"args":[{"name":"h","external_name":"h","restriction":"Hash(Symbol, _)"}],"args_string":"(h : Hash(Symbol, _))","args_html":"(h : Hash(Symbol, _))","location":{"filename":"src/clear/model/modules/has_columns.cr","line_number":39,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_columns.cr#L39"},"def":{"name":"reset","args":[{"name":"h","external_name":"h","restriction":"Hash(Symbol, _)"}],"visibility":"Public","body":""}},{"html_id":"reset(**t:**T)forallT-instance-method","name":"reset","doc":"Reset one or multiple columns; Reseting set the current value of the column\nto the given value, while the `changed?` flag remains false.\nIf you call save on a persisted model, the reset columns won't be\ncommited in the UPDATE query.","summary":"

Reset one or multiple columns; Reseting set the current value of the column to the given value, while the changed? flag remains false.

","abstract":false,"location":{"filename":"src/clear/model/modules/has_columns.cr","line_number":26,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_columns.cr#L26"},"def":{"name":"reset","double_splat":{"name":"t","external_name":"t","restriction":"**T"},"visibility":"Public","body":""}},{"html_id":"set(h:Hash(String,_))-instance-method","name":"set","doc":"See `set(**t : **T)`","summary":"

See #set(**t : **T)

","abstract":false,"args":[{"name":"h","external_name":"h","restriction":"Hash(String, _)"}],"args_string":"(h : Hash(String, _))","args_html":"(h : Hash(String, _))","location":{"filename":"src/clear/model/modules/has_columns.cr","line_number":58,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_columns.cr#L58"},"def":{"name":"set","args":[{"name":"h","external_name":"h","restriction":"Hash(String, _)"}],"visibility":"Public","body":""}},{"html_id":"set(h:Hash(Symbol,_))-instance-method","name":"set","doc":"See `set(**t : **T)`","summary":"

See #set(**t : **T)

","abstract":false,"args":[{"name":"h","external_name":"h","restriction":"Hash(Symbol, _)"}],"args_string":"(h : Hash(Symbol, _))","args_html":"(h : Hash(Symbol, _))","location":{"filename":"src/clear/model/modules/has_columns.cr","line_number":62,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_columns.cr#L62"},"def":{"name":"set","args":[{"name":"h","external_name":"h","restriction":"Hash(Symbol, _)"}],"visibility":"Public","body":""}},{"html_id":"set(**t:**T)forallT-instance-method","name":"set","doc":"Set one or multiple columns to a specific value\nThis two are equivalents:\n\n```\nmodel.set(a: 1)\nmodel.a = 1\n```","summary":"

Set one or multiple columns to a specific value This two are equivalents:

","abstract":false,"location":{"filename":"src/clear/model/modules/has_columns.cr","line_number":49,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_columns.cr#L49"},"def":{"name":"set","double_splat":{"name":"t","external_name":"t","restriction":"**T"},"visibility":"Public","body":""}},{"html_id":"to_h(full=false)-instance-method","name":"to_h","doc":"Returns the model columns as Hash.\nCalling `to_h` will returns only the defined columns, while settings the optional parameter `full` to `true`\n will return all the column and fill the undefined columns by `nil` values.\nExample:\n\n```\n# Assuming our model has a primary key, a first name and last name and two timestamp columns:\nmodel = Model.query.select(\"first_name, last_name\").first!\nmodel.to_h # => { \"first_name\" => \"Johnny\", \"last_name\" => \"Walker\" }\nmodel.to_h(full: true) # => {\"id\" => nil, \"first_name\" => \"Johnny\", \"last_name\" => \"Walker\", \"created_at\" => nil, \"updated_at\" => nil}\n```","summary":"

Returns the model columns as Hash.

","abstract":false,"args":[{"name":"full","default_value":"false","external_name":"full","restriction":""}],"args_string":"(full = false)","args_html":"(full = false)","location":{"filename":"src/clear/model/modules/has_columns.cr","line_number":110,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_columns.cr#L110"},"def":{"name":"to_h","args":[{"name":"full","default_value":"false","external_name":"full","restriction":""}],"visibility":"Public","body":"{} of String => ::Clear::SQL::Any"}},{"html_id":"update_h-instance-method","name":"update_h","doc":"Returns the current hash of the modified values:\n\n```\nmodel = Model.query.first!\nmodel.update_h # => {}\nmodel.first_name = \"hello\"\nmodel.update_h # => { \"first_name\" => \"hello\" }\nmodel.save!\nmodel.update_h # => {}\n```","summary":"

Returns the current hash of the modified values:

","abstract":false,"location":{"filename":"src/clear/model/modules/has_columns.cr","line_number":95,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_columns.cr#L95"},"def":{"name":"update_h","visibility":"Public","body":"{} of String => ::Clear::SQL::Any"}}],"macros":[{"html_id":"column(name,primary=false,converter=nil,column_name=nil,presence=true,mass_assign=true)-macro","name":"column","doc":"Bind a column to the model.\n\nSimple example:\n\n```\nclass MyModel\n include Clear::Model\n\n column some_id : Int32, primary: true\n column nullable_column : String?\nend\n```\noptions:\n\n* `primary : Bool`: Let Clear ORM know which column is the primary key.\nCurrently compound primary key are not compatible with Clear ORM.\n\n* `converter : Class | Module`: Use this class to convert the data from the\nSQL. This class must possess the class methods\n`to_column(::Clear::SQL::Any) : T` and `to_db(T) : ::Clear::SQL::Any`\nwith `T` the type of the column.\n\n* `column_name : String`: If the name of the column in the model doesn't fit the name of the\n column in the SQL, you can use the parameter `column_name` to tell Clear about\n which db column is linked to current field.\n\n* `presence : Bool (default = true)`: Use this option to let know Clear that\n your column is not nullable but with default value generated by the database\n on insert (e.g. serial)\nDuring validation before saving, the presence will not be checked on this field\n and Clear will try to insert without the field value.\n\n* `mass_assign : Bool (default = true)`: Use this option to turn on/ off mass assignment\n when instantiating or updating a new model from json through `.from_json` methods from\n the `Clear::Model::JSONDeserialize` module.\n","summary":"

Bind a column to the model.

","abstract":false,"args":[{"name":"name","external_name":"name","restriction":""},{"name":"primary","default_value":"false","external_name":"primary","restriction":""},{"name":"converter","default_value":"nil","external_name":"converter","restriction":""},{"name":"column_name","default_value":"nil","external_name":"column_name","restriction":""},{"name":"presence","default_value":"true","external_name":"presence","restriction":""},{"name":"mass_assign","default_value":"true","external_name":"mass_assign","restriction":""}],"args_string":"(name, primary = false, converter = nil, column_name = nil, presence = true, mass_assign = true)","args_html":"(name, primary = false, converter = nil, column_name = nil, presence = true, mass_assign = true)","location":{"filename":"src/clear/model/modules/has_columns.cr","line_number":150,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_columns.cr#L150"},"def":{"name":"column","args":[{"name":"name","external_name":"name","restriction":""},{"name":"primary","default_value":"false","external_name":"primary","restriction":""},{"name":"converter","default_value":"nil","external_name":"converter","restriction":""},{"name":"column_name","default_value":"nil","external_name":"column_name","restriction":""},{"name":"presence","default_value":"true","external_name":"presence","restriction":""},{"name":"mass_assign","default_value":"true","external_name":"mass_assign","restriction":""}],"visibility":"Public","body":" \n{% _type = name.type %}\n\n \n{% unless converter\n if _type.is_a?(Path)\n if _type.resolve.stringify =~ (/\\(/)\n converter = _type.stringify\n else\n converter = _type.resolve.stringify\n end\n else\n if _type.is_a?(Generic)\n if _type.name.stringify == \"::Union\"\n converter = (_type.type_vars.map(&.resolve).map(&.stringify).sort.reject do |x|\n (x == \"Nil\") || (x == \"::Nil\")\n end.join(\"\")).id.stringify\n else\n converter = _type.resolve.stringify\n end\n else\n if _type.is_a?(Union)\n converter = (_type.types.map(&.resolve).map(&.stringify).sort.reject do |x|\n (x == \"Nil\") || (x == \"::Nil\")\n end.join(\"\")).id.stringify\n else\n raise(\"Unknown: #{_type}, #{_type.class}\")\n end\n end\n end\nend %}\n\n\n \n{% db_column_name = column_name == nil ? name.var : column_name.id\nCOLUMNS[\"#{db_column_name.id}\"] = {type: _type, primary: primary, converter: converter, db_column_name: \"#{db_column_name.id}\", crystal_variable_name: name.var, presence: presence, mass_assign: mass_assign}\n %}\n\n \n"}}]},{"html_id":"clear/Clear/Model/HasFactory","path":"Clear/Model/HasFactory.html","kind":"module","full_name":"Clear::Model::HasFactory","name":"HasFactory","abstract":false,"locations":[{"filename":"src/clear/model/modules/has_factory.cr","line_number":3,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_factory.cr#L3"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"clear/Clear/Model","kind":"module","full_name":"Clear::Model","name":"Model"}],"namespace":{"html_id":"clear/Clear/Model","kind":"module","full_name":"Clear::Model","name":"Model"},"macros":[{"html_id":"polymorphic(through=\"type\")-macro","name":"polymorphic","doc":"Define a polymorphic factory, if the model is tagged as polymorphic","summary":"

Define a polymorphic factory, if the model is tagged as polymorphic

","abstract":false,"args":[{"name":"through","default_value":"\"type\"","external_name":"through","restriction":""}],"args_string":"(through = \"type\")","args_html":"(through = "type")","location":{"filename":"src/clear/model/modules/has_factory.cr","line_number":36,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_factory.cr#L36"},"def":{"name":"polymorphic","args":[{"name":"through","default_value":"\"type\"","external_name":"through","restriction":""}],"visibility":"Public","body":" \n{% POLYMORPHISM_SETTINGS[:has_factory] = true %}\n\n\n column \n{{ through.id }}\n : String\n\n before(:validate) do |model|\n model = model.as(self)\n model.\n{{ through.id }}\n = model.class.name\n \nend\n\n \n# Subclasses are refined using a default scope\n\n \n# to filter by type.\n\n macro inherited\n class Collection < Clear::Model::CollectionBase(\n\\{\n{@type}}); \nend\n\n def self.query\n Collection.new.from(table).where \n{ \n{{ through.id }}\n == self.name }\n \nend\n \nend\n\n \n# Base class can be refined too, only if the baseclass is not abstract.\n\n \n{% if @type.abstract? %}{% else %}\n def self.query\n Collection.new.from(table).where { {{ through.id }} == self.name }\n end\n {% end %}\n\n\n def self.polymorphic?\n true\n \nend\n\n Clear::Model::Factory.add(\n \"\n{{ @type }}\n\",\n Clear::Model::Factory::PolymorphicFactory(\n{{ @type }}\n).new(\n{{ through.id.stringify }}\n, \"\n{{ @type }}\n\")\n )\n\n macro inherited\n Clear::Model::Factory.add(\n \"\n\\{\n{@type}}\",\n Clear::Model::Factory::SimpleFactory(\n\\{\n{@type}}).new\n )\n \nend\n \n"}}]},{"html_id":"clear/Clear/Model/HasHooks","path":"Clear/Model/HasHooks.html","kind":"module","full_name":"Clear::Model::HasHooks","name":"HasHooks","abstract":false,"locations":[{"filename":"src/clear/model/modules/has_hooks.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_hooks.cr#L1"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"clear/Clear/Model","kind":"module","full_name":"Clear::Model","name":"Model"}],"namespace":{"html_id":"clear/Clear/Model","kind":"module","full_name":"Clear::Model","name":"Model"},"instance_methods":[{"html_id":"trigger_after_events(event_name)-instance-method","name":"trigger_after_events","doc":"Triggers the events hooked after `event_name`","summary":"

Triggers the events hooked after event_name

","abstract":false,"args":[{"name":"event_name","external_name":"event_name","restriction":""}],"args_string":"(event_name)","args_html":"(event_name)","location":{"filename":"src/clear/model/modules/has_hooks.cr","line_number":30,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_hooks.cr#L30"},"def":{"name":"trigger_after_events","args":[{"name":"event_name","external_name":"event_name","restriction":""}],"visibility":"Public","body":"Clear::Model::EventManager.trigger(self.class, :after, event_name, self)"}},{"html_id":"trigger_before_events(event_name)-instance-method","name":"trigger_before_events","doc":"Triggers the events hooked before `event_name`","summary":"

Triggers the events hooked before event_name

","abstract":false,"args":[{"name":"event_name","external_name":"event_name","restriction":""}],"args_string":"(event_name)","args_html":"(event_name)","location":{"filename":"src/clear/model/modules/has_hooks.cr","line_number":25,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_hooks.cr#L25"},"def":{"name":"trigger_before_events","args":[{"name":"event_name","external_name":"event_name","restriction":""}],"visibility":"Public","body":"Clear::Model::EventManager.trigger(self.class, :before, event_name, self)"}},{"html_id":"with_triggers(event_name,&)-instance-method","name":"with_triggers","doc":"This performs theses operations:\n\n- Call triggers `before` the event\n- Yield the given block\n- Call triggers `after` the event\n\n```\nmodel.with_triggers(\"email_sent\") do |m|\n model.send_email\nend\n```\n\nReturns `self`","summary":"

This performs theses operations:

","abstract":false,"args":[{"name":"event_name","external_name":"event_name","restriction":""}],"args_string":"(event_name, &)","args_html":"(event_name, &)","location":{"filename":"src/clear/model/modules/has_hooks.cr","line_number":15,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_hooks.cr#L15"},"def":{"name":"with_triggers","args":[{"name":"event_name","external_name":"event_name","restriction":""}],"yields":1,"block_arity":1,"visibility":"Public","body":"Clear::SQL.transaction do |cnx|\n trigger_before_events(event_name)\n yield(cnx)\n trigger_after_events(event_name)\nend\nself\n"}}],"macros":[{"html_id":"after(event_name,method_name)-macro","name":"after","abstract":false,"args":[{"name":"event_name","external_name":"event_name","restriction":""},{"name":"method_name","external_name":"method_name","restriction":""}],"args_string":"(event_name, method_name)","args_html":"(event_name, method_name)","location":{"filename":"src/clear/model/modules/has_hooks.cr","line_number":50,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_hooks.cr#L50"},"def":{"name":"after","args":[{"name":"event_name","external_name":"event_name","restriction":""},{"name":"method_name","external_name":"method_name","restriction":""}],"visibility":"Public","body":" after(\n{{ event_name }}\n) \n{ |mdl|\n mdl.as(\n{{ @type }}\n).\n{{ method_name.id }}\n\n }\n \n"}},{"html_id":"before(event_name,method_name)-macro","name":"before","abstract":false,"args":[{"name":"event_name","external_name":"event_name","restriction":""},{"name":"method_name","external_name":"method_name","restriction":""}],"args_string":"(event_name, method_name)","args_html":"(event_name, method_name)","location":{"filename":"src/clear/model/modules/has_hooks.cr","line_number":44,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_hooks.cr#L44"},"def":{"name":"before","args":[{"name":"event_name","external_name":"event_name","restriction":""},{"name":"method_name","external_name":"method_name","restriction":""}],"visibility":"Public","body":" before(\n{{ event_name }}\n) \n{ |mdl|\n mdl.as(\n{{ @type }}\n).\n{{ method_name.id }}\n\n }\n \n"}}],"types":[{"html_id":"clear/Clear/Model/HasHooks/ClassMethods","path":"Clear/Model/HasHooks/ClassMethods.html","kind":"module","full_name":"Clear::Model::HasHooks::ClassMethods","name":"ClassMethods","abstract":false,"locations":[{"filename":"src/clear/model/modules/has_hooks.cr","line_number":34,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_hooks.cr#L34"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Model/HasHooks","kind":"module","full_name":"Clear::Model::HasHooks","name":"HasHooks"},"instance_methods":[{"html_id":"after(event_name:Symbol,&block:Clear::Model->Nil)-instance-method","name":"after","abstract":false,"args":[{"name":"event_name","external_name":"event_name","restriction":"Symbol"}],"args_string":"(event_name : Symbol, &block : Clear::Model -> Nil)","args_html":"(event_name : Symbol, &block : Clear::Model -> Nil)","location":{"filename":"src/clear/model/modules/has_hooks.cr","line_number":39,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_hooks.cr#L39"},"def":{"name":"after","args":[{"name":"event_name","external_name":"event_name","restriction":"Symbol"}],"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Clear::Model -> Nil)"},"visibility":"Public","body":"Clear::Model::EventManager.attach(self, :after, event_name, block)"}},{"html_id":"before(event_name:Symbol,&block:Clear::Model->Nil)-instance-method","name":"before","abstract":false,"args":[{"name":"event_name","external_name":"event_name","restriction":"Symbol"}],"args_string":"(event_name : Symbol, &block : Clear::Model -> Nil)","args_html":"(event_name : Symbol, &block : Clear::Model -> Nil)","location":{"filename":"src/clear/model/modules/has_hooks.cr","line_number":35,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_hooks.cr#L35"},"def":{"name":"before","args":[{"name":"event_name","external_name":"event_name","restriction":"Symbol"}],"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Clear::Model -> Nil)"},"visibility":"Public","body":"Clear::Model::EventManager.attach(self, :before, event_name, block)"}}]}]},{"html_id":"clear/Clear/Model/HasRelations","path":"Clear/Model/HasRelations.html","kind":"module","full_name":"Clear::Model::HasRelations","name":"HasRelations","abstract":false,"locations":[{"filename":"src/clear/model/modules/has_relations.cr","line_number":13,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_relations.cr#L13"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"clear/Clear/Model","kind":"module","full_name":"Clear::Model","name":"Model"}],"namespace":{"html_id":"clear/Clear/Model","kind":"module","full_name":"Clear::Model","name":"Model"},"doc":"```\nclass Model\n include Clear::Model\n\n has_many posts : Post, foreign_key: Model.underscore_name + \"_id\", no_cache : false\n\n has_one passport : Passport\n has_many posts\nend\n```","summary":"
","macros":[{"html_id":"belongs_to(name,foreign_key=nil,no_cache=false,primary=false,foreign_key_type=Int64)-macro","name":"belongs_to","doc":"```\nclass Model\n include Clear::Model\n\n belongs_to user : User, foreign_key: \"the_user_id\"\nend\n```","summary":"
","abstract":false,"args":[{"name":"name","external_name":"name","restriction":""},{"name":"foreign_key","default_value":"nil","external_name":"foreign_key","restriction":""},{"name":"no_cache","default_value":"false","external_name":"no_cache","restriction":""},{"name":"primary","default_value":"false","external_name":"primary","restriction":""},{"name":"foreign_key_type","default_value":"Int64","external_name":"foreign_key_type","restriction":""}],"args_string":"(name, foreign_key = nil, no_cache = false, primary = false, foreign_key_type = Int64)","args_html":"(name, foreign_key = nil, no_cache = false, primary = false, foreign_key_type = Int64)","location":{"filename":"src/clear/model/modules/has_relations.cr","line_number":120,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_relations.cr#L120"},"def":{"name":"belongs_to","args":[{"name":"name","external_name":"name","restriction":""},{"name":"foreign_key","default_value":"nil","external_name":"foreign_key","restriction":""},{"name":"no_cache","default_value":"false","external_name":"no_cache","restriction":""},{"name":"primary","default_value":"false","external_name":"primary","restriction":""},{"name":"foreign_key_type","default_value":"Int64","external_name":"foreign_key_type","restriction":""}],"visibility":"Public","body":" \n{% if foreign_key.is_a?(SymbolLiteral) || foreign_key.is_a?(StringLiteral)\n foreign_key = foreign_key.id\nend\nnilable = false\nif name.type.is_a?(Union)\n types = name.type.types.map do |x|\n \"#{x.id}\"\n end\n nilable = types.includes?(\"Nil\")\n type = name.type.types.first\nelse\n type = name.type\nend\nif nilable\n unless foreign_key_type.resolve.nilable?\n foreign_key_type = \"#{foreign_key_type.id}?\".id\n end\nend\nRELATIONS[name.var.id] = {relation_type: :belongs_to, type: type, foreign_key: foreign_key, nilable: nilable, primary: primary, no_cache: no_cache, foreign_key_type: foreign_key_type}\n %}\n\n \n"}},{"html_id":"has_many(name,through=nil,foreign_key=nil,own_key=nil,primary_key=nil,no_cache=false,polymorphic=false,foreign_key_type=nil)-macro","name":"has_many","doc":"Has Many and Has One are the relations where the model share its primary key into a foreign table. In our example above, we can assume than a User has many Post as author.\n\nBasically, for each `belongs_to` declaration, you must have a `has_many` or `has_one` declaration on the other model.\n\nWhile `has_many` relation returns a list of models, `has_one` returns only one model when called.\n\nExample:\n\n```\nclass User\n include Clear::Model\n\n has_many posts : Post, foreign_key: \"author_id\"\nend\n```","summary":"

Has Many and Has One are the relations where the model share its primary key into a foreign table.

","abstract":false,"args":[{"name":"name","external_name":"name","restriction":""},{"name":"through","default_value":"nil","external_name":"through","restriction":""},{"name":"foreign_key","default_value":"nil","external_name":"foreign_key","restriction":""},{"name":"own_key","default_value":"nil","external_name":"own_key","restriction":""},{"name":"primary_key","default_value":"nil","external_name":"primary_key","restriction":""},{"name":"no_cache","default_value":"false","external_name":"no_cache","restriction":""},{"name":"polymorphic","default_value":"false","external_name":"polymorphic","restriction":""},{"name":"foreign_key_type","default_value":"nil","external_name":"foreign_key_type","restriction":""}],"args_string":"(name, through = nil, foreign_key = nil, own_key = nil, primary_key = nil, no_cache = false, polymorphic = false, foreign_key_type = nil)","args_html":"(name, through = nil, foreign_key = nil, own_key = nil, primary_key = nil, no_cache = false, polymorphic = false, foreign_key_type = nil)","location":{"filename":"src/clear/model/modules/has_relations.cr","line_number":72,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_relations.cr#L72"},"def":{"name":"has_many","args":[{"name":"name","external_name":"name","restriction":""},{"name":"through","default_value":"nil","external_name":"through","restriction":""},{"name":"foreign_key","default_value":"nil","external_name":"foreign_key","restriction":""},{"name":"own_key","default_value":"nil","external_name":"own_key","restriction":""},{"name":"primary_key","default_value":"nil","external_name":"primary_key","restriction":""},{"name":"no_cache","default_value":"false","external_name":"no_cache","restriction":""},{"name":"polymorphic","default_value":"false","external_name":"polymorphic","restriction":""},{"name":"foreign_key_type","default_value":"nil","external_name":"foreign_key_type","restriction":""}],"visibility":"Public","body":" \n{% if through != nil\n if through.is_a?(SymbolLiteral) || through.is_a?(StringLiteral)\n through = through.id\n end\n if own_key.is_a?(SymbolLiteral) || own_key.is_a?(StringLiteral)\n own_key = own_key.id\n end\n if foreign_key.is_a?(SymbolLiteral) || foreign_key.is_a?(StringLiteral)\n foreign_key = foreign_key.id\n end\n if foreign_key_type.is_a?(SymbolLiteral) || foreign_key_type.is_a?(StringLiteral)\n foreign_key_type = foreign_key_type.id\n end\n RELATIONS[name.var.id] = {relation_type: :has_many_through, type: name.type, through: through, own_key: own_key, foreign_key: foreign_key, foreign_key_type: foreign_key_type, polymorphic: polymorphic}\nelse\n if foreign_key.is_a?(SymbolLiteral) || foreign_key.is_a?(StringLiteral)\n foreign_key = foreign_key.id\n end\n if primary_key.is_a?(SymbolLiteral) || primary_key.is_a?(StringLiteral)\n primary_key = primary_key.id\n end\n if foreign_key_type.is_a?(SymbolLiteral) || foreign_key_type.is_a?(StringLiteral)\n foreign_key_type = foreign_key_type.id\n end\n RELATIONS[name.var.id] = {relation_type: :has_many, type: name.type, foreign_key: foreign_key, primary_key: primary_key, foreign_key_type: foreign_key_type, no_cache: no_cache, polymorphic: polymorphic}\nend %}\n\n \n"}},{"html_id":"has_one(name,foreign_key=nil,primary_key=nil,no_cache=false,polymorphic=false,foreign_key_type=nil)-macro","name":"has_one","doc":"The method `has_one` declare a relation 1 to [0,1]\nwhere the current model primary key is stored in the foreign table.\n`primary_key` method (default: `self#__pkey__`) and `foreign_key` method\n(default: table_name in singular, plus \"_id\" appended)\ncan be redefined\n\nExample:\n\n```\nmodel Passport\n column id : Int32, primary : true\n has_one user : User It assumes the table `users` have a column `passport_id`\nend\n\nmodel Passport\n column id : Int32, primary : true\n has_one owner : User # It assumes the table `users` have a column `passport_id`\nend\n```","summary":"

The method has_one declare a relation 1 to [0,1] where the current model primary key is stored in the foreign table.

","abstract":false,"args":[{"name":"name","external_name":"name","restriction":""},{"name":"foreign_key","default_value":"nil","external_name":"foreign_key","restriction":""},{"name":"primary_key","default_value":"nil","external_name":"primary_key","restriction":""},{"name":"no_cache","default_value":"false","external_name":"no_cache","restriction":""},{"name":"polymorphic","default_value":"false","external_name":"polymorphic","restriction":""},{"name":"foreign_key_type","default_value":"nil","external_name":"foreign_key_type","restriction":""}],"args_string":"(name, foreign_key = nil, primary_key = nil, no_cache = false, polymorphic = false, foreign_key_type = nil)","args_html":"(name, foreign_key = nil, primary_key = nil, no_cache = false, polymorphic = false, foreign_key_type = nil)","location":{"filename":"src/clear/model/modules/has_relations.cr","line_number":40,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_relations.cr#L40"},"def":{"name":"has_one","args":[{"name":"name","external_name":"name","restriction":""},{"name":"foreign_key","default_value":"nil","external_name":"foreign_key","restriction":""},{"name":"primary_key","default_value":"nil","external_name":"primary_key","restriction":""},{"name":"no_cache","default_value":"false","external_name":"no_cache","restriction":""},{"name":"polymorphic","default_value":"false","external_name":"polymorphic","restriction":""},{"name":"foreign_key_type","default_value":"nil","external_name":"foreign_key_type","restriction":""}],"visibility":"Public","body":" \n{% if foreign_key.is_a?(SymbolLiteral) || foreign_key.is_a?(StringLiteral)\n foreign_key = foreign_key.id\nend\nif primary_key.is_a?(SymbolLiteral) || primary_key.is_a?(StringLiteral)\n primary_key = primary_key.id\nend\nRELATIONS[name.var.id] = {relation_type: :has_one, type: name.type, foreign_key: foreign_key, primary_key: primary_key, no_cache: no_cache}\n %}\n\n \n"}}]},{"html_id":"clear/Clear/Model/HasSaving","path":"Clear/Model/HasSaving.html","kind":"module","full_name":"Clear::Model::HasSaving","name":"HasSaving","abstract":false,"locations":[{"filename":"src/clear/model/modules/has_saving.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_saving.cr#L1"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"clear/Clear/Model","kind":"module","full_name":"Clear::Model","name":"Model"}],"namespace":{"html_id":"clear/Clear/Model","kind":"module","full_name":"Clear::Model","name":"Model"},"instance_methods":[{"html_id":"delete-instance-method","name":"delete","doc":" Delete the model by building and executing a `DELETE` query.\n A deleted model is not persisted anymore, and can be saved again.\n Clear will do `INSERT` instead of `UPDATE` then\n Return `true` if the model has been successfully deleted, and `false` otherwise.","summary":"

Delete the model by building and executing a DELETE query.

","abstract":false,"location":{"filename":"src/clear/model/modules/has_saving.cr","line_number":184,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_saving.cr#L184"},"def":{"name":"delete","visibility":"Public","body":"if persisted?\nelse\n return false\nend\nwith_triggers(:delete) do\n (Clear::SQL::DeleteQuery.new.from(self.class.full_table_name)).where do\n (var(\"#{self.class.__pkey__}\")) == __pkey__\n end.execute(@@connection)\n @persisted = false\n clear_change_flags\nend\ntrue\n"}},{"html_id":"persisted?:Bool-instance-method","name":"persisted?","abstract":false,"location":{"filename":"src/clear/model/modules/has_saving.cr","line_number":51,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_saving.cr#L51"},"def":{"name":"persisted?","return_type":"Bool","visibility":"Public","body":"@persisted"}},{"html_id":"reload:self-instance-method","name":"reload","abstract":false,"location":{"filename":"src/clear/model/modules/has_saving.cr","line_number":168,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_saving.cr#L168"},"def":{"name":"reload","return_type":"self","visibility":"Public","body":"set(self.class.query.where do\n (var(\"#{self.class.__pkey__}\")) == __pkey__\nend.fetch_first!)\ninvalidate_caching\n@attributes.clear\nclear_change_flags\n@persisted = true\nself\n"}},{"html_id":"save(on_conflict:Clear::SQL::InsertQuery->|Nil=nil)-instance-method","name":"save","doc":"Save the model. If the model is already persisted, will call `UPDATE` query.\nIf the model is not persisted, will call `INSERT`\n\nOptionally, you can pass a `Proc` to refine the `INSERT` with on conflict\nresolution functions.\n\nReturn `false` if the model cannot be saved (validation issue)\nReturn `true` if the model has been correctly saved.\n\nExample:\n\n```\nu = User.new\nif u.save\n puts \"User correctly saved !\"\nelse\n puts \"There was a problem during save: \"\n # do something with `u.errors`\nend\n```\n\n## `on_conflict` optional parameter\n\nExample:\n\n```\nu = User.new id: 123, email: \"email@example.com\"\nu.save(-> (qry) { qry.on_conflict.do_update { |u| u.set(email: \"email@example.com\") } #update\n# IMPORTANT NOTICE: user may not be saved, but will be still detected as persisted !\n```\n\nYou may want to use a block for `on_conflict` optional parameter:\n\n```\nu = User.new id: 123, email: \"email@example.com\"\nu.save do |qry|\n qry.on_conflict.do_update { |u| u.set(email: \"email@example.com\")\nend\n```\n","summary":"

Save the model.

","abstract":false,"args":[{"name":"on_conflict","default_value":"nil","external_name":"on_conflict","restriction":"(Clear::SQL::InsertQuery ->) | ::Nil"}],"args_string":"(on_conflict : Clear::SQL::InsertQuery -> | Nil = nil)","args_html":"(on_conflict : Clear::SQL::InsertQuery -> | Nil = nil)","location":{"filename":"src/clear/model/modules/has_saving.cr","line_number":93,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_saving.cr#L93"},"def":{"name":"save","args":[{"name":"on_conflict","default_value":"nil","external_name":"on_conflict","restriction":"(Clear::SQL::InsertQuery ->) | ::Nil"}],"visibility":"Public","body":"if self.class.read_only?\n return false\nend\nwith_triggers(:save) do\n if valid?\n if persisted?\n h = update_h\n if h.empty?\n else\n with_triggers(:update) do\n ((Clear::SQL.update(self.class.full_table_name)).set(update_h)).where do\n (var(\"#{self.class.__pkey__}\")) == __pkey__\n end.execute(@@connection)\n end\n end\n else\n with_triggers(:create) do\n query = (Clear::SQL.insert_into(self.class.full_table_name, to_h)).returning(\"*\")\n if on_conflict\n on_conflict.call(query)\n end\n hash = query.execute(@@connection)\n reset(hash)\n @persisted = true\n end\n end\n clear_change_flags\n return true\n else\n return false\n end\nend\n"}},{"html_id":"save(&block)-instance-method","name":"save","abstract":false,"location":{"filename":"src/clear/model/modules/has_saving.cr","line_number":125,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_saving.cr#L125"},"def":{"name":"save","yields":0,"block_arity":0,"block_arg":{"name":"block","external_name":"block","restriction":""},"visibility":"Public","body":"save(on_conflict: block)"}},{"html_id":"save!(on_conflict:Clear::SQL::InsertQuery->|Nil=nil)-instance-method","name":"save!","doc":"Performs `save` call, but instead of returning `false` if validation failed,\nraise `Clear::Model::InvalidError` exception","summary":"

Performs #save call, but instead of returning false if validation failed, raise Clear::Model::InvalidError exception

","abstract":false,"args":[{"name":"on_conflict","default_value":"nil","external_name":"on_conflict","restriction":"(Clear::SQL::InsertQuery ->) | ::Nil"}],"args_string":"(on_conflict : Clear::SQL::InsertQuery -> | Nil = nil)","args_html":"(on_conflict : Clear::SQL::InsertQuery -> | Nil = nil)","location":{"filename":"src/clear/model/modules/has_saving.cr","line_number":131,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_saving.cr#L131"},"def":{"name":"save!","args":[{"name":"on_conflict","default_value":"nil","external_name":"on_conflict","restriction":"(Clear::SQL::InsertQuery ->) | ::Nil"}],"visibility":"Public","body":"if self.class.read_only?\n raise(Clear::Model::ReadOnlyError.new(self))\nend\nif save(on_conflict)\nelse\n raise(Clear::Model::InvalidError.new(self))\nend\nself\n"}},{"html_id":"save!(&block:Clear::SQL::InsertQuery->)-instance-method","name":"save!","doc":"Pass the `on_conflict` optional parameter via block.","summary":"

Pass the on_conflict optional parameter via block.

","abstract":false,"location":{"filename":"src/clear/model/modules/has_saving.cr","line_number":140,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_saving.cr#L140"},"def":{"name":"save!","yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Clear::SQL::InsertQuery ->)"},"visibility":"Public","body":"save!(block)"}},{"html_id":"update(**args)-instance-method","name":"update","doc":"Set the fields passed as argument and call `save` on the object","summary":"

Set the fields passed as argument and call #save on the object

","abstract":false,"location":{"filename":"src/clear/model/modules/has_saving.cr","line_number":145,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_saving.cr#L145"},"def":{"name":"update","double_splat":{"name":"args","external_name":"args","restriction":""},"visibility":"Public","body":"set(**args)\nsave\n"}},{"html_id":"update!(**args)-instance-method","name":"update!","doc":"Set the fields passed as argument and call `save!` on the object","summary":"

Set the fields passed as argument and call #save! on the object

","abstract":false,"location":{"filename":"src/clear/model/modules/has_saving.cr","line_number":151,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_saving.cr#L151"},"def":{"name":"update!","double_splat":{"name":"args","external_name":"args","restriction":""},"visibility":"Public","body":"set(**args)\nsave!\n"}}]},{"html_id":"clear/Clear/Model/HasScope","path":"Clear/Model/HasScope.html","kind":"module","full_name":"Clear::Model::HasScope","name":"HasScope","abstract":false,"locations":[{"filename":"src/clear/model/modules/has_scope.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_scope.cr#L1"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"clear/Clear/Model","kind":"module","full_name":"Clear::Model","name":"Model"}],"namespace":{"html_id":"clear/Clear/Model","kind":"module","full_name":"Clear::Model","name":"Model"}},{"html_id":"clear/Clear/Model/HasSerialPkey","path":"Clear/Model/HasSerialPkey.html","kind":"module","full_name":"Clear::Model::HasSerialPkey","name":"HasSerialPkey","abstract":false,"locations":[{"filename":"src/clear/model/modules/has_serial_pkey.cr","line_number":3,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_serial_pkey.cr#L3"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"PKEY_TYPE","name":"PKEY_TYPE","value":"{\"bigserial\" => \"column(__name__ : Int64, primary: true, presence: false)\", \"serial\" => \"column(__name__ : Int32, primary: true, presence: false)\", \"text\" => \"column(__name__ : String, primary: true, presence: true)\", \"int\" => \"column(__name__ : Int32, primary: true, presence: true)\", \"bigint\" => \"column(__name__ : Int64, primary: true, presence: true)\", \"uuid\" => \"column(__name__ : UUID, primary: true, presence: true)\\nbefore(:validate) do |m|\\n if !m.persisted? && (m.as(self)).__name___column.value(nil).nil?\\n (m.as(self)).__name__ = UUID.random\\n end\\nend\\n\"} of Nil => Nil"}],"including_types":[{"html_id":"clear/Clear/Model","kind":"module","full_name":"Clear::Model","name":"Model"}],"namespace":{"html_id":"clear/Clear/Model","kind":"module","full_name":"Clear::Model","name":"Model"},"macros":[{"html_id":"add_pkey_type(type,&block)-macro","name":"add_pkey_type","doc":"Add a hook for the `primary_key`\nIn the hook, __name__ will be replaced by the column name required by calling primary_key\n\n## Example\n\n```\nClear::Model::HasSerialPkey.add_pkey_type(\"awesomepkeysystem\") do\n column __name__ : AwesomePkey, primary: true, presence: false\n\n before_validate do\n # ...\n end\nend\n```","summary":"

Add a hook for the primary_key In the hook, name will be replaced by the column name required by calling primary_key

","abstract":false,"args":[{"name":"type","external_name":"type","restriction":""}],"args_string":"(type, &block)","args_html":"(type, &block)","location":{"filename":"src/clear/model/modules/has_serial_pkey.cr","line_number":41,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_serial_pkey.cr#L41"},"def":{"name":"add_pkey_type","args":[{"name":"type","external_name":"type","restriction":""}],"block_arg":{"name":"block","external_name":"block","restriction":""},"visibility":"Public","body":" \n{% PKEY_TYPE[type] = \"#{block.body}\" %}\n\n \n"}},{"html_id":"primary_key(name=\"id\",type=:bigserial)-macro","name":"primary_key","doc":"Macro used to define serializable primary keys.\nCurrently support `bigserial`, `serial` and `uuid`.\n\nFor `bigserial` and `serial`, let to PostgreSQL the handling of sequence numbers.\nFor `uuid`, will generate a new `UUID` number on creation.","summary":"

Macro used to define serializable primary keys.

","abstract":false,"args":[{"name":"name","default_value":"\"id\"","external_name":"name","restriction":""},{"name":"type","default_value":":bigserial","external_name":"type","restriction":""}],"args_string":"(name = \"id\", type = :bigserial)","args_html":"(name = "id", type = :bigserial)","location":{"filename":"src/clear/model/modules/has_serial_pkey.cr","line_number":11,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_serial_pkey.cr#L11"},"def":{"name":"primary_key","args":[{"name":"name","default_value":"\"id\"","external_name":"name","restriction":""},{"name":"type","default_value":":bigserial","external_name":"type","restriction":""}],"visibility":"Public","body":" \n# Transform symbols to string\n\n \n{% name = \"#{name.id}\"\ntype = \"#{type.id}\"\n %}\n\n\n \n{% cb = PKEY_TYPE[type] %}\n\n\n \n{% if cb %}\n {{ (cb.gsub(/__name__/, name)).id }}\n {% else %}\n {% raise(\"Cannot define primary key of type #{type}. Candidates are: #{PKEY_TYPE.keys.join(\", \")}\") %}\n {% end %}\n\n \n"}}]},{"html_id":"clear/Clear/Model/HasTimestamps","path":"Clear/Model/HasTimestamps.html","kind":"module","full_name":"Clear::Model::HasTimestamps","name":"HasTimestamps","abstract":false,"locations":[{"filename":"src/clear/model/modules/has_timestamps.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_timestamps.cr#L1"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"clear/Clear/Model","kind":"module","full_name":"Clear::Model","name":"Model"}],"namespace":{"html_id":"clear/Clear/Model","kind":"module","full_name":"Clear::Model","name":"Model"},"macros":[{"html_id":"timestamps-macro","name":"timestamps","doc":"Generate the columns `updated_at` and `created_at`\nThe two column values are automatically set during insertion\n or update of the model.","summary":"

Generate the columns updated_at and created_at The two column values are automatically set during insertion or update of the model.

","abstract":false,"location":{"filename":"src/clear/model/modules/has_timestamps.cr","line_number":5,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_timestamps.cr#L5"},"def":{"name":"timestamps","visibility":"Public","body":" column(updated_at : Time)\n column(created_at : Time)\n\n before(:validate) do |model|\n model = model.as(self)\n\n unless model.persisted?\n now = Time.local\n model.created_at = now unless model.created_at_column.defined?\n model.updated_at = now unless model.updated_at_column.defined?\n \nend\n \nend\n\n after(:validate) do |model|\n model = model.as(self)\n\n \n# In the case the updated_at has been changed, we do not override.\n\n \n# It happens on first insert, in the before validation setup.\n\n model.updated_at = Time.local if model.changed? && !model.updated_at_column.changed?\n \nend\n\n \n# Saves the record with the updated_at set to the current time.\n\n def touch(now = Time.local) : Clear::Model\n self.updated_at = now\n self.save!\n\n self\n \nend\n \n"}}]},{"html_id":"clear/Clear/Model/HasValidation","path":"Clear/Model/HasValidation.html","kind":"module","full_name":"Clear::Model::HasValidation","name":"HasValidation","abstract":false,"ancestors":[{"html_id":"clear/Clear/Validation/Helper","kind":"module","full_name":"Clear::Validation::Helper","name":"Helper"}],"locations":[{"filename":"src/clear/model/modules/has_validation.cr","line_number":3,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_validation.cr#L3"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"clear/Clear/Validation/Helper","kind":"module","full_name":"Clear::Validation::Helper","name":"Helper"}],"including_types":[{"html_id":"clear/Clear/Model","kind":"module","full_name":"Clear::Model","name":"Model"}],"namespace":{"html_id":"clear/Clear/Model","kind":"module","full_name":"Clear::Model","name":"Model"},"instance_methods":[{"html_id":"add_error(column,reason)-instance-method","name":"add_error","doc":"Add validation error related to a specific column","summary":"

Add validation error related to a specific column

","abstract":false,"args":[{"name":"column","external_name":"column","restriction":""},{"name":"reason","external_name":"reason","restriction":""}],"args_string":"(column, reason)","args_html":"(column, reason)","location":{"filename":"src/clear/model/modules/has_validation.cr","line_number":15,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_validation.cr#L15"},"def":{"name":"add_error","args":[{"name":"column","external_name":"column","restriction":""},{"name":"reason","external_name":"reason","restriction":""}],"visibility":"Public","body":"@errors << Error.new(reason: reason, column: column.to_s)"}},{"html_id":"add_error(reason)-instance-method","name":"add_error","doc":"Add validation error not related to a specific column","summary":"

Add validation error not related to a specific column

","abstract":false,"args":[{"name":"reason","external_name":"reason","restriction":""}],"args_string":"(reason)","args_html":"(reason)","location":{"filename":"src/clear/model/modules/has_validation.cr","line_number":10,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_validation.cr#L10"},"def":{"name":"add_error","args":[{"name":"reason","external_name":"reason","restriction":""}],"visibility":"Public","body":"@errors << Error.new(reason: reason, column: nil)"}},{"html_id":"clear_errors-instance-method","name":"clear_errors","doc":"Clear the errors log (if any) of the model and return itself","summary":"

Clear the errors log (if any) of the model and return itself

","abstract":false,"location":{"filename":"src/clear/model/modules/has_validation.cr","line_number":26,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_validation.cr#L26"},"def":{"name":"clear_errors","visibility":"Public","body":"@errors.clear\nself\n"}},{"html_id":"error?-instance-method","name":"error?","doc":"Return `true` if saving has been declined because of validation issues.\nThe error list can be found by calling `Clear::Model#errors`","summary":"

Return true if saving has been declined because of validation issues.

","abstract":false,"location":{"filename":"src/clear/model/modules/has_validation.cr","line_number":21,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_validation.cr#L21"},"def":{"name":"error?","visibility":"Public","body":"!@errors.empty?"}},{"html_id":"errors:Array(Error)-instance-method","name":"errors","doc":"List of errors raised during validation, in case the model hasn't been saved properly.","summary":"

List of errors raised during validation, in case the model hasn't been saved properly.

","abstract":false,"location":{"filename":"src/clear/model/modules/has_validation.cr","line_number":7,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_validation.cr#L7"},"def":{"name":"errors","return_type":"Array(Error)","visibility":"Public","body":"@errors"}},{"html_id":"print_errors-instance-method","name":"print_errors","doc":"Print the errors in string. Useful for debugging or simple error handling.","summary":"

Print the errors in string.

","abstract":false,"location":{"filename":"src/clear/model/modules/has_validation.cr","line_number":33,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_validation.cr#L33"},"def":{"name":"print_errors","visibility":"Public","body":"@errors.group_by(&.column).to_a.sort do |__temp_92, __temp_93|\n f1, _ = __temp_92\n f2, _ = __temp_93\n (f1 || \"\") <=> (f2 || \"\")\nend.join(\"\\n\") do |column, errors|\n [column, errors.join(\", \", &.reason)].compact.join(\": \")\nend"}},{"html_id":"valid!-instance-method","name":"valid!","doc":"Check whether the model is valid. If not, raise `InvalidModelError`.\nReturn the model itself","summary":"

Check whether the model is valid.

","abstract":false,"location":{"filename":"src/clear/model/modules/has_validation.cr","line_number":47,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_validation.cr#L47"},"def":{"name":"valid!","visibility":"Public","body":"if valid?\nelse\n raise(InvalidError.new(self))\nend\nself\n"}},{"html_id":"valid?-instance-method","name":"valid?","doc":"Return `true` if the model","summary":"

Return true if the model

","abstract":false,"location":{"filename":"src/clear/model/modules/has_validation.cr","line_number":54,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_validation.cr#L54"},"def":{"name":"valid?","visibility":"Public","body":"clear_errors\nwith_triggers(:validate) do\n validate\n validate_fields_presence\nend\n!error?\n"}},{"html_id":"validate-instance-method","name":"validate","doc":"This method is called whenever `valid?` or `save` is called.\nBy default, `validate` is empty and must be overriden by your own validation code.","summary":"

This method is called whenever #valid? or save is called.

","abstract":false,"location":{"filename":"src/clear/model/modules/has_validation.cr","line_number":41,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_validation.cr#L41"},"def":{"name":"validate","visibility":"Public","body":""}}],"types":[{"html_id":"clear/Clear/Model/HasValidation/Error","path":"Clear/Model/HasValidation/Error.html","kind":"struct","full_name":"Clear::Model::HasValidation::Error","name":"Error","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/model/modules/has_validation.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_validation.cr#L4"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Model/HasValidation","kind":"module","full_name":"Clear::Model::HasValidation","name":"HasValidation"},"constructors":[{"html_id":"new(reason:String,column:String|Nil)-class-method","name":"new","abstract":false,"args":[{"name":"reason","external_name":"reason","restriction":"String"},{"name":"column","external_name":"column","restriction":"String | ::Nil"}],"args_string":"(reason : String, column : String | Nil)","args_html":"(reason : String, column : String | Nil)","location":{"filename":"src/clear/model/modules/has_validation.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_validation.cr#L4"},"def":{"name":"new","args":[{"name":"reason","external_name":"reason","restriction":"String"},{"name":"column","external_name":"column","restriction":"String | ::Nil"}],"visibility":"Public","body":"_ = allocate\n_.initialize(reason, column)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"clone-instance-method","name":"clone","abstract":false,"location":{"filename":"src/clear/model/modules/has_validation.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_validation.cr#L4"},"def":{"name":"clone","visibility":"Public","body":"self.class.new(@reason.clone, @column.clone)"}},{"html_id":"column:String|Nil-instance-method","name":"column","abstract":false,"def":{"name":"column","return_type":"String | ::Nil","visibility":"Public","body":"@column"}},{"html_id":"copy_with(reason_reason=@reason,column_column=@column)-instance-method","name":"copy_with","abstract":false,"args":[{"name":"_reason","default_value":"@reason","external_name":"reason","restriction":""},{"name":"_column","default_value":"@column","external_name":"column","restriction":""}],"args_string":"(reason _reason = @reason, column _column = @column)","args_html":"(reason _reason = @reason, column _column = @column)","location":{"filename":"src/clear/model/modules/has_validation.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/has_validation.cr#L4"},"def":{"name":"copy_with","args":[{"name":"_reason","default_value":"@reason","external_name":"reason","restriction":""},{"name":"_column","default_value":"@column","external_name":"column","restriction":""}],"visibility":"Public","body":"self.class.new(_reason, _column)"}},{"html_id":"reason:String-instance-method","name":"reason","abstract":false,"def":{"name":"reason","return_type":"String","visibility":"Public","body":"@reason"}}]}]},{"html_id":"clear/Clear/Model/InvalidError","path":"Clear/Model/InvalidError.html","kind":"class","full_name":"Clear::Model::InvalidError","name":"InvalidError","abstract":false,"superclass":{"html_id":"clear/Clear/Model/Error","kind":"class","full_name":"Clear::Model::Error","name":"Error"},"ancestors":[{"html_id":"clear/Clear/Model/Error","kind":"class","full_name":"Clear::Model::Error","name":"Error"},{"html_id":"clear/Exception","kind":"class","full_name":"Exception","name":"Exception"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/model/errors.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/errors.cr#L4"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Model","kind":"module","full_name":"Clear::Model","name":"Model"},"constructors":[{"html_id":"new(model:Clear::Model)-class-method","name":"new","abstract":false,"args":[{"name":"model","external_name":"model","restriction":"Clear::Model"}],"args_string":"(model : Clear::Model)","args_html":"(model : Clear::Model)","location":{"filename":"src/clear/model/errors.cr","line_number":7,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/errors.cr#L7"},"def":{"name":"new","args":[{"name":"model","external_name":"model","restriction":"Clear::Model"}],"visibility":"Public","body":"_ = allocate\n_.initialize(model)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"model:Clear::Model-instance-method","name":"model","abstract":false,"location":{"filename":"src/clear/model/errors.cr","line_number":5,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/errors.cr#L5"},"def":{"name":"model","return_type":"Clear::Model","visibility":"Public","body":"@model"}}]},{"html_id":"clear/Clear/Model/JSONDeserialize","path":"Clear/Model/JSONDeserialize.html","kind":"module","full_name":"Clear::Model::JSONDeserialize","name":"JSONDeserialize","abstract":false,"locations":[{"filename":"src/clear/model/json_deserialize.cr","line_number":2,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/json_deserialize.cr#L2"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"clear/Clear/Model","kind":"module","full_name":"Clear::Model","name":"Model"}],"namespace":{"html_id":"clear/Clear/Model","kind":"module","full_name":"Clear::Model","name":"Model"},"doc":"This module declare all the methods and macro related to deserializing json in `Clear::Model`","summary":"

This module declare all the methods and macro related to deserializing json in Clear::Model

"},{"html_id":"clear/Clear/Model/QueryCache","path":"Clear/Model/QueryCache.html","kind":"class","full_name":"Clear::Model::QueryCache","name":"QueryCache","abstract":false,"superclass":{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/model/query_cache.cr","line_number":9,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/query_cache.cr#L9"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Model","kind":"module","full_name":"Clear::Model","name":"Model"},"doc":"The Clear::Model::QueryCache\nis a __fire-and-forget__ cache used when caching associations and preventing N+1 queries anti-pattern.\n\nThis is not a global cache: One cache instance exists per collection, and the cache\ndisappear at the same time the Collection is unreferenced.\n\nEach cache can references multiples relations at the same time.\nThis cache use an underlying hash to access to the references keys.","summary":"

The Clear::Model::QueryCache is a fire-and-forget cache used when caching associations and preventing N+1 queries anti-pattern.

","instance_methods":[{"html_id":"active(relation_name)-instance-method","name":"active","doc":"Tell this cache than we active the cache over a specific relation name.\nReturns `self`","summary":"

Tell this cache than we active the cache over a specific relation name.

","abstract":false,"args":[{"name":"relation_name","external_name":"relation_name","restriction":""}],"args_string":"(relation_name)","args_html":"(relation_name)","location":{"filename":"src/clear/model/query_cache.cr","line_number":28,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/query_cache.cr#L28"},"def":{"name":"active","args":[{"name":"relation_name","external_name":"relation_name","restriction":""}],"visibility":"Public","body":"@cache_activation.add(relation_name)\nself\n"}},{"html_id":"active?(relation_name)-instance-method","name":"active?","doc":"Check whether the cache is active on a certain association.\nReturns `true` if `relation_name` is flagged as encached, or `false` otherwise.","summary":"

Check whether the cache is active on a certain association.

","abstract":false,"args":[{"name":"relation_name","external_name":"relation_name","restriction":""}],"args_string":"(relation_name)","args_html":"(relation_name)","location":{"filename":"src/clear/model/query_cache.cr","line_number":36,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/query_cache.cr#L36"},"def":{"name":"active?","args":[{"name":"relation_name","external_name":"relation_name","restriction":""}],"visibility":"Public","body":"@cache_activation.includes?(relation_name)"}},{"html_id":"clear-instance-method","name":"clear","doc":"Empty the cache and flag all relations has unactive","summary":"

Empty the cache and flag all relations has unactive

","abstract":false,"location":{"filename":"src/clear/model/query_cache.cr","line_number":70,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/query_cache.cr#L70"},"def":{"name":"clear","visibility":"Public","body":"@cache.clear\n@cache_activation.clear\n"}},{"html_id":"fetch-instance-method","name":"fetch","abstract":false,"location":{"filename":"src/clear/model/query_cache.cr","line_number":22,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/query_cache.cr#L22"},"def":{"name":"fetch","visibility":"Public","body":"query"}},{"html_id":"hit(relation_name,relation_value,klass:T.class):Array(T)forallT-instance-method","name":"hit","doc":"Try to hit the cache. If an array is found, it will be returned.\nOtherwise, empty array is returned.\n\nThis methods do not check if a relation flagged as is actively cached or not. Therefore, hitting a non-cached\nrelation will return always an empty-array.","summary":"

Try to hit the cache.

","abstract":false,"args":[{"name":"relation_name","external_name":"relation_name","restriction":""},{"name":"relation_value","external_name":"relation_value","restriction":""},{"name":"klass","external_name":"klass","restriction":"T.class"}],"args_string":"(relation_name, relation_value, klass : T.class) : Array(T) forall T","args_html":"(relation_name, relation_value, klass : T.class) : Array(T) forall T","location":{"filename":"src/clear/model/query_cache.cr","line_number":45,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/query_cache.cr#L45"},"def":{"name":"hit","args":[{"name":"relation_name","external_name":"relation_name","restriction":""},{"name":"relation_value","external_name":"relation_value","restriction":""},{"name":"klass","external_name":"klass","restriction":"T.class"}],"return_type":"Array(T)","visibility":"Public","body":"(@cache.fetch(CacheKey.new(relation_name, relation_value, T.name)) do\n [] of T\nend).unsafe_as(Array(T))"}},{"html_id":"set(relation_name,relation_value,arr:Array(T))forallT-instance-method","name":"set","doc":"Set the cached array for a specific key `{relation_name,relation_value}`","summary":"

Set the cached array for a specific key {relation_name,relation_value}

","abstract":false,"args":[{"name":"relation_name","external_name":"relation_name","restriction":""},{"name":"relation_value","external_name":"relation_value","restriction":""},{"name":"arr","external_name":"arr","restriction":"Array(T)"}],"args_string":"(relation_name, relation_value, arr : Array(T)) forall T","args_html":"(relation_name, relation_value, arr : Array(T)) forall T","location":{"filename":"src/clear/model/query_cache.cr","line_number":52,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/query_cache.cr#L52"},"def":{"name":"set","args":[{"name":"relation_name","external_name":"relation_name","restriction":""},{"name":"relation_value","external_name":"relation_value","restriction":""},{"name":"arr","external_name":"arr","restriction":"Array(T)"}],"visibility":"Public","body":"@cache[CacheKey.new(relation_name, relation_value, T.name)] = arr.unsafe_as(Pointer(Nil))"}},{"html_id":"with_cache(&)-instance-method","name":"with_cache","doc":"Perform some operations with the cache then eventually clear the cache.","summary":"

Perform some operations with the cache then eventually clear the cache.

","abstract":false,"location":{"filename":"src/clear/model/query_cache.cr","line_number":63,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/query_cache.cr#L63"},"def":{"name":"with_cache","yields":0,"block_arity":0,"visibility":"Public","body":"begin\n yield\nensure\n clear\nend"}}]},{"html_id":"clear/Clear/Model/ReadOnlyError","path":"Clear/Model/ReadOnlyError.html","kind":"class","full_name":"Clear::Model::ReadOnlyError","name":"ReadOnlyError","abstract":false,"superclass":{"html_id":"clear/Clear/Model/Error","kind":"class","full_name":"Clear::Model::Error","name":"Error"},"ancestors":[{"html_id":"clear/Clear/Model/Error","kind":"class","full_name":"Clear::Model::Error","name":"Error"},{"html_id":"clear/Exception","kind":"class","full_name":"Exception","name":"Exception"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/model/errors.cr","line_number":12,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/errors.cr#L12"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Model","kind":"module","full_name":"Clear::Model","name":"Model"},"constructors":[{"html_id":"new(model:Clear::Model)-class-method","name":"new","abstract":false,"args":[{"name":"model","external_name":"model","restriction":"Clear::Model"}],"args_string":"(model : Clear::Model)","args_html":"(model : Clear::Model)","location":{"filename":"src/clear/model/errors.cr","line_number":15,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/errors.cr#L15"},"def":{"name":"new","args":[{"name":"model","external_name":"model","restriction":"Clear::Model"}],"visibility":"Public","body":"_ = allocate\n_.initialize(model)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"model:Clear::Model-instance-method","name":"model","abstract":false,"location":{"filename":"src/clear/model/errors.cr","line_number":13,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/errors.cr#L13"},"def":{"name":"model","return_type":"Clear::Model","visibility":"Public","body":"@model"}}]},{"html_id":"clear/Clear/Model/Relations","path":"Clear/Model/Relations.html","kind":"module","full_name":"Clear::Model::Relations","name":"Relations","abstract":false,"locations":[{"filename":"src/clear/model/modules/relations/belongs_to_macro.cr","line_number":2,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/modules/relations/belongs_to_macro.cr#L2"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Model","kind":"module","full_name":"Clear::Model","name":"Model"}}]},{"html_id":"clear/Clear/Reflection","path":"Clear/Reflection.html","kind":"module","full_name":"Clear::Reflection","name":"Reflection","abstract":false,"locations":[{"filename":"src/clear/model/reflection/column.cr","line_number":3,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/column.cr#L3"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear","kind":"module","full_name":"Clear","name":"Clear"},"types":[{"html_id":"clear/Clear/Reflection/Column","path":"Clear/Reflection/Column.html","kind":"class","full_name":"Clear::Reflection::Column","name":"Column","abstract":false,"superclass":{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"clear/Clear/Model","kind":"module","full_name":"Clear::Model","name":"Model"},{"html_id":"clear/Clear/Model/FullTextSearchable","kind":"module","full_name":"Clear::Model::FullTextSearchable","name":"FullTextSearchable"},{"html_id":"clear/Clear/Model/JSONDeserialize","kind":"module","full_name":"Clear::Model::JSONDeserialize","name":"JSONDeserialize"},{"html_id":"clear/Clear/Model/Initializer","kind":"module","full_name":"Clear::Model::Initializer","name":"Initializer"},{"html_id":"clear/Clear/Model/HasFactory","kind":"module","full_name":"Clear::Model::HasFactory","name":"HasFactory"},{"html_id":"clear/Clear/Model/ClassMethods","kind":"module","full_name":"Clear::Model::ClassMethods","name":"ClassMethods"},{"html_id":"clear/Clear/Model/HasScope","kind":"module","full_name":"Clear::Model::HasScope","name":"HasScope"},{"html_id":"clear/Clear/Model/HasRelations","kind":"module","full_name":"Clear::Model::HasRelations","name":"HasRelations"},{"html_id":"clear/Clear/Model/HasValidation","kind":"module","full_name":"Clear::Model::HasValidation","name":"HasValidation"},{"html_id":"clear/Clear/Validation/Helper","kind":"module","full_name":"Clear::Validation::Helper","name":"Helper"},{"html_id":"clear/Clear/Model/HasSaving","kind":"module","full_name":"Clear::Model::HasSaving","name":"HasSaving"},{"html_id":"clear/Clear/Model/HasSerialPkey","kind":"module","full_name":"Clear::Model::HasSerialPkey","name":"HasSerialPkey"},{"html_id":"clear/Clear/Model/HasTimestamps","kind":"module","full_name":"Clear::Model::HasTimestamps","name":"HasTimestamps"},{"html_id":"clear/Clear/Model/HasColumns","kind":"module","full_name":"Clear::Model::HasColumns","name":"HasColumns"},{"html_id":"clear/Clear/Model/HasHooks","kind":"module","full_name":"Clear::Model::HasHooks","name":"HasHooks"},{"html_id":"clear/Clear/Model/Connection","kind":"module","full_name":"Clear::Model::Connection","name":"Connection"},{"html_id":"clear/Clear/ErrorMessages","kind":"module","full_name":"Clear::ErrorMessages","name":"ErrorMessages"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/model/reflection/column.cr","line_number":3,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/column.cr#L3"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"COLUMNS","name":"COLUMNS","value":"{\"table_catalog\" => {type: String, primary: false, converter: \"String\", db_column_name: \"table_catalog\", crystal_variable_name: table_catalog, presence: true, mass_assign: true}, \"table_schema\" => {type: String, primary: false, converter: \"String\", db_column_name: \"table_schema\", crystal_variable_name: table_schema, presence: true, mass_assign: true}, \"table_name\" => {type: String, primary: false, converter: \"String\", db_column_name: \"table_name\", crystal_variable_name: table_name, presence: false, mass_assign: true}, \"column_name\" => {type: String, primary: true, converter: \"String\", db_column_name: \"column_name\", crystal_variable_name: column_name, presence: true, mass_assign: true}} of Nil => Nil"},{"id":"POLYMORPHISM_SETTINGS","name":"POLYMORPHISM_SETTINGS","value":"{} of Nil => Nil"}],"included_modules":[{"html_id":"clear/Clear/Model","kind":"module","full_name":"Clear::Model","name":"Model"}],"extended_modules":[{"html_id":"clear/Clear/Model/HasHooks/ClassMethods","kind":"module","full_name":"Clear::Model::HasHooks::ClassMethods","name":"ClassMethods"}],"namespace":{"html_id":"clear/Clear/Reflection","kind":"module","full_name":"Clear::Reflection","name":"Reflection"},"doc":"Reflection of the columns using information_schema in postgreSQL.\nTODO: Usage of view instead of model","summary":"

Reflection of the columns using information_schema in postgreSQL.

","class_methods":[{"html_id":"build(**tuple:**T)forallT-class-method","name":"build","doc":"Build a new empty model and fill the columns using the NamedTuple in argument.\n\nReturns the new model","summary":"

Build a new empty model and fill the columns using the NamedTuple in argument.

","abstract":false,"location":{"filename":"src/clear/model/reflection/column.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/column.cr#L4"},"def":{"name":"build","double_splat":{"name":"tuple","external_name":"tuple","restriction":"**T"},"visibility":"Public","body":"{% if T.size > 0 %}\n self.new(tuple)\n {% else %}\n self.new\n {% end %}"}},{"html_id":"build(**tuple)-class-method","name":"build","doc":"Build a new empty model and fill the columns using the NamedTuple in argument.\n\nReturns the new model","summary":"

Build a new empty model and fill the columns using the NamedTuple in argument.

","abstract":false,"location":{"filename":"src/clear/model/reflection/column.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/column.cr#L4"},"def":{"name":"build","double_splat":{"name":"tuple","external_name":"tuple","restriction":""},"visibility":"Public","body":"build(**tuple) do\nend"}},{"html_id":"build(**tuple,&)-class-method","name":"build","doc":"Build a new empty model and fill the columns using the NamedTuple in argument.\n\nReturns the new model","summary":"

Build a new empty model and fill the columns using the NamedTuple in argument.

","abstract":false,"location":{"filename":"src/clear/model/reflection/column.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/column.cr#L4"},"def":{"name":"build","double_splat":{"name":"tuple","external_name":"tuple","restriction":""},"yields":1,"block_arity":1,"visibility":"Public","body":"r = build(**tuple)\nyield(r)\nr\n"}},{"html_id":"columns-class-method","name":"columns","abstract":false,"location":{"filename":"src/clear/model/reflection/column.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/column.cr#L4"},"def":{"name":"columns","visibility":"Public","body":"@@columns"}},{"html_id":"connection:String-class-method","name":"connection","doc":"Define on which connection the model is living. Useful in case of models living in different databases.\n\nIs set to \"default\" by default.\n\nSee `Clear::SQL#init(URI, *opts)` for more information about multi-connections.\n\nExample:\n\n```\nClear::SQL.init(\"postgres://postgres@localhost/database_1\")\nClear::SQL.init(\"secondary\", \"postgres://postgres@localhost/database_2\")\n\nclass ModelA\n include Clear::Model\n\n # Performs all the queries on `database_1`\n # self.connection = \"default\"\n column id : Int32, primary: true, presence: false\n column title : String\nend\n\nclass ModelB\n include Clear::Model\n\n # Performs all the queries on `database_2`\n self.connection = \"secondary\"\n\n column id : Int32, primary: true, presence: false\nend\n```","summary":"

Define on which connection the model is living.

","abstract":false,"def":{"name":"connection","return_type":"String","visibility":"Public","body":"@@connection"}},{"html_id":"connection=(connection:String)-class-method","name":"connection=","doc":"Define on which connection the model is living. Useful in case of models living in different databases.\n\nIs set to \"default\" by default.\n\nSee `Clear::SQL#init(URI, *opts)` for more information about multi-connections.\n\nExample:\n\n```\nClear::SQL.init(\"postgres://postgres@localhost/database_1\")\nClear::SQL.init(\"secondary\", \"postgres://postgres@localhost/database_2\")\n\nclass ModelA\n include Clear::Model\n\n # Performs all the queries on `database_1`\n # self.connection = \"default\"\n column id : Int32, primary: true, presence: false\n column title : String\nend\n\nclass ModelB\n include Clear::Model\n\n # Performs all the queries on `database_2`\n self.connection = \"secondary\"\n\n column id : Int32, primary: true, presence: false\nend\n```","summary":"

Define on which connection the model is living.

","abstract":false,"args":[{"name":"connection","external_name":"connection","restriction":"String"}],"args_string":"(connection : String)","args_html":"(connection : String)","def":{"name":"connection=","args":[{"name":"connection","external_name":"connection","restriction":"String"}],"visibility":"Public","body":"@@connection = connection"}},{"html_id":"create_from_json(string_or_io:String|IO,trusted:Bool=false)-class-method","name":"create_from_json","doc":"Create a new model from json and save it. Returns the model.\n\nThe model may not be saved due to validation failure;\ncheck the returned model `errors?` and `persisted?` flags.\nTrusted flag set to true will allow mass assignment without protection, FALSE by default","summary":"

Create a new model from json and save it.

","abstract":false,"args":[{"name":"string_or_io","external_name":"string_or_io","restriction":"String | IO"},{"name":"trusted","default_value":"false","external_name":"trusted","restriction":"Bool"}],"args_string":"(string_or_io : String | IO, trusted : Bool = false)","args_html":"(string_or_io : String | IO, trusted : Bool = false)","def":{"name":"create_from_json","args":[{"name":"string_or_io","external_name":"string_or_io","restriction":"String | IO"},{"name":"trusted","default_value":"false","external_name":"trusted","restriction":"Bool"}],"visibility":"Public","body":"mdl = self.from_json(string_or_io, trusted)\nmdl.save\nmdl\n"}},{"html_id":"create_from_json!(string_or_io:String|IO,trusted:Bool=false)-class-method","name":"create_from_json!","doc":"Create a new model from json and save it. Returns the model.\n\nReturns the newly inserted model\nRaises an exception if validation failed during the saving process.\nTrusted flag set to true will allow mass assignment without protection, FALSE by default","summary":"

Create a new model from json and save it.

","abstract":false,"args":[{"name":"string_or_io","external_name":"string_or_io","restriction":"String | IO"},{"name":"trusted","default_value":"false","external_name":"trusted","restriction":"Bool"}],"args_string":"(string_or_io : String | IO, trusted : Bool = false)","args_html":"(string_or_io : String | IO, trusted : Bool = false)","def":{"name":"create_from_json!","args":[{"name":"string_or_io","external_name":"string_or_io","restriction":"String | IO"},{"name":"trusted","default_value":"false","external_name":"trusted","restriction":"Bool"}],"visibility":"Public","body":"(self.from_json(string_or_io, trusted)).save!"}},{"html_id":"find(x)-class-method","name":"find","doc":"Returns a model using primary key equality\nReturns `nil` if not found.","summary":"

Returns a model using primary key equality Returns nil if not found.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x)","args_html":"(x)","location":{"filename":"src/clear/model/reflection/column.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/column.cr#L4"},"def":{"name":"find","args":[{"name":"x","external_name":"x","restriction":""}],"visibility":"Public","body":"query.where do\n (raw(__pkey__)) == x\nend.first"}},{"html_id":"find!(x)-class-method","name":"find!","doc":"Returns a model using primary key equality.\nRaises error if the model is not found.","summary":"

Returns a model using primary key equality.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x)","args_html":"(x)","location":{"filename":"src/clear/model/reflection/column.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/column.cr#L4"},"def":{"name":"find!","args":[{"name":"x","external_name":"x","restriction":""}],"visibility":"Public","body":"(find(x)) || (raise(Clear::SQL::RecordNotFoundError.new))"}},{"html_id":"from_json(string_or_io:String|IO,trusted:Bool=false)-class-method","name":"from_json","doc":"Create a new empty model and fill the columns from json. Returns the new model\n\nTrusted flag set to true will allow mass assignment without protection, FALSE by default","summary":"

Create a new empty model and fill the columns from json.

","abstract":false,"args":[{"name":"string_or_io","external_name":"string_or_io","restriction":"String | IO"},{"name":"trusted","default_value":"false","external_name":"trusted","restriction":"Bool"}],"args_string":"(string_or_io : String | IO, trusted : Bool = false)","args_html":"(string_or_io : String | IO, trusted : Bool = false)","def":{"name":"from_json","args":[{"name":"string_or_io","external_name":"string_or_io","restriction":"String | IO"},{"name":"trusted","default_value":"false","external_name":"trusted","restriction":"Bool"}],"visibility":"Public","body":"(Assigner.from_json(string_or_io)).create(trusted)"}},{"html_id":"full_table_name-class-method","name":"full_table_name","doc":"returns the fully qualified and escaped name for this table.\nadd schema if schema is different from 'public' (default schema)\n\nex: \"schema\".\"table\"","summary":"

returns the fully qualified and escaped name for this table.

","abstract":false,"location":{"filename":"src/clear/model/reflection/column.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/column.cr#L4"},"def":{"name":"full_table_name","visibility":"Public","body":"if s = schema\n {schema, table}.map do |x|\n Clear::SQL.escape(x.to_s)\n end.join(\".\")\nelse\n Clear::SQL.escape(table)\nend"}},{"html_id":"import(array:Enumerable(self),on_conflict:Clear::SQL::InsertQuery->|Nil=nil)-class-method","name":"import","doc":"Import a bulk of models in one SQL insert query.\nEach model must be non-persisted.\n\n`on_conflict` callback can be optionnaly turned on\nto manage constraints of the database.\n\nNote: Old models are not modified. This method return a copy of the\nmodels as saved in the database.\n\n## Example:\n\n```\nusers = [User.new(id: 1), User.new(id: 2), User.new(id: 3)]\nusers = User.import(users)\n```","summary":"

Import a bulk of models in one SQL insert query.

","abstract":false,"args":[{"name":"array","external_name":"array","restriction":"Enumerable(self)"},{"name":"on_conflict","default_value":"nil","external_name":"on_conflict","restriction":"(Clear::SQL::InsertQuery ->) | ::Nil"}],"args_string":"(array : Enumerable(self), on_conflict : Clear::SQL::InsertQuery -> | Nil = nil)","args_html":"(array : Enumerable(self), on_conflict : Clear::SQL::InsertQuery -> | Nil = nil)","location":{"filename":"src/clear/model/reflection/column.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/column.cr#L4"},"def":{"name":"import","args":[{"name":"array","external_name":"array","restriction":"Enumerable(self)"},{"name":"on_conflict","default_value":"nil","external_name":"on_conflict","restriction":"(Clear::SQL::InsertQuery ->) | ::Nil"}],"visibility":"Public","body":"array.each do |item|\n if item.persisted?\n raise(\"One of your model is persisted while calling import\")\n end\nend\nhashes = array.map do |item|\n item.trigger_before_events(:save)\n if item.valid?\n else\n raise(\"import: Validation failed for `#{item}`\")\n end\n item.trigger_before_events(:create)\n item.to_h\nend\nquery = (Clear::SQL.insert_into(self.table, hashes)).returning(\"*\")\nif on_conflict\n on_conflict.call(query)\nend\no = [] of self\nquery.fetch(@@connection) do |hash|\n o << ((Clear::Model::Factory.build(self.name, hash, persisted: true, fetch_columns: false, cache: nil)).as(self))\nend\no.each(&.trigger_after_events(:create))\no.each(&.trigger_after_events(:save))\no\n"}},{"html_id":"polymorphic?:Bool-class-method","name":"polymorphic?","abstract":false,"def":{"name":"polymorphic?","return_type":"Bool","visibility":"Public","body":"@@polymorphic"}},{"html_id":"query-class-method","name":"query","doc":"Return a new empty query `SELECT * FROM [my_model_table]`. Can be refined after that.","summary":"

Return a new empty query SELECT * FROM [my_model_table].

","abstract":false,"location":{"filename":"src/clear/model/reflection/column.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/column.cr#L4"},"def":{"name":"query","visibility":"Public","body":"(Collection.new.use_connection(connection)).from(self.full_table_name)"}},{"html_id":"read_only=(read_only:Bool)-class-method","name":"read_only=","abstract":false,"args":[{"name":"read_only","external_name":"read_only","restriction":"Bool"}],"args_string":"(read_only : Bool)","args_html":"(read_only : Bool)","def":{"name":"read_only=","args":[{"name":"read_only","external_name":"read_only","restriction":"Bool"}],"visibility":"Public","body":"@@read_only = read_only"}},{"html_id":"read_only?:Bool-class-method","name":"read_only?","abstract":false,"def":{"name":"read_only?","return_type":"Bool","visibility":"Public","body":"@@read_only"}},{"html_id":"schema:Clear::SQL::Symbolic|Nil-class-method","name":"schema","doc":"Define the current schema used in PostgreSQL. The value is `nil` by default, which lead to non-specified\n schema during the querying, and usage of \"public\" by PostgreSQL.\n\nThis property can be redefined on initialization. Example:\n\n```\nclass MyModel\n include Clear::Model\n\n self.schema = \"my_schema\"\nend\nMyModel.query.to_sql # SELECT * FROM \"my_schema\".\"my_models\"\n```","summary":"

Define the current schema used in PostgreSQL.

","abstract":false,"def":{"name":"schema","return_type":"Clear::SQL::Symbolic | ::Nil","visibility":"Public","body":"@@schema"}},{"html_id":"schema=(schema:Clear::SQL::Symbolic|Nil)-class-method","name":"schema=","doc":"Define the current schema used in PostgreSQL. The value is `nil` by default, which lead to non-specified\n schema during the querying, and usage of \"public\" by PostgreSQL.\n\nThis property can be redefined on initialization. Example:\n\n```\nclass MyModel\n include Clear::Model\n\n self.schema = \"my_schema\"\nend\nMyModel.query.to_sql # SELECT * FROM \"my_schema\".\"my_models\"\n```","summary":"

Define the current schema used in PostgreSQL.

","abstract":false,"args":[{"name":"schema","external_name":"schema","restriction":"Clear::SQL::Symbolic | ::Nil"}],"args_string":"(schema : Clear::SQL::Symbolic | Nil)","args_html":"(schema : Clear::SQL::Symbolic | Nil)","def":{"name":"schema=","args":[{"name":"schema","external_name":"schema","restriction":"Clear::SQL::Symbolic | ::Nil"}],"visibility":"Public","body":"@@schema = schema"}},{"html_id":"table:Clear::SQL::Symbolic-class-method","name":"table","doc":"Return the table name setup for this model.\nBy convention, the class name is by default equals to the pluralized underscored string form of the model name.\nExample:\n\n```\nMyModel => \"my_models\"\nPerson => \"people\"\nProject::Info => \"project_infos\"\n```\n\nThe property can be updated at initialization to a custom table name:\n\n```\nclass MyModel\n include Clear::Model\n\n self.table = \"another_table_name\"\nend\nMyModel.query.to_sql # SELECT * FROM \"another_table_name\"\n```","summary":"

Return the table name setup for this model.

","abstract":false,"def":{"name":"table","return_type":"Clear::SQL::Symbolic","visibility":"Public","body":"@@table"}},{"html_id":"table=(table:Clear::SQL::Symbolic)-class-method","name":"table=","doc":"Return the table name setup for this model.\nBy convention, the class name is by default equals to the pluralized underscored string form of the model name.\nExample:\n\n```\nMyModel => \"my_models\"\nPerson => \"people\"\nProject::Info => \"project_infos\"\n```\n\nThe property can be updated at initialization to a custom table name:\n\n```\nclass MyModel\n include Clear::Model\n\n self.table = \"another_table_name\"\nend\nMyModel.query.to_sql # SELECT * FROM \"another_table_name\"\n```","summary":"

Return the table name setup for this model.

","abstract":false,"args":[{"name":"table","external_name":"table","restriction":"Clear::SQL::Symbolic"}],"args_string":"(table : Clear::SQL::Symbolic)","args_html":"(table : Clear::SQL::Symbolic)","def":{"name":"table=","args":[{"name":"table","external_name":"table","restriction":"Clear::SQL::Symbolic"}],"visibility":"Public","body":"@@table = table"}}],"constructors":[{"html_id":"build(x:NamedTuple):self-class-method","name":"build","doc":"Build a new empty model and fill the columns using the NamedTuple in argument.\n\nReturns the new model","summary":"

Build a new empty model and fill the columns using the NamedTuple in argument.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"args_string":"(x : NamedTuple) : self","args_html":"(x : NamedTuple) : self","location":{"filename":"src/clear/model/reflection/column.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/column.cr#L4"},"def":{"name":"build","args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"return_type":"self","visibility":"Public","body":"build(**x) do\nend"}},{"html_id":"build(x:NamedTuple,&block:self->Nil):self-class-method","name":"build","doc":"Build a new empty model and fill the columns using the NamedTuple in argument.\n\nReturns the new model","summary":"

Build a new empty model and fill the columns using the NamedTuple in argument.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"args_string":"(x : NamedTuple, &block : self -> Nil) : self","args_html":"(x : NamedTuple, &block : self -> Nil) : self","location":{"filename":"src/clear/model/reflection/column.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/column.cr#L4"},"def":{"name":"build","args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(self -> Nil)"},"return_type":"self","visibility":"Public","body":"build(**x, &block)"}},{"html_id":"create(x:NamedTuple,&block:self->Nil):self-class-method","name":"create","doc":"Build and new model and save it. Returns the model.\n\nThe model may not be saved due to validation failure;\ncheck the returned model `errors?` and `persisted?` flags.","summary":"

Build and new model and save it.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"args_string":"(x : NamedTuple, &block : self -> Nil) : self","args_html":"(x : NamedTuple, &block : self -> Nil) : self","location":{"filename":"src/clear/model/reflection/column.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/column.cr#L4"},"def":{"name":"create","args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(self -> Nil)"},"return_type":"self","visibility":"Public","body":"create(**x, &block)"}},{"html_id":"create(**tuple,&block:self->Nil):self-class-method","name":"create","doc":"Build and new model and save it. Returns the model.\n\nThe model may not be saved due to validation failure;\ncheck the returned model `errors?` and `persisted?` flags.","summary":"

Build and new model and save it.

","abstract":false,"location":{"filename":"src/clear/model/reflection/column.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/column.cr#L4"},"def":{"name":"create","double_splat":{"name":"tuple","external_name":"tuple","restriction":""},"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(self -> Nil)"},"return_type":"self","visibility":"Public","body":"r = build(**tuple) do |mdl|\n yield(mdl)\nend\nr.save\nr\n"}},{"html_id":"create(x:NamedTuple):self-class-method","name":"create","doc":"Build and new model and save it. Returns the model.\n\nThe model may not be saved due to validation failure;\ncheck the returned model `errors?` and `persisted?` flags.","summary":"

Build and new model and save it.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"args_string":"(x : NamedTuple) : self","args_html":"(x : NamedTuple) : self","location":{"filename":"src/clear/model/reflection/column.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/column.cr#L4"},"def":{"name":"create","args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"return_type":"self","visibility":"Public","body":"create(**x) do\nend"}},{"html_id":"create(**tuple):self-class-method","name":"create","doc":"Build and new model and save it. Returns the model.\n\nThe model may not be saved due to validation failure;\ncheck the returned model `errors?` and `persisted?` flags.","summary":"

Build and new model and save it.

","abstract":false,"location":{"filename":"src/clear/model/reflection/column.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/column.cr#L4"},"def":{"name":"create","double_splat":{"name":"tuple","external_name":"tuple","restriction":""},"return_type":"self","visibility":"Public","body":"create(**tuple) do\nend"}},{"html_id":"create!(x:NamedTuple,&block:self->Nil):self-class-method","name":"create!","doc":"Build and new model and save it. Returns the model.\n\nReturns the newly inserted model\nRaises an exception if validation failed during the saving process.","summary":"

Build and new model and save it.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"args_string":"(x : NamedTuple, &block : self -> Nil) : self","args_html":"(x : NamedTuple, &block : self -> Nil) : self","location":{"filename":"src/clear/model/reflection/column.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/column.cr#L4"},"def":{"name":"create!","args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(self -> Nil)"},"return_type":"self","visibility":"Public","body":"create!(**x, &block)"}},{"html_id":"create!(**tuple,&block:self->Nil):self-class-method","name":"create!","doc":"Build and new model and save it. Returns the model.\n\nReturns the newly inserted model\nRaises an exception if validation failed during the saving process.","summary":"

Build and new model and save it.

","abstract":false,"location":{"filename":"src/clear/model/reflection/column.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/column.cr#L4"},"def":{"name":"create!","double_splat":{"name":"tuple","external_name":"tuple","restriction":""},"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(self -> Nil)"},"return_type":"self","visibility":"Public","body":"r = build(**tuple) do |mdl|\n yield(mdl)\nend\nr.save!\nr\n"}},{"html_id":"create!(x:NamedTuple):self-class-method","name":"create!","doc":"Build and new model and save it. Returns the model.\n\nReturns the newly inserted model\nRaises an exception if validation failed during the saving process.","summary":"

Build and new model and save it.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"args_string":"(x : NamedTuple) : self","args_html":"(x : NamedTuple) : self","location":{"filename":"src/clear/model/reflection/column.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/column.cr#L4"},"def":{"name":"create!","args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"return_type":"self","visibility":"Public","body":"create!(**x) do\nend"}},{"html_id":"create!(**tuple):self-class-method","name":"create!","doc":"Build and new model and save it. Returns the model.\n\nReturns the newly inserted model\nRaises an exception if validation failed during the saving process.","summary":"

Build and new model and save it.

","abstract":false,"location":{"filename":"src/clear/model/reflection/column.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/column.cr#L4"},"def":{"name":"create!","double_splat":{"name":"tuple","external_name":"tuple","restriction":""},"return_type":"self","visibility":"Public","body":"create!(**tuple) do\nend"}},{"html_id":"new(h:Hash(String,_),cache:Clear::Model::QueryCache|Nil=nil,persisted=false,fetch_columns=false)-class-method","name":"new","abstract":false,"args":[{"name":"h","external_name":"h","restriction":"Hash(String, _)"},{"name":"cache","default_value":"nil","external_name":"cache","restriction":"Clear::Model::QueryCache | ::Nil"},{"name":"persisted","default_value":"false","external_name":"persisted","restriction":""},{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"args_string":"(h : Hash(String, _), cache : Clear::Model::QueryCache | Nil = nil, persisted = false, fetch_columns = false)","args_html":"(h : Hash(String, _), cache : Clear::Model::QueryCache | Nil = nil, persisted = false, fetch_columns = false)","location":{"filename":"src/clear/model/reflection/column.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/column.cr#L4"},"def":{"name":"new","args":[{"name":"h","external_name":"h","restriction":"Hash(String, _)"},{"name":"cache","default_value":"nil","external_name":"cache","restriction":"Clear::Model::QueryCache | ::Nil"},{"name":"persisted","default_value":"false","external_name":"persisted","restriction":""},{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"visibility":"Public","body":"_ = allocate\n_.initialize(h, cache, persisted, fetch_columns)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new(json:JSON::Any,cache:Clear::Model::QueryCache|Nil=nil,persisted=false)-class-method","name":"new","abstract":false,"args":[{"name":"json","external_name":"json","restriction":"::JSON::Any"},{"name":"cache","default_value":"nil","external_name":"cache","restriction":"Clear::Model::QueryCache | ::Nil"},{"name":"persisted","default_value":"false","external_name":"persisted","restriction":""}],"args_string":"(json : JSON::Any, cache : Clear::Model::QueryCache | Nil = nil, persisted = false)","args_html":"(json : JSON::Any, cache : Clear::Model::QueryCache | Nil = nil, persisted = false)","location":{"filename":"src/clear/model/reflection/column.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/column.cr#L4"},"def":{"name":"new","args":[{"name":"json","external_name":"json","restriction":"::JSON::Any"},{"name":"cache","default_value":"nil","external_name":"cache","restriction":"Clear::Model::QueryCache | ::Nil"},{"name":"persisted","default_value":"false","external_name":"persisted","restriction":""}],"visibility":"Public","body":"_ = allocate\n_.initialize(json, cache, persisted)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new(t:NamedTuple,persisted=false)-class-method","name":"new","abstract":false,"args":[{"name":"t","external_name":"t","restriction":"NamedTuple"},{"name":"persisted","default_value":"false","external_name":"persisted","restriction":""}],"args_string":"(t : NamedTuple, persisted = false)","args_html":"(t : NamedTuple, persisted = false)","location":{"filename":"src/clear/model/reflection/column.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/column.cr#L4"},"def":{"name":"new","args":[{"name":"t","external_name":"t","restriction":"NamedTuple"},{"name":"persisted","default_value":"false","external_name":"persisted","restriction":""}],"visibility":"Public","body":"_ = allocate\n_.initialize(t, persisted)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new-class-method","name":"new","abstract":false,"location":{"filename":"src/clear/model/reflection/column.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/column.cr#L4"},"def":{"name":"new","visibility":"Public","body":"_ = allocate\n_.initialize\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"_cached_table:Clear::Reflection::Table|Nil-instance-method","name":"_cached_table","abstract":false,"def":{"name":"_cached_table","return_type":"Clear::Reflection::Table | ::Nil","visibility":"Public","body":"@_cached_table"}},{"html_id":"attributes:Hash(String,Clear::SQL::Any)-instance-method","name":"attributes","doc":"Attributes, used when fetch_columns is true","summary":"

Attributes, used when fetch_columns is true

","abstract":false,"def":{"name":"attributes","return_type":"Hash(String, ::Clear::SQL::Any)","visibility":"Public","body":"@attributes"}},{"html_id":"cache:Clear::Model::QueryCache|Nil-instance-method","name":"cache","abstract":false,"def":{"name":"cache","return_type":"Clear::Model::QueryCache | ::Nil","visibility":"Public","body":"@cache"}},{"html_id":"changed?-instance-method","name":"changed?","doc":"Return `true` if the model is dirty (e.g. one or more fields\n have been changed.). Return `false` otherwise.","summary":"

Return true if the model is dirty (e.g.

","abstract":false,"def":{"name":"changed?","visibility":"Public","body":"if @table_catalog_column.changed?\n return true\nend\nif @table_schema_column.changed?\n return true\nend\nif @table_name_column.changed?\n return true\nend\nif @column_name_column.changed?\n return true\nend\nreturn false\n"}},{"html_id":"clear_change_flags-instance-method","name":"clear_change_flags","doc":"Reset the `changed?` flag on all columns\n\nThe model behave like its not dirty anymore\nand call to save would apply no changes.\n\nReturns `self`","summary":"

Reset the #changed? flag on all columns

","abstract":false,"def":{"name":"clear_change_flags","visibility":"Public","body":"@table_catalog_column.clear_change_flag\n@table_schema_column.clear_change_flag\n@table_name_column.clear_change_flag\n@column_name_column.clear_change_flag\nself\n"}},{"html_id":"column_name:String-instance-method","name":"column_name","doc":"Returns the value of `column_name` column or throw an exception if the column is not defined.","summary":"

Returns the value of #column_name column or throw an exception if the column is not defined.

","abstract":false,"def":{"name":"column_name","return_type":"String","visibility":"Public","body":"@column_name_column.value"}},{"html_id":"column_name=(x:String)-instance-method","name":"column_name=","doc":"Setter for `column_name` column.","summary":"

Setter for #column_name column.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"String"}],"args_string":"(x : String)","args_html":"(x : String)","def":{"name":"column_name=","args":[{"name":"x","external_name":"x","restriction":"String"}],"visibility":"Public","body":"@column_name_column.value = x"}},{"html_id":"column_name_column:Clear::Model::Column(String,Clear::Model::Converter::StringConverter)-instance-method","name":"column_name_column","doc":"Returns the column object used to manage `column_name` field\n\nSee `Clear::Model::Column`","summary":"

Returns the column object used to manage #column_name field

","abstract":false,"def":{"name":"column_name_column","return_type":"Clear::Model::Column(String, Clear::Model::Converter::StringConverter)","visibility":"Public","body":"@column_name_column"}},{"html_id":"reset(h:Hash(Symbol,_))-instance-method","name":"reset","doc":"Set the columns from hash","summary":"

Set the columns from hash

","abstract":false,"args":[{"name":"h","external_name":"h","restriction":"Hash(Symbol, _)"}],"args_string":"(h : Hash(Symbol, _))","args_html":"(h : Hash(Symbol, _))","def":{"name":"reset","args":[{"name":"h","external_name":"h","restriction":"Hash(Symbol, _)"}],"visibility":"Public","body":"super(h)\n{% for name, settings in COLUMNS %}\n v = h.fetch(:\\{{settings[:db_column_name]}}) { Clear::Model::Column::UNKNOWN }\n @{{ settings[:crystal_variable_name] }}_column.reset_convert(v) unless v.is_a?(Clear::Model::Column::UnknownClass)\n {% end %}\nself\n"}},{"html_id":"reset(h:Hash(String,_))-instance-method","name":"reset","doc":"Set the model fields from hash","summary":"

Set the model fields from hash

","abstract":false,"args":[{"name":"h","external_name":"h","restriction":"Hash(String, _)"}],"args_string":"(h : Hash(String, _))","args_html":"(h : Hash(String, _))","def":{"name":"reset","args":[{"name":"h","external_name":"h","restriction":"Hash(String, _)"}],"visibility":"Public","body":"super(h)\n{% for name, settings in COLUMNS %}\n v = h.fetch({{ settings[:db_column_name] }}) { Clear::Model::Column::UNKNOWN }\n @{{ settings[:crystal_variable_name] }}_column.reset_convert(v) unless v.is_a?(Clear::Model::Column::UnknownClass)\n {% end %}\nself\n"}},{"html_id":"reset(t:NamedTuple)-instance-method","name":"reset","abstract":false,"args":[{"name":"t","external_name":"t","restriction":"NamedTuple"}],"args_string":"(t : NamedTuple)","args_html":"(t : NamedTuple)","def":{"name":"reset","args":[{"name":"t","external_name":"t","restriction":"NamedTuple"}],"visibility":"Public","body":"reset(**t)"}},{"html_id":"reset(from_json:JSON::Any)-instance-method","name":"reset","abstract":false,"args":[{"name":"from_json","external_name":"from_json","restriction":"JSON::Any"}],"args_string":"(from_json : JSON::Any)","args_html":"(from_json : JSON::Any)","def":{"name":"reset","args":[{"name":"from_json","external_name":"from_json","restriction":"JSON::Any"}],"visibility":"Public","body":"reset(from_json.as_h)"}},{"html_id":"reset(**t:**T)forallT-instance-method","name":"reset","doc":"reset flavors","summary":"

reset flavors

","abstract":false,"def":{"name":"reset","double_splat":{"name":"t","external_name":"t","restriction":"**T"},"visibility":"Public","body":"super(**t)\n{% for name, typ in T %}\n\n {% if settings = COLUMNS[\"#{name}\"] %}\n @{{ settings[:crystal_variable_name] }}_column.reset_convert(t[:{{ name }}])\n {% else %}\n {% if !(@type.has_method?(\"#{name}=\")) %}\n {% raise(\"Cannot find the column `#{name}` of the model `#{@type}`\") %}\n {% end %}\n self.{{ name }} = t[:{{ name }}]\n {% end %}\n {% end %}\nself\n"}},{"html_id":"set(h:Hash(Symbol,_))-instance-method","name":"set","doc":"Set the columns from hash","summary":"

Set the columns from hash

","abstract":false,"args":[{"name":"h","external_name":"h","restriction":"Hash(Symbol, _)"}],"args_string":"(h : Hash(Symbol, _))","args_html":"(h : Hash(Symbol, _))","def":{"name":"set","args":[{"name":"h","external_name":"h","restriction":"Hash(Symbol, _)"}],"visibility":"Public","body":"super(h)\n{% for name, settings in COLUMNS %}\n v = h.fetch(:{{ settings[:db_column_name] }}) { Clear::Model::Column::UNKNOWN }\n @{{ settings[:crystal_variable_name] }}_column.set_convert(v) unless v.is_a?(Clear::Model::Column::UnknownClass)\n {% end %}\nself\n"}},{"html_id":"set(h:Hash(String,_))-instance-method","name":"set","doc":"Set the model fields from hash","summary":"

Set the model fields from hash

","abstract":false,"args":[{"name":"h","external_name":"h","restriction":"Hash(String, _)"}],"args_string":"(h : Hash(String, _))","args_html":"(h : Hash(String, _))","def":{"name":"set","args":[{"name":"h","external_name":"h","restriction":"Hash(String, _)"}],"visibility":"Public","body":"super(h)\n{% for name, settings in COLUMNS %}\n v = h.fetch({{ settings[:db_column_name] }}) { Clear::Model::Column::UNKNOWN }\n @{{ settings[:crystal_variable_name] }}_column.set_convert(v) unless v.is_a?(Clear::Model::Column::UnknownClass)\n {% end %}\nself\n"}},{"html_id":"set(t:NamedTuple)-instance-method","name":"set","abstract":false,"args":[{"name":"t","external_name":"t","restriction":"NamedTuple"}],"args_string":"(t : NamedTuple)","args_html":"(t : NamedTuple)","def":{"name":"set","args":[{"name":"t","external_name":"t","restriction":"NamedTuple"}],"visibility":"Public","body":"set(**t)"}},{"html_id":"set(from_json:JSON::Any)-instance-method","name":"set","abstract":false,"args":[{"name":"from_json","external_name":"from_json","restriction":"JSON::Any"}],"args_string":"(from_json : JSON::Any)","args_html":"(from_json : JSON::Any)","def":{"name":"set","args":[{"name":"from_json","external_name":"from_json","restriction":"JSON::Any"}],"visibility":"Public","body":"set(from_json.as_h)"}},{"html_id":"set(**t:**T)forallT-instance-method","name":"set","doc":"Set one or multiple columns to a specific value\nThis two are equivalents:\n\n```\nmodel.set(a: 1)\nmodel.a = 1\n```","summary":"

Set one or multiple columns to a specific value This two are equivalents:

","abstract":false,"def":{"name":"set","double_splat":{"name":"t","external_name":"t","restriction":"**T"},"visibility":"Public","body":"super(**t)\n{% for name, typ in T %}\n {% if settings = COLUMNS[\"#{name}\".id] %}\n @{{ settings[:crystal_variable_name] }}_column.set_convert(t[:{{ name }}])\n {% else %}\n {% if !(@type.has_method?(\"#{name}=\")) %}\n {% raise(\"No method #{@type}##{name}= while trying to set value of #{name}\") %}\n {% end %}\n self.{{ name }} = t[:{{ name }}]\n {% end %}\n {% end %}\nself\n"}},{"html_id":"set_from_json(string_or_io:String|IO,trusted:Bool=false)-instance-method","name":"set_from_json","doc":"Set the fields from json passed as argument\nTrusted flag set to true will allow mass assignment without protection, FALSE by default","summary":"

Set the fields from json passed as argument Trusted flag set to true will allow mass assignment without protection, FALSE by default

","abstract":false,"args":[{"name":"string_or_io","external_name":"string_or_io","restriction":"String | IO"},{"name":"trusted","default_value":"false","external_name":"trusted","restriction":"Bool"}],"args_string":"(string_or_io : String | IO, trusted : Bool = false)","args_html":"(string_or_io : String | IO, trusted : Bool = false)","def":{"name":"set_from_json","args":[{"name":"string_or_io","external_name":"string_or_io","restriction":"String | IO"},{"name":"trusted","default_value":"false","external_name":"trusted","restriction":"Bool"}],"visibility":"Public","body":"(Assigner.from_json(string_or_io)).update(self, trusted)"}},{"html_id":"table:Clear::Reflection::Table-instance-method","name":"table","doc":"The method table is a `belongs_to` relation to Clear::Reflection::Table","summary":"

The method table is a belongs_to relation to Clear::Reflection::Table

","abstract":false,"def":{"name":"table","return_type":"Clear::Reflection::Table","visibility":"Public","body":"if cached = @_cached_table\n cached\nelse\n cache = @cache\n if cache && (cache.active?(\"table\"))\n @_cached_table = (cache.hit(\"table\", self.table_name_column.to_sql_value, Clear::Reflection::Table)).first? || (raise(Clear::SQL::RecordNotFoundError.new))\n else\n @_cached_table = Clear::Reflection::Table.query.where do\n (raw(Clear::Reflection::Table.__pkey__)) == self.table_name\n end.first!\n end\nend"}},{"html_id":"table=(model:Clear::Reflection::Table)-instance-method","name":"table=","abstract":false,"args":[{"name":"model","external_name":"model","restriction":"Clear::Reflection::Table"}],"args_string":"(model : Clear::Reflection::Table)","args_html":"(model : Clear::Reflection::Table)","def":{"name":"table=","args":[{"name":"model","external_name":"model","restriction":"Clear::Reflection::Table"}],"visibility":"Public","body":"if model.persisted?\n if model.__pkey_column__.defined?\n else\n raise(\"#{model.__pkey_column__.name} must be defined when assigning a belongs_to relation.\")\n end\n @table_name_column.value = model.__pkey__\nend\n@_cached_table = model\n"}},{"html_id":"table_catalog:String-instance-method","name":"table_catalog","doc":"Returns the value of `table_catalog` column or throw an exception if the column is not defined.","summary":"

Returns the value of #table_catalog column or throw an exception if the column is not defined.

","abstract":false,"def":{"name":"table_catalog","return_type":"String","visibility":"Public","body":"@table_catalog_column.value"}},{"html_id":"table_catalog=(x:String)-instance-method","name":"table_catalog=","doc":"Setter for `table_catalog` column.","summary":"

Setter for #table_catalog column.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"String"}],"args_string":"(x : String)","args_html":"(x : String)","def":{"name":"table_catalog=","args":[{"name":"x","external_name":"x","restriction":"String"}],"visibility":"Public","body":"@table_catalog_column.value = x"}},{"html_id":"table_catalog_column:Clear::Model::Column(String,Clear::Model::Converter::StringConverter)-instance-method","name":"table_catalog_column","doc":"Returns the column object used to manage `table_catalog` field\n\nSee `Clear::Model::Column`","summary":"

Returns the column object used to manage #table_catalog field

","abstract":false,"def":{"name":"table_catalog_column","return_type":"Clear::Model::Column(String, Clear::Model::Converter::StringConverter)","visibility":"Public","body":"@table_catalog_column"}},{"html_id":"table_name:String-instance-method","name":"table_name","doc":"Returns the value of `table_name` column or throw an exception if the column is not defined.","summary":"

Returns the value of #table_name column or throw an exception if the column is not defined.

","abstract":false,"def":{"name":"table_name","return_type":"String","visibility":"Public","body":"@table_name_column.value"}},{"html_id":"table_name=(x:String)-instance-method","name":"table_name=","doc":"Setter for `table_name` column.","summary":"

Setter for #table_name column.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"String"}],"args_string":"(x : String)","args_html":"(x : String)","def":{"name":"table_name=","args":[{"name":"x","external_name":"x","restriction":"String"}],"visibility":"Public","body":"@table_name_column.value = x"}},{"html_id":"table_name_column:Clear::Model::Column(String,Clear::Model::Converter::StringConverter)-instance-method","name":"table_name_column","doc":"Returns the column object used to manage `table_name` field\n\nSee `Clear::Model::Column`","summary":"

Returns the column object used to manage #table_name field

","abstract":false,"def":{"name":"table_name_column","return_type":"Clear::Model::Column(String, Clear::Model::Converter::StringConverter)","visibility":"Public","body":"@table_name_column"}},{"html_id":"table_schema:String-instance-method","name":"table_schema","doc":"Returns the value of `table_schema` column or throw an exception if the column is not defined.","summary":"

Returns the value of #table_schema column or throw an exception if the column is not defined.

","abstract":false,"def":{"name":"table_schema","return_type":"String","visibility":"Public","body":"@table_schema_column.value"}},{"html_id":"table_schema=(x:String)-instance-method","name":"table_schema=","doc":"Setter for `table_schema` column.","summary":"

Setter for #table_schema column.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"String"}],"args_string":"(x : String)","args_html":"(x : String)","def":{"name":"table_schema=","args":[{"name":"x","external_name":"x","restriction":"String"}],"visibility":"Public","body":"@table_schema_column.value = x"}},{"html_id":"table_schema_column:Clear::Model::Column(String,Clear::Model::Converter::StringConverter)-instance-method","name":"table_schema_column","doc":"Returns the column object used to manage `table_schema` field\n\nSee `Clear::Model::Column`","summary":"

Returns the column object used to manage #table_schema field

","abstract":false,"def":{"name":"table_schema_column","return_type":"Clear::Model::Column(String, Clear::Model::Converter::StringConverter)","visibility":"Public","body":"@table_schema_column"}},{"html_id":"to_h(full=false):Hash(String,Clear::SQL::Any)-instance-method","name":"to_h","doc":"Return a hash version of the columns of this model.","summary":"

Return a hash version of the columns of this model.

","abstract":false,"args":[{"name":"full","default_value":"false","external_name":"full","restriction":""}],"args_string":"(full = false) : Hash(String, Clear::SQL::Any)","args_html":"(full = false) : Hash(String, Clear::SQL::Any)","def":{"name":"to_h","args":[{"name":"full","default_value":"false","external_name":"full","restriction":""}],"return_type":"Hash(String, ::Clear::SQL::Any)","visibility":"Public","body":"out = super(full)\nif full || @table_catalog_column.defined?\n out[\"table_catalog\"] = @table_catalog_column.to_sql_value(nil)\nend\nif full || @table_schema_column.defined?\n out[\"table_schema\"] = @table_schema_column.to_sql_value(nil)\nend\nif full || @table_name_column.defined?\n out[\"table_name\"] = @table_name_column.to_sql_value(nil)\nend\nif full || @column_name_column.defined?\n out[\"column_name\"] = @column_name_column.to_sql_value(nil)\nend\nout\n"}},{"html_id":"to_json(emit_nulls:Bool=false)-instance-method","name":"to_json","abstract":false,"args":[{"name":"emit_nulls","default_value":"false","external_name":"emit_nulls","restriction":"Bool"}],"args_string":"(emit_nulls : Bool = false)","args_html":"(emit_nulls : Bool = false)","def":{"name":"to_json","args":[{"name":"emit_nulls","default_value":"false","external_name":"emit_nulls","restriction":"Bool"}],"visibility":"Public","body":"JSON.build do |json|\n to_json(json, emit_nulls)\nend"}},{"html_id":"to_json(json,emit_nulls=false)-instance-method","name":"to_json","abstract":false,"args":[{"name":"json","external_name":"json","restriction":""},{"name":"emit_nulls","default_value":"false","external_name":"emit_nulls","restriction":""}],"args_string":"(json, emit_nulls = false)","args_html":"(json, emit_nulls = false)","def":{"name":"to_json","args":[{"name":"json","external_name":"json","restriction":""},{"name":"emit_nulls","default_value":"false","external_name":"emit_nulls","restriction":""}],"visibility":"Public","body":"json.object do\n if emit_nulls || @table_catalog_column.defined?\n json.field(\"table_catalog\") do\n (@table_catalog_column.value(nil)).to_json(json)\n end\n end\n if emit_nulls || @table_schema_column.defined?\n json.field(\"table_schema\") do\n (@table_schema_column.value(nil)).to_json(json)\n end\n end\n if emit_nulls || @table_name_column.defined?\n json.field(\"table_name\") do\n (@table_name_column.value(nil)).to_json(json)\n end\n end\n if emit_nulls || @column_name_column.defined?\n json.field(\"column_name\") do\n (@column_name_column.value(nil)).to_json(json)\n end\n end\nend"}},{"html_id":"update_from_json(string_or_io:String|IO,trusted:Bool=false)-instance-method","name":"update_from_json","doc":"Set the fields from json passed as argument and call `save` on the object\nTrusted flag set to true will allow mass assignment without protection, FALSE by default","summary":"

Set the fields from json passed as argument and call save on the object Trusted flag set to true will allow mass assignment without protection, FALSE by default

","abstract":false,"args":[{"name":"string_or_io","external_name":"string_or_io","restriction":"String | IO"},{"name":"trusted","default_value":"false","external_name":"trusted","restriction":"Bool"}],"args_string":"(string_or_io : String | IO, trusted : Bool = false)","args_html":"(string_or_io : String | IO, trusted : Bool = false)","def":{"name":"update_from_json","args":[{"name":"string_or_io","external_name":"string_or_io","restriction":"String | IO"},{"name":"trusted","default_value":"false","external_name":"trusted","restriction":"Bool"}],"visibility":"Public","body":"mdl = set_from_json(string_or_io, trusted)\nmdl.save\nmdl\n"}},{"html_id":"update_from_json!(string_or_io:String|IO,trusted:Bool=false)-instance-method","name":"update_from_json!","doc":"Set the fields from json passed as argument and call `save!` on the object\nTrusted flag set to true will allow mass assignment without protection, FALSE by default","summary":"

Set the fields from json passed as argument and call save! on the object Trusted flag set to true will allow mass assignment without protection, FALSE by default

","abstract":false,"args":[{"name":"string_or_io","external_name":"string_or_io","restriction":"String | IO"},{"name":"trusted","default_value":"false","external_name":"trusted","restriction":"Bool"}],"args_string":"(string_or_io : String | IO, trusted : Bool = false)","args_html":"(string_or_io : String | IO, trusted : Bool = false)","def":{"name":"update_from_json!","args":[{"name":"string_or_io","external_name":"string_or_io","restriction":"String | IO"},{"name":"trusted","default_value":"false","external_name":"trusted","restriction":"Bool"}],"visibility":"Public","body":"(set_from_json(string_or_io, trusted)).save!"}},{"html_id":"update_h:Hash(String,Clear::SQL::Any)-instance-method","name":"update_h","doc":"Generate the hash for update request (like during save)","summary":"

Generate the hash for update request (like during save)

","abstract":false,"def":{"name":"update_h","return_type":"Hash(String, ::Clear::SQL::Any)","visibility":"Public","body":"o = super()\nif @table_catalog_column.defined? && @table_catalog_column.changed?\n o[\"table_catalog\"] = @table_catalog_column.to_sql_value\nend\nif @table_schema_column.defined? && @table_schema_column.changed?\n o[\"table_schema\"] = @table_schema_column.to_sql_value\nend\nif @table_name_column.defined? && @table_name_column.changed?\n o[\"table_name\"] = @table_name_column.to_sql_value\nend\nif @column_name_column.defined? && @column_name_column.changed?\n o[\"column_name\"] = @column_name_column.to_sql_value\nend\no\n"}},{"html_id":"validate_fields_presence-instance-method","name":"validate_fields_presence","doc":"For each column, ensure than when needed the column has present\ninformation into it.\n\nThis method is called on validation.","summary":"

For each column, ensure than when needed the column has present information into it.

","abstract":false,"def":{"name":"validate_fields_presence","visibility":"Public","body":"if persisted?\nelse\n if @table_catalog_column.failed_to_be_present?\n add_error(\"table_catalog\", \"must be present\")\n end\nend\nif persisted?\nelse\n if @table_schema_column.failed_to_be_present?\n add_error(\"table_schema\", \"must be present\")\n end\nend\nif persisted?\nelse\n if @table_name_column.failed_to_be_present?\n add_error(\"table_name\", \"must be present\")\n end\nend\nif persisted?\nelse\n if @column_name_column.failed_to_be_present?\n add_error(\"column_name\", \"must be present\")\n end\nend\n"}}],"types":[{"html_id":"clear/Clear/Reflection/Column/Collection","path":"Clear/Reflection/Column/Collection.html","kind":"class","full_name":"Clear::Reflection::Column::Collection","name":"Collection","abstract":false,"superclass":{"html_id":"clear/Clear/Model/CollectionBase","kind":"class","full_name":"Clear::Model::CollectionBase","name":"CollectionBase"},"ancestors":[{"html_id":"clear/Clear/Model/CollectionBase","kind":"class","full_name":"Clear::Model::CollectionBase","name":"CollectionBase"},{"html_id":"clear/Clear/SQL/SelectBuilder","kind":"module","full_name":"Clear::SQL::SelectBuilder","name":"SelectBuilder"},{"html_id":"clear/Clear/SQL/Query/WithPagination","kind":"module","full_name":"Clear::SQL::Query::WithPagination","name":"WithPagination"},{"html_id":"clear/Clear/SQL/Query/BeforeQuery","kind":"module","full_name":"Clear::SQL::Query::BeforeQuery","name":"BeforeQuery"},{"html_id":"clear/Clear/SQL/Query/Change","kind":"module","full_name":"Clear::SQL::Query::Change","name":"Change"},{"html_id":"clear/Clear/SQL/Query/Connection","kind":"module","full_name":"Clear::SQL::Query::Connection","name":"Connection"},{"html_id":"clear/Clear/SQL/Query/Pluck","kind":"module","full_name":"Clear::SQL::Query::Pluck","name":"Pluck"},{"html_id":"clear/Clear/SQL/Query/Fetch","kind":"module","full_name":"Clear::SQL::Query::Fetch","name":"Fetch"},{"html_id":"clear/Clear/SQL/Query/Execute","kind":"module","full_name":"Clear::SQL::Query::Execute","name":"Execute"},{"html_id":"clear/Clear/SQL/Query/Lock","kind":"module","full_name":"Clear::SQL::Query::Lock","name":"Lock"},{"html_id":"clear/Clear/SQL/Query/Window","kind":"module","full_name":"Clear::SQL::Query::Window","name":"Window"},{"html_id":"clear/Clear/SQL/Query/CTE","kind":"module","full_name":"Clear::SQL::Query::CTE","name":"CTE"},{"html_id":"clear/Clear/SQL/Query/Aggregate","kind":"module","full_name":"Clear::SQL::Query::Aggregate","name":"Aggregate"},{"html_id":"clear/Clear/SQL/Query/OffsetLimit","kind":"module","full_name":"Clear::SQL::Query::OffsetLimit","name":"OffsetLimit"},{"html_id":"clear/Clear/SQL/Query/GroupBy","kind":"module","full_name":"Clear::SQL::Query::GroupBy","name":"GroupBy"},{"html_id":"clear/Clear/SQL/Query/OrderBy","kind":"module","full_name":"Clear::SQL::Query::OrderBy","name":"OrderBy"},{"html_id":"clear/Clear/SQL/Query/Having","kind":"module","full_name":"Clear::SQL::Query::Having","name":"Having"},{"html_id":"clear/Clear/SQL/Query/Where","kind":"module","full_name":"Clear::SQL::Query::Where","name":"Where"},{"html_id":"clear/Clear/SQL/Query/Join","kind":"module","full_name":"Clear::SQL::Query::Join","name":"Join"},{"html_id":"clear/Clear/SQL/Query/From","kind":"module","full_name":"Clear::SQL::Query::From","name":"From"},{"html_id":"clear/Clear/SQL/Query/Select","kind":"module","full_name":"Clear::SQL::Query::Select","name":"Select"},{"html_id":"clear/Enumerable","kind":"module","full_name":"Enumerable","name":"Enumerable"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/model/reflection/column.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/column.cr#L4"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Reflection/Column","kind":"class","full_name":"Clear::Reflection::Column","name":"Column"},"doc":":doc:\nClear::Model::Collection\n\nThis is the object managing a `SELECT` request.\nA new collection is created by calling `Clear::Model.query`\n\nCollection are mutable and refining the SQL will mutate the collection.\nYou may want to copy the collection by calling `dup`\n\nSee `Clear::Model::CollectionBase`","summary":"

:doc: Clear::Model::Collection

","instance_methods":[{"html_id":"with_table(fetch_columns=false,&block:Clear::Reflection::Table::Collection->):self-instance-method","name":"with_table","abstract":false,"args":[{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"args_string":"(fetch_columns = false, &block : Clear::Reflection::Table::Collection -> ) : self","args_html":"(fetch_columns = false, &block : Clear::Reflection::Table::Collection -> ) : self","def":{"name":"with_table","args":[{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Clear::Reflection::Table::Collection ->)"},"return_type":"self","visibility":"Public","body":"before_query do\n sub_query = self.dup.clear_select.select(\"#{Clear::Reflection::Column.table}.table_name\")\n cached_qry = Clear::Reflection::Table.query.where do\n (raw(\"#{Clear::Reflection::Table.table}.#{Clear::Reflection::Table.__pkey__}\")).in?(sub_query)\n end\n block.call(cached_qry)\n @cache.active(\"table\")\n cached_qry.each(fetch_columns: fetch_columns) do |mdl|\n @cache.set(\"table\", mdl.__pkey__, [mdl])\n end\nend\nself\n"}},{"html_id":"with_table(fetch_columns=false):self-instance-method","name":"with_table","abstract":false,"args":[{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"args_string":"(fetch_columns = false) : self","args_html":"(fetch_columns = false) : self","def":{"name":"with_table","args":[{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"return_type":"self","visibility":"Public","body":"with_table(fetch_columns) do\nend\nself\n"}}]}]},{"html_id":"clear/Clear/Reflection/Table","path":"Clear/Reflection/Table.html","kind":"class","full_name":"Clear::Reflection::Table","name":"Table","abstract":false,"superclass":{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"clear/Clear/Model","kind":"module","full_name":"Clear::Model","name":"Model"},{"html_id":"clear/Clear/Model/FullTextSearchable","kind":"module","full_name":"Clear::Model::FullTextSearchable","name":"FullTextSearchable"},{"html_id":"clear/Clear/Model/JSONDeserialize","kind":"module","full_name":"Clear::Model::JSONDeserialize","name":"JSONDeserialize"},{"html_id":"clear/Clear/Model/Initializer","kind":"module","full_name":"Clear::Model::Initializer","name":"Initializer"},{"html_id":"clear/Clear/Model/HasFactory","kind":"module","full_name":"Clear::Model::HasFactory","name":"HasFactory"},{"html_id":"clear/Clear/Model/ClassMethods","kind":"module","full_name":"Clear::Model::ClassMethods","name":"ClassMethods"},{"html_id":"clear/Clear/Model/HasScope","kind":"module","full_name":"Clear::Model::HasScope","name":"HasScope"},{"html_id":"clear/Clear/Model/HasRelations","kind":"module","full_name":"Clear::Model::HasRelations","name":"HasRelations"},{"html_id":"clear/Clear/Model/HasValidation","kind":"module","full_name":"Clear::Model::HasValidation","name":"HasValidation"},{"html_id":"clear/Clear/Validation/Helper","kind":"module","full_name":"Clear::Validation::Helper","name":"Helper"},{"html_id":"clear/Clear/Model/HasSaving","kind":"module","full_name":"Clear::Model::HasSaving","name":"HasSaving"},{"html_id":"clear/Clear/Model/HasSerialPkey","kind":"module","full_name":"Clear::Model::HasSerialPkey","name":"HasSerialPkey"},{"html_id":"clear/Clear/Model/HasTimestamps","kind":"module","full_name":"Clear::Model::HasTimestamps","name":"HasTimestamps"},{"html_id":"clear/Clear/Model/HasColumns","kind":"module","full_name":"Clear::Model::HasColumns","name":"HasColumns"},{"html_id":"clear/Clear/Model/HasHooks","kind":"module","full_name":"Clear::Model::HasHooks","name":"HasHooks"},{"html_id":"clear/Clear/Model/Connection","kind":"module","full_name":"Clear::Model::Connection","name":"Connection"},{"html_id":"clear/Clear/ErrorMessages","kind":"module","full_name":"Clear::ErrorMessages","name":"ErrorMessages"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/model/reflection/table.cr","line_number":3,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/table.cr#L3"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"COLUMNS","name":"COLUMNS","value":"{\"table_catalog\" => {type: String, primary: false, converter: \"String\", db_column_name: \"table_catalog\", crystal_variable_name: table_catalog, presence: true, mass_assign: true}, \"table_schema\" => {type: String, primary: false, converter: \"String\", db_column_name: \"table_schema\", crystal_variable_name: table_schema, presence: true, mass_assign: true}, \"table_name\" => {type: String, primary: true, converter: \"String\", db_column_name: \"table_name\", crystal_variable_name: table_name, presence: true, mass_assign: true}, \"table_type\" => {type: String, primary: false, converter: \"String\", db_column_name: \"table_type\", crystal_variable_name: table_type, presence: true, mass_assign: true}} of Nil => Nil"},{"id":"POLYMORPHISM_SETTINGS","name":"POLYMORPHISM_SETTINGS","value":"{} of Nil => Nil"}],"included_modules":[{"html_id":"clear/Clear/Model","kind":"module","full_name":"Clear::Model","name":"Model"}],"extended_modules":[{"html_id":"clear/Clear/Model/HasHooks/ClassMethods","kind":"module","full_name":"Clear::Model::HasHooks::ClassMethods","name":"ClassMethods"}],"namespace":{"html_id":"clear/Clear/Reflection","kind":"module","full_name":"Clear::Reflection","name":"Reflection"},"doc":"Reflection of the tables using information_schema in postgreSQL.\nTODO: Usage of view instead of model","summary":"

Reflection of the tables using information_schema in postgreSQL.

","class_methods":[{"html_id":"build(**tuple:**T)forallT-class-method","name":"build","doc":"Build a new empty model and fill the columns using the NamedTuple in argument.\n\nReturns the new model","summary":"

Build a new empty model and fill the columns using the NamedTuple in argument.

","abstract":false,"location":{"filename":"src/clear/model/reflection/table.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/table.cr#L4"},"def":{"name":"build","double_splat":{"name":"tuple","external_name":"tuple","restriction":"**T"},"visibility":"Public","body":"{% if T.size > 0 %}\n self.new(tuple)\n {% else %}\n self.new\n {% end %}"}},{"html_id":"build(**tuple)-class-method","name":"build","doc":"Build a new empty model and fill the columns using the NamedTuple in argument.\n\nReturns the new model","summary":"

Build a new empty model and fill the columns using the NamedTuple in argument.

","abstract":false,"location":{"filename":"src/clear/model/reflection/table.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/table.cr#L4"},"def":{"name":"build","double_splat":{"name":"tuple","external_name":"tuple","restriction":""},"visibility":"Public","body":"build(**tuple) do\nend"}},{"html_id":"build(**tuple,&)-class-method","name":"build","doc":"Build a new empty model and fill the columns using the NamedTuple in argument.\n\nReturns the new model","summary":"

Build a new empty model and fill the columns using the NamedTuple in argument.

","abstract":false,"location":{"filename":"src/clear/model/reflection/table.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/table.cr#L4"},"def":{"name":"build","double_splat":{"name":"tuple","external_name":"tuple","restriction":""},"yields":1,"block_arity":1,"visibility":"Public","body":"r = build(**tuple)\nyield(r)\nr\n"}},{"html_id":"columns-class-method","name":"columns","abstract":false,"location":{"filename":"src/clear/model/reflection/table.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/table.cr#L4"},"def":{"name":"columns","visibility":"Public","body":"@@columns"}},{"html_id":"connection:String-class-method","name":"connection","doc":"Define on which connection the model is living. Useful in case of models living in different databases.\n\nIs set to \"default\" by default.\n\nSee `Clear::SQL#init(URI, *opts)` for more information about multi-connections.\n\nExample:\n\n```\nClear::SQL.init(\"postgres://postgres@localhost/database_1\")\nClear::SQL.init(\"secondary\", \"postgres://postgres@localhost/database_2\")\n\nclass ModelA\n include Clear::Model\n\n # Performs all the queries on `database_1`\n # self.connection = \"default\"\n column id : Int32, primary: true, presence: false\n column title : String\nend\n\nclass ModelB\n include Clear::Model\n\n # Performs all the queries on `database_2`\n self.connection = \"secondary\"\n\n column id : Int32, primary: true, presence: false\nend\n```","summary":"

Define on which connection the model is living.

","abstract":false,"def":{"name":"connection","return_type":"String","visibility":"Public","body":"@@connection"}},{"html_id":"connection=(connection:String)-class-method","name":"connection=","doc":"Define on which connection the model is living. Useful in case of models living in different databases.\n\nIs set to \"default\" by default.\n\nSee `Clear::SQL#init(URI, *opts)` for more information about multi-connections.\n\nExample:\n\n```\nClear::SQL.init(\"postgres://postgres@localhost/database_1\")\nClear::SQL.init(\"secondary\", \"postgres://postgres@localhost/database_2\")\n\nclass ModelA\n include Clear::Model\n\n # Performs all the queries on `database_1`\n # self.connection = \"default\"\n column id : Int32, primary: true, presence: false\n column title : String\nend\n\nclass ModelB\n include Clear::Model\n\n # Performs all the queries on `database_2`\n self.connection = \"secondary\"\n\n column id : Int32, primary: true, presence: false\nend\n```","summary":"

Define on which connection the model is living.

","abstract":false,"args":[{"name":"connection","external_name":"connection","restriction":"String"}],"args_string":"(connection : String)","args_html":"(connection : String)","def":{"name":"connection=","args":[{"name":"connection","external_name":"connection","restriction":"String"}],"visibility":"Public","body":"@@connection = connection"}},{"html_id":"create_from_json(string_or_io:String|IO,trusted:Bool=false)-class-method","name":"create_from_json","doc":"Create a new model from json and save it. Returns the model.\n\nThe model may not be saved due to validation failure;\ncheck the returned model `errors?` and `persisted?` flags.\nTrusted flag set to true will allow mass assignment without protection, FALSE by default","summary":"

Create a new model from json and save it.

","abstract":false,"args":[{"name":"string_or_io","external_name":"string_or_io","restriction":"String | IO"},{"name":"trusted","default_value":"false","external_name":"trusted","restriction":"Bool"}],"args_string":"(string_or_io : String | IO, trusted : Bool = false)","args_html":"(string_or_io : String | IO, trusted : Bool = false)","def":{"name":"create_from_json","args":[{"name":"string_or_io","external_name":"string_or_io","restriction":"String | IO"},{"name":"trusted","default_value":"false","external_name":"trusted","restriction":"Bool"}],"visibility":"Public","body":"mdl = self.from_json(string_or_io, trusted)\nmdl.save\nmdl\n"}},{"html_id":"create_from_json!(string_or_io:String|IO,trusted:Bool=false)-class-method","name":"create_from_json!","doc":"Create a new model from json and save it. Returns the model.\n\nReturns the newly inserted model\nRaises an exception if validation failed during the saving process.\nTrusted flag set to true will allow mass assignment without protection, FALSE by default","summary":"

Create a new model from json and save it.

","abstract":false,"args":[{"name":"string_or_io","external_name":"string_or_io","restriction":"String | IO"},{"name":"trusted","default_value":"false","external_name":"trusted","restriction":"Bool"}],"args_string":"(string_or_io : String | IO, trusted : Bool = false)","args_html":"(string_or_io : String | IO, trusted : Bool = false)","def":{"name":"create_from_json!","args":[{"name":"string_or_io","external_name":"string_or_io","restriction":"String | IO"},{"name":"trusted","default_value":"false","external_name":"trusted","restriction":"Bool"}],"visibility":"Public","body":"(self.from_json(string_or_io, trusted)).save!"}},{"html_id":"find(x)-class-method","name":"find","doc":"Returns a model using primary key equality\nReturns `nil` if not found.","summary":"

Returns a model using primary key equality Returns nil if not found.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x)","args_html":"(x)","location":{"filename":"src/clear/model/reflection/table.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/table.cr#L4"},"def":{"name":"find","args":[{"name":"x","external_name":"x","restriction":""}],"visibility":"Public","body":"query.where do\n (raw(__pkey__)) == x\nend.first"}},{"html_id":"find!(x)-class-method","name":"find!","doc":"Returns a model using primary key equality.\nRaises error if the model is not found.","summary":"

Returns a model using primary key equality.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x)","args_html":"(x)","location":{"filename":"src/clear/model/reflection/table.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/table.cr#L4"},"def":{"name":"find!","args":[{"name":"x","external_name":"x","restriction":""}],"visibility":"Public","body":"(find(x)) || (raise(Clear::SQL::RecordNotFoundError.new))"}},{"html_id":"from_json(string_or_io:String|IO,trusted:Bool=false)-class-method","name":"from_json","doc":"Create a new empty model and fill the columns from json. Returns the new model\n\nTrusted flag set to true will allow mass assignment without protection, FALSE by default","summary":"

Create a new empty model and fill the columns from json.

","abstract":false,"args":[{"name":"string_or_io","external_name":"string_or_io","restriction":"String | IO"},{"name":"trusted","default_value":"false","external_name":"trusted","restriction":"Bool"}],"args_string":"(string_or_io : String | IO, trusted : Bool = false)","args_html":"(string_or_io : String | IO, trusted : Bool = false)","def":{"name":"from_json","args":[{"name":"string_or_io","external_name":"string_or_io","restriction":"String | IO"},{"name":"trusted","default_value":"false","external_name":"trusted","restriction":"Bool"}],"visibility":"Public","body":"(Assigner.from_json(string_or_io)).create(trusted)"}},{"html_id":"full_table_name-class-method","name":"full_table_name","doc":"returns the fully qualified and escaped name for this table.\nadd schema if schema is different from 'public' (default schema)\n\nex: \"schema\".\"table\"","summary":"

returns the fully qualified and escaped name for this table.

","abstract":false,"location":{"filename":"src/clear/model/reflection/table.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/table.cr#L4"},"def":{"name":"full_table_name","visibility":"Public","body":"if s = schema\n {schema, table}.map do |x|\n Clear::SQL.escape(x.to_s)\n end.join(\".\")\nelse\n Clear::SQL.escape(table)\nend"}},{"html_id":"import(array:Enumerable(self),on_conflict:Clear::SQL::InsertQuery->|Nil=nil)-class-method","name":"import","doc":"Import a bulk of models in one SQL insert query.\nEach model must be non-persisted.\n\n`on_conflict` callback can be optionnaly turned on\nto manage constraints of the database.\n\nNote: Old models are not modified. This method return a copy of the\nmodels as saved in the database.\n\n## Example:\n\n```\nusers = [User.new(id: 1), User.new(id: 2), User.new(id: 3)]\nusers = User.import(users)\n```","summary":"

Import a bulk of models in one SQL insert query.

","abstract":false,"args":[{"name":"array","external_name":"array","restriction":"Enumerable(self)"},{"name":"on_conflict","default_value":"nil","external_name":"on_conflict","restriction":"(Clear::SQL::InsertQuery ->) | ::Nil"}],"args_string":"(array : Enumerable(self), on_conflict : Clear::SQL::InsertQuery -> | Nil = nil)","args_html":"(array : Enumerable(self), on_conflict : Clear::SQL::InsertQuery -> | Nil = nil)","location":{"filename":"src/clear/model/reflection/table.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/table.cr#L4"},"def":{"name":"import","args":[{"name":"array","external_name":"array","restriction":"Enumerable(self)"},{"name":"on_conflict","default_value":"nil","external_name":"on_conflict","restriction":"(Clear::SQL::InsertQuery ->) | ::Nil"}],"visibility":"Public","body":"array.each do |item|\n if item.persisted?\n raise(\"One of your model is persisted while calling import\")\n end\nend\nhashes = array.map do |item|\n item.trigger_before_events(:save)\n if item.valid?\n else\n raise(\"import: Validation failed for `#{item}`\")\n end\n item.trigger_before_events(:create)\n item.to_h\nend\nquery = (Clear::SQL.insert_into(self.table, hashes)).returning(\"*\")\nif on_conflict\n on_conflict.call(query)\nend\no = [] of self\nquery.fetch(@@connection) do |hash|\n o << ((Clear::Model::Factory.build(self.name, hash, persisted: true, fetch_columns: false, cache: nil)).as(self))\nend\no.each(&.trigger_after_events(:create))\no.each(&.trigger_after_events(:save))\no\n"}},{"html_id":"polymorphic?:Bool-class-method","name":"polymorphic?","abstract":false,"def":{"name":"polymorphic?","return_type":"Bool","visibility":"Public","body":"@@polymorphic"}},{"html_id":"public-class-method","name":"public","abstract":false,"location":{"filename":"src/clear/model/reflection/table.cr","line_number":16,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/table.cr#L16"},"def":{"name":"public","visibility":"Public","body":"query.public()"}},{"html_id":"query-class-method","name":"query","doc":"Return a new empty query `SELECT * FROM [my_model_table]`. Can be refined after that.","summary":"

Return a new empty query SELECT * FROM [my_model_table].

","abstract":false,"location":{"filename":"src/clear/model/reflection/table.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/table.cr#L4"},"def":{"name":"query","visibility":"Public","body":"(Collection.new.use_connection(connection)).from(self.full_table_name)"}},{"html_id":"read_only=(read_only:Bool)-class-method","name":"read_only=","abstract":false,"args":[{"name":"read_only","external_name":"read_only","restriction":"Bool"}],"args_string":"(read_only : Bool)","args_html":"(read_only : Bool)","def":{"name":"read_only=","args":[{"name":"read_only","external_name":"read_only","restriction":"Bool"}],"visibility":"Public","body":"@@read_only = read_only"}},{"html_id":"read_only?:Bool-class-method","name":"read_only?","abstract":false,"def":{"name":"read_only?","return_type":"Bool","visibility":"Public","body":"@@read_only"}},{"html_id":"schema:Clear::SQL::Symbolic|Nil-class-method","name":"schema","doc":"Define the current schema used in PostgreSQL. The value is `nil` by default, which lead to non-specified\n schema during the querying, and usage of \"public\" by PostgreSQL.\n\nThis property can be redefined on initialization. Example:\n\n```\nclass MyModel\n include Clear::Model\n\n self.schema = \"my_schema\"\nend\nMyModel.query.to_sql # SELECT * FROM \"my_schema\".\"my_models\"\n```","summary":"

Define the current schema used in PostgreSQL.

","abstract":false,"def":{"name":"schema","return_type":"Clear::SQL::Symbolic | ::Nil","visibility":"Public","body":"@@schema"}},{"html_id":"schema=(schema:Clear::SQL::Symbolic|Nil)-class-method","name":"schema=","doc":"Define the current schema used in PostgreSQL. The value is `nil` by default, which lead to non-specified\n schema during the querying, and usage of \"public\" by PostgreSQL.\n\nThis property can be redefined on initialization. Example:\n\n```\nclass MyModel\n include Clear::Model\n\n self.schema = \"my_schema\"\nend\nMyModel.query.to_sql # SELECT * FROM \"my_schema\".\"my_models\"\n```","summary":"

Define the current schema used in PostgreSQL.

","abstract":false,"args":[{"name":"schema","external_name":"schema","restriction":"Clear::SQL::Symbolic | ::Nil"}],"args_string":"(schema : Clear::SQL::Symbolic | Nil)","args_html":"(schema : Clear::SQL::Symbolic | Nil)","def":{"name":"schema=","args":[{"name":"schema","external_name":"schema","restriction":"Clear::SQL::Symbolic | ::Nil"}],"visibility":"Public","body":"@@schema = schema"}},{"html_id":"table:Clear::SQL::Symbolic-class-method","name":"table","doc":"Return the table name setup for this model.\nBy convention, the class name is by default equals to the pluralized underscored string form of the model name.\nExample:\n\n```\nMyModel => \"my_models\"\nPerson => \"people\"\nProject::Info => \"project_infos\"\n```\n\nThe property can be updated at initialization to a custom table name:\n\n```\nclass MyModel\n include Clear::Model\n\n self.table = \"another_table_name\"\nend\nMyModel.query.to_sql # SELECT * FROM \"another_table_name\"\n```","summary":"

Return the table name setup for this model.

","abstract":false,"def":{"name":"table","return_type":"Clear::SQL::Symbolic","visibility":"Public","body":"@@table"}},{"html_id":"table=(table:Clear::SQL::Symbolic)-class-method","name":"table=","doc":"Return the table name setup for this model.\nBy convention, the class name is by default equals to the pluralized underscored string form of the model name.\nExample:\n\n```\nMyModel => \"my_models\"\nPerson => \"people\"\nProject::Info => \"project_infos\"\n```\n\nThe property can be updated at initialization to a custom table name:\n\n```\nclass MyModel\n include Clear::Model\n\n self.table = \"another_table_name\"\nend\nMyModel.query.to_sql # SELECT * FROM \"another_table_name\"\n```","summary":"

Return the table name setup for this model.

","abstract":false,"args":[{"name":"table","external_name":"table","restriction":"Clear::SQL::Symbolic"}],"args_string":"(table : Clear::SQL::Symbolic)","args_html":"(table : Clear::SQL::Symbolic)","def":{"name":"table=","args":[{"name":"table","external_name":"table","restriction":"Clear::SQL::Symbolic"}],"visibility":"Public","body":"@@table = table"}},{"html_id":"tables_only-class-method","name":"tables_only","abstract":false,"location":{"filename":"src/clear/model/reflection/table.cr","line_number":18,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/table.cr#L18"},"def":{"name":"tables_only","visibility":"Public","body":"query.tables_only()"}},{"html_id":"views_only-class-method","name":"views_only","abstract":false,"location":{"filename":"src/clear/model/reflection/table.cr","line_number":19,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/table.cr#L19"},"def":{"name":"views_only","visibility":"Public","body":"query.views_only()"}}],"constructors":[{"html_id":"build(x:NamedTuple):self-class-method","name":"build","doc":"Build a new empty model and fill the columns using the NamedTuple in argument.\n\nReturns the new model","summary":"

Build a new empty model and fill the columns using the NamedTuple in argument.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"args_string":"(x : NamedTuple) : self","args_html":"(x : NamedTuple) : self","location":{"filename":"src/clear/model/reflection/table.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/table.cr#L4"},"def":{"name":"build","args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"return_type":"self","visibility":"Public","body":"build(**x) do\nend"}},{"html_id":"build(x:NamedTuple,&block:self->Nil):self-class-method","name":"build","doc":"Build a new empty model and fill the columns using the NamedTuple in argument.\n\nReturns the new model","summary":"

Build a new empty model and fill the columns using the NamedTuple in argument.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"args_string":"(x : NamedTuple, &block : self -> Nil) : self","args_html":"(x : NamedTuple, &block : self -> Nil) : self","location":{"filename":"src/clear/model/reflection/table.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/table.cr#L4"},"def":{"name":"build","args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(self -> Nil)"},"return_type":"self","visibility":"Public","body":"build(**x, &block)"}},{"html_id":"create(x:NamedTuple,&block:self->Nil):self-class-method","name":"create","doc":"Build and new model and save it. Returns the model.\n\nThe model may not be saved due to validation failure;\ncheck the returned model `errors?` and `persisted?` flags.","summary":"

Build and new model and save it.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"args_string":"(x : NamedTuple, &block : self -> Nil) : self","args_html":"(x : NamedTuple, &block : self -> Nil) : self","location":{"filename":"src/clear/model/reflection/table.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/table.cr#L4"},"def":{"name":"create","args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(self -> Nil)"},"return_type":"self","visibility":"Public","body":"create(**x, &block)"}},{"html_id":"create(**tuple,&block:self->Nil):self-class-method","name":"create","doc":"Build and new model and save it. Returns the model.\n\nThe model may not be saved due to validation failure;\ncheck the returned model `errors?` and `persisted?` flags.","summary":"

Build and new model and save it.

","abstract":false,"location":{"filename":"src/clear/model/reflection/table.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/table.cr#L4"},"def":{"name":"create","double_splat":{"name":"tuple","external_name":"tuple","restriction":""},"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(self -> Nil)"},"return_type":"self","visibility":"Public","body":"r = build(**tuple) do |mdl|\n yield(mdl)\nend\nr.save\nr\n"}},{"html_id":"create(x:NamedTuple):self-class-method","name":"create","doc":"Build and new model and save it. Returns the model.\n\nThe model may not be saved due to validation failure;\ncheck the returned model `errors?` and `persisted?` flags.","summary":"

Build and new model and save it.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"args_string":"(x : NamedTuple) : self","args_html":"(x : NamedTuple) : self","location":{"filename":"src/clear/model/reflection/table.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/table.cr#L4"},"def":{"name":"create","args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"return_type":"self","visibility":"Public","body":"create(**x) do\nend"}},{"html_id":"create(**tuple):self-class-method","name":"create","doc":"Build and new model and save it. Returns the model.\n\nThe model may not be saved due to validation failure;\ncheck the returned model `errors?` and `persisted?` flags.","summary":"

Build and new model and save it.

","abstract":false,"location":{"filename":"src/clear/model/reflection/table.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/table.cr#L4"},"def":{"name":"create","double_splat":{"name":"tuple","external_name":"tuple","restriction":""},"return_type":"self","visibility":"Public","body":"create(**tuple) do\nend"}},{"html_id":"create!(x:NamedTuple,&block:self->Nil):self-class-method","name":"create!","doc":"Build and new model and save it. Returns the model.\n\nReturns the newly inserted model\nRaises an exception if validation failed during the saving process.","summary":"

Build and new model and save it.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"args_string":"(x : NamedTuple, &block : self -> Nil) : self","args_html":"(x : NamedTuple, &block : self -> Nil) : self","location":{"filename":"src/clear/model/reflection/table.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/table.cr#L4"},"def":{"name":"create!","args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(self -> Nil)"},"return_type":"self","visibility":"Public","body":"create!(**x, &block)"}},{"html_id":"create!(**tuple,&block:self->Nil):self-class-method","name":"create!","doc":"Build and new model and save it. Returns the model.\n\nReturns the newly inserted model\nRaises an exception if validation failed during the saving process.","summary":"

Build and new model and save it.

","abstract":false,"location":{"filename":"src/clear/model/reflection/table.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/table.cr#L4"},"def":{"name":"create!","double_splat":{"name":"tuple","external_name":"tuple","restriction":""},"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(self -> Nil)"},"return_type":"self","visibility":"Public","body":"r = build(**tuple) do |mdl|\n yield(mdl)\nend\nr.save!\nr\n"}},{"html_id":"create!(x:NamedTuple):self-class-method","name":"create!","doc":"Build and new model and save it. Returns the model.\n\nReturns the newly inserted model\nRaises an exception if validation failed during the saving process.","summary":"

Build and new model and save it.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"args_string":"(x : NamedTuple) : self","args_html":"(x : NamedTuple) : self","location":{"filename":"src/clear/model/reflection/table.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/table.cr#L4"},"def":{"name":"create!","args":[{"name":"x","external_name":"x","restriction":"NamedTuple"}],"return_type":"self","visibility":"Public","body":"create!(**x) do\nend"}},{"html_id":"create!(**tuple):self-class-method","name":"create!","doc":"Build and new model and save it. Returns the model.\n\nReturns the newly inserted model\nRaises an exception if validation failed during the saving process.","summary":"

Build and new model and save it.

","abstract":false,"location":{"filename":"src/clear/model/reflection/table.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/table.cr#L4"},"def":{"name":"create!","double_splat":{"name":"tuple","external_name":"tuple","restriction":""},"return_type":"self","visibility":"Public","body":"create!(**tuple) do\nend"}},{"html_id":"new(h:Hash(String,_),cache:Clear::Model::QueryCache|Nil=nil,persisted=false,fetch_columns=false)-class-method","name":"new","abstract":false,"args":[{"name":"h","external_name":"h","restriction":"Hash(String, _)"},{"name":"cache","default_value":"nil","external_name":"cache","restriction":"Clear::Model::QueryCache | ::Nil"},{"name":"persisted","default_value":"false","external_name":"persisted","restriction":""},{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"args_string":"(h : Hash(String, _), cache : Clear::Model::QueryCache | Nil = nil, persisted = false, fetch_columns = false)","args_html":"(h : Hash(String, _), cache : Clear::Model::QueryCache | Nil = nil, persisted = false, fetch_columns = false)","location":{"filename":"src/clear/model/reflection/table.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/table.cr#L4"},"def":{"name":"new","args":[{"name":"h","external_name":"h","restriction":"Hash(String, _)"},{"name":"cache","default_value":"nil","external_name":"cache","restriction":"Clear::Model::QueryCache | ::Nil"},{"name":"persisted","default_value":"false","external_name":"persisted","restriction":""},{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"visibility":"Public","body":"_ = allocate\n_.initialize(h, cache, persisted, fetch_columns)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new(json:JSON::Any,cache:Clear::Model::QueryCache|Nil=nil,persisted=false)-class-method","name":"new","abstract":false,"args":[{"name":"json","external_name":"json","restriction":"::JSON::Any"},{"name":"cache","default_value":"nil","external_name":"cache","restriction":"Clear::Model::QueryCache | ::Nil"},{"name":"persisted","default_value":"false","external_name":"persisted","restriction":""}],"args_string":"(json : JSON::Any, cache : Clear::Model::QueryCache | Nil = nil, persisted = false)","args_html":"(json : JSON::Any, cache : Clear::Model::QueryCache | Nil = nil, persisted = false)","location":{"filename":"src/clear/model/reflection/table.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/table.cr#L4"},"def":{"name":"new","args":[{"name":"json","external_name":"json","restriction":"::JSON::Any"},{"name":"cache","default_value":"nil","external_name":"cache","restriction":"Clear::Model::QueryCache | ::Nil"},{"name":"persisted","default_value":"false","external_name":"persisted","restriction":""}],"visibility":"Public","body":"_ = allocate\n_.initialize(json, cache, persisted)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new(t:NamedTuple,persisted=false)-class-method","name":"new","abstract":false,"args":[{"name":"t","external_name":"t","restriction":"NamedTuple"},{"name":"persisted","default_value":"false","external_name":"persisted","restriction":""}],"args_string":"(t : NamedTuple, persisted = false)","args_html":"(t : NamedTuple, persisted = false)","location":{"filename":"src/clear/model/reflection/table.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/table.cr#L4"},"def":{"name":"new","args":[{"name":"t","external_name":"t","restriction":"NamedTuple"},{"name":"persisted","default_value":"false","external_name":"persisted","restriction":""}],"visibility":"Public","body":"_ = allocate\n_.initialize(t, persisted)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new-class-method","name":"new","abstract":false,"location":{"filename":"src/clear/model/reflection/table.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/table.cr#L4"},"def":{"name":"new","visibility":"Public","body":"_ = allocate\n_.initialize\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"attributes:Hash(String,Clear::SQL::Any)-instance-method","name":"attributes","doc":"Attributes, used when fetch_columns is true","summary":"

Attributes, used when fetch_columns is true

","abstract":false,"def":{"name":"attributes","return_type":"Hash(String, ::Clear::SQL::Any)","visibility":"Public","body":"@attributes"}},{"html_id":"cache:Clear::Model::QueryCache|Nil-instance-method","name":"cache","abstract":false,"def":{"name":"cache","return_type":"Clear::Model::QueryCache | ::Nil","visibility":"Public","body":"@cache"}},{"html_id":"changed?-instance-method","name":"changed?","doc":"Return `true` if the model is dirty (e.g. one or more fields\n have been changed.). Return `false` otherwise.","summary":"

Return true if the model is dirty (e.g.

","abstract":false,"def":{"name":"changed?","visibility":"Public","body":"if @table_catalog_column.changed?\n return true\nend\nif @table_schema_column.changed?\n return true\nend\nif @table_name_column.changed?\n return true\nend\nif @table_type_column.changed?\n return true\nend\nreturn false\n"}},{"html_id":"clear_change_flags-instance-method","name":"clear_change_flags","doc":"Reset the `changed?` flag on all columns\n\nThe model behave like its not dirty anymore\nand call to save would apply no changes.\n\nReturns `self`","summary":"

Reset the #changed? flag on all columns

","abstract":false,"def":{"name":"clear_change_flags","visibility":"Public","body":"@table_catalog_column.clear_change_flag\n@table_schema_column.clear_change_flag\n@table_name_column.clear_change_flag\n@table_type_column.clear_change_flag\nself\n"}},{"html_id":"columns:Clear::Reflection::Column::Collection-instance-method","name":"columns","doc":"The method columns is a `has_many` relation to Clear::Reflection::Column","summary":"

The method columns is a has_many relation to Clear::Reflection::Column

","abstract":false,"def":{"name":"columns","return_type":"Clear::Reflection::Column::Collection","visibility":"Public","body":"__temp_99 = table_name\n__temp_100 = \"table_name\"\ncache = @cache\nquery = if cache && (cache.active?(\"columns\"))\n arr = cache.hit(\"columns\", self.__pkey_column__.to_sql_value, Clear::Reflection::Column)\n (Clear::Reflection::Column.query.tags({\"#{__temp_100}\" => \"#{__temp_99}\"})).where do\n (raw(__temp_100)) == __temp_99\n end.with_cached_result(arr)\nelse\n (Clear::Reflection::Column.query.tags({\"#{__temp_100}\" => \"#{__temp_99}\"})).where do\n (raw(__temp_100)) == __temp_99\n end\nend\nquery.append_operation = ->(x : Clear::Reflection::Column) do\n x.reset(query.tags)\n x.save!\n x\nend\nquery\n"}},{"html_id":"indexes:Hash(String,Array(String))-instance-method","name":"indexes","doc":"List all the indexes related to the current table.\nreturn an hash where the key is the name of the column\nand the value is an array containing all the indexes related to this specific\nfield.","summary":"

List all the indexes related to the current table.

","abstract":false,"location":{"filename":"src/clear/model/reflection/table.cr","line_number":27,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/table.cr#L27"},"def":{"name":"indexes","return_type":"Hash(String, Array(String))","visibility":"Public","body":"o = {} of String => Array(String)\n((((SQL.select({index_name: \"i.relname\", column_name: \"a.attname\"})).from({t: \"pg_class\", i: \"pg_class\", ix: \"pg_index\", a: \"pg_attribute\"})).where do\n (((((t.oid == ix.indrelid) & (i.oid == ix.indexrelid)) & (a.attrelid == t.oid)) & (a.attnum == (raw(\"ANY(ix.indkey)\")))) & (t.relkind == \"r\")) & (t.relname == self.table_name)\nend.order_by(\"t.relname\")).order_by(\"i.relname\")).fetch do |h|\n col = h[\"column_name\"].to_s\n v = h[\"index_name\"].to_s\n arr = o[col]? ? o[col] : (o[col] = [] of String)\n arr << v\nend\no\n"}},{"html_id":"invalidate_caching:self-instance-method","name":"invalidate_caching","doc":"Force to clean-up the caches for the relations\nconnected to this model.","summary":"

Force to clean-up the caches for the relations connected to this model.

","abstract":false,"location":{"filename":"src/clear/model/reflection/table.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/table.cr#L4"},"def":{"name":"invalidate_caching","return_type":"self","visibility":"Public","body":"@cache = nil\nself\n"}},{"html_id":"reset(h:Hash(Symbol,_))-instance-method","name":"reset","doc":"Set the columns from hash","summary":"

Set the columns from hash

","abstract":false,"args":[{"name":"h","external_name":"h","restriction":"Hash(Symbol, _)"}],"args_string":"(h : Hash(Symbol, _))","args_html":"(h : Hash(Symbol, _))","def":{"name":"reset","args":[{"name":"h","external_name":"h","restriction":"Hash(Symbol, _)"}],"visibility":"Public","body":"super(h)\n{% for name, settings in COLUMNS %}\n v = h.fetch(:\\{{settings[:db_column_name]}}) { Clear::Model::Column::UNKNOWN }\n @{{ settings[:crystal_variable_name] }}_column.reset_convert(v) unless v.is_a?(Clear::Model::Column::UnknownClass)\n {% end %}\nself\n"}},{"html_id":"reset(h:Hash(String,_))-instance-method","name":"reset","doc":"Set the model fields from hash","summary":"

Set the model fields from hash

","abstract":false,"args":[{"name":"h","external_name":"h","restriction":"Hash(String, _)"}],"args_string":"(h : Hash(String, _))","args_html":"(h : Hash(String, _))","def":{"name":"reset","args":[{"name":"h","external_name":"h","restriction":"Hash(String, _)"}],"visibility":"Public","body":"super(h)\n{% for name, settings in COLUMNS %}\n v = h.fetch({{ settings[:db_column_name] }}) { Clear::Model::Column::UNKNOWN }\n @{{ settings[:crystal_variable_name] }}_column.reset_convert(v) unless v.is_a?(Clear::Model::Column::UnknownClass)\n {% end %}\nself\n"}},{"html_id":"reset(t:NamedTuple)-instance-method","name":"reset","abstract":false,"args":[{"name":"t","external_name":"t","restriction":"NamedTuple"}],"args_string":"(t : NamedTuple)","args_html":"(t : NamedTuple)","def":{"name":"reset","args":[{"name":"t","external_name":"t","restriction":"NamedTuple"}],"visibility":"Public","body":"reset(**t)"}},{"html_id":"reset(from_json:JSON::Any)-instance-method","name":"reset","abstract":false,"args":[{"name":"from_json","external_name":"from_json","restriction":"JSON::Any"}],"args_string":"(from_json : JSON::Any)","args_html":"(from_json : JSON::Any)","def":{"name":"reset","args":[{"name":"from_json","external_name":"from_json","restriction":"JSON::Any"}],"visibility":"Public","body":"reset(from_json.as_h)"}},{"html_id":"reset(**t:**T)forallT-instance-method","name":"reset","doc":"reset flavors","summary":"

reset flavors

","abstract":false,"def":{"name":"reset","double_splat":{"name":"t","external_name":"t","restriction":"**T"},"visibility":"Public","body":"super(**t)\n{% for name, typ in T %}\n\n {% if settings = COLUMNS[\"#{name}\"] %}\n @{{ settings[:crystal_variable_name] }}_column.reset_convert(t[:{{ name }}])\n {% else %}\n {% if !(@type.has_method?(\"#{name}=\")) %}\n {% raise(\"Cannot find the column `#{name}` of the model `#{@type}`\") %}\n {% end %}\n self.{{ name }} = t[:{{ name }}]\n {% end %}\n {% end %}\nself\n"}},{"html_id":"set(h:Hash(Symbol,_))-instance-method","name":"set","doc":"Set the columns from hash","summary":"

Set the columns from hash

","abstract":false,"args":[{"name":"h","external_name":"h","restriction":"Hash(Symbol, _)"}],"args_string":"(h : Hash(Symbol, _))","args_html":"(h : Hash(Symbol, _))","def":{"name":"set","args":[{"name":"h","external_name":"h","restriction":"Hash(Symbol, _)"}],"visibility":"Public","body":"super(h)\n{% for name, settings in COLUMNS %}\n v = h.fetch(:{{ settings[:db_column_name] }}) { Clear::Model::Column::UNKNOWN }\n @{{ settings[:crystal_variable_name] }}_column.set_convert(v) unless v.is_a?(Clear::Model::Column::UnknownClass)\n {% end %}\nself\n"}},{"html_id":"set(h:Hash(String,_))-instance-method","name":"set","doc":"Set the model fields from hash","summary":"

Set the model fields from hash

","abstract":false,"args":[{"name":"h","external_name":"h","restriction":"Hash(String, _)"}],"args_string":"(h : Hash(String, _))","args_html":"(h : Hash(String, _))","def":{"name":"set","args":[{"name":"h","external_name":"h","restriction":"Hash(String, _)"}],"visibility":"Public","body":"super(h)\n{% for name, settings in COLUMNS %}\n v = h.fetch({{ settings[:db_column_name] }}) { Clear::Model::Column::UNKNOWN }\n @{{ settings[:crystal_variable_name] }}_column.set_convert(v) unless v.is_a?(Clear::Model::Column::UnknownClass)\n {% end %}\nself\n"}},{"html_id":"set(t:NamedTuple)-instance-method","name":"set","abstract":false,"args":[{"name":"t","external_name":"t","restriction":"NamedTuple"}],"args_string":"(t : NamedTuple)","args_html":"(t : NamedTuple)","def":{"name":"set","args":[{"name":"t","external_name":"t","restriction":"NamedTuple"}],"visibility":"Public","body":"set(**t)"}},{"html_id":"set(from_json:JSON::Any)-instance-method","name":"set","abstract":false,"args":[{"name":"from_json","external_name":"from_json","restriction":"JSON::Any"}],"args_string":"(from_json : JSON::Any)","args_html":"(from_json : JSON::Any)","def":{"name":"set","args":[{"name":"from_json","external_name":"from_json","restriction":"JSON::Any"}],"visibility":"Public","body":"set(from_json.as_h)"}},{"html_id":"set(**t:**T)forallT-instance-method","name":"set","doc":"Set one or multiple columns to a specific value\nThis two are equivalents:\n\n```\nmodel.set(a: 1)\nmodel.a = 1\n```","summary":"

Set one or multiple columns to a specific value This two are equivalents:

","abstract":false,"def":{"name":"set","double_splat":{"name":"t","external_name":"t","restriction":"**T"},"visibility":"Public","body":"super(**t)\n{% for name, typ in T %}\n {% if settings = COLUMNS[\"#{name}\".id] %}\n @{{ settings[:crystal_variable_name] }}_column.set_convert(t[:{{ name }}])\n {% else %}\n {% if !(@type.has_method?(\"#{name}=\")) %}\n {% raise(\"No method #{@type}##{name}= while trying to set value of #{name}\") %}\n {% end %}\n self.{{ name }} = t[:{{ name }}]\n {% end %}\n {% end %}\nself\n"}},{"html_id":"set_from_json(string_or_io:String|IO,trusted:Bool=false)-instance-method","name":"set_from_json","doc":"Set the fields from json passed as argument\nTrusted flag set to true will allow mass assignment without protection, FALSE by default","summary":"

Set the fields from json passed as argument Trusted flag set to true will allow mass assignment without protection, FALSE by default

","abstract":false,"args":[{"name":"string_or_io","external_name":"string_or_io","restriction":"String | IO"},{"name":"trusted","default_value":"false","external_name":"trusted","restriction":"Bool"}],"args_string":"(string_or_io : String | IO, trusted : Bool = false)","args_html":"(string_or_io : String | IO, trusted : Bool = false)","def":{"name":"set_from_json","args":[{"name":"string_or_io","external_name":"string_or_io","restriction":"String | IO"},{"name":"trusted","default_value":"false","external_name":"trusted","restriction":"Bool"}],"visibility":"Public","body":"(Assigner.from_json(string_or_io)).update(self, trusted)"}},{"html_id":"table_catalog:String-instance-method","name":"table_catalog","doc":"Returns the value of `table_catalog` column or throw an exception if the column is not defined.","summary":"

Returns the value of #table_catalog column or throw an exception if the column is not defined.

","abstract":false,"def":{"name":"table_catalog","return_type":"String","visibility":"Public","body":"@table_catalog_column.value"}},{"html_id":"table_catalog=(x:String)-instance-method","name":"table_catalog=","doc":"Setter for `table_catalog` column.","summary":"

Setter for #table_catalog column.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"String"}],"args_string":"(x : String)","args_html":"(x : String)","def":{"name":"table_catalog=","args":[{"name":"x","external_name":"x","restriction":"String"}],"visibility":"Public","body":"@table_catalog_column.value = x"}},{"html_id":"table_catalog_column:Clear::Model::Column(String,Clear::Model::Converter::StringConverter)-instance-method","name":"table_catalog_column","doc":"Returns the column object used to manage `table_catalog` field\n\nSee `Clear::Model::Column`","summary":"

Returns the column object used to manage #table_catalog field

","abstract":false,"def":{"name":"table_catalog_column","return_type":"Clear::Model::Column(String, Clear::Model::Converter::StringConverter)","visibility":"Public","body":"@table_catalog_column"}},{"html_id":"table_name:String-instance-method","name":"table_name","doc":"Returns the value of `table_name` column or throw an exception if the column is not defined.","summary":"

Returns the value of #table_name column or throw an exception if the column is not defined.

","abstract":false,"def":{"name":"table_name","return_type":"String","visibility":"Public","body":"@table_name_column.value"}},{"html_id":"table_name=(x:String)-instance-method","name":"table_name=","doc":"Setter for `table_name` column.","summary":"

Setter for #table_name column.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"String"}],"args_string":"(x : String)","args_html":"(x : String)","def":{"name":"table_name=","args":[{"name":"x","external_name":"x","restriction":"String"}],"visibility":"Public","body":"@table_name_column.value = x"}},{"html_id":"table_name_column:Clear::Model::Column(String,Clear::Model::Converter::StringConverter)-instance-method","name":"table_name_column","doc":"Returns the column object used to manage `table_name` field\n\nSee `Clear::Model::Column`","summary":"

Returns the column object used to manage #table_name field

","abstract":false,"def":{"name":"table_name_column","return_type":"Clear::Model::Column(String, Clear::Model::Converter::StringConverter)","visibility":"Public","body":"@table_name_column"}},{"html_id":"table_schema:String-instance-method","name":"table_schema","doc":"Returns the value of `table_schema` column or throw an exception if the column is not defined.","summary":"

Returns the value of #table_schema column or throw an exception if the column is not defined.

","abstract":false,"def":{"name":"table_schema","return_type":"String","visibility":"Public","body":"@table_schema_column.value"}},{"html_id":"table_schema=(x:String)-instance-method","name":"table_schema=","doc":"Setter for `table_schema` column.","summary":"

Setter for #table_schema column.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"String"}],"args_string":"(x : String)","args_html":"(x : String)","def":{"name":"table_schema=","args":[{"name":"x","external_name":"x","restriction":"String"}],"visibility":"Public","body":"@table_schema_column.value = x"}},{"html_id":"table_schema_column:Clear::Model::Column(String,Clear::Model::Converter::StringConverter)-instance-method","name":"table_schema_column","doc":"Returns the column object used to manage `table_schema` field\n\nSee `Clear::Model::Column`","summary":"

Returns the column object used to manage #table_schema field

","abstract":false,"def":{"name":"table_schema_column","return_type":"Clear::Model::Column(String, Clear::Model::Converter::StringConverter)","visibility":"Public","body":"@table_schema_column"}},{"html_id":"table_type:String-instance-method","name":"table_type","doc":"Returns the value of `table_type` column or throw an exception if the column is not defined.","summary":"

Returns the value of #table_type column or throw an exception if the column is not defined.

","abstract":false,"def":{"name":"table_type","return_type":"String","visibility":"Public","body":"@table_type_column.value"}},{"html_id":"table_type=(x:String)-instance-method","name":"table_type=","doc":"Setter for `table_type` column.","summary":"

Setter for #table_type column.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"String"}],"args_string":"(x : String)","args_html":"(x : String)","def":{"name":"table_type=","args":[{"name":"x","external_name":"x","restriction":"String"}],"visibility":"Public","body":"@table_type_column.value = x"}},{"html_id":"table_type_column:Clear::Model::Column(String,Clear::Model::Converter::StringConverter)-instance-method","name":"table_type_column","doc":"Returns the column object used to manage `table_type` field\n\nSee `Clear::Model::Column`","summary":"

Returns the column object used to manage #table_type field

","abstract":false,"def":{"name":"table_type_column","return_type":"Clear::Model::Column(String, Clear::Model::Converter::StringConverter)","visibility":"Public","body":"@table_type_column"}},{"html_id":"to_h(full=false):Hash(String,Clear::SQL::Any)-instance-method","name":"to_h","doc":"Return a hash version of the columns of this model.","summary":"

Return a hash version of the columns of this model.

","abstract":false,"args":[{"name":"full","default_value":"false","external_name":"full","restriction":""}],"args_string":"(full = false) : Hash(String, Clear::SQL::Any)","args_html":"(full = false) : Hash(String, Clear::SQL::Any)","def":{"name":"to_h","args":[{"name":"full","default_value":"false","external_name":"full","restriction":""}],"return_type":"Hash(String, ::Clear::SQL::Any)","visibility":"Public","body":"out = super(full)\nif full || @table_catalog_column.defined?\n out[\"table_catalog\"] = @table_catalog_column.to_sql_value(nil)\nend\nif full || @table_schema_column.defined?\n out[\"table_schema\"] = @table_schema_column.to_sql_value(nil)\nend\nif full || @table_name_column.defined?\n out[\"table_name\"] = @table_name_column.to_sql_value(nil)\nend\nif full || @table_type_column.defined?\n out[\"table_type\"] = @table_type_column.to_sql_value(nil)\nend\nout\n"}},{"html_id":"to_json(emit_nulls:Bool=false)-instance-method","name":"to_json","abstract":false,"args":[{"name":"emit_nulls","default_value":"false","external_name":"emit_nulls","restriction":"Bool"}],"args_string":"(emit_nulls : Bool = false)","args_html":"(emit_nulls : Bool = false)","def":{"name":"to_json","args":[{"name":"emit_nulls","default_value":"false","external_name":"emit_nulls","restriction":"Bool"}],"visibility":"Public","body":"JSON.build do |json|\n to_json(json, emit_nulls)\nend"}},{"html_id":"to_json(json,emit_nulls=false)-instance-method","name":"to_json","abstract":false,"args":[{"name":"json","external_name":"json","restriction":""},{"name":"emit_nulls","default_value":"false","external_name":"emit_nulls","restriction":""}],"args_string":"(json, emit_nulls = false)","args_html":"(json, emit_nulls = false)","def":{"name":"to_json","args":[{"name":"json","external_name":"json","restriction":""},{"name":"emit_nulls","default_value":"false","external_name":"emit_nulls","restriction":""}],"visibility":"Public","body":"json.object do\n if emit_nulls || @table_catalog_column.defined?\n json.field(\"table_catalog\") do\n (@table_catalog_column.value(nil)).to_json(json)\n end\n end\n if emit_nulls || @table_schema_column.defined?\n json.field(\"table_schema\") do\n (@table_schema_column.value(nil)).to_json(json)\n end\n end\n if emit_nulls || @table_name_column.defined?\n json.field(\"table_name\") do\n (@table_name_column.value(nil)).to_json(json)\n end\n end\n if emit_nulls || @table_type_column.defined?\n json.field(\"table_type\") do\n (@table_type_column.value(nil)).to_json(json)\n end\n end\nend"}},{"html_id":"update_from_json(string_or_io:String|IO,trusted:Bool=false)-instance-method","name":"update_from_json","doc":"Set the fields from json passed as argument and call `save` on the object\nTrusted flag set to true will allow mass assignment without protection, FALSE by default","summary":"

Set the fields from json passed as argument and call save on the object Trusted flag set to true will allow mass assignment without protection, FALSE by default

","abstract":false,"args":[{"name":"string_or_io","external_name":"string_or_io","restriction":"String | IO"},{"name":"trusted","default_value":"false","external_name":"trusted","restriction":"Bool"}],"args_string":"(string_or_io : String | IO, trusted : Bool = false)","args_html":"(string_or_io : String | IO, trusted : Bool = false)","def":{"name":"update_from_json","args":[{"name":"string_or_io","external_name":"string_or_io","restriction":"String | IO"},{"name":"trusted","default_value":"false","external_name":"trusted","restriction":"Bool"}],"visibility":"Public","body":"mdl = set_from_json(string_or_io, trusted)\nmdl.save\nmdl\n"}},{"html_id":"update_from_json!(string_or_io:String|IO,trusted:Bool=false)-instance-method","name":"update_from_json!","doc":"Set the fields from json passed as argument and call `save!` on the object\nTrusted flag set to true will allow mass assignment without protection, FALSE by default","summary":"

Set the fields from json passed as argument and call save! on the object Trusted flag set to true will allow mass assignment without protection, FALSE by default

","abstract":false,"args":[{"name":"string_or_io","external_name":"string_or_io","restriction":"String | IO"},{"name":"trusted","default_value":"false","external_name":"trusted","restriction":"Bool"}],"args_string":"(string_or_io : String | IO, trusted : Bool = false)","args_html":"(string_or_io : String | IO, trusted : Bool = false)","def":{"name":"update_from_json!","args":[{"name":"string_or_io","external_name":"string_or_io","restriction":"String | IO"},{"name":"trusted","default_value":"false","external_name":"trusted","restriction":"Bool"}],"visibility":"Public","body":"(set_from_json(string_or_io, trusted)).save!"}},{"html_id":"update_h:Hash(String,Clear::SQL::Any)-instance-method","name":"update_h","doc":"Generate the hash for update request (like during save)","summary":"

Generate the hash for update request (like during save)

","abstract":false,"def":{"name":"update_h","return_type":"Hash(String, ::Clear::SQL::Any)","visibility":"Public","body":"o = super()\nif @table_catalog_column.defined? && @table_catalog_column.changed?\n o[\"table_catalog\"] = @table_catalog_column.to_sql_value\nend\nif @table_schema_column.defined? && @table_schema_column.changed?\n o[\"table_schema\"] = @table_schema_column.to_sql_value\nend\nif @table_name_column.defined? && @table_name_column.changed?\n o[\"table_name\"] = @table_name_column.to_sql_value\nend\nif @table_type_column.defined? && @table_type_column.changed?\n o[\"table_type\"] = @table_type_column.to_sql_value\nend\no\n"}},{"html_id":"validate_fields_presence-instance-method","name":"validate_fields_presence","doc":"For each column, ensure than when needed the column has present\ninformation into it.\n\nThis method is called on validation.","summary":"

For each column, ensure than when needed the column has present information into it.

","abstract":false,"def":{"name":"validate_fields_presence","visibility":"Public","body":"if persisted?\nelse\n if @table_catalog_column.failed_to_be_present?\n add_error(\"table_catalog\", \"must be present\")\n end\nend\nif persisted?\nelse\n if @table_schema_column.failed_to_be_present?\n add_error(\"table_schema\", \"must be present\")\n end\nend\nif persisted?\nelse\n if @table_name_column.failed_to_be_present?\n add_error(\"table_name\", \"must be present\")\n end\nend\nif persisted?\nelse\n if @table_type_column.failed_to_be_present?\n add_error(\"table_type\", \"must be present\")\n end\nend\n"}}],"types":[{"html_id":"clear/Clear/Reflection/Table/Collection","path":"Clear/Reflection/Table/Collection.html","kind":"class","full_name":"Clear::Reflection::Table::Collection","name":"Collection","abstract":false,"superclass":{"html_id":"clear/Clear/Model/CollectionBase","kind":"class","full_name":"Clear::Model::CollectionBase","name":"CollectionBase"},"ancestors":[{"html_id":"clear/Clear/Model/CollectionBase","kind":"class","full_name":"Clear::Model::CollectionBase","name":"CollectionBase"},{"html_id":"clear/Clear/SQL/SelectBuilder","kind":"module","full_name":"Clear::SQL::SelectBuilder","name":"SelectBuilder"},{"html_id":"clear/Clear/SQL/Query/WithPagination","kind":"module","full_name":"Clear::SQL::Query::WithPagination","name":"WithPagination"},{"html_id":"clear/Clear/SQL/Query/BeforeQuery","kind":"module","full_name":"Clear::SQL::Query::BeforeQuery","name":"BeforeQuery"},{"html_id":"clear/Clear/SQL/Query/Change","kind":"module","full_name":"Clear::SQL::Query::Change","name":"Change"},{"html_id":"clear/Clear/SQL/Query/Connection","kind":"module","full_name":"Clear::SQL::Query::Connection","name":"Connection"},{"html_id":"clear/Clear/SQL/Query/Pluck","kind":"module","full_name":"Clear::SQL::Query::Pluck","name":"Pluck"},{"html_id":"clear/Clear/SQL/Query/Fetch","kind":"module","full_name":"Clear::SQL::Query::Fetch","name":"Fetch"},{"html_id":"clear/Clear/SQL/Query/Execute","kind":"module","full_name":"Clear::SQL::Query::Execute","name":"Execute"},{"html_id":"clear/Clear/SQL/Query/Lock","kind":"module","full_name":"Clear::SQL::Query::Lock","name":"Lock"},{"html_id":"clear/Clear/SQL/Query/Window","kind":"module","full_name":"Clear::SQL::Query::Window","name":"Window"},{"html_id":"clear/Clear/SQL/Query/CTE","kind":"module","full_name":"Clear::SQL::Query::CTE","name":"CTE"},{"html_id":"clear/Clear/SQL/Query/Aggregate","kind":"module","full_name":"Clear::SQL::Query::Aggregate","name":"Aggregate"},{"html_id":"clear/Clear/SQL/Query/OffsetLimit","kind":"module","full_name":"Clear::SQL::Query::OffsetLimit","name":"OffsetLimit"},{"html_id":"clear/Clear/SQL/Query/GroupBy","kind":"module","full_name":"Clear::SQL::Query::GroupBy","name":"GroupBy"},{"html_id":"clear/Clear/SQL/Query/OrderBy","kind":"module","full_name":"Clear::SQL::Query::OrderBy","name":"OrderBy"},{"html_id":"clear/Clear/SQL/Query/Having","kind":"module","full_name":"Clear::SQL::Query::Having","name":"Having"},{"html_id":"clear/Clear/SQL/Query/Where","kind":"module","full_name":"Clear::SQL::Query::Where","name":"Where"},{"html_id":"clear/Clear/SQL/Query/Join","kind":"module","full_name":"Clear::SQL::Query::Join","name":"Join"},{"html_id":"clear/Clear/SQL/Query/From","kind":"module","full_name":"Clear::SQL::Query::From","name":"From"},{"html_id":"clear/Clear/SQL/Query/Select","kind":"module","full_name":"Clear::SQL::Query::Select","name":"Select"},{"html_id":"clear/Enumerable","kind":"module","full_name":"Enumerable","name":"Enumerable"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/model/reflection/table.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/table.cr#L4"},{"filename":"src/clear/model/reflection/table.cr","line_number":16,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/table.cr#L16"},{"filename":"src/clear/model/reflection/table.cr","line_number":18,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/table.cr#L18"},{"filename":"src/clear/model/reflection/table.cr","line_number":19,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/table.cr#L19"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/Reflection/Table","kind":"class","full_name":"Clear::Reflection::Table","name":"Table"},"doc":"Addition of the method for eager loading and N+1 avoidance.","summary":"

Addition of the method for eager loading and N+1 avoidance.

","instance_methods":[{"html_id":"public-instance-method","name":"public","abstract":false,"location":{"filename":"src/clear/model/reflection/table.cr","line_number":16,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/table.cr#L16"},"def":{"name":"public","visibility":"Public","body":"where do\n table_schema == \"public\"\nend\nreturn self\n"}},{"html_id":"tables_only-instance-method","name":"tables_only","abstract":false,"location":{"filename":"src/clear/model/reflection/table.cr","line_number":18,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/table.cr#L18"},"def":{"name":"tables_only","visibility":"Public","body":"where do\n table_type == \"BASE TABLE\"\nend\nreturn self\n"}},{"html_id":"views_only-instance-method","name":"views_only","abstract":false,"location":{"filename":"src/clear/model/reflection/table.cr","line_number":19,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/reflection/table.cr#L19"},"def":{"name":"views_only","visibility":"Public","body":"where do\n table_type == \"VIEW\"\nend\nreturn self\n"}},{"html_id":"with_columns(fetch_columns=false,&block:Clear::Reflection::Column::Collection->):self-instance-method","name":"with_columns","doc":"Eager load the has many relation columns.\nUse it to avoid N+1 queries.","summary":"

Eager load the has many relation columns.

","abstract":false,"args":[{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"args_string":"(fetch_columns = false, &block : Clear::Reflection::Column::Collection -> ) : self","args_html":"(fetch_columns = false, &block : Clear::Reflection::Column::Collection -> ) : self","def":{"name":"with_columns","args":[{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Clear::Reflection::Column::Collection ->)"},"return_type":"self","visibility":"Public","body":"before_query do\n __temp_99 = table_name\n __temp_100 = \"table_name\"\n sub_query = self.dup.clear_select.select(\"#{Clear::Reflection::Table.table}.#{__temp_99}\")\n qry = Clear::Reflection::Column.query.where do\n (raw(__temp_100)).in?(sub_query)\n end\n block.call(qry)\n @cache.active(\"columns\")\n h = {} of Clear::SQL::Any => Array(Clear::Reflection::Column)\n qry.each(fetch_columns: true) do |mdl|\n if h[mdl.attributes[__temp_100]]?\n else\n h[mdl.attributes[__temp_100]] = [] of Clear::Reflection::Column\n end\n h[mdl.attributes[__temp_100]] << mdl\n end\n h.each do |key, value|\n @cache.set(\"columns\", key, value)\n end\nend\nself\n"}},{"html_id":"with_columns(fetch_columns=false)-instance-method","name":"with_columns","abstract":false,"args":[{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"args_string":"(fetch_columns = false)","args_html":"(fetch_columns = false)","def":{"name":"with_columns","args":[{"name":"fetch_columns","default_value":"false","external_name":"fetch_columns","restriction":""}],"visibility":"Public","body":"with_columns(fetch_columns) do\nend"}}]}]}]},{"html_id":"clear/Clear/SQL","path":"Clear/SQL.html","kind":"module","full_name":"Clear::SQL","name":"SQL","abstract":false,"ancestors":[{"html_id":"clear/Clear/SQL/Transaction","kind":"module","full_name":"Clear::SQL::Transaction","name":"Transaction"},{"html_id":"clear/Clear/SQL/Logger","kind":"module","full_name":"Clear::SQL::Logger","name":"Logger"}],"locations":[{"filename":"src/clear/sql/connection_pool.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/connection_pool.cr#L1"},{"filename":"src/clear/sql/errors.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/errors.cr#L1"},{"filename":"src/clear/sql/fragment/column.cr","line_number":9,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/fragment/column.cr#L9"},{"filename":"src/clear/sql/fragment/fragment.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/fragment/fragment.cr#L1"},{"filename":"src/clear/sql/fragment/from.cr","line_number":3,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/fragment/from.cr#L3"},{"filename":"src/clear/sql/fragment/join.cr","line_number":3,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/fragment/join.cr#L3"},{"filename":"src/clear/sql/lock.cr","line_number":2,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/lock.cr#L2"},{"filename":"src/clear/sql/query/connection.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/connection.cr#L1"},{"filename":"src/clear/sql/query/from.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/from.cr#L1"},{"filename":"src/clear/sql/sql.cr","line_number":50,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/sql.cr#L50"},{"filename":"src/clear/sql/truncate.cr","line_number":2,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/truncate.cr#L2"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"clear/Clear/SQL/Logger","kind":"module","full_name":"Clear::SQL::Logger","name":"Logger"},{"html_id":"clear/Clear/SQL/Transaction","kind":"module","full_name":"Clear::SQL::Transaction","name":"Transaction"}],"extended_modules":[{"html_id":"clear/Clear/SQL","kind":"module","full_name":"Clear::SQL","name":"SQL"}],"namespace":{"html_id":"clear/Clear","kind":"module","full_name":"Clear","name":"Clear"},"doc":"\n## Clear::SQL\n\nClear is made like an onion:\n\n```\n+------------------------------------+\n| THE ORM STACK +\n+------------------------------------+\n| Model | DB Views | Migrations | < High Level Tools\n+---------------+--------------------+\n| Columns | Validation | Converters | < Mapping system\n+---------------+--------------------+\n| Clear::SQL | Clear::Expression | < Low Level SQL Builder\n+------------------------------------+\n| Crystal DB | Crystal PG | < Low Level connection\n+------------------------------------+\n```\n\nOn the bottom stack, Clear offer SQL query building.\nTheses features are then used by top level parts of the engine.\n\nThe SQL module provide a simple API to generate `delete`, `insert`, `select`\nand `update` methods.\n\nEach requests can be duplicated then modified and executed.\n\nNote: Each request object is mutable. Therefore, to update and store a request,\nyou must use manually the `dup` method.\n","summary":"

\n \n \nClear::SQL

","class_methods":[{"html_id":"lock(table:String|Symbol,mode=\"ACCESSEXCLUSIVE\",connection=\"default\",&)-class-method","name":"lock","doc":"Lock completetly a table.\n\n```\nClear::SQL.lock(\"my_table\") do\nend\n```\n\nOptional parameter `mode` allow you to decide over the lock level\nModes are:\n- ACCESS EXCLUSIVE (default)\n- ACCESS SHARE\n- ROW SHARE\n- ROW EXCLUSIVE\n- SHARE UPDATE EXCLUSIVE\n- SHARE\n- SHARE ROW EXCLUSIVE\n- EXCLUSIVE\n\nSee [Official PG documentation for more informations](https://www.postgresql.org/docs/12/explicit-locking.html)\n","summary":"

Lock completetly a table.

","abstract":false,"args":[{"name":"table","external_name":"table","restriction":"String | Symbol"},{"name":"mode","default_value":"\"ACCESS EXCLUSIVE\"","external_name":"mode","restriction":""},{"name":"connection","default_value":"\"default\"","external_name":"connection","restriction":""}],"args_string":"(table : String | Symbol, mode = \"ACCESS EXCLUSIVE\", connection = \"default\", &)","args_html":"(table : String | Symbol, mode = "ACCESS EXCLUSIVE", connection = "default", &)","location":{"filename":"src/clear/sql/lock.cr","line_number":23,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/lock.cr#L23"},"def":{"name":"lock","args":[{"name":"table","external_name":"table","restriction":"String | Symbol"},{"name":"mode","default_value":"\"ACCESS EXCLUSIVE\"","external_name":"mode","restriction":""},{"name":"connection","default_value":"\"default\"","external_name":"connection","restriction":""}],"yields":1,"block_arity":1,"visibility":"Public","body":"Clear::SQL::ConnectionPool.with_connection(connection) do |cnx|\n transaction do\n execute(\"LOCK TABLE #{table} IN #{mode} MODE\")\n return yield(cnx)\n end\nend"}},{"html_id":"truncate(tablename:Clear::Model.class|String|Symbol,restart_sequence:Bool=false,cascade:Bool=false,truncate_inherited:Bool=true,connection_name:String=\"default\")forallT-class-method","name":"truncate","doc":"Truncate a table or a model\n\n```\nUser.query.count # => 200\nClear::SQL.truncate(User) # equivalent to Clear::SQL.truncate(User.table, connection_name: User.connection)\nUser.query.count # => 0\n```\n\nSEE https://www.postgresql.org/docs/current/sql-truncate.html\nfor more information.\n\n- `restart_sequence` set to true will append `RESTART IDENTITY` to the query\n- `cascade` set to true will append `CASCADE` to the query\n- `truncate_inherited` set to false will append `ONLY` to the query\n- `connection_name` will be: `Model.connection` or `default` unless optionally defined.","summary":"

Truncate a table or a model

","abstract":false,"args":[{"name":"tablename","external_name":"tablename","restriction":"Clear::Model.class | String | Symbol"},{"name":"restart_sequence","default_value":"false","external_name":"restart_sequence","restriction":"Bool"},{"name":"cascade","default_value":"false","external_name":"cascade","restriction":"Bool"},{"name":"truncate_inherited","default_value":"true","external_name":"truncate_inherited","restriction":"Bool"},{"name":"connection_name","default_value":"\"default\"","external_name":"connection_name","restriction":"String"}],"args_string":"(tablename : Clear::Model.class | String | Symbol, restart_sequence : Bool = false, cascade : Bool = false, truncate_inherited : Bool = true, connection_name : String = \"default\") forall T","args_html":"(tablename : Clear::Model.class | String | Symbol, restart_sequence : Bool = false, cascade : Bool = false, truncate_inherited : Bool = true, connection_name : String = "default") forall T","location":{"filename":"src/clear/sql/truncate.cr","line_number":18,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/truncate.cr#L18"},"def":{"name":"truncate","args":[{"name":"tablename","external_name":"tablename","restriction":"Clear::Model.class | String | Symbol"},{"name":"restart_sequence","default_value":"false","external_name":"restart_sequence","restriction":"Bool"},{"name":"cascade","default_value":"false","external_name":"cascade","restriction":"Bool"},{"name":"truncate_inherited","default_value":"true","external_name":"truncate_inherited","restriction":"Bool"},{"name":"connection_name","default_value":"\"default\"","external_name":"connection_name","restriction":"String"}],"visibility":"Public","body":"case tablename\nwhen String\nwhen Symbol\n tablename = Clear::SQL.escape(tablename.to_s)\nelse\n connection_name = tablename.connection\n tablename = tablename.full_table_name\nend\nonly = truncate_inherited ? \"\" : \" ONLY \"\nrestart_sequence = restart_sequence ? \" RESTART IDENTITY \" : \"\"\ncascade = cascade ? \" CASCADE \" : \"\"\nexecute(connection_name, {\"TRUNCATE TABLE \", only, tablename, restart_sequence, cascade}.join)\n"}}],"instance_methods":[{"html_id":"add_connection(name:String,url:String)-instance-method","name":"add_connection","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"String"},{"name":"url","external_name":"url","restriction":"String"}],"args_string":"(name : String, url : String)","args_html":"(name : String, url : String)","location":{"filename":"src/clear/sql/sql.cr","line_number":125,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/sql.cr#L125"},"def":{"name":"add_connection","args":[{"name":"name","external_name":"name","restriction":"String"},{"name":"url","external_name":"url","restriction":"String"}],"visibility":"Public","body":"Clear::SQL::ConnectionPool.init(url, name)"}},{"html_id":"delete(table:Symbolic)-instance-method","name":"delete","doc":"Start a DELETE table query","summary":"

Start a DELETE table query

","abstract":false,"args":[{"name":"table","external_name":"table","restriction":"Symbolic"}],"args_string":"(table : Symbolic)","args_html":"(table : Symbolic)","location":{"filename":"src/clear/sql/sql.cr","line_number":185,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/sql.cr#L185"},"def":{"name":"delete","args":[{"name":"table","external_name":"table","restriction":"Symbolic"}],"visibility":"Public","body":"Clear::SQL::DeleteQuery.new.from(table)"}},{"html_id":"escape(x:String|Symbol)-instance-method","name":"escape","doc":"Escape the expression, double quoting it.\n\nIt allows use of reserved keywords as table or column name\nNOTE: Escape is used for escaping postgresql keyword. For example\nif you have a column named order (which is a reserved word), you want\nto escape it by double-quoting it.\n\nFor escaping STRING value, please use Clear::SQL.sanitize","summary":"

Escape the expression, double quoting it.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"String | Symbol"}],"args_string":"(x : String | Symbol)","args_html":"(x : String | Symbol)","location":{"filename":"src/clear/sql/sql.cr","line_number":103,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/sql.cr#L103"},"def":{"name":"escape","args":[{"name":"x","external_name":"x","restriction":"String | Symbol"}],"visibility":"Public","body":"(\"\\\"\" + (x.to_s.gsub(\"\\\"\", \"\\\"\\\"\"))) + \"\\\"\""}},{"html_id":"execute(connection_name:String,sql)-instance-method","name":"execute","doc":"Execute a SQL statement on a specific connection.\n\nUsage:\nClear::SQL.execute(\"seconddatabase\", \"SELECT 1 FROM users\")","summary":"

Execute a SQL statement on a specific connection.

","abstract":false,"args":[{"name":"connection_name","external_name":"connection_name","restriction":"String"},{"name":"sql","external_name":"sql","restriction":""}],"args_string":"(connection_name : String, sql)","args_html":"(connection_name : String, sql)","location":{"filename":"src/clear/sql/sql.cr","line_number":175,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/sql.cr#L175"},"def":{"name":"execute","args":[{"name":"connection_name","external_name":"connection_name","restriction":"String"},{"name":"sql","external_name":"sql","restriction":""}],"visibility":"Public","body":"log_query(sql) do\n Clear::SQL::ConnectionPool.with_connection(connection_name, &.exec_all(sql))\nend"}},{"html_id":"execute(sql)-instance-method","name":"execute","doc":"Execute a SQL statement.\n\nUsage:\nClear::SQL.execute(\"SELECT 1 FROM users\")\n","summary":"

Execute a SQL statement.

","abstract":false,"args":[{"name":"sql","external_name":"sql","restriction":""}],"args_string":"(sql)","args_html":"(sql)","location":{"filename":"src/clear/sql/sql.cr","line_number":167,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/sql.cr#L167"},"def":{"name":"execute","args":[{"name":"sql","external_name":"sql","restriction":""}],"visibility":"Public","body":"execute(\"default\", sql)"}},{"html_id":"init(name:String,url:String)-instance-method","name":"init","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"String"},{"name":"url","external_name":"url","restriction":"String"}],"args_string":"(name : String, url : String)","args_html":"(name : String, url : String)","location":{"filename":"src/clear/sql/sql.cr","line_number":115,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/sql.cr#L115"},"def":{"name":"init","args":[{"name":"name","external_name":"name","restriction":"String"},{"name":"url","external_name":"url","restriction":"String"}],"visibility":"Public","body":"Clear::SQL::ConnectionPool.init(url, name)"}},{"html_id":"init(url:String)-instance-method","name":"init","abstract":false,"args":[{"name":"url","external_name":"url","restriction":"String"}],"args_string":"(url : String)","args_html":"(url : String)","location":{"filename":"src/clear/sql/sql.cr","line_number":111,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/sql.cr#L111"},"def":{"name":"init","args":[{"name":"url","external_name":"url","restriction":"String"}],"visibility":"Public","body":"Clear::SQL::ConnectionPool.init(url, \"default\")"}},{"html_id":"init(connections:Hash(Symbolic,String))-instance-method","name":"init","abstract":false,"args":[{"name":"connections","external_name":"connections","restriction":"Hash(Symbolic, String)"}],"args_string":"(connections : Hash(Symbolic, String))","args_html":"(connections : Hash(Symbolic, String))","location":{"filename":"src/clear/sql/sql.cr","line_number":119,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/sql.cr#L119"},"def":{"name":"init","args":[{"name":"connections","external_name":"connections","restriction":"Hash(Symbolic, String)"}],"visibility":"Public","body":"connections.each do |name, url|\n Clear::SQL::ConnectionPool.init(url, name)\nend"}},{"html_id":"insert(table,args:NamedTuple)-instance-method","name":"insert","abstract":false,"args":[{"name":"table","external_name":"table","restriction":""},{"name":"args","external_name":"args","restriction":"NamedTuple"}],"args_string":"(table, args : NamedTuple)","args_html":"(table, args : NamedTuple)","location":{"filename":"src/clear/sql/sql.cr","line_number":214,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/sql.cr#L214"},"def":{"name":"insert","args":[{"name":"table","external_name":"table","restriction":""},{"name":"args","external_name":"args","restriction":"NamedTuple"}],"visibility":"Public","body":"insert_into(table, args)"}},{"html_id":"insert(table,*args)-instance-method","name":"insert","doc":"Alias of `insert_into`, for hurry developers","summary":"

Alias of #insert_into, for hurry developers

","abstract":false,"args":[{"name":"table","external_name":"table","restriction":""},{"name":"args","external_name":"args","restriction":""}],"args_string":"(table, *args)","args_html":"(table, *args)","location":{"filename":"src/clear/sql/sql.cr","line_number":210,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/sql.cr#L210"},"def":{"name":"insert","args":[{"name":"table","external_name":"table","restriction":""},{"name":"args","external_name":"args","restriction":""}],"splat_index":1,"visibility":"Public","body":"insert_into(table, *args)"}},{"html_id":"insert-instance-method","name":"insert","doc":"Create a new INSERT query","summary":"

Create a new INSERT query

","abstract":false,"location":{"filename":"src/clear/sql/sql.cr","line_number":205,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/sql.cr#L205"},"def":{"name":"insert","visibility":"Public","body":"Clear::SQL::InsertQuery.new"}},{"html_id":"insert_into(table:Symbolic)-instance-method","name":"insert_into","doc":"Prepare a new INSERT INTO table query\n:ditto:","summary":"

Prepare a new INSERT INTO table query :ditto:

","abstract":false,"args":[{"name":"table","external_name":"table","restriction":"Symbolic"}],"args_string":"(table : Symbolic)","args_html":"(table : Symbolic)","location":{"filename":"src/clear/sql/sql.cr","line_number":200,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/sql.cr#L200"},"def":{"name":"insert_into","args":[{"name":"table","external_name":"table","restriction":"Symbolic"}],"visibility":"Public","body":"Clear::SQL::InsertQuery.new(table)"}},{"html_id":"insert_into(table:Symbolic,*args)-instance-method","name":"insert_into","doc":"Start an INSERT INTO table query\n\n```\nClear::SQL.insert_into(\"table\", {id: 1, name: \"hello\"}, {id: 2, name: \"World\"})\n```","summary":"

Start an INSERT INTO table query

","abstract":false,"args":[{"name":"table","external_name":"table","restriction":"Symbolic"},{"name":"args","external_name":"args","restriction":""}],"args_string":"(table : Symbolic, *args)","args_html":"(table : Symbolic, *args)","location":{"filename":"src/clear/sql/sql.cr","line_number":194,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/sql.cr#L194"},"def":{"name":"insert_into","args":[{"name":"table","external_name":"table","restriction":"Symbolic"},{"name":"args","external_name":"args","restriction":""}],"splat_index":1,"visibility":"Public","body":"(Clear::SQL::InsertQuery.new(table)).values(*args)"}},{"html_id":"raw(x,*params)-instance-method","name":"raw","doc":"This provide a fast way to create SQL fragment while escaping items, both with `?` and `:key` system:\n\n```\nquery = Mode.query.select(Clear::SQL.raw(\"CASE WHEN x=:x THEN 1 ELSE 0 END as check\", x: \"blabla\"))\nquery = Mode.query.select(Clear::SQL.raw(\"CASE WHEN x=? THEN 1 ELSE 0 END as check\", \"blabla\"))\n```","summary":"

This provide a fast way to create SQL fragment while escaping items, both with ? and :key system:

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""},{"name":"params","external_name":"params","restriction":""}],"args_string":"(x, *params)","args_html":"(x, *params)","location":{"filename":"src/clear/sql/sql.cr","line_number":81,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/sql.cr#L81"},"def":{"name":"raw","args":[{"name":"x","external_name":"x","restriction":""},{"name":"params","external_name":"params","restriction":""}],"splat_index":1,"visibility":"Public","body":"Clear::Expression.raw(x, *params)"}},{"html_id":"raw(__template,**params)-instance-method","name":"raw","abstract":false,"args":[{"name":"__template","external_name":"__template","restriction":""}],"args_string":"(__template, **params)","args_html":"(__template, **params)","location":{"filename":"src/clear/sql/sql.cr","line_number":91,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/sql.cr#L91"},"def":{"name":"raw","args":[{"name":"__template","external_name":"__template","restriction":""}],"double_splat":{"name":"params","external_name":"params","restriction":""},"visibility":"Public","body":"Clear::Expression.raw(__template, **params)"}},{"html_id":"raw_enum(x,params:Enumerable(T))forallT-instance-method","name":"raw_enum","doc":"See `self.raw`\nCan pass an array to this version","summary":"

See self.raw Can pass an array to this version

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""},{"name":"params","external_name":"params","restriction":"Enumerable(T)"}],"args_string":"(x, params : Enumerable(T)) forall T","args_html":"(x, params : Enumerable(T)) forall T","location":{"filename":"src/clear/sql/sql.cr","line_number":87,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/sql.cr#L87"},"def":{"name":"raw_enum","args":[{"name":"x","external_name":"x","restriction":""},{"name":"params","external_name":"params","restriction":"Enumerable(T)"}],"visibility":"Public","body":"Clear::Expression.raw_enum(x, params)"}},{"html_id":"rollback-instance-method","name":"rollback","doc":"Raise a rollback, in case of transaction","summary":"

Raise a rollback, in case of transaction

","abstract":false,"location":{"filename":"src/clear/sql/sql.cr","line_number":158,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/sql.cr#L158"},"def":{"name":"rollback","visibility":"Public","body":"raise(RollbackError.new)"}},{"html_id":"sanitize(x)-instance-method","name":"sanitize","doc":"Sanitize string and convert some literals (e.g. `Time`)","summary":"

Sanitize string and convert some literals (e.g.

","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x)","args_html":"(x)","location":{"filename":"src/clear/sql/sql.cr","line_number":71,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/sql.cr#L71"},"def":{"name":"sanitize","args":[{"name":"x","external_name":"x","restriction":""}],"visibility":"Public","body":"Clear::Expression[x]"}},{"html_id":"select(*args)-instance-method","name":"select","doc":"Start a SELECT FROM table query","summary":"

Start a SELECT FROM table query

","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args)","args_html":"(*args)","location":{"filename":"src/clear/sql/sql.cr","line_number":224,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/sql.cr#L224"},"def":{"name":"select","args":[{"name":"args","external_name":"args","restriction":""}],"splat_index":0,"visibility":"Public","body":"if args.size > 0\n Clear::SQL::SelectQuery.new.select(*args)\nelse\n Clear::SQL::SelectQuery.new\nend"}},{"html_id":"unsafe(x)-instance-method","name":"unsafe","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x)","args_html":"(x)","location":{"filename":"src/clear/sql/sql.cr","line_number":107,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/sql.cr#L107"},"def":{"name":"unsafe","args":[{"name":"x","external_name":"x","restriction":""}],"visibility":"Public","body":"Clear::Expression::UnsafeSql.new(x)"}},{"html_id":"update(table)-instance-method","name":"update","doc":"Start a UPDATE table query","summary":"

Start a UPDATE table query

","abstract":false,"args":[{"name":"table","external_name":"table","restriction":""}],"args_string":"(table)","args_html":"(table)","location":{"filename":"src/clear/sql/sql.cr","line_number":219,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/sql.cr#L219"},"def":{"name":"update","args":[{"name":"table","external_name":"table","restriction":""}],"visibility":"Public","body":"Clear::SQL::UpdateQuery.new(table)"}},{"html_id":"with_savepoint(connection_name=\"default\",&)-instance-method","name":"with_savepoint","doc":"Create a transaction, but this one is stackable\nusing savepoints.\n\nExample:\n\n```\nClear::SQL.with_savepoint do\n # do something\n Clear::SQL.with_savepoint do\n rollback # < Rollback only the last `with_savepoint` block\n end\nend\n```","summary":"

Create a transaction, but this one is stackable using savepoints.

","abstract":false,"args":[{"name":"connection_name","default_value":"\"default\"","external_name":"connection_name","restriction":""}],"args_string":"(connection_name = \"default\", &)","args_html":"(connection_name = "default", &)","location":{"filename":"src/clear/sql/sql.cr","line_number":144,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/sql.cr#L144"},"def":{"name":"with_savepoint","args":[{"name":"connection_name","default_value":"\"default\"","external_name":"connection_name","restriction":""}],"yields":0,"block_arity":0,"visibility":"Public","body":"transaction do |cnx|\n sp_name = \"sp_#{@@savepoint_uid = @@savepoint_uid + 1}\"\n begin\n execute(connection_name, \"SAVEPOINT #{sp_name}\")\n yield\n if cnx._clear_in_transaction?\n execute(connection_name, \"RELEASE SAVEPOINT #{sp_name}\")\n end\n rescue e : RollbackError\n if cnx._clear_in_transaction?\n execute(connection_name, \"ROLLBACK TO SAVEPOINT #{sp_name}\")\n end\n end\nend"}}],"types":[{"html_id":"clear/Clear/SQL/Any","path":"Clear/SQL/Any.html","kind":"alias","full_name":"Clear::SQL::Any","name":"Any","abstract":false,"locations":[{"filename":"src/clear/sql/sql.cr","line_number":56,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/sql.cr#L56"}],"repository_name":"clear","program":false,"enum":false,"alias":true,"aliased":"(Array(PG::BoolArray) | Array(PG::CharArray) | Array(PG::Float32Array) | Array(PG::Float64Array) | Array(PG::Int16Array) | Array(PG::Int32Array) | Array(PG::Int64Array) | Array(PG::NumericArray) | Array(PG::StringArray) | Array(PG::TimeArray) | Array(PG::UUIDArray) | BigDecimal | Bool | Char | Clear::Expression::Literal | Crypto::Bcrypt::Password | Float32 | Float64 | Int16 | Int32 | Int64 | Int8 | JSON::Any | JSON::PullParser | PG::Geo::Box | PG::Geo::Circle | PG::Geo::Line | PG::Geo::LineSegment | PG::Geo::Path | PG::Geo::Point | PG::Geo::Polygon | PG::Interval | PG::Numeric | Slice(UInt8) | String | Time | UInt16 | UInt32 | UInt64 | UInt8 | UUID | Nil)","aliased_html":"Array(PG::BoolArray) | Array(PG::CharArray) | Array(PG::Float32Array) | Array(PG::Float64Array) | Array(PG::Int16Array) | Array(PG::Int32Array) | Array(PG::Int64Array) | Array(PG::NumericArray) | Array(PG::StringArray) | Array(PG::TimeArray) | Array(PG::UUIDArray) | BigDecimal | Bool | Char | Clear::Expression::Literal | Crypto::Bcrypt::Password | Float32 | Float64 | Int16 | Int32 | Int64 | Int8 | JSON::Any | JSON::PullParser | PG::Geo::Box | PG::Geo::Circle | PG::Geo::Line | PG::Geo::LineSegment | PG::Geo::Path | PG::Geo::Point | PG::Geo::Polygon | PG::Interval | PG::Numeric | Slice(UInt8) | String | Time | UInt16 | UInt32 | UInt64 | UInt8 | UUID | Nil","const":false,"namespace":{"html_id":"clear/Clear/SQL","kind":"module","full_name":"Clear::SQL","name":"SQL"}},{"html_id":"clear/Clear/SQL/CancelTransactionError","path":"Clear/SQL/CancelTransactionError.html","kind":"class","full_name":"Clear::SQL::CancelTransactionError","name":"CancelTransactionError","abstract":false,"superclass":{"html_id":"clear/Clear/SQL/Error","kind":"class","full_name":"Clear::SQL::Error","name":"Error"},"ancestors":[{"html_id":"clear/Clear/SQL/Error","kind":"class","full_name":"Clear::SQL::Error","name":"Error"},{"html_id":"clear/Exception","kind":"class","full_name":"Exception","name":"Exception"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/sql/errors.cr","line_number":16,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/errors.cr#L16"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/SQL","kind":"module","full_name":"Clear::SQL","name":"SQL"},"doc":"Like rollback, but used into savepoint, it will revert completely the transaction","summary":"

Like rollback, but used into savepoint, it will revert completely the transaction

"},{"html_id":"clear/Clear/SQL/Column","path":"Clear/SQL/Column.html","kind":"struct","full_name":"Clear::SQL::Column","name":"Column","abstract":false,"superclass":{"html_id":"clear/Clear/SQL/Fragment","kind":"struct","full_name":"Clear::SQL::Fragment","name":"Fragment"},"ancestors":[{"html_id":"clear/Clear/SQL/Fragment","kind":"struct","full_name":"Clear::SQL::Fragment","name":"Fragment"},{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/sql/fragment/column.cr","line_number":10,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/fragment/column.cr#L10"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/SQL","kind":"module","full_name":"Clear::SQL","name":"SQL"},"constructors":[{"html_id":"new(value:Clear::SQL::SelectBuilder|String|Symbol,var:String|Symbol|Nil=nil)-class-method","name":"new","abstract":false,"args":[{"name":"value","external_name":"value","restriction":"::Clear::SQL::SelectBuilder | ::String | ::Symbol"},{"name":"var","default_value":"nil","external_name":"var","restriction":"::String | ::Symbol | ::Nil"}],"args_string":"(value : Clear::SQL::SelectBuilder | String | Symbol, var : String | Symbol | Nil = nil)","args_html":"(value : Clear::SQL::SelectBuilder | String | Symbol, var : String | Symbol | Nil = nil)","location":{"filename":"src/clear/sql/fragment/column.cr","line_number":14,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/fragment/column.cr#L14"},"def":{"name":"new","args":[{"name":"value","external_name":"value","restriction":"::Clear::SQL::SelectBuilder | ::String | ::Symbol"},{"name":"var","default_value":"nil","external_name":"var","restriction":"::String | ::Symbol | ::Nil"}],"visibility":"Public","body":"_ = allocate\n_.initialize(value, var)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"to_sql-instance-method","name":"to_sql","abstract":false,"location":{"filename":"src/clear/sql/fragment/column.cr","line_number":17,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/fragment/column.cr#L17"},"def":{"name":"to_sql","visibility":"Public","body":"v = value\ncase v\nwhen String\n [v, @var].compact.join(\" AS \")\nwhen Symbol\n [SQL.escape(v.to_s), @var].compact.join(\" AS \")\nwhen SQL::SelectBuilder\n [\"( #{v.to_sql} )\", @var].compact.join(\" AS \")\nelse\n raise(QueryBuildingError.new(\"Only String and SelectQuery are allowed as column declaration\"))\nend\n"}},{"html_id":"value:Selectable-instance-method","name":"value","abstract":false,"location":{"filename":"src/clear/sql/fragment/column.cr","line_number":11,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/fragment/column.cr#L11"},"def":{"name":"value","return_type":"Selectable","visibility":"Public","body":"@value"}},{"html_id":"value=(value:Selectable)-instance-method","name":"value=","abstract":false,"args":[{"name":"value","external_name":"value","restriction":"Selectable"}],"args_string":"(value : Selectable)","args_html":"(value : Selectable)","location":{"filename":"src/clear/sql/fragment/column.cr","line_number":11,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/fragment/column.cr#L11"},"def":{"name":"value=","args":[{"name":"value","external_name":"value","restriction":"Selectable"}],"visibility":"Public","body":"@value = value"}},{"html_id":"var:Symbolic|Nil-instance-method","name":"var","abstract":false,"location":{"filename":"src/clear/sql/fragment/column.cr","line_number":12,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/fragment/column.cr#L12"},"def":{"name":"var","return_type":"Symbolic | ::Nil","visibility":"Public","body":"@var"}},{"html_id":"var=(var:Symbolic|Nil)-instance-method","name":"var=","abstract":false,"args":[{"name":"var","external_name":"var","restriction":"Symbolic | ::Nil"}],"args_string":"(var : Symbolic | Nil)","args_html":"(var : Symbolic | Nil)","location":{"filename":"src/clear/sql/fragment/column.cr","line_number":12,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/fragment/column.cr#L12"},"def":{"name":"var=","args":[{"name":"var","external_name":"var","restriction":"Symbolic | ::Nil"}],"visibility":"Public","body":"@var = var"}}]},{"html_id":"clear/Clear/SQL/ConnectionPool","path":"Clear/SQL/ConnectionPool.html","kind":"class","full_name":"Clear::SQL::ConnectionPool","name":"ConnectionPool","abstract":false,"superclass":{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/sql/connection_pool.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/connection_pool.cr#L1"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/SQL","kind":"module","full_name":"Clear::SQL","name":"SQL"},"class_methods":[{"html_id":"init(uri,name)-class-method","name":"init","abstract":false,"args":[{"name":"uri","external_name":"uri","restriction":""},{"name":"name","external_name":"name","restriction":""}],"args_string":"(uri, name)","args_html":"(uri, name)","location":{"filename":"src/clear/sql/connection_pool.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/connection_pool.cr#L6"},"def":{"name":"init","args":[{"name":"uri","external_name":"uri","restriction":""},{"name":"name","external_name":"name","restriction":""}],"visibility":"Public","body":"@@databases[name] = DB.open(uri)"}},{"html_id":"with_connection(target:String,&)-class-method","name":"with_connection","doc":"Retrieve a connection from the connection pool, or wait for it.\nIf the current Fiber already has a connection, the connection is returned;\n this strategy provides easy usage of multiple statement connection (like BEGIN/ROLLBACK features).","summary":"

Retrieve a connection from the connection pool, or wait for it.

","abstract":false,"args":[{"name":"target","external_name":"target","restriction":"String"}],"args_string":"(target : String, &)","args_html":"(target : String, &)","location":{"filename":"src/clear/sql/connection_pool.cr","line_number":13,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/connection_pool.cr#L13"},"def":{"name":"with_connection","args":[{"name":"target","external_name":"target","restriction":"String"}],"yields":1,"block_arity":1,"visibility":"Public","body":"fiber_target = {target, Fiber.current}\ndatabase = @@databases.fetch(target) do\n raise(Clear::ErrorMessages.uninitialized_db_connection(target))\nend\ncnx = @@fiber_connections[fiber_target]?\nif cnx\n yield cnx\nelse\n database.using_connection do |new_connection|\n begin\n @@fiber_connections[fiber_target] = new_connection\n yield new_connection\n ensure\n @@fiber_connections.delete(fiber_target)\n end\n end\nend\n"}}]},{"html_id":"clear/Clear/SQL/DeleteQuery","path":"Clear/SQL/DeleteQuery.html","kind":"class","full_name":"Clear::SQL::DeleteQuery","name":"DeleteQuery","abstract":false,"superclass":{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"clear/Clear/SQL/Query/Change","kind":"module","full_name":"Clear::SQL::Query::Change","name":"Change"},{"html_id":"clear/Clear/SQL/Query/Execute","kind":"module","full_name":"Clear::SQL::Query::Execute","name":"Execute"},{"html_id":"clear/Clear/SQL/Query/Where","kind":"module","full_name":"Clear::SQL::Query::Where","name":"Where"},{"html_id":"clear/Clear/SQL/Query/Connection","kind":"module","full_name":"Clear::SQL::Query::Connection","name":"Connection"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/sql/delete_query.cr","line_number":3,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/delete_query.cr#L3"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"clear/Clear/SQL/Query/Change","kind":"module","full_name":"Clear::SQL::Query::Change","name":"Change"},{"html_id":"clear/Clear/SQL/Query/Connection","kind":"module","full_name":"Clear::SQL::Query::Connection","name":"Connection"},{"html_id":"clear/Clear/SQL/Query/Execute","kind":"module","full_name":"Clear::SQL::Query::Execute","name":"Execute"},{"html_id":"clear/Clear/SQL/Query/Where","kind":"module","full_name":"Clear::SQL::Query::Where","name":"Where"}],"namespace":{"html_id":"clear/Clear/SQL","kind":"module","full_name":"Clear::SQL","name":"SQL"},"constructors":[{"html_id":"new(table:String|Symbol|Nil=nil,wheres:Array(Clear::Expression::Node)=[]ofClear::Expression::Node)-class-method","name":"new","abstract":false,"args":[{"name":"table","default_value":"nil","external_name":"table","restriction":"::String | ::Symbol | ::Nil"},{"name":"wheres","default_value":"[] of Clear::Expression::Node","external_name":"wheres","restriction":"::Array(::Clear::Expression::Node)"}],"args_string":"(table : String | Symbol | Nil = nil, wheres : Array(Clear::Expression::Node) = [] of Clear::Expression::Node)","args_html":"(table : String | Symbol | Nil = nil, wheres : Array(Clear::Expression::Node) = [] of Clear::Expression::Node)","location":{"filename":"src/clear/sql/delete_query.cr","line_number":11,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/delete_query.cr#L11"},"def":{"name":"new","args":[{"name":"table","default_value":"nil","external_name":"table","restriction":"::String | ::Symbol | ::Nil"},{"name":"wheres","default_value":"[] of Clear::Expression::Node","external_name":"wheres","restriction":"::Array(::Clear::Expression::Node)"}],"visibility":"Public","body":"_ = allocate\n_.initialize(table, wheres)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"from(table:String|Symbol|Nil)-instance-method","name":"from","abstract":false,"args":[{"name":"table","external_name":"table","restriction":"::String | ::Symbol | ::Nil"}],"args_string":"(table : String | Symbol | Nil)","args_html":"(table : String | Symbol | Nil)","location":{"filename":"src/clear/sql/delete_query.cr","line_number":14,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/delete_query.cr#L14"},"def":{"name":"from","args":[{"name":"table","external_name":"table","restriction":"::String | ::Symbol | ::Nil"}],"visibility":"Public","body":"@table = table\nchange!\n"}},{"html_id":"table:Symbolic|Nil-instance-method","name":"table","abstract":false,"location":{"filename":"src/clear/sql/delete_query.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/delete_query.cr#L4"},"def":{"name":"table","return_type":"Symbolic | ::Nil","visibility":"Public","body":"@table"}},{"html_id":"to_sql-instance-method","name":"to_sql","abstract":false,"location":{"filename":"src/clear/sql/delete_query.cr","line_number":19,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/delete_query.cr#L19"},"def":{"name":"to_sql","visibility":"Public","body":"if table = @table\nelse\n raise(Clear::ErrorMessages.query_building_error(\"Delete Query must have a `from` clause.\"))\nend\ntable = table.is_a?(Symbol) ? SQL.escape(table.to_s) : table\n[\"DELETE FROM\", table, print_wheres].compact.join(\" \")\n"}},{"html_id":"wheres:Array(Clear::Expression::Node)-instance-method","name":"wheres","doc":"Return the list of where clause; each where clause are transformed into\nClear::Expression::Node","summary":"

Return the list of where clause; each where clause are transformed into Clear::Expression::Node

","abstract":false,"def":{"name":"wheres","return_type":"Array(Clear::Expression::Node)","visibility":"Public","body":"@wheres"}}]},{"html_id":"clear/Clear/SQL/Error","path":"Clear/SQL/Error.html","kind":"class","full_name":"Clear::SQL::Error","name":"Error","abstract":false,"superclass":{"html_id":"clear/Exception","kind":"class","full_name":"Exception","name":"Exception"},"ancestors":[{"html_id":"clear/Exception","kind":"class","full_name":"Exception","name":"Exception"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/sql/errors.cr","line_number":2,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/errors.cr#L2"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"subclasses":[{"html_id":"clear/Clear/SQL/CancelTransactionError","kind":"class","full_name":"Clear::SQL::CancelTransactionError","name":"CancelTransactionError"},{"html_id":"clear/Clear/SQL/ExecutionError","kind":"class","full_name":"Clear::SQL::ExecutionError","name":"ExecutionError"},{"html_id":"clear/Clear/SQL/OperationNotPermittedError","kind":"class","full_name":"Clear::SQL::OperationNotPermittedError","name":"OperationNotPermittedError"},{"html_id":"clear/Clear/SQL/QueryBuildingError","kind":"class","full_name":"Clear::SQL::QueryBuildingError","name":"QueryBuildingError"},{"html_id":"clear/Clear/SQL/RecordNotFoundError","kind":"class","full_name":"Clear::SQL::RecordNotFoundError","name":"RecordNotFoundError"},{"html_id":"clear/Clear/SQL/RollbackError","kind":"class","full_name":"Clear::SQL::RollbackError","name":"RollbackError"}],"namespace":{"html_id":"clear/Clear/SQL","kind":"module","full_name":"Clear::SQL","name":"SQL"}},{"html_id":"clear/Clear/SQL/ExecutionError","path":"Clear/SQL/ExecutionError.html","kind":"class","full_name":"Clear::SQL::ExecutionError","name":"ExecutionError","abstract":false,"superclass":{"html_id":"clear/Clear/SQL/Error","kind":"class","full_name":"Clear::SQL::Error","name":"Error"},"ancestors":[{"html_id":"clear/Clear/SQL/Error","kind":"class","full_name":"Clear::SQL::Error","name":"Error"},{"html_id":"clear/Exception","kind":"class","full_name":"Exception","name":"Exception"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/sql/errors.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/errors.cr#L4"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/SQL","kind":"module","full_name":"Clear::SQL","name":"SQL"}},{"html_id":"clear/Clear/SQL/Fragment","path":"Clear/SQL/Fragment.html","kind":"struct","full_name":"Clear::SQL::Fragment","name":"Fragment","abstract":true,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/sql/fragment/fragment.cr","line_number":2,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/fragment/fragment.cr#L2"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"subclasses":[{"html_id":"clear/Clear/SQL/Column","kind":"struct","full_name":"Clear::SQL::Column","name":"Column"},{"html_id":"clear/Clear/SQL/From","kind":"struct","full_name":"Clear::SQL::From","name":"From"},{"html_id":"clear/Clear/SQL/Join","kind":"struct","full_name":"Clear::SQL::Join","name":"Join"}],"namespace":{"html_id":"clear/Clear/SQL","kind":"module","full_name":"Clear::SQL","name":"SQL"},"constructors":[{"html_id":"new-class-method","name":"new","abstract":false,"location":{"filename":"src/clear/sql/fragment/fragment.cr","line_number":2,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/fragment/fragment.cr#L2"},"def":{"name":"new","visibility":"Public","body":"x = allocate\nif x.responds_to?(:finalize)\n ::GC.add_finalizer(x)\nend\nx\n"}}],"instance_methods":[{"html_id":"initialize-instance-method","name":"initialize","abstract":false,"location":{"filename":"src/clear/sql/fragment/fragment.cr","line_number":2,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/fragment/fragment.cr#L2"},"def":{"name":"initialize","visibility":"Public","body":""}},{"html_id":"to_sql-instance-method","name":"to_sql","abstract":true,"location":{"filename":"src/clear/sql/fragment/fragment.cr","line_number":3,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/fragment/fragment.cr#L3"},"def":{"name":"to_sql","visibility":"Public","body":""}}]},{"html_id":"clear/Clear/SQL/From","path":"Clear/SQL/From.html","kind":"struct","full_name":"Clear::SQL::From","name":"From","abstract":false,"superclass":{"html_id":"clear/Clear/SQL/Fragment","kind":"struct","full_name":"Clear::SQL::Fragment","name":"Fragment"},"ancestors":[{"html_id":"clear/Clear/SQL/Fragment","kind":"struct","full_name":"Clear::SQL::Fragment","name":"Fragment"},{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/sql/fragment/from.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/fragment/from.cr#L4"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/SQL","kind":"module","full_name":"Clear::SQL","name":"SQL"},"constructors":[{"html_id":"new(value:Clear::SQL::SelectBuilder|String|Symbol,var:String|Symbol|Nil=nil)-class-method","name":"new","abstract":false,"args":[{"name":"value","external_name":"value","restriction":"::Clear::SQL::SelectBuilder | ::String | ::Symbol"},{"name":"var","default_value":"nil","external_name":"var","restriction":"::String | ::Symbol | ::Nil"}],"args_string":"(value : Clear::SQL::SelectBuilder | String | Symbol, var : String | Symbol | Nil = nil)","args_html":"(value : Clear::SQL::SelectBuilder | String | Symbol, var : String | Symbol | Nil = nil)","location":{"filename":"src/clear/sql/fragment/from.cr","line_number":8,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/fragment/from.cr#L8"},"def":{"name":"new","args":[{"name":"value","external_name":"value","restriction":"::Clear::SQL::SelectBuilder | ::String | ::Symbol"},{"name":"var","default_value":"nil","external_name":"var","restriction":"::String | ::Symbol | ::Nil"}],"visibility":"Public","body":"_ = allocate\n_.initialize(value, var)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"to_sql-instance-method","name":"to_sql","abstract":false,"location":{"filename":"src/clear/sql/fragment/from.cr","line_number":11,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/fragment/from.cr#L11"},"def":{"name":"to_sql","visibility":"Public","body":"v = value\ncase v\nwhen Symbol\n [Clear::SQL.escape(v), @var].compact.join(\" AS \")\nwhen String\n [v, @var].compact.join(\" AS \")\nwhen SQL::SelectBuilder\n if @var.nil?\n raise(Clear::ErrorMessages.query_building_error(\"Subquery `from` clause must have variable name\"))\n end\n [\"(#{v.to_sql})\", @var].compact.join(\" \")\nelse\n raise(Clear::ErrorMessages.query_building_error(\"Only String and SelectQuery objects are allowed as `from` declaration\"))\nend\n"}},{"html_id":"value:Selectable-instance-method","name":"value","abstract":false,"location":{"filename":"src/clear/sql/fragment/from.cr","line_number":5,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/fragment/from.cr#L5"},"def":{"name":"value","return_type":"Selectable","visibility":"Public","body":"@value"}},{"html_id":"value=(value:Selectable)-instance-method","name":"value=","abstract":false,"args":[{"name":"value","external_name":"value","restriction":"Selectable"}],"args_string":"(value : Selectable)","args_html":"(value : Selectable)","location":{"filename":"src/clear/sql/fragment/from.cr","line_number":5,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/fragment/from.cr#L5"},"def":{"name":"value=","args":[{"name":"value","external_name":"value","restriction":"Selectable"}],"visibility":"Public","body":"@value = value"}},{"html_id":"var:Symbolic|Nil-instance-method","name":"var","abstract":false,"location":{"filename":"src/clear/sql/fragment/from.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/fragment/from.cr#L6"},"def":{"name":"var","return_type":"Symbolic | ::Nil","visibility":"Public","body":"@var"}},{"html_id":"var=(var:Symbolic|Nil)-instance-method","name":"var=","abstract":false,"args":[{"name":"var","external_name":"var","restriction":"Symbolic | ::Nil"}],"args_string":"(var : Symbolic | Nil)","args_html":"(var : Symbolic | Nil)","location":{"filename":"src/clear/sql/fragment/from.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/fragment/from.cr#L6"},"def":{"name":"var=","args":[{"name":"var","external_name":"var","restriction":"Symbolic | ::Nil"}],"visibility":"Public","body":"@var = var"}}]},{"html_id":"clear/Clear/SQL/InsertQuery","path":"Clear/SQL/InsertQuery.html","kind":"class","full_name":"Clear::SQL::InsertQuery","name":"InsertQuery","abstract":false,"superclass":{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"clear/Clear/SQL/Query/OnConflict","kind":"module","full_name":"Clear::SQL::Query::OnConflict","name":"OnConflict"},{"html_id":"clear/Clear/SQL/Query/Connection","kind":"module","full_name":"Clear::SQL::Query::Connection","name":"Connection"},{"html_id":"clear/Clear/SQL/Query/Change","kind":"module","full_name":"Clear::SQL::Query::Change","name":"Change"},{"html_id":"clear/Clear/SQL/Query/CTE","kind":"module","full_name":"Clear::SQL::Query::CTE","name":"CTE"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/sql/insert_query.cr","line_number":18,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/insert_query.cr#L18"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"clear/Clear/SQL/Query/Change","kind":"module","full_name":"Clear::SQL::Query::Change","name":"Change"},{"html_id":"clear/Clear/SQL/Query/Connection","kind":"module","full_name":"Clear::SQL::Query::Connection","name":"Connection"},{"html_id":"clear/Clear/SQL/Query/CTE","kind":"module","full_name":"Clear::SQL::Query::CTE","name":"CTE"},{"html_id":"clear/Clear/SQL/Query/OnConflict","kind":"module","full_name":"Clear::SQL::Query::OnConflict","name":"OnConflict"}],"namespace":{"html_id":"clear/Clear/SQL","kind":"module","full_name":"Clear::SQL","name":"SQL"},"doc":"\nAn insert query\n\ncf. postgres documentation\n\n```\n[ WITH [ RECURSIVE ] with_query [, ...] ]\nINSERT INTO table_name [ AS alias ] [ ( column_name [, ...] ) ]\n { DEFAULT VALUES | VALUES ( { expression | DEFAULT } [, ...] ) [, ...] | query }\n [ ON CONFLICT [ conflict_target ] conflict_action ]\n [ RETURNING * | output_expression [ [ AS ] output_name ] [, ...] ]\n```","summary":"

An insert query

","constructors":[{"html_id":"new(table:Symbol|String,values)-class-method","name":"new","abstract":false,"args":[{"name":"table","external_name":"table","restriction":"Symbol | String"},{"name":"values","external_name":"values","restriction":""}],"args_string":"(table : Symbol | String, values)","args_html":"(table : Symbol | String, values)","location":{"filename":"src/clear/sql/insert_query.cr","line_number":33,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/insert_query.cr#L33"},"def":{"name":"new","args":[{"name":"table","external_name":"table","restriction":"Symbol | String"},{"name":"values","external_name":"values","restriction":""}],"visibility":"Public","body":"_ = allocate\n_.initialize(table, values)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new(table:Symbol|String)-class-method","name":"new","abstract":false,"args":[{"name":"table","external_name":"table","restriction":"Symbol | String"}],"args_string":"(table : Symbol | String)","args_html":"(table : Symbol | String)","location":{"filename":"src/clear/sql/insert_query.cr","line_number":30,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/insert_query.cr#L30"},"def":{"name":"new","args":[{"name":"table","external_name":"table","restriction":"Symbol | String"}],"visibility":"Public","body":"_ = allocate\n_.initialize(table)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"clear_values-instance-method","name":"clear_values","abstract":false,"location":{"filename":"src/clear/sql/insert_query.cr","line_number":85,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/insert_query.cr#L85"},"def":{"name":"clear_values","visibility":"Public","body":"@values = [] of Array(Inserable)\nchange!\n"}},{"html_id":"columns(*args:Array(String|Symbol))-instance-method","name":"columns","doc":"Used with values","summary":"

Used with values

","abstract":false,"args":[{"name":"args","external_name":"args","restriction":"::Array(::String | ::Symbol)"}],"args_string":"(*args : Array(String | Symbol))","args_html":"(*args : Array(String | Symbol))","location":{"filename":"src/clear/sql/insert_query.cr","line_number":138,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/insert_query.cr#L138"},"def":{"name":"columns","args":[{"name":"args","external_name":"args","restriction":"::Array(::String | ::Symbol)"}],"splat_index":0,"visibility":"Public","body":"@keys = args\nchange!\n"}},{"html_id":"execute(connection_name:String=\"default\"):Hash(String,Clear::SQL::Any)-instance-method","name":"execute","abstract":false,"args":[{"name":"connection_name","default_value":"\"default\"","external_name":"connection_name","restriction":"String"}],"args_string":"(connection_name : String = \"default\") : Hash(String, Clear::SQL::Any)","args_html":"(connection_name : String = "default") : Hash(String, Clear::SQL::Any)","location":{"filename":"src/clear/sql/insert_query.cr","line_number":71,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/insert_query.cr#L71"},"def":{"name":"execute","args":[{"name":"connection_name","default_value":"\"default\"","external_name":"connection_name","restriction":"String"}],"return_type":"Hash(String, ::Clear::SQL::Any)","visibility":"Public","body":"o = {} of String => ::Clear::SQL::Any\nif @returning.nil?\n s = to_sql\n Clear::SQL.execute(connection_name, s)\nelse\n fetch(connection_name) do |x|\n o = x\n end\nend\no\n"}},{"html_id":"fetch(connection_name:String=\"default\",&:Hash(String,Clear::SQL::Any)->Nil)-instance-method","name":"fetch","abstract":false,"args":[{"name":"connection_name","default_value":"\"default\"","external_name":"connection_name","restriction":"String"}],"args_string":"(connection_name : String = \"default\", & : Hash(String, Clear::SQL::Any) -> Nil)","args_html":"(connection_name : String = "default", & : Hash(String, Clear::SQL::Any) -> Nil)","location":{"filename":"src/clear/sql/insert_query.cr","line_number":40,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/insert_query.cr#L40"},"def":{"name":"fetch","args":[{"name":"connection_name","default_value":"\"default\"","external_name":"connection_name","restriction":"String"}],"yields":1,"block_arity":1,"block_arg":{"name":"","external_name":"","restriction":"(Hash(String, ::Clear::SQL::Any) -> Nil)"},"visibility":"Public","body":"h = {} of String => ::Clear::SQL::Any\nClear::SQL::ConnectionPool.with_connection(connection_name) do |cnx|\n begin\n sql = to_sql\n rs = Clear::SQL.log_query(sql) do\n cnx.query(sql)\n end\n fetch_result_set(h, rs) do |x|\n yield(x)\n end\n ensure\n rs.try(&.close)\n end\nend\n"}},{"html_id":"into(table:Symbol|String)-instance-method","name":"into","abstract":false,"args":[{"name":"table","external_name":"table","restriction":"Symbol | String"}],"args_string":"(table : Symbol | String)","args_html":"(table : Symbol | String)","location":{"filename":"src/clear/sql/insert_query.cr","line_number":37,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/insert_query.cr#L37"},"def":{"name":"into","args":[{"name":"table","external_name":"table","restriction":"Symbol | String"}],"visibility":"Public","body":"@table = table"}},{"html_id":"keys:Array(Symbolic)-instance-method","name":"keys","abstract":false,"location":{"filename":"src/clear/sql/insert_query.cr","line_number":25,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/insert_query.cr#L25"},"def":{"name":"keys","return_type":"Array(Symbolic)","visibility":"Public","body":"@keys"}},{"html_id":"returning(str:String)-instance-method","name":"returning","abstract":false,"args":[{"name":"str","external_name":"str","restriction":"String"}],"args_string":"(str : String)","args_html":"(str : String)","location":{"filename":"src/clear/sql/insert_query.cr","line_number":161,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/insert_query.cr#L161"},"def":{"name":"returning","args":[{"name":"str","external_name":"str","restriction":"String"}],"visibility":"Public","body":"@returning = str\nchange!\n"}},{"html_id":"returning:String|Nil-instance-method","name":"returning","abstract":false,"location":{"filename":"src/clear/sql/insert_query.cr","line_number":28,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/insert_query.cr#L28"},"def":{"name":"returning","return_type":"String | ::Nil","visibility":"Public","body":"@returning"}},{"html_id":"size:Int32-instance-method","name":"size","doc":"Number of rows of this insertion request","summary":"

Number of rows of this insertion request

","abstract":false,"location":{"filename":"src/clear/sql/insert_query.cr","line_number":168,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/insert_query.cr#L168"},"def":{"name":"size","return_type":"Int32","visibility":"Public","body":"v = @values\nv.is_a?(Array) ? v.size : -1\n"}},{"html_id":"table:Symbol|String-instance-method","name":"table","abstract":false,"location":{"filename":"src/clear/sql/insert_query.cr","line_number":27,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/insert_query.cr#L27"},"def":{"name":"table","return_type":"Symbol | String","visibility":"Public","body":"if (__temp_1 = @table).nil?\n ::raise(::NilAssertionError.new(\"Clear::SQL::InsertQuery#table cannot be nil\"))\nelse\n __temp_1\nend"}},{"html_id":"table?:Symbol|String|Nil-instance-method","name":"table?","abstract":false,"location":{"filename":"src/clear/sql/insert_query.cr","line_number":27,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/insert_query.cr#L27"},"def":{"name":"table?","return_type":"Symbol | String | ::Nil","visibility":"Public","body":"@table"}},{"html_id":"to_sql-instance-method","name":"to_sql","abstract":false,"location":{"filename":"src/clear/sql/insert_query.cr","line_number":187,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/insert_query.cr#L187"},"def":{"name":"to_sql","visibility":"Public","body":"if table = @table\nelse\n raise(QueryBuildingError.new(\"You must provide a `into` clause\"))\nend\ntable = table.is_a?(Symbol) ? Clear::SQL.escape(table) : table\no = [print_ctes, \"INSERT INTO\", table, print_keys]\nv = @values\ncase v\nwhen SelectBuilder\n o << ((\"(\" + v.to_sql) + \")\")\nelse\n if v.empty? || ((v.size == 1) && v[0].empty?)\n o << \"DEFAULT VALUES\"\n else\n o << \"VALUES\"\n o << print_values\n end\nend\nprint_on_conflict(o)\nif @returning\n o << \"RETURNING\"\n o << @returning\nend\no.compact.join(\" \")\n"}},{"html_id":"values(row:Hash(Symbolic,Inserable))-instance-method","name":"values","abstract":false,"args":[{"name":"row","external_name":"row","restriction":"Hash(Symbolic, Inserable)"}],"args_string":"(row : Hash(Symbolic, Inserable))","args_html":"(row : Hash(Symbolic, Inserable))","location":{"filename":"src/clear/sql/insert_query.cr","line_number":108,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/insert_query.cr#L108"},"def":{"name":"values","args":[{"name":"row","external_name":"row","restriction":"Hash(Symbolic, Inserable)"}],"visibility":"Public","body":"@keys = row.keys.to_a.map() do |__arg3|\n __arg3.as(Symbolic)\nend\ncase v = @values\nwhen Array(Array(Inserable))\n v << row.values.to_a.map() do |__arg4|\n __arg4.as(Inserable)\n end\nelse\n raise(\"Cannot insert both from SELECT query and from data\")\nend\nchange!\n"}},{"html_id":"values(rows:Array(Hash(Symbolic,Inserable)))-instance-method","name":"values","abstract":false,"args":[{"name":"rows","external_name":"rows","restriction":"Array(Hash(Symbolic, Inserable))"}],"args_string":"(rows : Array(Hash(Symbolic, Inserable)))","args_html":"(rows : Array(Hash(Symbolic, Inserable)))","location":{"filename":"src/clear/sql/insert_query.cr","line_number":129,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/insert_query.cr#L129"},"def":{"name":"values","args":[{"name":"rows","external_name":"rows","restriction":"Array(Hash(Symbolic, Inserable))"}],"visibility":"Public","body":"rows.each do |nt|\n values(nt)\nend\nchange!\n"}},{"html_id":"values(row:NamedTuple)-instance-method","name":"values","doc":"Fast insert system\n\ninsert({field: \"value\"}).into(:table)\n","summary":"

Fast insert system

","abstract":false,"args":[{"name":"row","external_name":"row","restriction":"NamedTuple"}],"args_string":"(row : NamedTuple)","args_html":"(row : NamedTuple)","location":{"filename":"src/clear/sql/insert_query.cr","line_number":95,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/insert_query.cr#L95"},"def":{"name":"values","args":[{"name":"row","external_name":"row","restriction":"NamedTuple"}],"visibility":"Public","body":"@keys = row.keys.to_a.map() do |__arg1|\n __arg1.as(Symbolic)\nend\ncase v = @values\nwhen Array(Array(Inserable))\n v << row.values.to_a.map() do |__arg2|\n __arg2.as(Inserable)\n end\nelse\n raise(\"Cannot insert both from SELECT query and from data\")\nend\nchange!\n"}},{"html_id":"values(rows:Array(NamedTuple))-instance-method","name":"values","abstract":false,"args":[{"name":"rows","external_name":"rows","restriction":"Array(NamedTuple)"}],"args_string":"(rows : Array(NamedTuple))","args_html":"(rows : Array(NamedTuple))","location":{"filename":"src/clear/sql/insert_query.cr","line_number":121,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/insert_query.cr#L121"},"def":{"name":"values","args":[{"name":"rows","external_name":"rows","restriction":"Array(NamedTuple)"}],"visibility":"Public","body":"rows.each do |nt|\n values(nt)\nend\nchange!\n"}},{"html_id":"values(select_query:SelectBuilder)-instance-method","name":"values","doc":"Insert into ... (...) SELECT","summary":"

Insert into ...

","abstract":false,"args":[{"name":"select_query","external_name":"select_query","restriction":"SelectBuilder"}],"args_string":"(select_query : SelectBuilder)","args_html":"(select_query : SelectBuilder)","location":{"filename":"src/clear/sql/insert_query.cr","line_number":151,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/insert_query.cr#L151"},"def":{"name":"values","args":[{"name":"select_query","external_name":"select_query","restriction":"SelectBuilder"}],"visibility":"Public","body":"if @values.is_a?(Array) && (@values.as(Array)).present?\n raise(QueryBuildingError.new(\"Cannot insert both from SELECT and from data\"))\nend\n@values = select_query\nchange!\n"}},{"html_id":"values:SelectBuilder|Array(Array(Inserable))-instance-method","name":"values","abstract":false,"location":{"filename":"src/clear/sql/insert_query.cr","line_number":26,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/insert_query.cr#L26"},"def":{"name":"values","return_type":"SelectBuilder | Array(Array(Inserable))","visibility":"Public","body":"@values"}},{"html_id":"values(*args)-instance-method","name":"values","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args)","args_html":"(*args)","location":{"filename":"src/clear/sql/insert_query.cr","line_number":144,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/insert_query.cr#L144"},"def":{"name":"values","args":[{"name":"args","external_name":"args","restriction":""}],"splat_index":0,"visibility":"Public","body":"@values << args\nchange!\n"}}],"types":[{"html_id":"clear/Clear/SQL/InsertQuery/Inserable","path":"Clear/SQL/InsertQuery/Inserable.html","kind":"alias","full_name":"Clear::SQL::InsertQuery::Inserable","name":"Inserable","abstract":false,"locations":[{"filename":"src/clear/sql/insert_query.cr","line_number":24,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/insert_query.cr#L24"}],"repository_name":"clear","program":false,"enum":false,"alias":true,"aliased":"(Array(PG::BoolArray) | Array(PG::CharArray) | Array(PG::Float32Array) | Array(PG::Float64Array) | Array(PG::Int16Array) | Array(PG::Int32Array) | Array(PG::Int64Array) | Array(PG::NumericArray) | Array(PG::StringArray) | Array(PG::TimeArray) | Array(PG::UUIDArray) | BigDecimal | BigFloat | BigInt | Bool | Char | Clear::Expression::Literal | Crypto::Bcrypt::Password | Float32 | Float64 | Int16 | Int32 | Int64 | Int8 | JSON::Any | JSON::PullParser | PG::Geo::Box | PG::Geo::Circle | PG::Geo::Line | PG::Geo::LineSegment | PG::Geo::Path | PG::Geo::Point | PG::Geo::Polygon | PG::Interval | PG::Numeric | Slice(UInt8) | String | Time | UInt16 | UInt32 | UInt64 | UInt8 | UUID | Nil)","aliased_html":"Array(PG::BoolArray) | Array(PG::CharArray) | Array(PG::Float32Array) | Array(PG::Float64Array) | Array(PG::Int16Array) | Array(PG::Int32Array) | Array(PG::Int64Array) | Array(PG::NumericArray) | Array(PG::StringArray) | Array(PG::TimeArray) | Array(PG::UUIDArray) | BigDecimal | BigFloat | BigInt | Bool | Char | Clear::Expression::Literal | Crypto::Bcrypt::Password | Float32 | Float64 | Int16 | Int32 | Int64 | Int8 | JSON::Any | JSON::PullParser | PG::Geo::Box | PG::Geo::Circle | PG::Geo::Line | PG::Geo::LineSegment | PG::Geo::Path | PG::Geo::Point | PG::Geo::Polygon | PG::Interval | PG::Numeric | Slice(UInt8) | String | Time | UInt16 | UInt32 | UInt64 | UInt8 | UUID | Nil","const":false,"namespace":{"html_id":"clear/Clear/SQL/InsertQuery","kind":"class","full_name":"Clear::SQL::InsertQuery","name":"InsertQuery"}}]},{"html_id":"clear/Clear/SQL/Join","path":"Clear/SQL/Join.html","kind":"struct","full_name":"Clear::SQL::Join","name":"Join","abstract":false,"superclass":{"html_id":"clear/Clear/SQL/Fragment","kind":"struct","full_name":"Clear::SQL::Fragment","name":"Fragment"},"ancestors":[{"html_id":"clear/Clear/SQL/Fragment","kind":"struct","full_name":"Clear::SQL::Fragment","name":"Fragment"},{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/sql/fragment/join.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/fragment/join.cr#L4"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"TYPE","name":"TYPE","value":"{left: \"LEFT JOIN\", inner: \"INNER JOIN\", right: \"RIGHT JOIN\", full_outer: \"FULL OUTER JOIN\", cross: \"CROSS JOIN\"}"}],"namespace":{"html_id":"clear/Clear/SQL","kind":"module","full_name":"Clear::SQL","name":"SQL"},"constructors":[{"html_id":"new(from:Clear::SQL::SelectBuilder|String|Symbol,condition:Clear::Expression::Node|Nil=nil,lateral:Bool=false,type:Symbol=:inner)-class-method","name":"new","abstract":false,"args":[{"name":"from","external_name":"from","restriction":"::Clear::SQL::SelectBuilder | ::String | ::Symbol"},{"name":"condition","default_value":"nil","external_name":"condition","restriction":"::Clear::Expression::Node | ::Nil"},{"name":"lateral","default_value":"false","external_name":"lateral","restriction":"::Bool"},{"name":"type","default_value":":inner","external_name":"type","restriction":"Symbol"}],"args_string":"(from : Clear::SQL::SelectBuilder | String | Symbol, condition : Clear::Expression::Node | Nil = nil, lateral : Bool = false, type : Symbol = :inner)","args_html":"(from : Clear::SQL::SelectBuilder | String | Symbol, condition : Clear::Expression::Node | Nil = nil, lateral : Bool = false, type : Symbol = :inner)","location":{"filename":"src/clear/sql/fragment/join.cr","line_number":16,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/fragment/join.cr#L16"},"def":{"name":"new","args":[{"name":"from","external_name":"from","restriction":"::Clear::SQL::SelectBuilder | ::String | ::Symbol"},{"name":"condition","default_value":"nil","external_name":"condition","restriction":"::Clear::Expression::Node | ::Nil"},{"name":"lateral","default_value":"false","external_name":"lateral","restriction":"::Bool"},{"name":"type","default_value":":inner","external_name":"type","restriction":"Symbol"}],"visibility":"Public","body":"_ = allocate\n_.initialize(from, condition, lateral, type)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"condition:Clear::Expression::Node|Nil-instance-method","name":"condition","abstract":false,"location":{"filename":"src/clear/sql/fragment/join.cr","line_number":13,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/fragment/join.cr#L13"},"def":{"name":"condition","return_type":"Clear::Expression::Node | ::Nil","visibility":"Public","body":"@condition"}},{"html_id":"from:Selectable-instance-method","name":"from","abstract":false,"location":{"filename":"src/clear/sql/fragment/join.cr","line_number":12,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/fragment/join.cr#L12"},"def":{"name":"from","return_type":"Selectable","visibility":"Public","body":"@from"}},{"html_id":"lateral?:Bool-instance-method","name":"lateral?","abstract":false,"location":{"filename":"src/clear/sql/fragment/join.cr","line_number":14,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/fragment/join.cr#L14"},"def":{"name":"lateral?","return_type":"Bool","visibility":"Public","body":"@lateral"}},{"html_id":"to_sql-instance-method","name":"to_sql","abstract":false,"location":{"filename":"src/clear/sql/fragment/join.cr","line_number":20,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/fragment/join.cr#L20"},"def":{"name":"to_sql","visibility":"Public","body":"from = @from\nfrom = case from\nwhen SQL::SelectBuilder\n \"(#{from.to_sql})\"\nelse\n from.to_s\nend\nif c = @condition\n [type, lateral? ? \"LATERAL\" : nil, from, \"ON\", c.resolve].compact.join(\" \")\nelse\n [type, lateral? ? \"LATERAL\" : nil, SQL.sel_str(from)].compact.join(\" \")\nend\n"}},{"html_id":"type:String-instance-method","name":"type","abstract":false,"location":{"filename":"src/clear/sql/fragment/join.cr","line_number":11,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/fragment/join.cr#L11"},"def":{"name":"type","return_type":"String","visibility":"Public","body":"@type"}}]},{"html_id":"clear/Clear/SQL/JSONB","path":"Clear/SQL/JSONB.html","kind":"module","full_name":"Clear::SQL::JSONB","name":"JSONB","abstract":false,"locations":[{"filename":"src/clear/extensions/jsonb/jsonb.cr","line_number":32,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/jsonb/jsonb.cr#L32"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"extended_modules":[{"html_id":"clear/Clear/SQL/JSONB","kind":"module","full_name":"Clear::SQL::JSONB","name":"JSONB"}],"including_types":[{"html_id":"clear/Clear/Expression/Node/JSONB/Equality","kind":"class","full_name":"Clear::Expression::Node::JSONB::Equality","name":"Equality"},{"html_id":"clear/Clear/Expression/Node/JSONB/Field","kind":"class","full_name":"Clear::Expression::Node::JSONB::Field","name":"Field"}],"namespace":{"html_id":"clear/Clear/SQL","kind":"module","full_name":"Clear::SQL","name":"SQL"},"instance_methods":[{"html_id":"jsonb_all_exists?(field,keys:Array(String))-instance-method","name":"jsonb_all_exists?","doc":"jsonb `?&` operator\nDo all of these array strings exist as top-level keys?","summary":"

jsonb ?& operator Do all of these array strings exist as top-level keys?

","abstract":false,"args":[{"name":"field","external_name":"field","restriction":""},{"name":"keys","external_name":"keys","restriction":"Array(String)"}],"args_string":"(field, keys : Array(String))","args_html":"(field, keys : Array(String))","location":{"filename":"src/clear/extensions/jsonb/jsonb.cr","line_number":56,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/jsonb/jsonb.cr#L56"},"def":{"name":"jsonb_all_exists?","args":[{"name":"field","external_name":"field","restriction":""},{"name":"keys","external_name":"keys","restriction":"Array(String)"}],"visibility":"Public","body":"{field, (\"array[\" + (keys.join(\",\") do |x|\n Clear::SQL.sanitize(x)\nend)) + \"]\"}.join(\" ?& \")"}},{"html_id":"jsonb_any_exists?(field,keys:Array(String))-instance-method","name":"jsonb_any_exists?","doc":"jsonb `?|` operator\nDo any of these array strings exist as top-level keys?","summary":"

jsonb ?| operator Do any of these array strings exist as top-level keys?

","abstract":false,"args":[{"name":"field","external_name":"field","restriction":""},{"name":"keys","external_name":"keys","restriction":"Array(String)"}],"args_string":"(field, keys : Array(String))","args_html":"(field, keys : Array(String))","location":{"filename":"src/clear/extensions/jsonb/jsonb.cr","line_number":45,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/jsonb/jsonb.cr#L45"},"def":{"name":"jsonb_any_exists?","args":[{"name":"field","external_name":"field","restriction":""},{"name":"keys","external_name":"keys","restriction":"Array(String)"}],"visibility":"Public","body":"{field, (\"array[\" + (keys.join(\",\") do |x|\n Clear::SQL.sanitize(x)\nend)) + \"]\"}.join(\" ?| \")"}},{"html_id":"jsonb_eq(field,key,value)-instance-method","name":"jsonb_eq","doc":"Test equality using the `@>` operator\n\n```\njsonb_eq(\"data.sub.key\", \"value\")\n```\n\n=> `data @> '{\"sub\": {\"key\": \"value\"}}' `","summary":"

Test equality using the @> operator

","abstract":false,"args":[{"name":"field","external_name":"field","restriction":""},{"name":"key","external_name":"key","restriction":""},{"name":"value","external_name":"value","restriction":""}],"args_string":"(field, key, value)","args_html":"(field, key, value)","location":{"filename":"src/clear/extensions/jsonb/jsonb.cr","line_number":112,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/jsonb/jsonb.cr#L112"},"def":{"name":"jsonb_eq","args":[{"name":"field","external_name":"field","restriction":""},{"name":"key","external_name":"key","restriction":""},{"name":"value","external_name":"value","restriction":""}],"visibility":"Public","body":"arr = jsonb_k2a(key)\nif arr.empty?\n {field, Clear::Expression[value]}.join(\" = \")\nelse\n {field, Clear::Expression[(jsonb_arr2h(arr, value)).to_json]}.join(\" @> \")\nend\n"}},{"html_id":"jsonb_exists?(field,value)-instance-method","name":"jsonb_exists?","doc":"Does the string exist as a top-level key within the JSON value?","summary":"

Does the string exist as a top-level key within the JSON value?

","abstract":false,"args":[{"name":"field","external_name":"field","restriction":""},{"name":"value","external_name":"value","restriction":""}],"args_string":"(field, value)","args_html":"(field, value)","location":{"filename":"src/clear/extensions/jsonb/jsonb.cr","line_number":50,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/jsonb/jsonb.cr#L50"},"def":{"name":"jsonb_exists?","args":[{"name":"field","external_name":"field","restriction":""},{"name":"value","external_name":"value","restriction":""}],"visibility":"Public","body":"{field, Clear::SQL.sanitize(value)}.join(\" ? \")"}},{"html_id":"jsonb_k2h(key:String,value:JSONBKey):JSONBHash-instance-method","name":"jsonb_k2h","doc":"Transform a key to a hash","summary":"

Transform a key to a hash

","abstract":false,"args":[{"name":"key","external_name":"key","restriction":"String"},{"name":"value","external_name":"value","restriction":"JSONBKey"}],"args_string":"(key : String, value : JSONBKey) : JSONBHash","args_html":"(key : String, value : JSONBKey) : JSONBHash","location":{"filename":"src/clear/extensions/jsonb/jsonb.cr","line_number":39,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/jsonb/jsonb.cr#L39"},"def":{"name":"jsonb_k2h","args":[{"name":"key","external_name":"key","restriction":"String"},{"name":"value","external_name":"value","restriction":"JSONBKey"}],"return_type":"JSONBHash","visibility":"Public","body":"jsonb_arr2h(jsonb_k2a(key), value)"}},{"html_id":"jsonb_resolve(field,arr:Array(String),cast=nil):String-instance-method","name":"jsonb_resolve","abstract":false,"args":[{"name":"field","external_name":"field","restriction":""},{"name":"arr","external_name":"arr","restriction":"Array(String)"},{"name":"cast","default_value":"nil","external_name":"cast","restriction":""}],"args_string":"(field, arr : Array(String), cast = nil) : String","args_html":"(field, arr : Array(String), cast = nil) : String","location":{"filename":"src/clear/extensions/jsonb/jsonb.cr","line_number":122,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/jsonb/jsonb.cr#L122"},"def":{"name":"jsonb_resolve","args":[{"name":"field","external_name":"field","restriction":""},{"name":"arr","external_name":"arr","restriction":"Array(String)"},{"name":"cast","default_value":"nil","external_name":"cast","restriction":""}],"return_type":"String","visibility":"Public","body":"if arr.empty?\n return field\nend\no = ([field] + Clear::Expression[arr]).join(\"->\")\nif cast\n o = \"(#{o})::#{cast}\"\nend\no\n"}},{"html_id":"jsonb_resolve(field,key:String,cast=nil)-instance-method","name":"jsonb_resolve","doc":"Return text selector for the field/key :\n\n```\njsonb_text(\"data\", \"sub.key\").like(\"user%\")\n# => \"data->'sub'->>'key' LIKE 'user%'\"\n```","summary":"

Return text selector for the field/key :

","abstract":false,"args":[{"name":"field","external_name":"field","restriction":""},{"name":"key","external_name":"key","restriction":"String"},{"name":"cast","default_value":"nil","external_name":"cast","restriction":""}],"args_string":"(field, key : String, cast = nil)","args_html":"(field, key : String, cast = nil)","location":{"filename":"src/clear/extensions/jsonb/jsonb.cr","line_number":138,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/jsonb/jsonb.cr#L138"},"def":{"name":"jsonb_resolve","args":[{"name":"field","external_name":"field","restriction":""},{"name":"key","external_name":"key","restriction":"String"},{"name":"cast","default_value":"nil","external_name":"cast","restriction":""}],"visibility":"Public","body":"arr = jsonb_k2a(key)\njsonb_resolve(field, arr, cast)\n"}}],"types":[{"html_id":"clear/Clear/SQL/JSONB/JSONBHash","path":"Clear/SQL/JSONB/JSONBHash.html","kind":"alias","full_name":"Clear::SQL::JSONB::JSONBHash","name":"JSONBHash","abstract":false,"locations":[{"filename":"src/clear/extensions/jsonb/jsonb.cr","line_number":36,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/jsonb/jsonb.cr#L36"}],"repository_name":"clear","program":false,"enum":false,"alias":true,"aliased":"Hash(String, Clear::SQL::JSONB::JSONBKey)","aliased_html":"Hash(String, Clear::SQL::JSONB::JSONBKey)","const":false,"namespace":{"html_id":"clear/Clear/SQL/JSONB","kind":"module","full_name":"Clear::SQL::JSONB","name":"JSONB"}},{"html_id":"clear/Clear/SQL/JSONB/JSONBKey","path":"Clear/SQL/JSONB/JSONBKey.html","kind":"alias","full_name":"Clear::SQL::JSONB::JSONBKey","name":"JSONBKey","abstract":false,"locations":[{"filename":"src/clear/extensions/jsonb/jsonb.cr","line_number":35,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/jsonb/jsonb.cr#L35"}],"repository_name":"clear","program":false,"enum":false,"alias":true,"aliased":"(Bool | Clear::Expression::Literal | Float32 | Float64 | Hash(String, Clear::SQL::JSONB::JSONBKey) | Int16 | Int32 | Int64 | Int8 | String | Symbol | Time | UInt16 | UInt32 | UInt64 | UInt8 | Nil)","aliased_html":"Bool | Clear::Expression::Literal | Float32 | Float64 | Hash(String, Clear::SQL::JSONB::JSONBKey) | Int16 | Int32 | Int64 | Int8 | String | Symbol | Time | UInt16 | UInt32 | UInt64 | UInt8 | Nil","const":false,"namespace":{"html_id":"clear/Clear/SQL/JSONB","kind":"module","full_name":"Clear::SQL::JSONB","name":"JSONB"}}]},{"html_id":"clear/Clear/SQL/Logger","path":"Clear/SQL/Logger.html","kind":"module","full_name":"Clear::SQL::Logger","name":"Logger","abstract":false,"locations":[{"filename":"src/clear/sql/logger.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/logger.cr#L4"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"clear/Clear/SQL","kind":"module","full_name":"Clear::SQL","name":"SQL"}],"namespace":{"html_id":"clear/Clear/SQL","kind":"module","full_name":"Clear::SQL","name":"SQL"},"class_methods":[{"html_id":"colorize=(colorize:Bool)-class-method","name":"colorize=","abstract":false,"args":[{"name":"colorize","external_name":"colorize","restriction":"Bool"}],"args_string":"(colorize : Bool)","args_html":"(colorize : Bool)","location":{"filename":"src/clear/sql/logger.cr","line_number":5,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/logger.cr#L5"},"def":{"name":"colorize=","args":[{"name":"colorize","external_name":"colorize","restriction":"Bool"}],"visibility":"Public","body":"@@colorize = colorize"}},{"html_id":"colorize?:Bool-class-method","name":"colorize?","abstract":false,"location":{"filename":"src/clear/sql/logger.cr","line_number":5,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/logger.cr#L5"},"def":{"name":"colorize?","return_type":"Bool","visibility":"Public","body":"@@colorize"}},{"html_id":"colorize_query(qry:String)-class-method","name":"colorize_query","abstract":false,"args":[{"name":"qry","external_name":"qry","restriction":"String"}],"args_string":"(qry : String)","args_html":"(qry : String)","location":{"filename":"src/clear/sql/logger.cr","line_number":21,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/logger.cr#L21"},"def":{"name":"colorize_query","args":[{"name":"qry","external_name":"qry","restriction":"String"}],"visibility":"Public","body":"if @@colorize\nelse\n return qry\nend\no = (qry.to_s.split(/([a-zA-Z0-9_]+)/)).join(\"\") do |word|\n if SQL_KEYWORDS.includes?(word.upcase)\n word.colorize.bold.blue.to_s\n else\n if word =~ (/\\d+/)\n word.colorize.red\n else\n word.colorize.white\n end\n end\nend\no.gsub(/(--.*)$/) do |__arg0|\n __arg0.colorize.dark_gray\nend\n"}},{"html_id":"display_mn_sec(x):String-class-method","name":"display_mn_sec","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x) : String","args_html":"(x) : String","location":{"filename":"src/clear/sql/logger.cr","line_number":37,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/logger.cr#L37"},"def":{"name":"display_mn_sec","args":[{"name":"x","external_name":"x","restriction":""}],"return_type":"String","visibility":"Public","body":"mn = x.to_i / 60\nsc = x.to_i % 60\n({mn > 9 ? mn : \"0#{mn}\", sc > 9 ? sc : \"0#{sc}\"}.join(\"mn\")) + \"s\"\n"}},{"html_id":"display_time(x):String-class-method","name":"display_time","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x) : String","args_html":"(x) : String","location":{"filename":"src/clear/sql/logger.cr","line_number":44,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/logger.cr#L44"},"def":{"name":"display_time","args":[{"name":"x","external_name":"x","restriction":""}],"return_type":"String","visibility":"Public","body":"if x > 60\n display_mn_sec(x)\nelse\n if x > 1\n (\"%.2f\" % x) + \"s\"\n else\n if x > 0.001\n (1000 * x).to_i.to_s + \"ms\"\n else\n (1000000 * x).to_i.to_s + \"µs\"\n end\n end\nend"}}],"instance_methods":[{"html_id":"log_query(sql,&)-instance-method","name":"log_query","abstract":false,"args":[{"name":"sql","external_name":"sql","restriction":""}],"args_string":"(sql, &)","args_html":"(sql, &)","location":{"filename":"src/clear/sql/logger.cr","line_number":56,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/logger.cr#L56"},"def":{"name":"log_query","args":[{"name":"sql","external_name":"sql","restriction":""}],"yields":0,"block_arity":0,"visibility":"Public","body":"begin\n start_time = Time.monotonic\n o = yield\n elapsed_time = Time.monotonic - start_time\n Log.debug do\n (\"[\" + (Clear::SQL::Logger.display_time(elapsed_time.to_f)).colorize.bold.white.to_s) + \"] #{SQL::Logger.colorize_query(sql)}\"\n end\n o\nrescue e\n raise(Clear::SQL::Error.new(message: [e.message, \"Error caught, last query was:\", Clear::SQL::Logger.colorize_query(sql)].compact.join(\"\\n\"), cause: e))\nend"}}]},{"html_id":"clear/Clear/SQL/OperationNotPermittedError","path":"Clear/SQL/OperationNotPermittedError.html","kind":"class","full_name":"Clear::SQL::OperationNotPermittedError","name":"OperationNotPermittedError","abstract":false,"superclass":{"html_id":"clear/Clear/SQL/Error","kind":"class","full_name":"Clear::SQL::Error","name":"Error"},"ancestors":[{"html_id":"clear/Clear/SQL/Error","kind":"class","full_name":"Clear::SQL::Error","name":"Error"},{"html_id":"clear/Exception","kind":"class","full_name":"Exception","name":"Exception"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/sql/errors.cr","line_number":8,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/errors.cr#L8"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/SQL","kind":"module","full_name":"Clear::SQL","name":"SQL"}},{"html_id":"clear/Clear/SQL/Query","path":"Clear/SQL/Query.html","kind":"module","full_name":"Clear::SQL::Query","name":"Query","abstract":false,"locations":[{"filename":"src/clear/sql/query/aggregate.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/aggregate.cr#L1"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/SQL","kind":"module","full_name":"Clear::SQL","name":"SQL"},"types":[{"html_id":"clear/Clear/SQL/Query/Aggregate","path":"Clear/SQL/Query/Aggregate.html","kind":"module","full_name":"Clear::SQL::Query::Aggregate","name":"Aggregate","abstract":false,"locations":[{"filename":"src/clear/sql/query/aggregate.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/aggregate.cr#L1"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"clear/Clear/SQL/SelectBuilder","kind":"module","full_name":"Clear::SQL::SelectBuilder","name":"SelectBuilder"}],"namespace":{"html_id":"clear/Clear/SQL/Query","kind":"module","full_name":"Clear::SQL::Query","name":"Query"},"instance_methods":[{"html_id":"agg(field,x:X.class)forallX-instance-method","name":"agg","doc":"Call an custom aggregation function, like MEDIAN or other:\n\n```\nquery.agg(\"MEDIAN(age)\", Int64)\n```\n\nNote than COUNT, MIN, MAX, SUM and AVG are already conveniently mapped.\n\nThis return only one row, and should not be used with `group_by` (prefer pluck or fetch)","summary":"

Call an custom aggregation function, like MEDIAN or other:

","abstract":false,"args":[{"name":"field","external_name":"field","restriction":""},{"name":"x","external_name":"x","restriction":"X.class"}],"args_string":"(field, x : X.class) forall X","args_html":"(field, x : X.class) forall X","location":{"filename":"src/clear/sql/query/aggregate.cr","line_number":38,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/aggregate.cr#L38"},"def":{"name":"agg","args":[{"name":"field","external_name":"field","restriction":""},{"name":"x","external_name":"x","restriction":"X.class"}],"visibility":"Public","body":"(clear_select.select(field)).scalar(X)"}},{"html_id":"avg(field,x:X.class)forallX-instance-method","name":"avg","doc":"SQL aggregation function \"AVG\":\n\n```\nquery.avg(\"field\", Int64)\n```","summary":"

SQL aggregation function "AVG":

","abstract":false,"args":[{"name":"field","external_name":"field","restriction":""},{"name":"x","external_name":"x","restriction":"X.class"}],"args_string":"(field, x : X.class) forall X","args_html":"(field, x : X.class) forall X","location":{"filename":"src/clear/sql/query/aggregate.cr","line_number":48,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/aggregate.cr#L48"},"def":{"name":"avg","args":[{"name":"field","external_name":"field","restriction":""},{"name":"x","external_name":"x","restriction":"X.class"}],"visibility":"Public","body":"agg(\"AVG(#{field})\", X)"}},{"html_id":"count(type:X.class=Int64)forallX-instance-method","name":"count","doc":"Use SQL `COUNT` over your query, and return this number as a Int64\n\nas count return always a scalar, the usage of `COUNT(*) OVER GROUP BY` can be done by\nusing `pluck` or `select`","summary":"

Use SQL COUNT over your query, and return this number as a Int64

","abstract":false,"args":[{"name":"type","default_value":"Int64","external_name":"type","restriction":"X.class"}],"args_string":"(type : X.class = Int64) forall X","args_html":"(type : X.class = Int64) forall X","location":{"filename":"src/clear/sql/query/aggregate.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/aggregate.cr#L6"},"def":{"name":"count","args":[{"name":"type","default_value":"Int64","external_name":"type","restriction":"X.class"}],"visibility":"Public","body":"columns = @columns.dup\nif (@offset || @limit) || @group_bys\n subquery = is_distinct? ? self : (dup.clear_order_bys.clear_select.use_connection(connection_name)).select(\"1\")\n o = X.new(((Clear::SQL.select(\"COUNT(*)\")).from({query_count: subquery})).scalar(Int64))\nelse\n new_query = dup.clear_select.select(\"COUNT(*)\")\n o = X.new(new_query.scalar(Int64))\nend\n@columns = columns\no\n"}},{"html_id":"max(field,x:X.class)forallX-instance-method","name":"max","doc":"SQL aggregation function \"MAX\":\n\n```\nquery.max(\"field\", Int64)\n```","summary":"

SQL aggregation function "MAX":

","abstract":false,"args":[{"name":"field","external_name":"field","restriction":""},{"name":"x","external_name":"x","restriction":"X.class"}],"args_string":"(field, x : X.class) forall X","args_html":"(field, x : X.class) forall X","location":{"filename":"src/clear/sql/query/aggregate.cr","line_number":48,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/aggregate.cr#L48"},"def":{"name":"max","args":[{"name":"field","external_name":"field","restriction":""},{"name":"x","external_name":"x","restriction":"X.class"}],"visibility":"Public","body":"agg(\"MAX(#{field})\", X)"}},{"html_id":"min(field,x:X.class)forallX-instance-method","name":"min","doc":"SQL aggregation function \"MIN\":\n\n```\nquery.min(\"field\", Int64)\n```","summary":"

SQL aggregation function "MIN":

","abstract":false,"args":[{"name":"field","external_name":"field","restriction":""},{"name":"x","external_name":"x","restriction":"X.class"}],"args_string":"(field, x : X.class) forall X","args_html":"(field, x : X.class) forall X","location":{"filename":"src/clear/sql/query/aggregate.cr","line_number":48,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/aggregate.cr#L48"},"def":{"name":"min","args":[{"name":"field","external_name":"field","restriction":""},{"name":"x","external_name":"x","restriction":"X.class"}],"visibility":"Public","body":"agg(\"MIN(#{field})\", X)"}},{"html_id":"sum(field):Float64-instance-method","name":"sum","doc":"SUM through a field and return a Float64\nNote: This function is not safe injection-wise, so beware !.","summary":"

SUM through a field and return a Float64 Note: This function is not safe injection-wise, so beware !.

","abstract":false,"args":[{"name":"field","external_name":"field","restriction":""}],"args_string":"(field) : Float64","args_html":"(field) : Float64","location":{"filename":"src/clear/sql/query/aggregate.cr","line_number":44,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/aggregate.cr#L44"},"def":{"name":"sum","args":[{"name":"field","external_name":"field","restriction":""}],"return_type":"Float64","visibility":"Public","body":"(agg(\"SUM(#{field})\", Union(Int64 | PG::Numeric | Nil))).try(&.to_f) || 0.0"}}]},{"html_id":"clear/Clear/SQL/Query/BeforeQuery","path":"Clear/SQL/Query/BeforeQuery.html","kind":"module","full_name":"Clear::SQL::Query::BeforeQuery","name":"BeforeQuery","abstract":false,"locations":[{"filename":"src/clear/sql/query/before_query.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/before_query.cr#L1"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"clear/Clear/SQL/SelectBuilder","kind":"module","full_name":"Clear::SQL::SelectBuilder","name":"SelectBuilder"}],"namespace":{"html_id":"clear/Clear/SQL/Query","kind":"module","full_name":"Clear::SQL::Query","name":"Query"}},{"html_id":"clear/Clear/SQL/Query/Change","path":"Clear/SQL/Query/Change.html","kind":"module","full_name":"Clear::SQL::Query::Change","name":"Change","abstract":false,"locations":[{"filename":"src/clear/sql/query/change.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/change.cr#L1"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"clear/Clear/SQL/DeleteQuery","kind":"class","full_name":"Clear::SQL::DeleteQuery","name":"DeleteQuery"},{"html_id":"clear/Clear/SQL/InsertQuery","kind":"class","full_name":"Clear::SQL::InsertQuery","name":"InsertQuery"},{"html_id":"clear/Clear/SQL/SelectBuilder","kind":"module","full_name":"Clear::SQL::SelectBuilder","name":"SelectBuilder"},{"html_id":"clear/Clear/SQL/UpdateQuery","kind":"class","full_name":"Clear::SQL::UpdateQuery","name":"UpdateQuery"}],"namespace":{"html_id":"clear/Clear/SQL/Query","kind":"module","full_name":"Clear::SQL::Query","name":"Query"},"instance_methods":[{"html_id":"change!:self-instance-method","name":"change!","doc":"This method is called everytime the request has been changed\nBy default, this do nothing and return `self`. However, it can be\nreimplemented to change some behavior when the query is changed\n\n(eg. it is by `Clear::Model::Collection`, to discard cache over collection)","summary":"

This method is called everytime the request has been changed By default, this do nothing and return self.

","abstract":false,"location":{"filename":"src/clear/sql/query/change.cr","line_number":7,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/change.cr#L7"},"def":{"name":"change!","return_type":"self","visibility":"Public","body":"self"}}]},{"html_id":"clear/Clear/SQL/Query/Connection","path":"Clear/SQL/Query/Connection.html","kind":"module","full_name":"Clear::SQL::Query::Connection","name":"Connection","abstract":false,"locations":[{"filename":"src/clear/sql/query/connection.cr","line_number":2,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/connection.cr#L2"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"clear/Clear/SQL/DeleteQuery","kind":"class","full_name":"Clear::SQL::DeleteQuery","name":"DeleteQuery"},{"html_id":"clear/Clear/SQL/InsertQuery","kind":"class","full_name":"Clear::SQL::InsertQuery","name":"InsertQuery"},{"html_id":"clear/Clear/SQL/SelectBuilder","kind":"module","full_name":"Clear::SQL::SelectBuilder","name":"SelectBuilder"},{"html_id":"clear/Clear/SQL/UpdateQuery","kind":"class","full_name":"Clear::SQL::UpdateQuery","name":"UpdateQuery"}],"namespace":{"html_id":"clear/Clear/SQL/Query","kind":"module","full_name":"Clear::SQL::Query","name":"Query"},"instance_methods":[{"html_id":"connection_name:String-instance-method","name":"connection_name","doc":"Connection used by the query.\nChange it using `use_connection` method","summary":"

Connection used by the query.

","abstract":false,"location":{"filename":"src/clear/sql/query/connection.cr","line_number":5,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/connection.cr#L5"},"def":{"name":"connection_name","return_type":"String","visibility":"Public","body":"@connection_name"}},{"html_id":"use_connection(connection_name:String)-instance-method","name":"use_connection","doc":"Change the connection used by the query on execution","summary":"

Change the connection used by the query on execution

","abstract":false,"args":[{"name":"connection_name","external_name":"connection_name","restriction":"String"}],"args_string":"(connection_name : String)","args_html":"(connection_name : String)","location":{"filename":"src/clear/sql/query/connection.cr","line_number":8,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/connection.cr#L8"},"def":{"name":"use_connection","args":[{"name":"connection_name","external_name":"connection_name","restriction":"String"}],"visibility":"Public","body":"@connection_name = connection_name\nself\n"}}]},{"html_id":"clear/Clear/SQL/Query/CTE","path":"Clear/SQL/Query/CTE.html","kind":"module","full_name":"Clear::SQL::Query::CTE","name":"CTE","abstract":false,"locations":[{"filename":"src/clear/sql/query/cte.cr","line_number":2,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/cte.cr#L2"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"clear/Clear/SQL/InsertQuery","kind":"class","full_name":"Clear::SQL::InsertQuery","name":"InsertQuery"},{"html_id":"clear/Clear/SQL/SelectBuilder","kind":"module","full_name":"Clear::SQL::SelectBuilder","name":"SelectBuilder"},{"html_id":"clear/Clear/SQL/UpdateQuery","kind":"class","full_name":"Clear::SQL::UpdateQuery","name":"UpdateQuery"}],"namespace":{"html_id":"clear/Clear/SQL/Query","kind":"module","full_name":"Clear::SQL::Query","name":"Query"},"doc":"Allow usage of Common Table Expressions (CTE) in the query building","summary":"

Allow usage of Common Table Expressions (CTE) in the query building

","instance_methods":[{"html_id":"cte:Hash(String,CTEAuthorized)-instance-method","name":"cte","doc":"List the current CTE of the query. The key is the name of the CTE,\nwhile the value is the fragment (string or Sub-select)","summary":"

List the current CTE of the query.

","abstract":false,"location":{"filename":"src/clear/sql/query/cte.cr","line_number":8,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/cte.cr#L8"},"def":{"name":"cte","return_type":"Hash(String, CTEAuthorized)","visibility":"Public","body":"@cte"}},{"html_id":"with_cte(name,request:CTEAuthorized)-instance-method","name":"with_cte","doc":"Add a CTE to the query.\n\n```\nClear::SQL.select.with_cte(\"full_year\",\n \"SELECT DATE(date)\"\n \"FROM generate_series(NOW() - INTERVAL '1 year', NOW(), '1 day'::interval) date\")\n .select(\"*\").from(\"full_year\")\n# WITH full_year AS ( SELECT DATE(date) ... ) SELECT * FROM full_year;\n```","summary":"

Add a CTE to the query.

","abstract":false,"args":[{"name":"name","external_name":"name","restriction":""},{"name":"request","external_name":"request","restriction":"CTEAuthorized"}],"args_string":"(name, request : CTEAuthorized)","args_html":"(name, request : CTEAuthorized)","location":{"filename":"src/clear/sql/query/cte.cr","line_number":19,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/cte.cr#L19"},"def":{"name":"with_cte","args":[{"name":"name","external_name":"name","restriction":""},{"name":"request","external_name":"request","restriction":"CTEAuthorized"}],"visibility":"Public","body":"cte[name] = request\nchange!\n"}},{"html_id":"with_cte(tuple:NamedTuple)-instance-method","name":"with_cte","doc":"Add a CTE to the query. Use NamedTuple convention:\n\n```\nClear::SQL.select.with_cte(cte: \"xxx\")\n# WITH cte AS xxx SELECT...\n```","summary":"

Add a CTE to the query.

","abstract":false,"args":[{"name":"tuple","external_name":"tuple","restriction":"NamedTuple"}],"args_string":"(tuple : NamedTuple)","args_html":"(tuple : NamedTuple)","location":{"filename":"src/clear/sql/query/cte.cr","line_number":30,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/cte.cr#L30"},"def":{"name":"with_cte","args":[{"name":"tuple","external_name":"tuple","restriction":"NamedTuple"}],"visibility":"Public","body":"tuple.each do |k, v|\n cte[k.to_s] = v\nend\nchange!\n"}}]},{"html_id":"clear/Clear/SQL/Query/Execute","path":"Clear/SQL/Query/Execute.html","kind":"module","full_name":"Clear::SQL::Query::Execute","name":"Execute","abstract":false,"locations":[{"filename":"src/clear/sql/query/execute.cr","line_number":3,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/execute.cr#L3"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"clear/Clear/SQL/DeleteQuery","kind":"class","full_name":"Clear::SQL::DeleteQuery","name":"DeleteQuery"},{"html_id":"clear/Clear/SQL/SelectBuilder","kind":"module","full_name":"Clear::SQL::SelectBuilder","name":"SelectBuilder"},{"html_id":"clear/Clear/SQL/UpdateQuery","kind":"class","full_name":"Clear::SQL::UpdateQuery","name":"UpdateQuery"}],"namespace":{"html_id":"clear/Clear/SQL/Query","kind":"module","full_name":"Clear::SQL::Query","name":"Query"},"instance_methods":[{"html_id":"execute(connection_name:String|Nil=nil)-instance-method","name":"execute","doc":"\nExecute an SQL statement which does not return anything.\n\nIf an optional `connection_name` parameter is given, this will\n override the connection used by the query.\n\n```\n%(default secondary).each do |cnx|\n Clear::SQL.select(\"pg_shards('xxx')\").execute(cnx)\nend\n```","summary":"

Execute an SQL statement which does not return anything.

","abstract":false,"args":[{"name":"connection_name","default_value":"nil","external_name":"connection_name","restriction":"String | ::Nil"}],"args_string":"(connection_name : String | Nil = nil)","args_html":"(connection_name : String | Nil = nil)","location":{"filename":"src/clear/sql/query/execute.cr","line_number":15,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/execute.cr#L15"},"def":{"name":"execute","args":[{"name":"connection_name","default_value":"nil","external_name":"connection_name","restriction":"String | ::Nil"}],"visibility":"Public","body":"Clear::SQL.execute(connection_name || self.connection_name, to_sql)"}}]},{"html_id":"clear/Clear/SQL/Query/Fetch","path":"Clear/SQL/Query/Fetch.html","kind":"module","full_name":"Clear::SQL::Query::Fetch","name":"Fetch","abstract":false,"locations":[{"filename":"src/clear/sql/query/fetch.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/fetch.cr#L1"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"clear/Clear/SQL/SelectBuilder","kind":"module","full_name":"Clear::SQL::SelectBuilder","name":"SelectBuilder"}],"namespace":{"html_id":"clear/Clear/SQL/Query","kind":"module","full_name":"Clear::SQL::Query","name":"Query"},"instance_methods":[{"html_id":"fetch(fetch_all=false,&:Hash(String,Clear::SQL::Any)->Nil)-instance-method","name":"fetch","doc":"Fetch the result set row per row\n`fetch_all` optional parameter is helpful in transactional environment, so it stores\nthe result and close the resultset before starting to call yield over the data\npreventing creation of a new connection if you need to call SQL into the\nyielded block.\n\n```\n# This is wrong: The connection is still busy retrieving the users:\nClear::SQL.select.from(\"users\").fetch do |u|\n Clear::SQL.select.from(\"posts\").where { u[\"id\"] == posts.id }\nend\n\n# Instead, use `fetch_all`\n# Clear will store the value of the result set in memory\n# before calling the block, and the connection is now ready to handle\n# another query.\nClear::SQL.select.from(\"users\").fetch(fetch_all: true) do |u|\n Clear::SQL.select.from(\"posts\").where { u[\"id\"] == posts.id }\nend\n```","summary":"

Fetch the result set row per row fetch_all optional parameter is helpful in transactional environment, so it stores the result and close the resultset before starting to call yield over the data preventing creation of a new connection if you need to call SQL into the yielded block.

","abstract":false,"args":[{"name":"fetch_all","default_value":"false","external_name":"fetch_all","restriction":""}],"args_string":"(fetch_all = false, & : Hash(String, Clear::SQL::Any) -> Nil)","args_html":"(fetch_all = false, & : Hash(String, Clear::SQL::Any) -> Nil)","location":{"filename":"src/clear/sql/query/fetch.cr","line_number":125,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/fetch.cr#L125"},"def":{"name":"fetch","args":[{"name":"fetch_all","default_value":"false","external_name":"fetch_all","restriction":""}],"yields":1,"block_arity":1,"block_arg":{"name":"","external_name":"","restriction":"(Hash(String, ::Clear::SQL::Any) -> Nil)"},"visibility":"Public","body":"trigger_before_query\nh = {} of String => ::Clear::SQL::Any\nsql = to_sql\nClear::SQL::ConnectionPool.with_connection(connection_name) do |cnx|\n rs = Clear::SQL.log_query(sql) do\n cnx.query(sql)\n end\n if fetch_all\n o = [] of Hash(String, ::Clear::SQL::Any)\n fetch_result_set(h, rs) do |x|\n o << x.dup\n end\n o.each do |x|\n yield(x)\n end\n else\n fetch_result_set(h, rs) do |x|\n yield(x)\n end\n end\nend\n"}},{"html_id":"fetch_first-instance-method","name":"fetch_first","doc":"Alias for `first` because first is redefined in Collection::Base\nobject to return a model instead.","summary":"

Alias for #first because first is redefined in Collection::Base object to return a model instead.

","abstract":false,"location":{"filename":"src/clear/sql/query/fetch.cr","line_number":75,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/fetch.cr#L75"},"def":{"name":"fetch_first","visibility":"Public","body":"(limit(1)).fetch(fetch_all: true) do |x|\n return x\nend\nnil\n"}},{"html_id":"fetch_first!-instance-method","name":"fetch_first!","abstract":false,"location":{"filename":"src/clear/sql/query/fetch.cr","line_number":81,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/fetch.cr#L81"},"def":{"name":"fetch_first!","visibility":"Public","body":"if o = fetch_first\n o\nelse\n raise(Clear::SQL::RecordNotFoundError.new)\nend"}},{"html_id":"fetch_with_cursor(count=1000,&:Hash(String,Clear::SQL::Any)->Nil)-instance-method","name":"fetch_with_cursor","doc":"Fetch the data using CURSOR.\nThis will prevent Clear to load all the data from the database into memory.\nThis is useful if you need to retrieve and update a large dataset.","summary":"

Fetch the data using CURSOR.

","abstract":false,"args":[{"name":"count","default_value":"1000","external_name":"count","restriction":""}],"args_string":"(count = 1000, & : Hash(String, Clear::SQL::Any) -> Nil)","args_html":"(count = 1000, & : Hash(String, Clear::SQL::Any) -> Nil)","location":{"filename":"src/clear/sql/query/fetch.cr","line_number":24,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/fetch.cr#L24"},"def":{"name":"fetch_with_cursor","args":[{"name":"count","default_value":"1000","external_name":"count","restriction":""}],"yields":1,"block_arity":1,"block_arg":{"name":"","external_name":"","restriction":"(Hash(String, ::Clear::SQL::Any) -> Nil)"},"visibility":"Public","body":"trigger_before_query\nClear::SQL.transaction do |cnx|\n cursor_name = \"__cursor_#{Time.local.to_unix ^ (rand * 268435455).to_i}__\"\n cursor_declaration = \"DECLARE #{cursor_name} CURSOR FOR #{to_sql}\"\n Clear::SQL.log_query(cursor_declaration) do\n cnx.exec(cursor_declaration)\n end\n h = {} of String => ::Clear::SQL::Any\n we_loop = true\n while we_loop\n fetch_query = \"FETCH #{count} FROM #{cursor_name}\"\n rs = Clear::SQL.log_query(fetch_query) do\n cnx.query(fetch_query)\n end\n o = Array(Hash(String, ::Clear::SQL::Any)).new(initial_capacity: count)\n we_loop = fetch_result_set(h, rs) do |x|\n o << x.dup\n end\n o.each do |hash|\n yield(hash)\n end\n end\nend\n"}},{"html_id":"first-instance-method","name":"first","doc":"Return the first line of the query as Hash(String, ::Clear::SQL::Any), or nil\nif not found","summary":"

Return the first line of the query as Hash(String, ::Clear::SQL::Any), or nil if not found

","abstract":false,"location":{"filename":"src/clear/sql/query/fetch.cr","line_number":65,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/fetch.cr#L65"},"def":{"name":"first","visibility":"Public","body":"fetch_first"}},{"html_id":"first!-instance-method","name":"first!","abstract":false,"location":{"filename":"src/clear/sql/query/fetch.cr","line_number":69,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/fetch.cr#L69"},"def":{"name":"first!","visibility":"Public","body":"fetch_first!"}},{"html_id":"scalar(type:T.class)forallT-instance-method","name":"scalar","doc":"Helpers to fetch a SELECT with only one row and one column return.","summary":"

Helpers to fetch a SELECT with only one row and one column return.

","abstract":false,"args":[{"name":"type","external_name":"type","restriction":"T.class"}],"args_string":"(type : T.class) forall T","args_html":"(type : T.class) forall T","location":{"filename":"src/clear/sql/query/fetch.cr","line_number":53,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/fetch.cr#L53"},"def":{"name":"scalar","args":[{"name":"type","external_name":"type","restriction":"T.class"}],"visibility":"Public","body":"trigger_before_query\nsql = to_sql\nClear::SQL.log_query(sql) do\n (Clear::SQL::ConnectionPool.with_connection(connection_name, &.scalar(sql))).as(T)\nend\n"}},{"html_id":"to_a:Array(Hash(String,Clear::SQL::Any))-instance-method","name":"to_a","doc":"Return an array with all the rows fetched.","summary":"

Return an array with all the rows fetched.

","abstract":false,"location":{"filename":"src/clear/sql/query/fetch.cr","line_number":90,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/fetch.cr#L90"},"def":{"name":"to_a","return_type":"Array(Hash(String, ::Clear::SQL::Any))","visibility":"Public","body":"trigger_before_query\nh = {} of String => ::Clear::SQL::Any\nsql = to_sql\nrs = Clear::SQL.log_query(sql) do\n Clear::SQL::ConnectionPool.with_connection(connection_name, &.query(sql))\nend\no = [] of Hash(String, ::Clear::SQL::Any)\nfetch_result_set(h, rs) do |x|\n o << x.dup\nend\no\n"}}]},{"html_id":"clear/Clear/SQL/Query/From","path":"Clear/SQL/Query/From.html","kind":"module","full_name":"Clear::SQL::Query::From","name":"From","abstract":false,"locations":[{"filename":"src/clear/sql/query/from.cr","line_number":2,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/from.cr#L2"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"clear/Clear/SQL/SelectBuilder","kind":"module","full_name":"Clear::SQL::SelectBuilder","name":"SelectBuilder"}],"namespace":{"html_id":"clear/Clear/SQL/Query","kind":"module","full_name":"Clear::SQL::Query","name":"Query"},"instance_methods":[{"html_id":"clear_from-instance-method","name":"clear_from","doc":"Clear the FROM clause and return `self`","summary":"

Clear the FROM clause and return self

","abstract":false,"location":{"filename":"src/clear/sql/query/from.cr","line_number":29,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/from.cr#L29"},"def":{"name":"clear_from","visibility":"Public","body":"@froms.clear\nchange!\n"}},{"html_id":"from(*args)-instance-method","name":"from","doc":"FROM fragment of the SQL query\n\n```\nClear::SQL.select.from(\"airplanes\").to_sql # < SELECT * FROM airplanes\n```","summary":"

FROM fragment of the SQL query

","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args)","args_html":"(*args)","location":{"filename":"src/clear/sql/query/from.cr","line_number":10,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/from.cr#L10"},"def":{"name":"from","args":[{"name":"args","external_name":"args","restriction":""}],"splat_index":0,"visibility":"Public","body":"args.each do |arg|\n case arg\n when NamedTuple\n arg.each do |k, v|\n @froms << (Clear::SQL::From.new(v, k.to_s))\n end\n else\n @froms << (Clear::SQL::From.new(arg))\n end\nend\nchange!\n"}},{"html_id":"from(**tuple)-instance-method","name":"from","abstract":false,"location":{"filename":"src/clear/sql/query/from.cr","line_number":23,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/from.cr#L23"},"def":{"name":"from","double_splat":{"name":"tuple","external_name":"tuple","restriction":""},"visibility":"Public","body":"tuple.each do |k, v|\n @froms << (Clear::SQL::From.new(v, k.to_s))\nend\nchange!\n"}},{"html_id":"froms:Array(SQL::From)-instance-method","name":"froms","abstract":false,"location":{"filename":"src/clear/sql/query/from.cr","line_number":3,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/from.cr#L3"},"def":{"name":"froms","return_type":"Array(SQL::From)","visibility":"Public","body":"@froms"}}]},{"html_id":"clear/Clear/SQL/Query/GroupBy","path":"Clear/SQL/Query/GroupBy.html","kind":"module","full_name":"Clear::SQL::Query::GroupBy","name":"GroupBy","abstract":false,"locations":[{"filename":"src/clear/sql/query/group_by.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/group_by.cr#L1"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"clear/Clear/SQL/SelectBuilder","kind":"module","full_name":"Clear::SQL::SelectBuilder","name":"SelectBuilder"}],"namespace":{"html_id":"clear/Clear/SQL/Query","kind":"module","full_name":"Clear::SQL::Query","name":"Query"},"instance_methods":[{"html_id":"clear_group_bys-instance-method","name":"clear_group_bys","abstract":false,"location":{"filename":"src/clear/sql/query/group_by.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/group_by.cr#L4"},"def":{"name":"clear_group_bys","visibility":"Public","body":"@group_bys.clear\nchange!\n"}},{"html_id":"group_by(column:Symbolic)-instance-method","name":"group_by","abstract":false,"args":[{"name":"column","external_name":"column","restriction":"Symbolic"}],"args_string":"(column : Symbolic)","args_html":"(column : Symbolic)","location":{"filename":"src/clear/sql/query/group_by.cr","line_number":9,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/group_by.cr#L9"},"def":{"name":"group_by","args":[{"name":"column","external_name":"column","restriction":"Symbolic"}],"visibility":"Public","body":"@group_bys << column\nchange!\n"}},{"html_id":"group_bys:Array(Symbolic)-instance-method","name":"group_bys","abstract":false,"location":{"filename":"src/clear/sql/query/group_by.cr","line_number":2,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/group_by.cr#L2"},"def":{"name":"group_bys","return_type":"Array(Symbolic)","visibility":"Public","body":"@group_bys"}}]},{"html_id":"clear/Clear/SQL/Query/Having","path":"Clear/SQL/Query/Having.html","kind":"module","full_name":"Clear::SQL::Query::Having","name":"Having","abstract":false,"locations":[{"filename":"src/clear/sql/query/having.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/having.cr#L1"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"clear/Clear/SQL/SelectBuilder","kind":"module","full_name":"Clear::SQL::SelectBuilder","name":"SelectBuilder"}],"namespace":{"html_id":"clear/Clear/SQL/Query","kind":"module","full_name":"Clear::SQL::Query","name":"Query"},"instance_methods":[{"html_id":"clear_havings-instance-method","name":"clear_havings","doc":"Clear all the having clauses and return `self`","summary":"

Clear all the having clauses and return self

","abstract":false,"location":{"filename":"src/clear/sql/query/having.cr","line_number":172,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/having.cr#L172"},"def":{"name":"clear_havings","visibility":"Public","body":"@havings.clear\nchange!\n"}},{"html_id":"having(node:Clear::Expression::Node)-instance-method","name":"having","doc":"Build SQL `having` condition using a Clear::Expression::Node\n\n```\nquery.having(Clear::Expression::Node::InArray.new(\"id\", ['1', '2', '3', '4']))\n# Note: in this example, InArray node use unsafe strings\n```\n\nIf useful for moving a having clause from a request to another one:\n\n```\nquery1.having { a == b } # having a = b\n```\n\n```\nquery2.having(query1.havings[0]) # HAVING a = b\n```","summary":"

Build SQL #having condition using a Clear::Expression::Node

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Clear::Expression::Node"}],"args_string":"(node : Clear::Expression::Node)","args_html":"(node : Clear::Expression::Node)","location":{"filename":"src/clear/sql/query/having.cr","line_number":22,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/having.cr#L22"},"def":{"name":"having","args":[{"name":"node","external_name":"node","restriction":"Clear::Expression::Node"}],"visibility":"Public","body":"@havings << node\nchange!\n"}},{"html_id":"having(&)-instance-method","name":"having","doc":"Build SQL `having` condition using the Expression engine.\n\n```\nquery.having { id == 1 }\n```","summary":"

Build SQL #having condition using the Expression engine.

","abstract":false,"location":{"filename":"src/clear/sql/query/having.cr","line_number":32,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/having.cr#L32"},"def":{"name":"having","yields":0,"block_arity":0,"visibility":"Public","body":"having(Clear::Expression.ensure_node!(with Clear::Expression.new yield))"}},{"html_id":"having(conditions:NamedTuple|Hash(String,Clear::SQL::Any))-instance-method","name":"having","doc":"Build SQL `having` condition using a NamedTuple.\nthis will use:\n\n- the `=` operator if compared with a literal\n\n```\nquery.having({keyword: \"hello\"}) # having keyword = 'hello'\n```\n\n- the `IN` operator if compared with an array:\n\n```\nquery.having({x: [1, 2]}) # having x in (1, 2)\n```\n\n- the `>=` and `<=` | `<` if compared with a range:\n\n```\nquery.having({x: (1..4)}) # having x >= 1 AND x <= 4\nquery.having({x: (1...4)}) # having x >= 1 AND x < 4\n```\n\n- You also can put another select query as argument:\n\n```\nquery.having({x: another_select}) # having x IN (SELECT ... )\n```","summary":"

Build SQL #having condition using a NamedTuple.

","abstract":false,"args":[{"name":"conditions","external_name":"conditions","restriction":"NamedTuple | Hash(String, Clear::SQL::Any)"}],"args_string":"(conditions : NamedTuple | Hash(String, Clear::SQL::Any))","args_html":"(conditions : NamedTuple | Hash(String, Clear::SQL::Any))","location":{"filename":"src/clear/sql/query/having.cr","line_number":67,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/having.cr#L67"},"def":{"name":"having","args":[{"name":"conditions","external_name":"conditions","restriction":"NamedTuple | Hash(String, Clear::SQL::Any)"}],"visibility":"Public","body":"conditions.each do |k, v|\n k = Clear::Expression::Node::Variable.new(k.to_s)\n @havings << (case v\n when Array\n Clear::Expression::Node::InArray.new(k, v.map do |it|\n Clear::Expression[it]\n end)\n when SelectBuilder\n Clear::Expression::Node::InSelect.new(k, v)\n when Range\n Clear::Expression::Node::InRange.new(k, Clear::Expression[v.begin]..Clear::Expression[v.end], v.exclusive?)\n else\n Clear::Expression::Node::DoubleOperator.new(k, Clear::Expression::Node::Literal.new(v), (v.nil? ? \"IS\" : \"=\"))\n end)\nend\nchange!\n"}},{"html_id":"having(template:String,*args)-instance-method","name":"having","doc":"Build SQL `having` condition using a template string and\ninterpolating `?` characters with parameters given in a tuple or array.\n\n```\nhaving(\"x = ? OR y = ?\", 1, \"l'eau\") # having x = 1 OR y = 'l''eau'\n```\n\nRaise error if there's not enough parameters to cover all the `?` placeholders","summary":"

Build SQL #having condition using a template string and interpolating ? characters with parameters given in a tuple or array.

","abstract":false,"args":[{"name":"template","external_name":"template","restriction":"String"},{"name":"args","external_name":"args","restriction":""}],"args_string":"(template : String, *args)","args_html":"(template : String, *args)","location":{"filename":"src/clear/sql/query/having.cr","line_number":110,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/having.cr#L110"},"def":{"name":"having","args":[{"name":"template","external_name":"template","restriction":"String"},{"name":"args","external_name":"args","restriction":""}],"splat_index":1,"visibility":"Public","body":"having(Clear::Expression::Node::Raw.new(Clear::SQL.raw(template, *args)))"}},{"html_id":"having(template:String,**tuple)-instance-method","name":"having","doc":"Build SQL `having` interpolating `:keyword` with the NamedTuple passed in argument.\n\n```\nhaving(\"id = :id OR date >= :start\", id: 1, start: 1.day.ago)\n# having id = 1 AND date >= '201x-xx-xx ...'\n```","summary":"

Build SQL #having interpolating :keyword with the NamedTuple passed in argument.

","abstract":false,"args":[{"name":"template","external_name":"template","restriction":"String"}],"args_string":"(template : String, **tuple)","args_html":"(template : String, **tuple)","location":{"filename":"src/clear/sql/query/having.cr","line_number":98,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/having.cr#L98"},"def":{"name":"having","args":[{"name":"template","external_name":"template","restriction":"String"}],"double_splat":{"name":"tuple","external_name":"tuple","restriction":""},"visibility":"Public","body":"having(Clear::Expression::Node::Raw.new(Clear::SQL.raw(template, **tuple)))"}},{"html_id":"having(**tuple)-instance-method","name":"having","abstract":false,"location":{"filename":"src/clear/sql/query/having.cr","line_number":36,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/having.cr#L36"},"def":{"name":"having","double_splat":{"name":"tuple","external_name":"tuple","restriction":""},"visibility":"Public","body":"having(conditions: tuple)"}},{"html_id":"or_having(node:Clear::Expression::Node)-instance-method","name":"or_having","doc":"Build SQL `or_having` condition using a Clear::Expression::Node\n\n```\nquery.or_having(Clear::Expression::Node::InArray.new(\"id\", ['1', '2', '3', '4']))\n# Note: in this example, InArray node use unsafe strings\n```\n\nIf useful for moving a having clause from a request to another one:\n\n```\nquery1.or_having { a == b } # having a = b\n```\n\n```\nquery2.or_having(query1.havings[0]) # having a = b\n```","summary":"

Build SQL #or_having condition using a Clear::Expression::Node

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Clear::Expression::Node"}],"args_string":"(node : Clear::Expression::Node)","args_html":"(node : Clear::Expression::Node)","location":{"filename":"src/clear/sql/query/having.cr","line_number":130,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/having.cr#L130"},"def":{"name":"or_having","args":[{"name":"node","external_name":"node","restriction":"Clear::Expression::Node"}],"visibility":"Public","body":"if @havings.empty?\n return having(node)\nend\nif (((@havings.size == 1) && (n = @havings.first)) && n.is_a?(Clear::Expression::Node::NodeArray)) && (n.link == \"OR\")\n n.expression << node\nelse\n if @havings.size == 1\n old_clause = @havings.first\n else\n old_clause = Clear::Expression::Node::NodeArray.new(@havings, \"AND\")\n end\n @havings.clear\n @havings << (Clear::Expression::Node::NodeArray.new([old_clause, node], \"OR\"))\nend\nchange!\n"}},{"html_id":"or_having(template:String,*args)-instance-method","name":"or_having","abstract":false,"args":[{"name":"template","external_name":"template","restriction":"String"},{"name":"args","external_name":"args","restriction":""}],"args_string":"(template : String, *args)","args_html":"(template : String, *args)","location":{"filename":"src/clear/sql/query/having.cr","line_number":158,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/having.cr#L158"},"def":{"name":"or_having","args":[{"name":"template","external_name":"template","restriction":"String"},{"name":"args","external_name":"args","restriction":""}],"splat_index":1,"visibility":"Public","body":"or_having(Clear::Expression::Node::Raw.new(Clear::Expression.raw(\"(#{template})\", *args)))"}},{"html_id":"or_having(template:String,**named_tuple)-instance-method","name":"or_having","abstract":false,"args":[{"name":"template","external_name":"template","restriction":"String"}],"args_string":"(template : String, **named_tuple)","args_html":"(template : String, **named_tuple)","location":{"filename":"src/clear/sql/query/having.cr","line_number":154,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/having.cr#L154"},"def":{"name":"or_having","args":[{"name":"template","external_name":"template","restriction":"String"}],"double_splat":{"name":"named_tuple","external_name":"named_tuple","restriction":""},"visibility":"Public","body":"or_having(Clear::Expression::Node::Raw.new(Clear::Expression.raw(\"(#{template})\", **named_tuple)))"}},{"html_id":"or_having(&)-instance-method","name":"or_having","doc":"Build SQL `having` condition using the Expression engine.\n\n```\nquery.or_having { id == 1 }\n```","summary":"

Build SQL #having condition using the Expression engine.

","abstract":false,"location":{"filename":"src/clear/sql/query/having.cr","line_number":167,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/having.cr#L167"},"def":{"name":"or_having","yields":0,"block_arity":0,"visibility":"Public","body":"or_having(Clear::Expression.ensure_node!(with Clear::Expression.new yield))"}}]},{"html_id":"clear/Clear/SQL/Query/Join","path":"Clear/SQL/Query/Join.html","kind":"module","full_name":"Clear::SQL::Query::Join","name":"Join","abstract":false,"locations":[{"filename":"src/clear/sql/query/join.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/join.cr#L1"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"clear/Clear/SQL/SelectBuilder","kind":"module","full_name":"Clear::SQL::SelectBuilder","name":"SelectBuilder"}],"namespace":{"html_id":"clear/Clear/SQL/Query","kind":"module","full_name":"Clear::SQL::Query","name":"Query"},"instance_methods":[{"html_id":"cross_join(name:Selectable,lateral=false)-instance-method","name":"cross_join","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Selectable"},{"name":"lateral","default_value":"false","external_name":"lateral","restriction":""}],"args_string":"(name : Selectable, lateral = false)","args_html":"(name : Selectable, lateral = false)","location":{"filename":"src/clear/sql/query/join.cr","line_number":26,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/join.cr#L26"},"def":{"name":"cross_join","args":[{"name":"name","external_name":"name","restriction":"Selectable"},{"name":"lateral","default_value":"false","external_name":"lateral","restriction":""}],"visibility":"Public","body":"join(name, :cross, lateral)"}},{"html_id":"full_outer_join(name:Selectable,lateral=false,&)-instance-method","name":"full_outer_join","doc":"Add a \"FULL_OUTER\" JOIN directive to the query","summary":"

Add a "FULL_OUTER" JOIN directive to the query

","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Selectable"},{"name":"lateral","default_value":"false","external_name":"lateral","restriction":""}],"args_string":"(name : Selectable, lateral = false, &)","args_html":"(name : Selectable, lateral = false, &)","location":{"filename":"src/clear/sql/query/join.cr","line_number":30,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/join.cr#L30"},"def":{"name":"full_outer_join","args":[{"name":"name","external_name":"name","restriction":"Selectable"},{"name":"lateral","default_value":"false","external_name":"lateral","restriction":""}],"yields":0,"block_arity":0,"visibility":"Public","body":"join_impl(name, :full_outer, lateral, Clear::Expression.ensure_node!(with Clear::Expression.new yield))"}},{"html_id":"full_outer_join(name:Selectable,condition:String=\"true\",lateral=false)-instance-method","name":"full_outer_join","doc":"Add a \"FULL_OUTER\" JOIN directive to the query","summary":"

Add a "FULL_OUTER" JOIN directive to the query

","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Selectable"},{"name":"condition","default_value":"\"true\"","external_name":"condition","restriction":"String"},{"name":"lateral","default_value":"false","external_name":"lateral","restriction":""}],"args_string":"(name : Selectable, condition : String = \"true\", lateral = false)","args_html":"(name : Selectable, condition : String = "true", lateral = false)","location":{"filename":"src/clear/sql/query/join.cr","line_number":30,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/join.cr#L30"},"def":{"name":"full_outer_join","args":[{"name":"name","external_name":"name","restriction":"Selectable"},{"name":"condition","default_value":"\"true\"","external_name":"condition","restriction":"String"},{"name":"lateral","default_value":"false","external_name":"lateral","restriction":""}],"visibility":"Public","body":"join_impl(name, :full_outer, lateral, Clear::Expression::Node::Raw.new((\"(\" + condition) + \")\"))"}},{"html_id":"inner_join(name:Selectable,lateral=false,&)-instance-method","name":"inner_join","doc":"Add a \"INNER\" JOIN directive to the query","summary":"

Add a "INNER" JOIN directive to the query

","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Selectable"},{"name":"lateral","default_value":"false","external_name":"lateral","restriction":""}],"args_string":"(name : Selectable, lateral = false, &)","args_html":"(name : Selectable, lateral = false, &)","location":{"filename":"src/clear/sql/query/join.cr","line_number":30,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/join.cr#L30"},"def":{"name":"inner_join","args":[{"name":"name","external_name":"name","restriction":"Selectable"},{"name":"lateral","default_value":"false","external_name":"lateral","restriction":""}],"yields":0,"block_arity":0,"visibility":"Public","body":"join_impl(name, :inner, lateral, Clear::Expression.ensure_node!(with Clear::Expression.new yield))"}},{"html_id":"inner_join(name:Selectable,condition:String=\"true\",lateral=false)-instance-method","name":"inner_join","doc":"Add a \"INNER\" JOIN directive to the query","summary":"

Add a "INNER" JOIN directive to the query

","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Selectable"},{"name":"condition","default_value":"\"true\"","external_name":"condition","restriction":"String"},{"name":"lateral","default_value":"false","external_name":"lateral","restriction":""}],"args_string":"(name : Selectable, condition : String = \"true\", lateral = false)","args_html":"(name : Selectable, condition : String = "true", lateral = false)","location":{"filename":"src/clear/sql/query/join.cr","line_number":30,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/join.cr#L30"},"def":{"name":"inner_join","args":[{"name":"name","external_name":"name","restriction":"Selectable"},{"name":"condition","default_value":"\"true\"","external_name":"condition","restriction":"String"},{"name":"lateral","default_value":"false","external_name":"lateral","restriction":""}],"visibility":"Public","body":"join_impl(name, :inner, lateral, Clear::Expression::Node::Raw.new((\"(\" + condition) + \")\"))"}},{"html_id":"join(name:Selectable,type=:inner,lateral=false,&)-instance-method","name":"join","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Selectable"},{"name":"type","default_value":":inner","external_name":"type","restriction":""},{"name":"lateral","default_value":"false","external_name":"lateral","restriction":""}],"args_string":"(name : Selectable, type = :inner, lateral = false, &)","args_html":"(name : Selectable, type = :inner, lateral = false, &)","location":{"filename":"src/clear/sql/query/join.cr","line_number":14,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/join.cr#L14"},"def":{"name":"join","args":[{"name":"name","external_name":"name","restriction":"Selectable"},{"name":"type","default_value":":inner","external_name":"type","restriction":""},{"name":"lateral","default_value":"false","external_name":"lateral","restriction":""}],"yields":0,"block_arity":0,"visibility":"Public","body":"join_impl(name, type, lateral, Clear::Expression.ensure_node!(with Clear::Expression.new yield))"}},{"html_id":"join(name:Selectable,type=:inner,condition:String=\"true\",lateral=false)-instance-method","name":"join","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Selectable"},{"name":"type","default_value":":inner","external_name":"type","restriction":""},{"name":"condition","default_value":"\"true\"","external_name":"condition","restriction":"String"},{"name":"lateral","default_value":"false","external_name":"lateral","restriction":""}],"args_string":"(name : Selectable, type = :inner, condition : String = \"true\", lateral = false)","args_html":"(name : Selectable, type = :inner, condition : String = "true", lateral = false)","location":{"filename":"src/clear/sql/query/join.cr","line_number":18,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/join.cr#L18"},"def":{"name":"join","args":[{"name":"name","external_name":"name","restriction":"Selectable"},{"name":"type","default_value":":inner","external_name":"type","restriction":""},{"name":"condition","default_value":"\"true\"","external_name":"condition","restriction":"String"},{"name":"lateral","default_value":"false","external_name":"lateral","restriction":""}],"visibility":"Public","body":"join_impl(name, type, lateral, Clear::Expression::Node::Raw.new((\"(\" + condition) + \")\"))"}},{"html_id":"join(name:Selectable,type=:inner,lateral=false)-instance-method","name":"join","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Selectable"},{"name":"type","default_value":":inner","external_name":"type","restriction":""},{"name":"lateral","default_value":"false","external_name":"lateral","restriction":""}],"args_string":"(name : Selectable, type = :inner, lateral = false)","args_html":"(name : Selectable, type = :inner, lateral = false)","location":{"filename":"src/clear/sql/query/join.cr","line_number":22,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/join.cr#L22"},"def":{"name":"join","args":[{"name":"name","external_name":"name","restriction":"Selectable"},{"name":"type","default_value":":inner","external_name":"type","restriction":""},{"name":"lateral","default_value":"false","external_name":"lateral","restriction":""}],"visibility":"Public","body":"join_impl(name, type, lateral, nil)"}},{"html_id":"left_join(name:Selectable,lateral=false,&)-instance-method","name":"left_join","doc":"Add a \"LEFT\" JOIN directive to the query","summary":"

Add a "LEFT" JOIN directive to the query

","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Selectable"},{"name":"lateral","default_value":"false","external_name":"lateral","restriction":""}],"args_string":"(name : Selectable, lateral = false, &)","args_html":"(name : Selectable, lateral = false, &)","location":{"filename":"src/clear/sql/query/join.cr","line_number":30,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/join.cr#L30"},"def":{"name":"left_join","args":[{"name":"name","external_name":"name","restriction":"Selectable"},{"name":"lateral","default_value":"false","external_name":"lateral","restriction":""}],"yields":0,"block_arity":0,"visibility":"Public","body":"join_impl(name, :left, lateral, Clear::Expression.ensure_node!(with Clear::Expression.new yield))"}},{"html_id":"left_join(name:Selectable,condition:String=\"true\",lateral=false)-instance-method","name":"left_join","doc":"Add a \"LEFT\" JOIN directive to the query","summary":"

Add a "LEFT" JOIN directive to the query

","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Selectable"},{"name":"condition","default_value":"\"true\"","external_name":"condition","restriction":"String"},{"name":"lateral","default_value":"false","external_name":"lateral","restriction":""}],"args_string":"(name : Selectable, condition : String = \"true\", lateral = false)","args_html":"(name : Selectable, condition : String = "true", lateral = false)","location":{"filename":"src/clear/sql/query/join.cr","line_number":30,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/join.cr#L30"},"def":{"name":"left_join","args":[{"name":"name","external_name":"name","restriction":"Selectable"},{"name":"condition","default_value":"\"true\"","external_name":"condition","restriction":"String"},{"name":"lateral","default_value":"false","external_name":"lateral","restriction":""}],"visibility":"Public","body":"join_impl(name, :left, lateral, Clear::Expression::Node::Raw.new((\"(\" + condition) + \")\"))"}},{"html_id":"right_join(name:Selectable,lateral=false,&)-instance-method","name":"right_join","doc":"Add a \"RIGHT\" JOIN directive to the query","summary":"

Add a "RIGHT" JOIN directive to the query

","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Selectable"},{"name":"lateral","default_value":"false","external_name":"lateral","restriction":""}],"args_string":"(name : Selectable, lateral = false, &)","args_html":"(name : Selectable, lateral = false, &)","location":{"filename":"src/clear/sql/query/join.cr","line_number":30,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/join.cr#L30"},"def":{"name":"right_join","args":[{"name":"name","external_name":"name","restriction":"Selectable"},{"name":"lateral","default_value":"false","external_name":"lateral","restriction":""}],"yields":0,"block_arity":0,"visibility":"Public","body":"join_impl(name, :right, lateral, Clear::Expression.ensure_node!(with Clear::Expression.new yield))"}},{"html_id":"right_join(name:Selectable,condition:String=\"true\",lateral=false)-instance-method","name":"right_join","doc":"Add a \"RIGHT\" JOIN directive to the query","summary":"

Add a "RIGHT" JOIN directive to the query

","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Selectable"},{"name":"condition","default_value":"\"true\"","external_name":"condition","restriction":"String"},{"name":"lateral","default_value":"false","external_name":"lateral","restriction":""}],"args_string":"(name : Selectable, condition : String = \"true\", lateral = false)","args_html":"(name : Selectable, condition : String = "true", lateral = false)","location":{"filename":"src/clear/sql/query/join.cr","line_number":30,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/join.cr#L30"},"def":{"name":"right_join","args":[{"name":"name","external_name":"name","restriction":"Selectable"},{"name":"condition","default_value":"\"true\"","external_name":"condition","restriction":"String"},{"name":"lateral","default_value":"false","external_name":"lateral","restriction":""}],"visibility":"Public","body":"join_impl(name, :right, lateral, Clear::Expression::Node::Raw.new((\"(\" + condition) + \")\"))"}}]},{"html_id":"clear/Clear/SQL/Query/Lock","path":"Clear/SQL/Query/Lock.html","kind":"module","full_name":"Clear::SQL::Query::Lock","name":"Lock","abstract":false,"locations":[{"filename":"src/clear/sql/query/lock.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/lock.cr#L1"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"clear/Clear/SQL/SelectBuilder","kind":"module","full_name":"Clear::SQL::SelectBuilder","name":"SelectBuilder"}],"namespace":{"html_id":"clear/Clear/SQL/Query","kind":"module","full_name":"Clear::SQL::Query","name":"Query"},"instance_methods":[{"html_id":"with_lock(str:String=\"FORUPDATE\")-instance-method","name":"with_lock","abstract":false,"args":[{"name":"str","default_value":"\"FOR UPDATE\"","external_name":"str","restriction":"String"}],"args_string":"(str : String = \"FOR UPDATE\")","args_html":"(str : String = "FOR UPDATE")","location":{"filename":"src/clear/sql/query/lock.cr","line_number":11,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/lock.cr#L11"},"def":{"name":"with_lock","args":[{"name":"str","default_value":"\"FOR UPDATE\"","external_name":"str","restriction":"String"}],"visibility":"Public","body":"@lock = str\nchange!\n"}}]},{"html_id":"clear/Clear/SQL/Query/OffsetLimit","path":"Clear/SQL/Query/OffsetLimit.html","kind":"module","full_name":"Clear::SQL::Query::OffsetLimit","name":"OffsetLimit","abstract":false,"locations":[{"filename":"src/clear/sql/query/offset_limit.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/offset_limit.cr#L1"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"clear/Clear/SQL/SelectBuilder","kind":"module","full_name":"Clear::SQL::SelectBuilder","name":"SelectBuilder"}],"namespace":{"html_id":"clear/Clear/SQL/Query","kind":"module","full_name":"Clear::SQL::Query","name":"Query"},"instance_methods":[{"html_id":"clear_limit-instance-method","name":"clear_limit","abstract":false,"location":{"filename":"src/clear/sql/query/offset_limit.cr","line_number":12,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/offset_limit.cr#L12"},"def":{"name":"clear_limit","visibility":"Public","body":"@limit = nil\nchange!\n"}},{"html_id":"clear_offset-instance-method","name":"clear_offset","abstract":false,"location":{"filename":"src/clear/sql/query/offset_limit.cr","line_number":17,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/offset_limit.cr#L17"},"def":{"name":"clear_offset","visibility":"Public","body":"@offset = nil\nchange!\n"}},{"html_id":"limit(x:Int|Nil)-instance-method","name":"limit","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Int | ::Nil"}],"args_string":"(x : Int | Nil)","args_html":"(x : Int | Nil)","location":{"filename":"src/clear/sql/query/offset_limit.cr","line_number":7,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/offset_limit.cr#L7"},"def":{"name":"limit","args":[{"name":"x","external_name":"x","restriction":"Int | ::Nil"}],"visibility":"Public","body":"@limit = Int64.new(x)\nchange!\n"}},{"html_id":"offset(x:Int|Nil)-instance-method","name":"offset","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Int | ::Nil"}],"args_string":"(x : Int | Nil)","args_html":"(x : Int | Nil)","location":{"filename":"src/clear/sql/query/offset_limit.cr","line_number":22,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/offset_limit.cr#L22"},"def":{"name":"offset","args":[{"name":"x","external_name":"x","restriction":"Int | ::Nil"}],"visibility":"Public","body":"@offset = Int64.new(x)\nchange!\n"}}]},{"html_id":"clear/Clear/SQL/Query/OnConflict","path":"Clear/SQL/Query/OnConflict.html","kind":"module","full_name":"Clear::SQL::Query::OnConflict","name":"OnConflict","abstract":false,"locations":[{"filename":"src/clear/sql/query/on_conflict.cr","line_number":3,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/on_conflict.cr#L3"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"clear/Clear/SQL/InsertQuery","kind":"class","full_name":"Clear::SQL::InsertQuery","name":"InsertQuery"}],"namespace":{"html_id":"clear/Clear/SQL/Query","kind":"module","full_name":"Clear::SQL::Query","name":"Query"},"instance_methods":[{"html_id":"clear_conflict-instance-method","name":"clear_conflict","abstract":false,"location":{"filename":"src/clear/sql/query/on_conflict.cr","line_number":58,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/on_conflict.cr#L58"},"def":{"name":"clear_conflict","visibility":"Public","body":"@on_conflict_condition = false"}},{"html_id":"conflict?-instance-method","name":"conflict?","abstract":false,"location":{"filename":"src/clear/sql/query/on_conflict.cr","line_number":54,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/on_conflict.cr#L54"},"def":{"name":"conflict?","visibility":"Public","body":"!!@on_conflict_condition"}},{"html_id":"do_conflict_action(str)-instance-method","name":"do_conflict_action","abstract":false,"args":[{"name":"str","external_name":"str","restriction":""}],"args_string":"(str)","args_html":"(str)","location":{"filename":"src/clear/sql/query/on_conflict.cr","line_number":23,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/on_conflict.cr#L23"},"def":{"name":"do_conflict_action","args":[{"name":"str","external_name":"str","restriction":""}],"visibility":"Public","body":"@on_conflict_action = \"#{str}\"\nchange!\n"}},{"html_id":"do_nothing-instance-method","name":"do_nothing","abstract":false,"location":{"filename":"src/clear/sql/query/on_conflict.cr","line_number":35,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/on_conflict.cr#L35"},"def":{"name":"do_nothing","visibility":"Public","body":"@on_conflict_action = \"NOTHING\"\nchange!\n"}},{"html_id":"do_update(&)-instance-method","name":"do_update","abstract":false,"location":{"filename":"src/clear/sql/query/on_conflict.cr","line_number":28,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/on_conflict.cr#L28"},"def":{"name":"do_update","yields":1,"block_arity":1,"visibility":"Public","body":"action = Clear::SQL::UpdateQuery.new(nil)\nyield(action)\n@on_conflict_action = action\nchange!\n"}},{"html_id":"on_conflict(constraint:String|Bool|OnConflictWhereClause=true)-instance-method","name":"on_conflict","abstract":false,"args":[{"name":"constraint","default_value":"true","external_name":"constraint","restriction":"String | Bool | OnConflictWhereClause"}],"args_string":"(constraint : String | Bool | OnConflictWhereClause = true)","args_html":"(constraint : String | Bool | OnConflictWhereClause = true)","location":{"filename":"src/clear/sql/query/on_conflict.cr","line_number":40,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/on_conflict.cr#L40"},"def":{"name":"on_conflict","args":[{"name":"constraint","default_value":"true","external_name":"constraint","restriction":"String | Bool | OnConflictWhereClause"}],"visibility":"Public","body":"@on_conflict_condition = constraint\nchange!\n"}},{"html_id":"on_conflict(&)-instance-method","name":"on_conflict","abstract":false,"location":{"filename":"src/clear/sql/query/on_conflict.cr","line_number":45,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/on_conflict.cr#L45"},"def":{"name":"on_conflict","yields":0,"block_arity":0,"visibility":"Public","body":"condition = OnConflictWhereClause.new\ncondition.where(Clear::Expression.ensure_node!(with Clear::Expression.new yield))\n@on_conflict_condition = condition\nchange!\n"}},{"html_id":"on_conflict_action:String|Clear::SQL::UpdateQuery-instance-method","name":"on_conflict_action","abstract":false,"location":{"filename":"src/clear/sql/query/on_conflict.cr","line_number":5,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/on_conflict.cr#L5"},"def":{"name":"on_conflict_action","return_type":"String | Clear::SQL::UpdateQuery","visibility":"Public","body":"@on_conflict_action"}},{"html_id":"on_conflict_condition:String|OnConflictWhereClause|Bool-instance-method","name":"on_conflict_condition","abstract":false,"location":{"filename":"src/clear/sql/query/on_conflict.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/on_conflict.cr#L4"},"def":{"name":"on_conflict_condition","return_type":"String | OnConflictWhereClause | Bool","visibility":"Public","body":"@on_conflict_condition"}}],"types":[{"html_id":"clear/Clear/SQL/Query/OnConflict/OnConflictWhereClause","path":"Clear/SQL/Query/OnConflict/OnConflictWhereClause.html","kind":"class","full_name":"Clear::SQL::Query::OnConflict::OnConflictWhereClause","name":"OnConflictWhereClause","abstract":false,"superclass":{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"clear/Clear/SQL/Query/Where","kind":"module","full_name":"Clear::SQL::Query::Where","name":"Where"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/sql/query/on_conflict.cr","line_number":8,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/on_conflict.cr#L8"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"clear/Clear/SQL/Query/Where","kind":"module","full_name":"Clear::SQL::Query::Where","name":"Where"}],"namespace":{"html_id":"clear/Clear/SQL/Query/OnConflict","kind":"module","full_name":"Clear::SQL::Query::OnConflict","name":"OnConflict"},"doc":"Fragment used when ON CONFLICT WHERE ...","summary":"

Fragment used when ON CONFLICT WHERE ...

","constructors":[{"html_id":"new-class-method","name":"new","abstract":false,"location":{"filename":"src/clear/sql/query/on_conflict.cr","line_number":11,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/on_conflict.cr#L11"},"def":{"name":"new","visibility":"Public","body":"_ = allocate\n_.initialize\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"change!-instance-method","name":"change!","abstract":false,"location":{"filename":"src/clear/sql/query/on_conflict.cr","line_number":19,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/on_conflict.cr#L19"},"def":{"name":"change!","visibility":"Public","body":""}},{"html_id":"to_s-instance-method","name":"to_s","doc":"Returns a nicely readable and concise string representation of this object,\ntypically intended for users.\n\nThis method should usually **not** be overridden. It delegates to\n`#to_s(IO)` which can be overridden for custom implementations.\n\nAlso see `#inspect`.","summary":"

Returns a nicely readable and concise string representation of this object, typically intended for users.

","abstract":false,"location":{"filename":"src/clear/sql/query/on_conflict.cr","line_number":15,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/on_conflict.cr#L15"},"def":{"name":"to_s","visibility":"Public","body":"print_wheres"}},{"html_id":"wheres:Array(Clear::Expression::Node)-instance-method","name":"wheres","doc":"Return the list of where clause; each where clause are transformed into\nClear::Expression::Node","summary":"

Return the list of where clause; each where clause are transformed into Clear::Expression::Node

","abstract":false,"def":{"name":"wheres","return_type":"Array(Clear::Expression::Node)","visibility":"Public","body":"@wheres"}}]}]},{"html_id":"clear/Clear/SQL/Query/OrderBy","path":"Clear/SQL/Query/OrderBy.html","kind":"module","full_name":"Clear::SQL::Query::OrderBy","name":"OrderBy","abstract":false,"locations":[{"filename":"src/clear/sql/query/order_by.cr","line_number":11,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/order_by.cr#L11"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"clear/Clear/SQL/SelectBuilder","kind":"module","full_name":"Clear::SQL::SelectBuilder","name":"SelectBuilder"}],"namespace":{"html_id":"clear/Clear/SQL/Query","kind":"module","full_name":"Clear::SQL::Query","name":"Query"},"doc":"Encode for:\n\n`ORDER BY expression [ASC | DESC | USING operator] [NULLS FIRST | NULLS LAST];`\n\nCurrent implementation:\n\n[x] Multiple Order by clauses\n[x] ASC/DESC\n[x] NULLS FIRST / NULLS LAST\n[ ] NOT IMPLEMENTED: USING OPERATOR","summary":"

Encode for:

","instance_methods":[{"html_id":"clear_order_bys-instance-method","name":"clear_order_bys","doc":"Remove all order by clauses","summary":"

Remove all order by clauses

","abstract":false,"location":{"filename":"src/clear/sql/query/order_by.cr","line_number":19,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/order_by.cr#L19"},"def":{"name":"clear_order_bys","visibility":"Public","body":"@order_bys.clear\nchange!\n"}},{"html_id":"order_by(tuple:NamedTuple)-instance-method","name":"order_by","doc":"Add multiple ORDER BY clause using a tuple:\n\n```\nquery = Clear::SQL.select.from(\"users\").order_by(id: :desc, name: {:asc, :nulls_last})\nquery.to_sql # > SELECT * FROM users ORDER BY \"id\" DESC, \"name\" ASC NULLS LAST\n```\n","summary":"

Add multiple ORDER BY clause using a tuple:

","abstract":false,"args":[{"name":"tuple","external_name":"tuple","restriction":"NamedTuple"}],"args_string":"(tuple : NamedTuple)","args_html":"(tuple : NamedTuple)","location":{"filename":"src/clear/sql/query/order_by.cr","line_number":81,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/order_by.cr#L81"},"def":{"name":"order_by","args":[{"name":"tuple","external_name":"tuple","restriction":"NamedTuple"}],"visibility":"Public","body":"tuple.each do |k, v|\n case v\n when Symbol, String\n order_by(k, v, nil)\n when Tuple\n order_by(k, v[0], v[1])\n else\n raise(\"order_by with namedtuple must be called with value of the tuple as Symbol, String or Tuple describing direction and nulls directive\")\n end\nend\nself\n"}},{"html_id":"order_by(expression:Symbol,direction:Symbol=:asc,nulls:Symbol|Nil=nil)-instance-method","name":"order_by","doc":"Add one ORDER BY clause\n\n```\nquery = Clear::SQL.select.from(\"users\").order_by(:id, :desc, nulls_last)\nquery.to_sql # > SELECT * FROM users ORDER BY \"id\" DESC NULLS LAST\n```","summary":"

Add one ORDER BY clause

","abstract":false,"args":[{"name":"expression","external_name":"expression","restriction":"Symbol"},{"name":"direction","default_value":":asc","external_name":"direction","restriction":"Symbol"},{"name":"nulls","default_value":"nil","external_name":"nulls","restriction":"Symbol | ::Nil"}],"args_string":"(expression : Symbol, direction : Symbol = :asc, nulls : Symbol | Nil = nil)","args_html":"(expression : Symbol, direction : Symbol = :asc, nulls : Symbol | Nil = nil)","location":{"filename":"src/clear/sql/query/order_by.cr","line_number":102,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/order_by.cr#L102"},"def":{"name":"order_by","args":[{"name":"expression","external_name":"expression","restriction":"Symbol"},{"name":"direction","default_value":":asc","external_name":"direction","restriction":"Symbol"},{"name":"nulls","default_value":"nil","external_name":"nulls","restriction":"Symbol | ::Nil"}],"visibility":"Public","body":"@order_bys << (Record.new(SQL.escape(expression.to_s), sanitize_direction(direction), sanitize_nulls(nulls)))\nchange!\n"}},{"html_id":"order_by(expression:String,direction:Symbol=:asc,nulls:Symbol|Nil=nil)-instance-method","name":"order_by","doc":"Add one ORDER BY clause\n\n```\nquery = Clear::SQL.select.from(\"users\").order_by(:id, :desc, nulls_last)\nquery.to_sql # > SELECT * FROM users ORDER BY \"id\" DESC NULLS LAST\n```","summary":"

Add one ORDER BY clause

","abstract":false,"args":[{"name":"expression","external_name":"expression","restriction":"String"},{"name":"direction","default_value":":asc","external_name":"direction","restriction":"Symbol"},{"name":"nulls","default_value":"nil","external_name":"nulls","restriction":"Symbol | ::Nil"}],"args_string":"(expression : String, direction : Symbol = :asc, nulls : Symbol | Nil = nil)","args_html":"(expression : String, direction : Symbol = :asc, nulls : Symbol | Nil = nil)","location":{"filename":"src/clear/sql/query/order_by.cr","line_number":108,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/order_by.cr#L108"},"def":{"name":"order_by","args":[{"name":"expression","external_name":"expression","restriction":"String"},{"name":"direction","default_value":":asc","external_name":"direction","restriction":"Symbol"},{"name":"nulls","default_value":"nil","external_name":"nulls","restriction":"Symbol | ::Nil"}],"visibility":"Public","body":"@order_bys << (Record.new(expression, sanitize_direction(direction), sanitize_nulls(nulls)))\nchange!\n"}},{"html_id":"order_by(**tuple)-instance-method","name":"order_by","doc":"Add multiple ORDER BY clause using a tuple:\n\n```\nquery = Clear::SQL.select.from(\"users\").order_by(id: :desc, name: {:asc, :nulls_last})\nquery.to_sql # > SELECT * FROM users ORDER BY \"id\" DESC, \"name\" ASC NULLS LAST\n```\n","summary":"

Add multiple ORDER BY clause using a tuple:

","abstract":false,"location":{"filename":"src/clear/sql/query/order_by.cr","line_number":76,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/order_by.cr#L76"},"def":{"name":"order_by","double_splat":{"name":"tuple","external_name":"tuple","restriction":""},"visibility":"Public","body":"order_by(tuple)"}},{"html_id":"reverse_order_by-instance-method","name":"reverse_order_by","doc":"Flip over all order bys by switching the ASC direction to DESC and the NULLS FIRST to NULLS LAST\n\n```\nquery = Clear::SQL.select.from(\"users\").order_by(id: :desc, name: :asc, company: {:asc, :nulls_last})\nquery.reverse_order_by\nquery.to_sql # SELECT * FROM users ORDER BY \"id\" ASC, \"name\" DESC, \"company\" DESC NULLS FIRST\n```\n\nreturn `self`","summary":"

Flip over all order bys by switching the ASC direction to DESC and the NULLS FIRST to NULLS LAST

","abstract":false,"location":{"filename":"src/clear/sql/query/order_by.cr","line_number":53,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/order_by.cr#L53"},"def":{"name":"reverse_order_by","visibility":"Public","body":"@order_bys = @order_bys.map do |rec|\n Record.new(rec.op, rec.dir == (:desc) ? :asc : :desc, rec.nulls.try do |n|\n n == (:nulls_last) ? :nulls_first : :nulls_last\n end)\nend\nchange!\n"}}],"types":[{"html_id":"clear/Clear/SQL/Query/OrderBy/Record","path":"Clear/SQL/Query/OrderBy/Record.html","kind":"struct","full_name":"Clear::SQL::Query::OrderBy::Record","name":"Record","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/sql/query/order_by.cr","line_number":12,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/order_by.cr#L12"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/SQL/Query/OrderBy","kind":"module","full_name":"Clear::SQL::Query::OrderBy","name":"OrderBy"},"constructors":[{"html_id":"new(op:String,dir:Symbol,nulls:Symbol|Nil)-class-method","name":"new","abstract":false,"args":[{"name":"op","external_name":"op","restriction":"String"},{"name":"dir","external_name":"dir","restriction":"Symbol"},{"name":"nulls","external_name":"nulls","restriction":"Symbol | ::Nil"}],"args_string":"(op : String, dir : Symbol, nulls : Symbol | Nil)","args_html":"(op : String, dir : Symbol, nulls : Symbol | Nil)","location":{"filename":"src/clear/sql/query/order_by.cr","line_number":12,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/order_by.cr#L12"},"def":{"name":"new","args":[{"name":"op","external_name":"op","restriction":"String"},{"name":"dir","external_name":"dir","restriction":"Symbol"},{"name":"nulls","external_name":"nulls","restriction":"Symbol | ::Nil"}],"visibility":"Public","body":"_ = allocate\n_.initialize(op, dir, nulls)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"clone-instance-method","name":"clone","abstract":false,"location":{"filename":"src/clear/sql/query/order_by.cr","line_number":12,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/order_by.cr#L12"},"def":{"name":"clone","visibility":"Public","body":"self.class.new(@op.clone, @dir.clone, @nulls.clone)"}},{"html_id":"copy_with(op_op=@op,dir_dir=@dir,nulls_nulls=@nulls)-instance-method","name":"copy_with","abstract":false,"args":[{"name":"_op","default_value":"@op","external_name":"op","restriction":""},{"name":"_dir","default_value":"@dir","external_name":"dir","restriction":""},{"name":"_nulls","default_value":"@nulls","external_name":"nulls","restriction":""}],"args_string":"(op _op = @op, dir _dir = @dir, nulls _nulls = @nulls)","args_html":"(op _op = @op, dir _dir = @dir, nulls _nulls = @nulls)","location":{"filename":"src/clear/sql/query/order_by.cr","line_number":12,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/order_by.cr#L12"},"def":{"name":"copy_with","args":[{"name":"_op","default_value":"@op","external_name":"op","restriction":""},{"name":"_dir","default_value":"@dir","external_name":"dir","restriction":""},{"name":"_nulls","default_value":"@nulls","external_name":"nulls","restriction":""}],"visibility":"Public","body":"self.class.new(_op, _dir, _nulls)"}},{"html_id":"dir:Symbol-instance-method","name":"dir","abstract":false,"def":{"name":"dir","return_type":"Symbol","visibility":"Public","body":"@dir"}},{"html_id":"nulls:Symbol|Nil-instance-method","name":"nulls","abstract":false,"def":{"name":"nulls","return_type":"Symbol | ::Nil","visibility":"Public","body":"@nulls"}},{"html_id":"op:String-instance-method","name":"op","abstract":false,"def":{"name":"op","return_type":"String","visibility":"Public","body":"@op"}}]}]},{"html_id":"clear/Clear/SQL/Query/Pluck","path":"Clear/SQL/Query/Pluck.html","kind":"module","full_name":"Clear::SQL::Query::Pluck","name":"Pluck","abstract":false,"locations":[{"filename":"src/clear/sql/query/pluck.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/pluck.cr#L1"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"clear/Clear/SQL/SelectBuilder","kind":"module","full_name":"Clear::SQL::SelectBuilder","name":"SelectBuilder"}],"namespace":{"html_id":"clear/Clear/SQL/Query","kind":"module","full_name":"Clear::SQL::Query","name":"Query"},"instance_methods":[{"html_id":"pluck(fields:Tuple(*T))forallT-instance-method","name":"pluck","doc":"Select specifics columns and return an array of Tuple(*Clear::SQL::Any) containing the columns in the order of the selected\narguments:\n\n```\nUser.query.pluck(\"first_name\", \"last_name\").each do |(first_name, last_name)|\n # ...\nend\n```","summary":"

Select specifics columns and return an array of Tuple(*Clear::SQL::Any) containing the columns in the order of the selected arguments:

","abstract":false,"args":[{"name":"fields","external_name":"fields","restriction":"Tuple(*T)"}],"args_string":"(fields : Tuple(*T)) forall T","args_html":"(fields : Tuple(*T)) forall T","location":{"filename":"src/clear/sql/query/pluck.cr","line_number":77,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/pluck.cr#L77"},"def":{"name":"pluck","args":[{"name":"fields","external_name":"fields","restriction":"Tuple(*T)"}],"visibility":"Public","body":"select_clause = fields.join(\", \") do |f|\n f.is_a?(Symbol) ? Clear::SQL.escape(f) : f.to_s\nend\nsql = (clear_select.select(select_clause)).to_sql\nClear::SQL::ConnectionPool.with_connection(connection_name) do |cnx|\n begin\n rs = Clear::SQL.log_query(sql) do\n cnx.query(sql)\n end\n {% if true %}\n o = [] of Tuple({% for t in T %}Clear::SQL::Any,{% end %})\n\n while rs.move_next\n o << { {% for t in T %} rs.read.as(Clear::SQL::Any), {% end %} }\n end\n o\n {% end %}\n ensure\n rs.try(&.close)\n end\nend\n"}},{"html_id":"pluck(*fields)-instance-method","name":"pluck","doc":"Select specifics columns and return an array of Tuple(*Clear::SQL::Any) containing the columns in the order of the selected\narguments:\n\n```\nUser.query.pluck(\"first_name\", \"last_name\").each do |(first_name, last_name)|\n # ...\nend\n```","summary":"

Select specifics columns and return an array of Tuple(*Clear::SQL::Any) containing the columns in the order of the selected arguments:

","abstract":false,"args":[{"name":"fields","external_name":"fields","restriction":""}],"args_string":"(*fields)","args_html":"(*fields)","location":{"filename":"src/clear/sql/query/pluck.cr","line_number":72,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/pluck.cr#L72"},"def":{"name":"pluck","args":[{"name":"fields","external_name":"fields","restriction":""}],"splat_index":0,"visibility":"Public","body":"pluck(fields)"}},{"html_id":"pluck(**fields:**T)forallT-instance-method","name":"pluck","doc":"Select specifics columns and returns on array of tuple of type of the named tuple passed as parameter:\n\n```\nUser.query.pluck(id: Int64, \"UPPER(last_name)\": String).each do #...\n```","summary":"

Select specifics columns and returns on array of tuple of type of the named tuple passed as parameter:

","abstract":false,"location":{"filename":"src/clear/sql/query/pluck.cr","line_number":102,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/pluck.cr#L102"},"def":{"name":"pluck","double_splat":{"name":"fields","external_name":"fields","restriction":"**T"},"visibility":"Public","body":"sql = (clear_select.select(fields.keys.join(\", \"))).to_sql\nClear::SQL::ConnectionPool.with_connection(connection_name) do |cnx|\n begin\n rs = Clear::SQL.log_query(sql) do\n cnx.query(sql)\n end\n {% if true %}\n o = [] of Tuple({% for k, v in T %}{{ v.instance }},{% end %})\n\n while rs.move_next\n o << { {% for k, v in T %} rs.read({{ v.instance }}), {% end %}}\n end\n o\n {% end %}\n ensure\n rs.try(&.close)\n end\nend\n"}},{"html_id":"pluck_col(field:Clear::SQL::Symbolic,type:T.class)forallT-instance-method","name":"pluck_col","doc":"Select a specific column of your SQL query, execute the query\nand return an array containing this field.\n\n```\nUser.query.pluck_col(\"id\") # [1,2,3,4...]\n```\n\nNote: It returns an array of `Clear::SQL::Any`. Therefore, you may want to use `pluck_col(str, Type)` to return\n an array of `Type`:\n\n```\nUser.query.pluck_col(\"id\", Int64)\n```\n\nThe field argument is a SQL fragment; it's not escaped (beware SQL injection) and allow call to functions\nand aggregate methods:\n\n```\n# ...\nUser.query.pluck_col(\"CASE WHEN id % 2 = 0 THEN id ELSE NULL END AS id\").each do\n# ...\n```","summary":"

Select a specific column of your SQL query, execute the query and return an array containing this field.

","abstract":false,"args":[{"name":"field","external_name":"field","restriction":"Clear::SQL::Symbolic"},{"name":"type","external_name":"type","restriction":"T.class"}],"args_string":"(field : Clear::SQL::Symbolic, type : T.class) forall T","args_html":"(field : Clear::SQL::Symbolic, type : T.class) forall T","location":{"filename":"src/clear/sql/query/pluck.cr","line_number":44,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/pluck.cr#L44"},"def":{"name":"pluck_col","args":[{"name":"field","external_name":"field","restriction":"Clear::SQL::Symbolic"},{"name":"type","external_name":"type","restriction":"T.class"}],"visibility":"Public","body":"if field.is_a?(Symbol)\n field = Clear::SQL.escape(field)\nend\nsql = (clear_select.select(field)).to_sql\nClear::SQL::ConnectionPool.with_connection(connection_name) do |cnx|\n begin\n rs = Clear::SQL.log_query(sql) do\n cnx.query(sql)\n end\n o = [] of T\n while rs.move_next\n o << (rs.read(T))\n end\n o\n ensure\n rs.try(&.close)\n end\nend\n"}},{"html_id":"pluck_col(field:Clear::SQL::Symbolic)-instance-method","name":"pluck_col","doc":"Select a specific column of your SQL query, execute the query\nand return an array containing this field.\n\n```\nUser.query.pluck_col(\"id\") # [1,2,3,4...]\n```\n\nNote: It returns an array of `Clear::SQL::Any`. Therefore, you may want to use `pluck_col(str, Type)` to return\n an array of `Type`:\n\n```\nUser.query.pluck_col(\"id\", Int64)\n```\n\nThe field argument is a SQL fragment; it's not escaped (beware SQL injection) and allow call to functions\nand aggregate methods:\n\n```\n# ...\nUser.query.pluck_col(\"CASE WHEN id % 2 = 0 THEN id ELSE NULL END AS id\").each do\n# ...\n```","summary":"

Select a specific column of your SQL query, execute the query and return an array containing this field.

","abstract":false,"args":[{"name":"field","external_name":"field","restriction":"Clear::SQL::Symbolic"}],"args_string":"(field : Clear::SQL::Symbolic)","args_html":"(field : Clear::SQL::Symbolic)","location":{"filename":"src/clear/sql/query/pluck.cr","line_number":24,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/pluck.cr#L24"},"def":{"name":"pluck_col","args":[{"name":"field","external_name":"field","restriction":"Clear::SQL::Symbolic"}],"visibility":"Public","body":"if field.is_a?(Symbol)\n field = Clear::SQL.escape(field)\nend\nsql = (clear_select.select(field)).to_sql\nClear::SQL::ConnectionPool.with_connection(connection_name) do |cnx|\n begin\n rs = Clear::SQL.log_query(sql) do\n cnx.query(sql)\n end\n o = [] of Clear::SQL::Any\n while rs.move_next\n o << (rs.read.as(Clear::SQL::Any))\n end\n o\n ensure\n rs.try(&.close)\n end\nend\n"}}]},{"html_id":"clear/Clear/SQL/Query/Select","path":"Clear/SQL/Query/Select.html","kind":"module","full_name":"Clear::SQL::Query::Select","name":"Select","abstract":false,"locations":[{"filename":"src/clear/sql/query/select.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/select.cr#L1"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"clear/Clear/SQL/SelectBuilder","kind":"module","full_name":"Clear::SQL::SelectBuilder","name":"SelectBuilder"}],"namespace":{"html_id":"clear/Clear/SQL/Query","kind":"module","full_name":"Clear::SQL::Query","name":"Query"},"instance_methods":[{"html_id":"clear_distinct-instance-method","name":"clear_distinct","doc":"Remove distinct","summary":"

Remove distinct

","abstract":false,"location":{"filename":"src/clear/sql/query/select.cr","line_number":43,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/select.cr#L43"},"def":{"name":"clear_distinct","visibility":"Public","body":"distinct(nil)"}},{"html_id":"clear_select-instance-method","name":"clear_select","abstract":false,"location":{"filename":"src/clear/sql/query/select.cr","line_number":66,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/select.cr#L66"},"def":{"name":"clear_select","visibility":"Public","body":"@columns.clear\nchange!\n"}},{"html_id":"default_wildcard_table=(table:String|Nil=nil)-instance-method","name":"default_wildcard_table=","doc":"In some case you want you query to return `table.*` instead of `*`\n if no select parameters has been set. This occurs in the case of joins\n between models.","summary":"

In some case you want you query to return table.* instead of * if no select parameters has been set.

","abstract":false,"args":[{"name":"table","default_value":"nil","external_name":"table","restriction":"String | ::Nil"}],"args_string":"(table : String | Nil = nil)","args_html":"(table : String | Nil = nil)","location":{"filename":"src/clear/sql/query/select.cr","line_number":17,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/select.cr#L17"},"def":{"name":"default_wildcard_table=","args":[{"name":"table","default_value":"nil","external_name":"table","restriction":"String | ::Nil"}],"visibility":"Public","body":"@default_wildcard_table = table\nchange!\n"}},{"html_id":"distinct(on:String|Nil=\"\")-instance-method","name":"distinct","doc":"Add DISTINCT to the SELECT part of the query\n\n- If `on` is blank (empty string, default), will call a simple `SELECT DISTINCT ...`\n- If `on` is nil, will remove the distinct (see `clear_distinct`)\n- If `on` is a non empty string, will call `SELECT DISTINCT ON (on) ...`\n","summary":"

Add DISTINCT to the SELECT part of the query

","abstract":false,"args":[{"name":"on","default_value":"\"\"","external_name":"on","restriction":"String | ::Nil"}],"args_string":"(on : String | Nil = \"\")","args_html":"(on : String | Nil = "")","location":{"filename":"src/clear/sql/query/select.cr","line_number":37,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/select.cr#L37"},"def":{"name":"distinct","args":[{"name":"on","default_value":"\"\"","external_name":"on","restriction":"String | ::Nil"}],"visibility":"Public","body":"@distinct_value = on\nchange!\n"}},{"html_id":"distinct_value:String|Nil-instance-method","name":"distinct_value","abstract":false,"location":{"filename":"src/clear/sql/query/select.cr","line_number":12,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/select.cr#L12"},"def":{"name":"distinct_value","return_type":"String | ::Nil","visibility":"Public","body":"@distinct_value"}},{"html_id":"select(c:Column)-instance-method","name":"select","doc":"def select(name : Symbolic, var = nil)\n @columns << Column.new(name, var)\n self\nend","summary":"

def select(name : Symbolic, var = nil) @columns << Column.new(name, var) self end

","abstract":false,"args":[{"name":"c","external_name":"c","restriction":"Column"}],"args_string":"(c : Column)","args_html":"(c : Column)","location":{"filename":"src/clear/sql/query/select.cr","line_number":26,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/select.cr#L26"},"def":{"name":"select","args":[{"name":"c","external_name":"c","restriction":"Column"}],"visibility":"Public","body":"@columns << c\nchange!\n"}},{"html_id":"select(*args)-instance-method","name":"select","doc":"Add field(s) to selection from tuple\n\n```\nselect({user_id: \"uid\", updated_at: \"updated_at\"})\n# => Output \"SELECT user_id as uid, updated_at as updated_at\"\n```","summary":"

Add field(s) to selection from tuple

","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args)","args_html":"(*args)","location":{"filename":"src/clear/sql/query/select.cr","line_number":53,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/select.cr#L53"},"def":{"name":"select","args":[{"name":"args","external_name":"args","restriction":""}],"splat_index":0,"visibility":"Public","body":"args.each do |arg|\n case arg\n when NamedTuple\n arg.each do |k, v|\n @columns << (Column.new(v, k.to_s))\n end\n else\n @columns << (Column.new(arg))\n end\nend\nchange!\n"}}]},{"html_id":"clear/Clear/SQL/Query/Where","path":"Clear/SQL/Query/Where.html","kind":"module","full_name":"Clear::SQL::Query::Where","name":"Where","abstract":false,"locations":[{"filename":"src/clear/sql/query/where.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/where.cr#L6"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"clear/Clear/SQL/DeleteQuery","kind":"class","full_name":"Clear::SQL::DeleteQuery","name":"DeleteQuery"},{"html_id":"clear/Clear/SQL/Query/OnConflict/OnConflictWhereClause","kind":"class","full_name":"Clear::SQL::Query::OnConflict::OnConflictWhereClause","name":"OnConflictWhereClause"},{"html_id":"clear/Clear/SQL/SelectBuilder","kind":"module","full_name":"Clear::SQL::SelectBuilder","name":"SelectBuilder"},{"html_id":"clear/Clear/SQL/UpdateQuery","kind":"class","full_name":"Clear::SQL::UpdateQuery","name":"UpdateQuery"}],"namespace":{"html_id":"clear/Clear/SQL/Query","kind":"module","full_name":"Clear::SQL::Query","name":"Query"},"doc":"Feature WHERE clause building.\neach call to where method stack where clause.\nTheses clauses are then combined together using the `AND` operator.\nTherefore, `query.where(\"a\").where(\"b\")` will return `a AND b`\n","summary":"

Feature WHERE clause building.

","instance_methods":[{"html_id":"clear_wheres-instance-method","name":"clear_wheres","doc":"Clear all the where clauses and return `self`","summary":"

Clear all the where clauses and return self

","abstract":false,"location":{"filename":"src/clear/sql/query/where.cr","line_number":190,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/where.cr#L190"},"def":{"name":"clear_wheres","visibility":"Public","body":"@wheres.clear\nchange!\n"}},{"html_id":"or_where(node:Clear::Expression::Node)-instance-method","name":"or_where","doc":"Build SQL `or_where` condition using a Clear::Expression::Node\n\n```\nquery.or_where(Clear::Expression::Node::InArray.new(\"id\", ['1', '2', '3', '4']))\n# Note: in this example, InArray node use unsafe strings\n```\n\nIf useful for moving a where clause from a request to another one:\n\n```\nquery1.or_where { a == b } # WHERE a = b\n```\n\n```\nquery2.or_where(query1.wheres[0]) # WHERE a = b\n```","summary":"

Build SQL #or_where condition using a Clear::Expression::Node

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Clear::Expression::Node"}],"args_string":"(node : Clear::Expression::Node)","args_html":"(node : Clear::Expression::Node)","location":{"filename":"src/clear/sql/query/where.cr","line_number":148,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/where.cr#L148"},"def":{"name":"or_where","args":[{"name":"node","external_name":"node","restriction":"Clear::Expression::Node"}],"visibility":"Public","body":"if @wheres.empty?\n return where(node)\nend\nif (((@wheres.size == 1) && (n = @wheres.first)) && n.is_a?(Clear::Expression::Node::NodeArray)) && (n.link == \"OR\")\n n.expression << node\nelse\n if @wheres.size == 1\n old_clause = @wheres.first\n else\n old_clause = Clear::Expression::Node::NodeArray.new(@wheres, \"AND\")\n end\n @wheres.clear\n @wheres << (Clear::Expression::Node::NodeArray.new([old_clause, node], \"OR\"))\nend\nchange!\n"}},{"html_id":"or_where(template:String,*args)-instance-method","name":"or_where","abstract":false,"args":[{"name":"template","external_name":"template","restriction":"String"},{"name":"args","external_name":"args","restriction":""}],"args_string":"(template : String, *args)","args_html":"(template : String, *args)","location":{"filename":"src/clear/sql/query/where.cr","line_number":176,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/where.cr#L176"},"def":{"name":"or_where","args":[{"name":"template","external_name":"template","restriction":"String"},{"name":"args","external_name":"args","restriction":""}],"splat_index":1,"visibility":"Public","body":"or_where(Clear::Expression::Node::Raw.new(Clear::Expression.raw(\"(#{template})\", *args)))"}},{"html_id":"or_where(template:String,**tuple)-instance-method","name":"or_where","abstract":false,"args":[{"name":"template","external_name":"template","restriction":"String"}],"args_string":"(template : String, **tuple)","args_html":"(template : String, **tuple)","location":{"filename":"src/clear/sql/query/where.cr","line_number":172,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/where.cr#L172"},"def":{"name":"or_where","args":[{"name":"template","external_name":"template","restriction":"String"}],"double_splat":{"name":"tuple","external_name":"tuple","restriction":""},"visibility":"Public","body":"or_where(Clear::Expression::Node::Raw.new(Clear::Expression.raw(\"(#{template})\", **tuple)))"}},{"html_id":"or_where(&)-instance-method","name":"or_where","doc":"Build SQL `where` condition using the Expression engine.\n\n```\nquery.or_where { id == 1 }\n```","summary":"

Build SQL #where condition using the Expression engine.

","abstract":false,"location":{"filename":"src/clear/sql/query/where.cr","line_number":185,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/where.cr#L185"},"def":{"name":"or_where","yields":0,"block_arity":0,"visibility":"Public","body":"or_where(Clear::Expression.ensure_node!(with Clear::Expression.new yield))"}},{"html_id":"where(node:Clear::Expression::Node)-instance-method","name":"where","doc":"Build SQL `where` condition using a Clear::Expression::Node\n\n```\nquery.where(Clear::Expression::Node::InArray.new(\"id\", ['1', '2', '3', '4']))\n# Note: in this example, InArray node use unsafe strings\n```\n\nIf useful for moving a where clause from a request to another one:\n\n```\nquery1.where { a == b } # WHERE a = b\n```\n\n```\nquery2.where(query1.wheres[0]) # WHERE a = b\n```","summary":"

Build SQL #where condition using a Clear::Expression::Node

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Clear::Expression::Node"}],"args_string":"(node : Clear::Expression::Node)","args_html":"(node : Clear::Expression::Node)","location":{"filename":"src/clear/sql/query/where.cr","line_number":29,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/where.cr#L29"},"def":{"name":"where","args":[{"name":"node","external_name":"node","restriction":"Clear::Expression::Node"}],"visibility":"Public","body":"@wheres << node\nchange!\n"}},{"html_id":"where(&)-instance-method","name":"where","doc":"Build SQL `where` condition using the Expression engine.\n\n```\nquery.where { id == 1 }\n```","summary":"

Build SQL #where condition using the Expression engine.

","abstract":false,"location":{"filename":"src/clear/sql/query/where.cr","line_number":40,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/where.cr#L40"},"def":{"name":"where","yields":0,"block_arity":0,"visibility":"Public","body":"where(Clear::Expression.ensure_node!(with Clear::Expression.new yield))"}},{"html_id":"where(conditions:NamedTuple|Hash(String,Clear::SQL::Any))-instance-method","name":"where","doc":"Build SQL `where` condition using a NamedTuple.\nthis will use:\n- the `=` operator if compared with a literal\n\n```\nquery.where({keyword: \"hello\"}) # WHERE keyword = 'hello'\n```\n\n- the `IN` operator if compared with an array:\n\n```\nquery.where({x: [1, 2]}) # WHERE x in (1,2)\n```\n\n- the `>=` and `<=` | `<` if compared with a range:\n\n```\nquery.where({x: (1..4)}) # WHERE x >= 1 AND x <= 4\nquery.where({x: (1...4)}) # WHERE x >= 1 AND x < 4\n```\n\n- You also can put another select query as argument:\n\n```\nquery.where({x: another_select}) # WHERE x IN (SELECT ... )\n```","summary":"

Build SQL #where condition using a NamedTuple.

","abstract":false,"args":[{"name":"conditions","external_name":"conditions","restriction":"NamedTuple | Hash(String, Clear::SQL::Any)"}],"args_string":"(conditions : NamedTuple | Hash(String, Clear::SQL::Any))","args_html":"(conditions : NamedTuple | Hash(String, Clear::SQL::Any))","location":{"filename":"src/clear/sql/query/where.cr","line_number":74,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/where.cr#L74"},"def":{"name":"where","args":[{"name":"conditions","external_name":"conditions","restriction":"NamedTuple | Hash(String, Clear::SQL::Any)"}],"visibility":"Public","body":"conditions.each do |k, v|\n k = Clear::Expression::Node::Variable.new(k.to_s)\n @wheres << (case v\n when Array\n Clear::Expression::Node::InArray.new(k, v.map do |it|\n Clear::Expression[it]\n end)\n when SelectBuilder\n Clear::Expression::Node::InSelect.new(k, v)\n when Range\n Clear::Expression::Node::InRange.new(k, Clear::Expression[v.begin]..Clear::Expression[v.end], v.exclusive?)\n else\n Clear::Expression::Node::DoubleOperator.new(k, Clear::Expression::Node::Literal.new(v), (v.nil? ? \"IS\" : \"=\"))\n end)\nend\nchange!\n"}},{"html_id":"where(template:String)-instance-method","name":"where","doc":"Build custom SQL `where`\nbeware of SQL injections!\n\n```\nwhere(\"ADD_SOME_DANGEROUS_SQL_HERE\") # WHERE ADD_SOME_DANGEROUS_SQL_HERE\n```","summary":"

Build custom SQL #where beware of SQL injections!

","abstract":false,"args":[{"name":"template","external_name":"template","restriction":"String"}],"args_string":"(template : String)","args_html":"(template : String)","location":{"filename":"src/clear/sql/query/where.cr","line_number":127,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/where.cr#L127"},"def":{"name":"where","args":[{"name":"template","external_name":"template","restriction":"String"}],"visibility":"Public","body":"@wheres << (Clear::Expression::Node::Raw.new(template))\nchange!\n"}},{"html_id":"where(template:String,*args)-instance-method","name":"where","doc":"Build SQL `where` condition using a template string and\ninterpolating `?` characters with parameters given in a tuple or array.\n\n```\nwhere(\"x = ? OR y = ?\", 1, \"l'eau\") # WHERE x = 1 OR y = 'l''eau'\n```\n\nRaise error if there's not enough parameters to cover all the `?` placeholders","summary":"

Build SQL #where condition using a template string and interpolating ? characters with parameters given in a tuple or array.

","abstract":false,"args":[{"name":"template","external_name":"template","restriction":"String"},{"name":"args","external_name":"args","restriction":""}],"args_string":"(template : String, *args)","args_html":"(template : String, *args)","location":{"filename":"src/clear/sql/query/where.cr","line_number":117,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/where.cr#L117"},"def":{"name":"where","args":[{"name":"template","external_name":"template","restriction":"String"},{"name":"args","external_name":"args","restriction":""}],"splat_index":1,"visibility":"Public","body":"where(Clear::Expression::Node::Raw.new(Clear::SQL.raw(template, *args)))"}},{"html_id":"where(template:String,**tuple)-instance-method","name":"where","doc":"Build SQL `where` interpolating `:keyword` with the NamedTuple passed in argument.\n\n```\nwhere(\"id = :id OR date >= :start\", id: 1, start: 1.day.ago)\n# WHERE id = 1 AND date >= '201x-xx-xx ...'\n```","summary":"

Build SQL #where interpolating :keyword with the NamedTuple passed in argument.

","abstract":false,"args":[{"name":"template","external_name":"template","restriction":"String"}],"args_string":"(template : String, **tuple)","args_html":"(template : String, **tuple)","location":{"filename":"src/clear/sql/query/where.cr","line_number":105,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/where.cr#L105"},"def":{"name":"where","args":[{"name":"template","external_name":"template","restriction":"String"}],"double_splat":{"name":"tuple","external_name":"tuple","restriction":""},"visibility":"Public","body":"where(Clear::Expression::Node::Raw.new(Clear::SQL.raw(template, **tuple)))"}},{"html_id":"where(**tuple)-instance-method","name":"where","abstract":false,"location":{"filename":"src/clear/sql/query/where.cr","line_number":44,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/where.cr#L44"},"def":{"name":"where","double_splat":{"name":"tuple","external_name":"tuple","restriction":""},"visibility":"Public","body":"where(conditions: tuple)"}}]},{"html_id":"clear/Clear/SQL/Query/Window","path":"Clear/SQL/Query/Window.html","kind":"module","full_name":"Clear::SQL::Query::Window","name":"Window","abstract":false,"locations":[{"filename":"src/clear/sql/query/window.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/window.cr#L1"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"clear/Clear/SQL/SelectBuilder","kind":"module","full_name":"Clear::SQL::SelectBuilder","name":"SelectBuilder"}],"namespace":{"html_id":"clear/Clear/SQL/Query","kind":"module","full_name":"Clear::SQL::Query","name":"Query"},"instance_methods":[{"html_id":"clear_windows-instance-method","name":"clear_windows","abstract":false,"location":{"filename":"src/clear/sql/query/window.cr","line_number":21,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/window.cr#L21"},"def":{"name":"clear_windows","visibility":"Public","body":"@windows.clear\nchange!\n"}},{"html_id":"print_windows-instance-method","name":"print_windows","abstract":false,"location":{"filename":"src/clear/sql/query/window.cr","line_number":27,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/window.cr#L27"},"def":{"name":"print_windows","visibility":"Public","body":"@windows.join do |name, value|\n {name.to_s, \" AS \", value}.join\nend"}},{"html_id":"window(name,value)-instance-method","name":"window","abstract":false,"args":[{"name":"name","external_name":"name","restriction":""},{"name":"value","external_name":"value","restriction":""}],"args_string":"(name, value)","args_html":"(name, value)","location":{"filename":"src/clear/sql/query/window.cr","line_number":15,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/window.cr#L15"},"def":{"name":"window","args":[{"name":"name","external_name":"name","restriction":""},{"name":"value","external_name":"value","restriction":""}],"visibility":"Public","body":"@windows << {name.to_s, value.to_s}\nchange!\n"}},{"html_id":"window(windows:NamedTuple)-instance-method","name":"window","abstract":false,"args":[{"name":"windows","external_name":"windows","restriction":"NamedTuple"}],"args_string":"(windows : NamedTuple)","args_html":"(windows : NamedTuple)","location":{"filename":"src/clear/sql/query/window.cr","line_number":7,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/window.cr#L7"},"def":{"name":"window","args":[{"name":"windows","external_name":"windows","restriction":"NamedTuple"}],"visibility":"Public","body":"windows.each do |k, v|\n @windows << {k.to_s, v.to_s}\nend\nchange!\n"}},{"html_id":"windows:Array(WindowDeclaration)-instance-method","name":"windows","doc":"eq. WINDOW window_name AS ( window_definition )","summary":"

eq.

","abstract":false,"location":{"filename":"src/clear/sql/query/window.cr","line_number":5,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/window.cr#L5"},"def":{"name":"windows","return_type":"Array(WindowDeclaration)","visibility":"Public","body":"@windows"}}],"types":[{"html_id":"clear/Clear/SQL/Query/Window/WindowDeclaration","path":"Clear/SQL/Query/Window/WindowDeclaration.html","kind":"alias","full_name":"Clear::SQL::Query::Window::WindowDeclaration","name":"WindowDeclaration","abstract":false,"locations":[{"filename":"src/clear/sql/query/window.cr","line_number":2,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/window.cr#L2"}],"repository_name":"clear","program":false,"enum":false,"alias":true,"aliased":"Tuple(String, String)","aliased_html":"{String, String}","const":false,"namespace":{"html_id":"clear/Clear/SQL/Query/Window","kind":"module","full_name":"Clear::SQL::Query::Window","name":"Window"}}]},{"html_id":"clear/Clear/SQL/Query/WithPagination","path":"Clear/SQL/Query/WithPagination.html","kind":"module","full_name":"Clear::SQL::Query::WithPagination","name":"WithPagination","abstract":false,"locations":[{"filename":"src/clear/sql/query/with_pagination.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/with_pagination.cr#L1"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"DEFAULT_LIMIT","name":"DEFAULT_LIMIT","value":"50"},{"id":"DEFAULT_PAGE","name":"DEFAULT_PAGE","value":"1"}],"including_types":[{"html_id":"clear/Clear/SQL/SelectBuilder","kind":"module","full_name":"Clear::SQL::SelectBuilder","name":"SelectBuilder"}],"namespace":{"html_id":"clear/Clear/SQL/Query","kind":"module","full_name":"Clear::SQL::Query","name":"Query"},"instance_methods":[{"html_id":"current_page-instance-method","name":"current_page","doc":"Return the current page","summary":"

Return the current page

","abstract":false,"location":{"filename":"src/clear/sql/query/with_pagination.cr","line_number":33,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/with_pagination.cr#L33"},"def":{"name":"current_page","visibility":"Public","body":"if offset.nil? || limit.nil?\n 1\nelse\n ((offset.as(Int64)) / (limit.as(Int64))) + 1\nend"}},{"html_id":"first_page?-instance-method","name":"first_page?","abstract":false,"location":{"filename":"src/clear/sql/query/with_pagination.cr","line_number":64,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/with_pagination.cr#L64"},"def":{"name":"first_page?","visibility":"Public","body":"current_page <= 1"}},{"html_id":"last_page?-instance-method","name":"last_page?","abstract":false,"location":{"filename":"src/clear/sql/query/with_pagination.cr","line_number":60,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/with_pagination.cr#L60"},"def":{"name":"last_page?","visibility":"Public","body":"next_page.nil?"}},{"html_id":"next_page-instance-method","name":"next_page","doc":"Return `current_page + 1` or `nil` if there is no next page","summary":"

Return current_page + 1 or nil if there is no next page

","abstract":false,"location":{"filename":"src/clear/sql/query/with_pagination.cr","line_number":56,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/with_pagination.cr#L56"},"def":{"name":"next_page","visibility":"Public","body":"current_page < total_pages ? (current_page + 1) : nil"}},{"html_id":"out_of_bounds?-instance-method","name":"out_of_bounds?","doc":"Helper method that is true when someone tries to fetch a page with a\nlarger number than the last page. Can be used in combination with flashes\nand redirecting.","summary":"

Helper method that is true when someone tries to fetch a page with a larger number than the last page.

","abstract":false,"location":{"filename":"src/clear/sql/query/with_pagination.cr","line_number":71,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/with_pagination.cr#L71"},"def":{"name":"out_of_bounds?","visibility":"Public","body":"current_page > total_pages"}},{"html_id":"paginate(page:Int32=DEFAULT_PAGE,per_page:Int32=DEFAULT_LIMIT)-instance-method","name":"paginate","doc":"Enter pagination mode.\nThis is helpful to manage paginated table.\nPagination will handle the page progression automatically and update\n`offset` and `limit` parameters by his own.\n\n```\npage = query.paginate(2, 50)\n```","summary":"

Enter pagination mode.

","abstract":false,"args":[{"name":"page","default_value":"DEFAULT_PAGE","external_name":"page","restriction":"Int32"},{"name":"per_page","default_value":"DEFAULT_LIMIT","external_name":"per_page","restriction":"Int32"}],"args_string":"(page : Int32 = DEFAULT_PAGE, per_page : Int32 = DEFAULT_LIMIT)","args_html":"(page : Int32 = DEFAULT_PAGE, per_page : Int32 = DEFAULT_LIMIT)","location":{"filename":"src/clear/sql/query/with_pagination.cr","line_number":17,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/with_pagination.cr#L17"},"def":{"name":"paginate","args":[{"name":"page","default_value":"DEFAULT_PAGE","external_name":"page","restriction":"Int32"},{"name":"per_page","default_value":"DEFAULT_LIMIT","external_name":"per_page","restriction":"Int32"}],"visibility":"Public","body":"clear_limit.clear_offset\n@total_entries = count\npage = {1, page}.max\n@limit = per_page.to_i64\n@offset = (per_page * (page - 1)).to_i64\nchange!\n"}},{"html_id":"per_page-instance-method","name":"per_page","doc":"Return the number of items maximum per page.","summary":"

Return the number of items maximum per page.

","abstract":false,"location":{"filename":"src/clear/sql/query/with_pagination.cr","line_number":28,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/with_pagination.cr#L28"},"def":{"name":"per_page","visibility":"Public","body":"limit"}},{"html_id":"previous_page-instance-method","name":"previous_page","doc":"Return `current_page - 1` or `nil` if there is no previous page","summary":"

Return current_page - 1 or nil if there is no previous page

","abstract":false,"location":{"filename":"src/clear/sql/query/with_pagination.cr","line_number":51,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/with_pagination.cr#L51"},"def":{"name":"previous_page","visibility":"Public","body":"current_page > 1 ? (current_page - 1) : nil"}},{"html_id":"total_pages-instance-method","name":"total_pages","doc":"Return the total number of pages.","summary":"

Return the total number of pages.

","abstract":false,"location":{"filename":"src/clear/sql/query/with_pagination.cr","line_number":42,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/query/with_pagination.cr#L42"},"def":{"name":"total_pages","visibility":"Public","body":"if limit.nil? || total_entries.nil?\n 1\nelse\n ((total_entries.as(Int64)) / (limit.as(Int64)).to_f).ceil.to_i\nend"}}]}]},{"html_id":"clear/Clear/SQL/QueryBuildingError","path":"Clear/SQL/QueryBuildingError.html","kind":"class","full_name":"Clear::SQL::QueryBuildingError","name":"QueryBuildingError","abstract":false,"superclass":{"html_id":"clear/Clear/SQL/Error","kind":"class","full_name":"Clear::SQL::Error","name":"Error"},"ancestors":[{"html_id":"clear/Clear/SQL/Error","kind":"class","full_name":"Clear::SQL::Error","name":"Error"},{"html_id":"clear/Exception","kind":"class","full_name":"Exception","name":"Exception"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/sql/errors.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/errors.cr#L6"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/SQL","kind":"module","full_name":"Clear::SQL","name":"SQL"}},{"html_id":"clear/Clear/SQL/RecordNotFoundError","path":"Clear/SQL/RecordNotFoundError.html","kind":"class","full_name":"Clear::SQL::RecordNotFoundError","name":"RecordNotFoundError","abstract":false,"superclass":{"html_id":"clear/Clear/SQL/Error","kind":"class","full_name":"Clear::SQL::Error","name":"Error"},"ancestors":[{"html_id":"clear/Clear/SQL/Error","kind":"class","full_name":"Clear::SQL::Error","name":"Error"},{"html_id":"clear/Exception","kind":"class","full_name":"Exception","name":"Exception"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/sql/errors.cr","line_number":10,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/errors.cr#L10"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/SQL","kind":"module","full_name":"Clear::SQL","name":"SQL"}},{"html_id":"clear/Clear/SQL/RollbackError","path":"Clear/SQL/RollbackError.html","kind":"class","full_name":"Clear::SQL::RollbackError","name":"RollbackError","abstract":false,"superclass":{"html_id":"clear/Clear/SQL/Error","kind":"class","full_name":"Clear::SQL::Error","name":"Error"},"ancestors":[{"html_id":"clear/Clear/SQL/Error","kind":"class","full_name":"Clear::SQL::Error","name":"Error"},{"html_id":"clear/Exception","kind":"class","full_name":"Exception","name":"Exception"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/sql/errors.cr","line_number":13,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/errors.cr#L13"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/SQL","kind":"module","full_name":"Clear::SQL","name":"SQL"},"doc":"Rollback the transaction or the last savepoint.","summary":"

Rollback the transaction or the last savepoint.

"},{"html_id":"clear/Clear/SQL/Selectable","path":"Clear/SQL/Selectable.html","kind":"alias","full_name":"Clear::SQL::Selectable","name":"Selectable","abstract":false,"locations":[{"filename":"src/clear/sql/sql.cr","line_number":68,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/sql.cr#L68"}],"repository_name":"clear","program":false,"enum":false,"alias":true,"aliased":"(Clear::SQL::SelectBuilder | String | Symbol)","aliased_html":"Clear::SQL::SelectBuilder | String | Symbol","const":false,"namespace":{"html_id":"clear/Clear/SQL","kind":"module","full_name":"Clear::SQL","name":"SQL"}},{"html_id":"clear/Clear/SQL/SelectBuilder","path":"Clear/SQL/SelectBuilder.html","kind":"module","full_name":"Clear::SQL::SelectBuilder","name":"SelectBuilder","abstract":false,"ancestors":[{"html_id":"clear/Clear/SQL/Query/WithPagination","kind":"module","full_name":"Clear::SQL::Query::WithPagination","name":"WithPagination"},{"html_id":"clear/Clear/SQL/Query/BeforeQuery","kind":"module","full_name":"Clear::SQL::Query::BeforeQuery","name":"BeforeQuery"},{"html_id":"clear/Clear/SQL/Query/Change","kind":"module","full_name":"Clear::SQL::Query::Change","name":"Change"},{"html_id":"clear/Clear/SQL/Query/Connection","kind":"module","full_name":"Clear::SQL::Query::Connection","name":"Connection"},{"html_id":"clear/Clear/SQL/Query/Pluck","kind":"module","full_name":"Clear::SQL::Query::Pluck","name":"Pluck"},{"html_id":"clear/Clear/SQL/Query/Fetch","kind":"module","full_name":"Clear::SQL::Query::Fetch","name":"Fetch"},{"html_id":"clear/Clear/SQL/Query/Execute","kind":"module","full_name":"Clear::SQL::Query::Execute","name":"Execute"},{"html_id":"clear/Clear/SQL/Query/Lock","kind":"module","full_name":"Clear::SQL::Query::Lock","name":"Lock"},{"html_id":"clear/Clear/SQL/Query/Window","kind":"module","full_name":"Clear::SQL::Query::Window","name":"Window"},{"html_id":"clear/Clear/SQL/Query/CTE","kind":"module","full_name":"Clear::SQL::Query::CTE","name":"CTE"},{"html_id":"clear/Clear/SQL/Query/Aggregate","kind":"module","full_name":"Clear::SQL::Query::Aggregate","name":"Aggregate"},{"html_id":"clear/Clear/SQL/Query/OffsetLimit","kind":"module","full_name":"Clear::SQL::Query::OffsetLimit","name":"OffsetLimit"},{"html_id":"clear/Clear/SQL/Query/GroupBy","kind":"module","full_name":"Clear::SQL::Query::GroupBy","name":"GroupBy"},{"html_id":"clear/Clear/SQL/Query/OrderBy","kind":"module","full_name":"Clear::SQL::Query::OrderBy","name":"OrderBy"},{"html_id":"clear/Clear/SQL/Query/Having","kind":"module","full_name":"Clear::SQL::Query::Having","name":"Having"},{"html_id":"clear/Clear/SQL/Query/Where","kind":"module","full_name":"Clear::SQL::Query::Where","name":"Where"},{"html_id":"clear/Clear/SQL/Query/Join","kind":"module","full_name":"Clear::SQL::Query::Join","name":"Join"},{"html_id":"clear/Clear/SQL/Query/From","kind":"module","full_name":"Clear::SQL::Query::From","name":"From"},{"html_id":"clear/Clear/SQL/Query/Select","kind":"module","full_name":"Clear::SQL::Query::Select","name":"Select"}],"locations":[{"filename":"src/clear/sql/select_builder.cr","line_number":3,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/select_builder.cr#L3"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"clear/Clear/SQL/Query/Aggregate","kind":"module","full_name":"Clear::SQL::Query::Aggregate","name":"Aggregate"},{"html_id":"clear/Clear/SQL/Query/BeforeQuery","kind":"module","full_name":"Clear::SQL::Query::BeforeQuery","name":"BeforeQuery"},{"html_id":"clear/Clear/SQL/Query/Change","kind":"module","full_name":"Clear::SQL::Query::Change","name":"Change"},{"html_id":"clear/Clear/SQL/Query/Connection","kind":"module","full_name":"Clear::SQL::Query::Connection","name":"Connection"},{"html_id":"clear/Clear/SQL/Query/CTE","kind":"module","full_name":"Clear::SQL::Query::CTE","name":"CTE"},{"html_id":"clear/Clear/SQL/Query/Execute","kind":"module","full_name":"Clear::SQL::Query::Execute","name":"Execute"},{"html_id":"clear/Clear/SQL/Query/Fetch","kind":"module","full_name":"Clear::SQL::Query::Fetch","name":"Fetch"},{"html_id":"clear/Clear/SQL/Query/From","kind":"module","full_name":"Clear::SQL::Query::From","name":"From"},{"html_id":"clear/Clear/SQL/Query/GroupBy","kind":"module","full_name":"Clear::SQL::Query::GroupBy","name":"GroupBy"},{"html_id":"clear/Clear/SQL/Query/Having","kind":"module","full_name":"Clear::SQL::Query::Having","name":"Having"},{"html_id":"clear/Clear/SQL/Query/Join","kind":"module","full_name":"Clear::SQL::Query::Join","name":"Join"},{"html_id":"clear/Clear/SQL/Query/Lock","kind":"module","full_name":"Clear::SQL::Query::Lock","name":"Lock"},{"html_id":"clear/Clear/SQL/Query/OffsetLimit","kind":"module","full_name":"Clear::SQL::Query::OffsetLimit","name":"OffsetLimit"},{"html_id":"clear/Clear/SQL/Query/OrderBy","kind":"module","full_name":"Clear::SQL::Query::OrderBy","name":"OrderBy"},{"html_id":"clear/Clear/SQL/Query/Pluck","kind":"module","full_name":"Clear::SQL::Query::Pluck","name":"Pluck"},{"html_id":"clear/Clear/SQL/Query/Select","kind":"module","full_name":"Clear::SQL::Query::Select","name":"Select"},{"html_id":"clear/Clear/SQL/Query/Where","kind":"module","full_name":"Clear::SQL::Query::Where","name":"Where"},{"html_id":"clear/Clear/SQL/Query/Window","kind":"module","full_name":"Clear::SQL::Query::Window","name":"Window"},{"html_id":"clear/Clear/SQL/Query/WithPagination","kind":"module","full_name":"Clear::SQL::Query::WithPagination","name":"WithPagination"}],"including_types":[{"html_id":"clear/Clear/Model/CollectionBase","kind":"class","full_name":"Clear::Model::CollectionBase(T)","name":"CollectionBase"},{"html_id":"clear/Clear/SQL/SelectQuery","kind":"class","full_name":"Clear::SQL::SelectQuery","name":"SelectQuery"}],"namespace":{"html_id":"clear/Clear/SQL","kind":"module","full_name":"Clear::SQL","name":"SQL"},"constructors":[{"html_id":"new(distinct_value=nil,cte={}ofString=>Clear::SQL::SelectBuilder|String,columns=[]ofSQL::Column,froms=[]ofSQL::From,joins=[]ofSQL::Join,wheres=[]ofClear::Expression::Node,havings=[]ofClear::Expression::Node,windows=[]of::Tuple(String,String),group_bys=[]ofSymbolic,order_bys=[]ofClear::SQL::Query::OrderBy::Record,limit=nil,offset=nil,lock=nil,before_query_triggers=[]of(->Nil))-class-method","name":"new","abstract":false,"args":[{"name":"distinct_value","default_value":"nil","external_name":"distinct_value","restriction":""},{"name":"cte","default_value":"{} of String => Clear::SQL::SelectBuilder | String","external_name":"cte","restriction":""},{"name":"columns","default_value":"[] of SQL::Column","external_name":"columns","restriction":""},{"name":"froms","default_value":"[] of SQL::From","external_name":"froms","restriction":""},{"name":"joins","default_value":"[] of SQL::Join","external_name":"joins","restriction":""},{"name":"wheres","default_value":"[] of Clear::Expression::Node","external_name":"wheres","restriction":""},{"name":"havings","default_value":"[] of Clear::Expression::Node","external_name":"havings","restriction":""},{"name":"windows","default_value":"[] of ::Tuple(String, String)","external_name":"windows","restriction":""},{"name":"group_bys","default_value":"[] of Symbolic","external_name":"group_bys","restriction":""},{"name":"order_bys","default_value":"[] of Clear::SQL::Query::OrderBy::Record","external_name":"order_bys","restriction":""},{"name":"limit","default_value":"nil","external_name":"limit","restriction":""},{"name":"offset","default_value":"nil","external_name":"offset","restriction":""},{"name":"lock","default_value":"nil","external_name":"lock","restriction":""},{"name":"before_query_triggers","default_value":"[] of (-> Nil)","external_name":"before_query_triggers","restriction":""}],"args_string":"(distinct_value = nil, cte = {} of String => Clear::SQL::SelectBuilder | String, columns = [] of SQL::Column, froms = [] of SQL::From, joins = [] of SQL::Join, wheres = [] of Clear::Expression::Node, havings = [] of Clear::Expression::Node, windows = [] of ::Tuple(String, String), group_bys = [] of Symbolic, order_bys = [] of Clear::SQL::Query::OrderBy::Record, limit = nil, offset = nil, lock = nil, before_query_triggers = [] of (-> Nil))","args_html":"(distinct_value = nil, cte = {} of String => Clear::SQL::SelectBuilder | String, columns = [] of SQL::Column, froms = [] of SQL::From, joins = [] of SQL::Join, wheres = [] of Clear::Expression::Node, havings = [] of Clear::Expression::Node, windows = [] of ::Tuple(String, String), group_bys = [] of Symbolic, order_bys = [] of Clear::SQL::Query::OrderBy::Record, limit = nil, offset = nil, lock = nil, before_query_triggers = [] of (-> Nil))","location":{"filename":"src/clear/sql/select_builder.cr","line_number":29,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/select_builder.cr#L29"},"def":{"name":"new","args":[{"name":"distinct_value","default_value":"nil","external_name":"distinct_value","restriction":""},{"name":"cte","default_value":"{} of String => Clear::SQL::SelectBuilder | String","external_name":"cte","restriction":""},{"name":"columns","default_value":"[] of SQL::Column","external_name":"columns","restriction":""},{"name":"froms","default_value":"[] of SQL::From","external_name":"froms","restriction":""},{"name":"joins","default_value":"[] of SQL::Join","external_name":"joins","restriction":""},{"name":"wheres","default_value":"[] of Clear::Expression::Node","external_name":"wheres","restriction":""},{"name":"havings","default_value":"[] of Clear::Expression::Node","external_name":"havings","restriction":""},{"name":"windows","default_value":"[] of ::Tuple(String, String)","external_name":"windows","restriction":""},{"name":"group_bys","default_value":"[] of Symbolic","external_name":"group_bys","restriction":""},{"name":"order_bys","default_value":"[] of Clear::SQL::Query::OrderBy::Record","external_name":"order_bys","restriction":""},{"name":"limit","default_value":"nil","external_name":"limit","restriction":""},{"name":"offset","default_value":"nil","external_name":"offset","restriction":""},{"name":"lock","default_value":"nil","external_name":"lock","restriction":""},{"name":"before_query_triggers","default_value":"[] of (-> Nil)","external_name":"before_query_triggers","restriction":""}],"visibility":"Public","body":"_ = allocate\n_.initialize(distinct_value, cte, columns, froms, joins, wheres, havings, windows, group_bys, order_bys, limit, offset, lock, before_query_triggers)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"before_query(&block:->Nil)-instance-method","name":"before_query","doc":"A hook to apply some operation just before the query is executed.\n\n```\ncall = 0\nreq = Clear::SQL.select(\"1\").before_query { call += 1 }\n10.times { req.execute }\npp call # 10\n```","summary":"

A hook to apply some operation just before the query is executed.

","abstract":false,"location":{"filename":"src/clear/sql/select_builder.cr","line_number":26,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/select_builder.cr#L26"},"def":{"name":"before_query","yields":0,"block_arity":0,"block_arg":{"name":"block","external_name":"block","restriction":"(-> Nil)"},"visibility":"Public","body":"@before_query_triggers << block\nself\n"}},{"html_id":"columns:Array(SQL::Column)-instance-method","name":"columns","abstract":false,"def":{"name":"columns","return_type":"Array(SQL::Column)","visibility":"Public","body":"@columns"}},{"html_id":"default_wildcard_table-instance-method","name":"default_wildcard_table","abstract":false,"def":{"name":"default_wildcard_table","visibility":"Public","body":"@default_wildcard_table"}},{"html_id":"dup:self-instance-method","name":"dup","doc":"Duplicate the query","summary":"

Duplicate the query

","abstract":false,"location":{"filename":"src/clear/sql/select_builder.cr","line_number":46,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/select_builder.cr#L46"},"def":{"name":"dup","return_type":"self","visibility":"Public","body":"self.class.new(distinct_value: @distinct_value, cte: @cte.dup, columns: @columns.dup, froms: @froms.dup, joins: @joins.dup, wheres: @wheres.dup, havings: @havings.dup, windows: @windows.dup, group_bys: @group_bys.dup, order_bys: @order_bys.dup, limit: @limit, offset: @offset, lock: @lock, before_query_triggers: @before_query_triggers).use_connection(connection_name)"}},{"html_id":"havings:Array(Clear::Expression::Node)-instance-method","name":"havings","abstract":false,"def":{"name":"havings","return_type":"Array(Clear::Expression::Node)","visibility":"Public","body":"@havings"}},{"html_id":"is_distinct?-instance-method","name":"is_distinct?","abstract":false,"location":{"filename":"src/clear/sql/select_builder.cr","line_number":4,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/select_builder.cr#L4"},"def":{"name":"is_distinct?","visibility":"Public","body":"!!@distinct_value"}},{"html_id":"joins:Array(SQL::Join)-instance-method","name":"joins","abstract":false,"def":{"name":"joins","return_type":"Array(SQL::Join)","visibility":"Public","body":"@joins"}},{"html_id":"limit:Int64|Nil-instance-method","name":"limit","abstract":false,"def":{"name":"limit","return_type":"Int64 | ::Nil","visibility":"Public","body":"@limit"}},{"html_id":"lock:String|Nil-instance-method","name":"lock","abstract":false,"def":{"name":"lock","return_type":"String | ::Nil","visibility":"Public","body":"@lock"}},{"html_id":"offset:Int64|Nil-instance-method","name":"offset","abstract":false,"def":{"name":"offset","return_type":"Int64 | ::Nil","visibility":"Public","body":"@offset"}},{"html_id":"order_bys:Array(Clear::SQL::Query::OrderBy::Record)-instance-method","name":"order_bys","abstract":false,"def":{"name":"order_bys","return_type":"Array(Clear::SQL::Query::OrderBy::Record)","visibility":"Public","body":"@order_bys"}},{"html_id":"to_delete-instance-method","name":"to_delete","doc":"Construct a delete query from this select query.\nIt uses only the `from` and the `where` clause fo the current select request.\nCan be useful in some case, but\n use at your own risk !","summary":"

Construct a delete query from this select query.

","abstract":false,"location":{"filename":"src/clear/sql/select_builder.cr","line_number":83,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/select_builder.cr#L83"},"def":{"name":"to_delete","visibility":"Public","body":"if @froms.size == 1\nelse\n raise(QueryBuildingError.new(\"Cannot build a delete query \" + \"from a select with multiple or none `from` clauses\"))\nend\nv = @froms[0].value\nif v.is_a?(SelectBuilder)\n raise(QueryBuildingError.new(\"Cannot delete from a select with sub-select as `from` clause\"))\nend\nDeleteQuery.new(v.dup, @wheres.dup)\n"}},{"html_id":"to_sql:String-instance-method","name":"to_sql","abstract":false,"location":{"filename":"src/clear/sql/select_builder.cr","line_number":65,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/select_builder.cr#L65"},"def":{"name":"to_sql","return_type":"String","visibility":"Public","body":"[print_ctes, print_select, print_froms, print_joins, print_wheres, print_windows, print_group_bys, print_havings, print_order_bys, print_limit_offsets, print_lock].compact.reject(&.empty?).join(\" \")"}},{"html_id":"to_update-instance-method","name":"to_update","abstract":false,"location":{"filename":"src/clear/sql/select_builder.cr","line_number":94,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/select_builder.cr#L94"},"def":{"name":"to_update","visibility":"Public","body":"if @froms.size == 1\nelse\n raise(QueryBuildingError.new(\"Cannot build a update query \" + \"from a select with multiple or none `from` clauses\"))\nend\nv = @froms[0].value\nif v.is_a?(SelectBuilder)\n raise(QueryBuildingError.new(\"Cannot delete from a select with sub-select as `from` clause\"))\nend\nUpdateQuery.new(table: v.dup, wheres: @wheres.dup)\n"}},{"html_id":"total_entries:Int64|Nil-instance-method","name":"total_entries","abstract":false,"def":{"name":"total_entries","return_type":"Int64 | ::Nil","visibility":"Public","body":"@total_entries"}},{"html_id":"total_entries=(total_entries:Int64|Nil)-instance-method","name":"total_entries=","abstract":false,"args":[{"name":"total_entries","external_name":"total_entries","restriction":"Int64 | ::Nil"}],"args_string":"(total_entries : Int64 | Nil)","args_html":"(total_entries : Int64 | Nil)","def":{"name":"total_entries=","args":[{"name":"total_entries","external_name":"total_entries","restriction":"Int64 | ::Nil"}],"visibility":"Public","body":"@total_entries = total_entries"}},{"html_id":"wheres:Array(Clear::Expression::Node)-instance-method","name":"wheres","doc":"Return the list of where clause; each where clause are transformed into\nClear::Expression::Node","summary":"

Return the list of where clause; each where clause are transformed into Clear::Expression::Node

","abstract":false,"def":{"name":"wheres","return_type":"Array(Clear::Expression::Node)","visibility":"Public","body":"@wheres"}}]},{"html_id":"clear/Clear/SQL/SelectQuery","path":"Clear/SQL/SelectQuery.html","kind":"class","full_name":"Clear::SQL::SelectQuery","name":"SelectQuery","abstract":false,"superclass":{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"clear/Clear/SQL/SelectBuilder","kind":"module","full_name":"Clear::SQL::SelectBuilder","name":"SelectBuilder"},{"html_id":"clear/Clear/SQL/Query/WithPagination","kind":"module","full_name":"Clear::SQL::Query::WithPagination","name":"WithPagination"},{"html_id":"clear/Clear/SQL/Query/BeforeQuery","kind":"module","full_name":"Clear::SQL::Query::BeforeQuery","name":"BeforeQuery"},{"html_id":"clear/Clear/SQL/Query/Change","kind":"module","full_name":"Clear::SQL::Query::Change","name":"Change"},{"html_id":"clear/Clear/SQL/Query/Connection","kind":"module","full_name":"Clear::SQL::Query::Connection","name":"Connection"},{"html_id":"clear/Clear/SQL/Query/Pluck","kind":"module","full_name":"Clear::SQL::Query::Pluck","name":"Pluck"},{"html_id":"clear/Clear/SQL/Query/Fetch","kind":"module","full_name":"Clear::SQL::Query::Fetch","name":"Fetch"},{"html_id":"clear/Clear/SQL/Query/Execute","kind":"module","full_name":"Clear::SQL::Query::Execute","name":"Execute"},{"html_id":"clear/Clear/SQL/Query/Lock","kind":"module","full_name":"Clear::SQL::Query::Lock","name":"Lock"},{"html_id":"clear/Clear/SQL/Query/Window","kind":"module","full_name":"Clear::SQL::Query::Window","name":"Window"},{"html_id":"clear/Clear/SQL/Query/CTE","kind":"module","full_name":"Clear::SQL::Query::CTE","name":"CTE"},{"html_id":"clear/Clear/SQL/Query/Aggregate","kind":"module","full_name":"Clear::SQL::Query::Aggregate","name":"Aggregate"},{"html_id":"clear/Clear/SQL/Query/OffsetLimit","kind":"module","full_name":"Clear::SQL::Query::OffsetLimit","name":"OffsetLimit"},{"html_id":"clear/Clear/SQL/Query/GroupBy","kind":"module","full_name":"Clear::SQL::Query::GroupBy","name":"GroupBy"},{"html_id":"clear/Clear/SQL/Query/OrderBy","kind":"module","full_name":"Clear::SQL::Query::OrderBy","name":"OrderBy"},{"html_id":"clear/Clear/SQL/Query/Having","kind":"module","full_name":"Clear::SQL::Query::Having","name":"Having"},{"html_id":"clear/Clear/SQL/Query/Where","kind":"module","full_name":"Clear::SQL::Query::Where","name":"Where"},{"html_id":"clear/Clear/SQL/Query/Join","kind":"module","full_name":"Clear::SQL::Query::Join","name":"Join"},{"html_id":"clear/Clear/SQL/Query/From","kind":"module","full_name":"Clear::SQL::Query::From","name":"From"},{"html_id":"clear/Clear/SQL/Query/Select","kind":"module","full_name":"Clear::SQL::Query::Select","name":"Select"},{"html_id":"clear/Enumerable","kind":"module","full_name":"Enumerable","name":"Enumerable"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/sql/select_query.cr","line_number":25,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/select_query.cr#L25"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"clear/Clear/SQL/SelectBuilder","kind":"module","full_name":"Clear::SQL::SelectBuilder","name":"SelectBuilder"},{"html_id":"clear/Enumerable","kind":"module","full_name":"Enumerable","name":"Enumerable"}],"namespace":{"html_id":"clear/Clear/SQL","kind":"module","full_name":"Clear::SQL","name":"SQL"},"doc":"A Select Query builder\n\nPostgres documentation:\n\n```\n[ WITH [ RECURSIVE ] with_query [, ...] ]\nSELECT [ ALL | DISTINCT [ ON ( expression [, ...] ) ] ]\n [ * | expression [ [ AS ] output_name ] [, ...] ]\n [ FROM from_item [, ...] ]\n [ WHERE condition ]\n [ GROUP BY grouping_element [, ...] ]\n [ HAVING condition [, ...] ]\n [ WINDOW window_name AS ( window_definition ) [, ...] ]\n [ { UNION | INTERSECT | EXCEPT } [ ALL | DISTINCT ] select ]\n [ ORDER BY expression [ ASC | DESC | USING operator ] [ NULLS { FIRST | LAST } ] [, ...] ]\n [ LIMIT { count | ALL } ]\n [ OFFSET start [ ROW | ROWS ] ]\n [ FETCH { FIRST | NEXT } [ count ] { ROW | ROWS } ONLY ]\n [ FOR { UPDATE | NO KEY UPDATE | SHARE | KEY SHARE } [ OF table_name [, ...] ] [ NOWAIT | SKIP LOCKED ] [...] ]\n```","summary":"

A Select Query builder

","instance_methods":[{"html_id":"each(&):Nil-instance-method","name":"each","doc":"Must yield this collection's elements to the block.","summary":"

Must yield this collection's elements to the block.

","abstract":false,"location":{"filename":"src/clear/sql/select_query.cr","line_number":29,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/select_query.cr#L29"},"def":{"name":"each","yields":1,"block_arity":1,"return_type":"Nil","visibility":"Public","body":"fetch do |h|\n yield(h)\nend"}}]},{"html_id":"clear/Clear/SQL/Symbolic","path":"Clear/SQL/Symbolic.html","kind":"alias","full_name":"Clear::SQL::Symbolic","name":"Symbolic","abstract":false,"locations":[{"filename":"src/clear/sql/sql.cr","line_number":67,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/sql.cr#L67"}],"repository_name":"clear","program":false,"enum":false,"alias":true,"aliased":"(String | Symbol)","aliased_html":"String | Symbol","const":false,"namespace":{"html_id":"clear/Clear/SQL","kind":"module","full_name":"Clear::SQL","name":"SQL"}},{"html_id":"clear/Clear/SQL/Transaction","path":"Clear/SQL/Transaction.html","kind":"module","full_name":"Clear::SQL::Transaction","name":"Transaction","abstract":false,"locations":[{"filename":"src/clear/sql/transaction.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/transaction.cr#L1"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"clear/Clear/SQL","kind":"module","full_name":"Clear::SQL","name":"SQL"}],"namespace":{"html_id":"clear/Clear/SQL","kind":"module","full_name":"Clear::SQL","name":"SQL"},"instance_methods":[{"html_id":"after_commit(connection:String=\"default\",&block:DB::Connection->Nil)-instance-method","name":"after_commit","doc":"Register a callback function which will be fired once when SQL `COMMIT`\noperation is called\n\nThis can be used for example to send email, or perform others tasks\nwhen you want to be sure the data is secured in the database.\n\n```\ntransaction do\n @user = User.find(1)\n @user.subscribe!\n Clear::SQL.after_commit { Email.deliver(ConfirmationMail.new(@user)) }\nend\n```\n\nIn case the transaction fail and eventually rollback, the code won't be called.\n","summary":"

Register a callback function which will be fired once when SQL COMMIT operation is called

","abstract":false,"args":[{"name":"connection","default_value":"\"default\"","external_name":"connection","restriction":"String"}],"args_string":"(connection : String = \"default\", &block : DB::Connection -> Nil)","args_html":"(connection : String = "default", &block : DB::Connection -> Nil)","location":{"filename":"src/clear/sql/transaction.cr","line_number":98,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/transaction.cr#L98"},"def":{"name":"after_commit","args":[{"name":"connection","default_value":"\"default\"","external_name":"connection","restriction":"String"}],"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(DB::Connection -> Nil)"},"visibility":"Public","body":"Clear::SQL::ConnectionPool.with_connection(connection) do |cnx|\n if cnx._clear_in_transaction?\n __temp_88 = cnx\n @@commit_callbacks[__temp_88] = @@commit_callbacks[__temp_88] << block\n else\n raise(Clear::SQL::Error.new(\"you need to be in transaction to add after_commit callback\"))\n end\nend"}},{"html_id":"in_transaction?(connection:String=\"default\")-instance-method","name":"in_transaction?","doc":"Check whether the current pair of fiber/connection is in transaction\nblock or not.","summary":"

Check whether the current pair of fiber/connection is in transaction block or not.

","abstract":false,"args":[{"name":"connection","default_value":"\"default\"","external_name":"connection","restriction":"String"}],"args_string":"(connection : String = \"default\")","args_html":"(connection : String = "default")","location":{"filename":"src/clear/sql/transaction.cr","line_number":29,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/transaction.cr#L29"},"def":{"name":"in_transaction?","args":[{"name":"connection","default_value":"\"default\"","external_name":"connection","restriction":"String"}],"visibility":"Public","body":"Clear::SQL::ConnectionPool.with_connection(connection, &._clear_in_transaction?)"}},{"html_id":"rollback(to=nil)-instance-method","name":"rollback","doc":"Rollback a transaction or return to the previous savepoint in case of a\nwith_savepoint block.\nThe params `to` offer","summary":"

Rollback a transaction or return to the previous savepoint in case of a with_savepoint block.

","abstract":false,"args":[{"name":"to","default_value":"nil","external_name":"to","restriction":""}],"args_string":"(to = nil)","args_html":"(to = nil)","location":{"filename":"src/clear/sql/transaction.cr","line_number":138,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/transaction.cr#L138"},"def":{"name":"rollback","args":[{"name":"to","default_value":"nil","external_name":"to","restriction":""}],"visibility":"Public","body":"raise(RollbackError.new(to))"}},{"html_id":"rollback_transaction-instance-method","name":"rollback_transaction","doc":"Rollback the transaction. In case the call is made inside a savepoint block\nrollback everything.","summary":"

Rollback the transaction.

","abstract":false,"location":{"filename":"src/clear/sql/transaction.cr","line_number":144,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/transaction.cr#L144"},"def":{"name":"rollback_transaction","visibility":"Public","body":"raise(CancelTransactionError.new)"}},{"html_id":"transaction(connection:String=\"default\",level:Level=Level::Serializable,&)-instance-method","name":"transaction","doc":"Enter new transaction block for the current connection/fiber pair.\n\nExample:\n\n```\nClear::SQL.transaction do\n # do something\n Clear::SQL.transaction do # Technically, this block do nothing, since we already are in transaction\n rollback # < Rollback the up-most `transaction` block.\n end\nend\n```\n\nsee #with_savepoint to use a stackable version using savepoints.\n","summary":"

Enter new transaction block for the current connection/fiber pair.

","abstract":false,"args":[{"name":"connection","default_value":"\"default\"","external_name":"connection","restriction":"String"},{"name":"level","default_value":"Level::Serializable","external_name":"level","restriction":"Level"}],"args_string":"(connection : String = \"default\", level : Level = Level::Serializable, &)","args_html":"(connection : String = "default", level : Level = Level::Serializable, &)","location":{"filename":"src/clear/sql/transaction.cr","line_number":48,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/transaction.cr#L48"},"def":{"name":"transaction","args":[{"name":"connection","default_value":"\"default\"","external_name":"connection","restriction":"String"},{"name":"level","default_value":"Level::Serializable","external_name":"level","restriction":"Level"}],"yields":1,"block_arity":1,"visibility":"Public","body":"Clear::SQL::ConnectionPool.with_connection(connection) do |cnx|\n has_rollback = false\n if cnx._clear_in_transaction?\n return yield(cnx)\n else\n cnx._clear_in_transaction = true\n execute(level.to_begin_operation)\n begin\n return yield(cnx)\n rescue e\n has_rollback = true\n is_rollback_error = e.is_a?(RollbackError) || e.is_a?(CancelTransactionError)\n begin\n execute(\"ROLLBACK --\" + (is_rollback_error ? \"normal\" : \"program error\"))\n rescue\n nil\n end\n if is_rollback_error\n else\n raise(e)\n end\n ensure\n cnx._clear_in_transaction = false\n callbacks = @@commit_callbacks.delete(cnx)\n if has_rollback\n else\n execute(\"COMMIT\")\n callbacks.try(&.each(&.call(cnx)))\n end\n end\n end\nend"}},{"html_id":"with_savepoint(sp_name:Symbolic|Nil=nil,connection_name:String=\"default\",&)-instance-method","name":"with_savepoint","doc":"Create a transaction, but this one is stackable\nusing savepoints.\n\nExample:\n\n```\nClear::SQL.with_savepoint do\n # do something\n Clear::SQL.with_savepoint do\n rollback # < Rollback only the last `with_savepoint` block\n end\nend\n```","summary":"

Create a transaction, but this one is stackable using savepoints.

","abstract":false,"args":[{"name":"sp_name","default_value":"nil","external_name":"sp_name","restriction":"Symbolic | ::Nil"},{"name":"connection_name","default_value":"\"default\"","external_name":"connection_name","restriction":"String"}],"args_string":"(sp_name : Symbolic | Nil = nil, connection_name : String = \"default\", &)","args_html":"(sp_name : Symbolic | Nil = nil, connection_name : String = "default", &)","location":{"filename":"src/clear/sql/transaction.cr","line_number":121,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/transaction.cr#L121"},"def":{"name":"with_savepoint","args":[{"name":"sp_name","default_value":"nil","external_name":"sp_name","restriction":"Symbolic | ::Nil"},{"name":"connection_name","default_value":"\"default\"","external_name":"connection_name","restriction":"String"}],"yields":0,"block_arity":0,"visibility":"Public","body":"transaction do |cnx|\n begin\n sp_name || (sp_name = \"sp_#{@@savepoint_uid = @@savepoint_uid + 1}\")\n execute(connection_name, \"SAVEPOINT #{sp_name}\")\n yield\n if cnx._clear_in_transaction?\n execute(connection_name, \"RELEASE SAVEPOINT #{sp_name}\")\n end\n rescue e : RollbackError\n if cnx._clear_in_transaction?\n execute(connection_name, \"ROLLBACK TO SAVEPOINT #{sp_name}\")\n if e.savepoint_id.try(&.!=(sp_name))\n raise(e)\n end\n end\n end\nend"}}],"types":[{"html_id":"clear/Clear/SQL/Transaction/Level","path":"Clear/SQL/Transaction/Level.html","kind":"enum","full_name":"Clear::SQL::Transaction::Level","name":"Level","abstract":false,"ancestors":[{"html_id":"clear/Enum","kind":"struct","full_name":"Enum","name":"Enum"},{"html_id":"clear/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/sql/transaction.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/transaction.cr#L6"}],"repository_name":"clear","program":false,"enum":true,"alias":false,"const":false,"constants":[{"id":"ReadCommitted","name":"ReadCommitted","value":"0"},{"id":"RepeatableRead","name":"RepeatableRead","value":"1"},{"id":"Serializable","name":"Serializable","value":"2"}],"namespace":{"html_id":"clear/Clear/SQL/Transaction","kind":"module","full_name":"Clear::SQL::Transaction","name":"Transaction"},"doc":"Represents the differents levels of transactions\n as described in https://www.postgresql.org/docs/9.5/transaction-iso.html\n\n ReadUncommited is voluntarly ommited as it fallback to ReadCommited in PostgreSQL","summary":"

Represents the differents levels of transactions as described in https://www.postgresql.org/docs/9.5/transaction-iso.html

","instance_methods":[{"html_id":"read_committed?-instance-method","name":"read_committed?","abstract":false,"location":{"filename":"src/clear/sql/transaction.cr","line_number":7,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/transaction.cr#L7"},"def":{"name":"read_committed?","visibility":"Public","body":"self == ReadCommitted"}},{"html_id":"repeatable_read?-instance-method","name":"repeatable_read?","abstract":false,"location":{"filename":"src/clear/sql/transaction.cr","line_number":8,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/transaction.cr#L8"},"def":{"name":"repeatable_read?","visibility":"Public","body":"self == RepeatableRead"}},{"html_id":"serializable?-instance-method","name":"serializable?","abstract":false,"location":{"filename":"src/clear/sql/transaction.cr","line_number":9,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/transaction.cr#L9"},"def":{"name":"serializable?","visibility":"Public","body":"self == Serializable"}}]}]},{"html_id":"clear/Clear/SQL/UpdateQuery","path":"Clear/SQL/UpdateQuery.html","kind":"class","full_name":"Clear::SQL::UpdateQuery","name":"UpdateQuery","abstract":false,"superclass":{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"clear/Clear/SQL/Query/Execute","kind":"module","full_name":"Clear::SQL::Query::Execute","name":"Execute"},{"html_id":"clear/Clear/SQL/Query/Where","kind":"module","full_name":"Clear::SQL::Query::Where","name":"Where"},{"html_id":"clear/Clear/SQL/Query/Change","kind":"module","full_name":"Clear::SQL::Query::Change","name":"Change"},{"html_id":"clear/Clear/SQL/Query/Connection","kind":"module","full_name":"Clear::SQL::Query::Connection","name":"Connection"},{"html_id":"clear/Clear/SQL/Query/CTE","kind":"module","full_name":"Clear::SQL::Query::CTE","name":"CTE"},{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/sql/update_query.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/update_query.cr#L6"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"clear/Clear/SQL/Query/Change","kind":"module","full_name":"Clear::SQL::Query::Change","name":"Change"},{"html_id":"clear/Clear/SQL/Query/Connection","kind":"module","full_name":"Clear::SQL::Query::Connection","name":"Connection"},{"html_id":"clear/Clear/SQL/Query/CTE","kind":"module","full_name":"Clear::SQL::Query::CTE","name":"CTE"},{"html_id":"clear/Clear/SQL/Query/Execute","kind":"module","full_name":"Clear::SQL::Query::Execute","name":"Execute"},{"html_id":"clear/Clear/SQL/Query/Where","kind":"module","full_name":"Clear::SQL::Query::Where","name":"Where"}],"namespace":{"html_id":"clear/Clear/SQL","kind":"module","full_name":"Clear::SQL","name":"SQL"},"doc":"TODO: Documentation","summary":"

TODO Documentation

","constructors":[{"html_id":"new(table:String|Symbol|Nil,wheres:Array(Clear::Expression::Node)=[]ofClear::Expression::Node)-class-method","name":"new","abstract":false,"args":[{"name":"table","external_name":"table","restriction":"::String | ::Symbol | ::Nil"},{"name":"wheres","default_value":"[] of Clear::Expression::Node","external_name":"wheres","restriction":"::Array(::Clear::Expression::Node)"}],"args_string":"(table : String | Symbol | Nil, wheres : Array(Clear::Expression::Node) = [] of Clear::Expression::Node)","args_html":"(table : String | Symbol | Nil, wheres : Array(Clear::Expression::Node) = [] of Clear::Expression::Node)","location":{"filename":"src/clear/sql/update_query.cr","line_number":19,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/update_query.cr#L19"},"def":{"name":"new","args":[{"name":"table","external_name":"table","restriction":"::String | ::Symbol | ::Nil"},{"name":"wheres","default_value":"[] of Clear::Expression::Node","external_name":"wheres","restriction":"::Array(::Clear::Expression::Node)"}],"visibility":"Public","body":"_ = allocate\n_.initialize(table, wheres)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"set(row:NamedTuple)-instance-method","name":"set","abstract":false,"args":[{"name":"row","external_name":"row","restriction":"NamedTuple"}],"args_string":"(row : NamedTuple)","args_html":"(row : NamedTuple)","location":{"filename":"src/clear/sql/update_query.cr","line_number":22,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/update_query.cr#L22"},"def":{"name":"set","args":[{"name":"row","external_name":"row","restriction":"NamedTuple"}],"visibility":"Public","body":"h = {} of String => Updatable\nrow.each do |k, v|\n h[k.to_s] = v\nend\nset(h)\nchange!\n"}},{"html_id":"set(row:String)-instance-method","name":"set","abstract":false,"args":[{"name":"row","external_name":"row","restriction":"String"}],"args_string":"(row : String)","args_html":"(row : String)","location":{"filename":"src/clear/sql/update_query.cr","line_number":33,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/update_query.cr#L33"},"def":{"name":"set","args":[{"name":"row","external_name":"row","restriction":"String"}],"visibility":"Public","body":"@values << row\nchange!\n"}},{"html_id":"set(row:Hash(String,Updatable))-instance-method","name":"set","abstract":false,"args":[{"name":"row","external_name":"row","restriction":"Hash(String, Updatable)"}],"args_string":"(row : Hash(String, Updatable))","args_html":"(row : Hash(String, Updatable))","location":{"filename":"src/clear/sql/update_query.cr","line_number":38,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/update_query.cr#L38"},"def":{"name":"set","args":[{"name":"row","external_name":"row","restriction":"Hash(String, Updatable)"}],"visibility":"Public","body":"@values << (Hash(String, Updatable).new.merge(row))\nchange!\n"}},{"html_id":"set(**row)-instance-method","name":"set","abstract":false,"location":{"filename":"src/clear/sql/update_query.cr","line_number":29,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/update_query.cr#L29"},"def":{"name":"set","double_splat":{"name":"row","external_name":"row","restriction":""},"visibility":"Public","body":"set(row)"}},{"html_id":"to_sql-instance-method","name":"to_sql","abstract":false,"location":{"filename":"src/clear/sql/update_query.cr","line_number":62,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/update_query.cr#L62"},"def":{"name":"to_sql","visibility":"Public","body":"table = @table.is_a?(Symbol) ? SQL.escape(@table.to_s) : @table\n[print_ctes, \"UPDATE\", table, \"SET\", print_values, print_wheres].compact.join(\" \")\n"}},{"html_id":"wheres:Array(Clear::Expression::Node)-instance-method","name":"wheres","doc":"Return the list of where clause; each where clause are transformed into\nClear::Expression::Node","summary":"

Return the list of where clause; each where clause are transformed into Clear::Expression::Node

","abstract":false,"def":{"name":"wheres","return_type":"Array(Clear::Expression::Node)","visibility":"Public","body":"@wheres"}}],"types":[{"html_id":"clear/Clear/SQL/UpdateQuery/Updatable","path":"Clear/SQL/UpdateQuery/Updatable.html","kind":"alias","full_name":"Clear::SQL::UpdateQuery::Updatable","name":"Updatable","abstract":false,"locations":[{"filename":"src/clear/sql/update_query.cr","line_number":7,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/update_query.cr#L7"}],"repository_name":"clear","program":false,"enum":false,"alias":true,"aliased":"(Array(PG::BoolArray) | Array(PG::CharArray) | Array(PG::Float32Array) | Array(PG::Float64Array) | Array(PG::Int16Array) | Array(PG::Int32Array) | Array(PG::Int64Array) | Array(PG::NumericArray) | Array(PG::StringArray) | Array(PG::TimeArray) | Array(PG::UUIDArray) | BigDecimal | BigFloat | BigInt | Bool | Char | Clear::Expression::Literal | Crypto::Bcrypt::Password | Float32 | Float64 | Int16 | Int32 | Int64 | Int8 | JSON::Any | JSON::PullParser | PG::Geo::Box | PG::Geo::Circle | PG::Geo::Line | PG::Geo::LineSegment | PG::Geo::Path | PG::Geo::Point | PG::Geo::Polygon | PG::Interval | PG::Numeric | Slice(UInt8) | String | Time | UInt16 | UInt32 | UInt64 | UInt8 | UUID | Nil)","aliased_html":"Array(PG::BoolArray) | Array(PG::CharArray) | Array(PG::Float32Array) | Array(PG::Float64Array) | Array(PG::Int16Array) | Array(PG::Int32Array) | Array(PG::Int64Array) | Array(PG::NumericArray) | Array(PG::StringArray) | Array(PG::TimeArray) | Array(PG::UUIDArray) | BigDecimal | BigFloat | BigInt | Bool | Char | Clear::Expression::Literal | Crypto::Bcrypt::Password | Float32 | Float64 | Int16 | Int32 | Int64 | Int8 | JSON::Any | JSON::PullParser | PG::Geo::Box | PG::Geo::Circle | PG::Geo::Line | PG::Geo::LineSegment | PG::Geo::Path | PG::Geo::Point | PG::Geo::Polygon | PG::Interval | PG::Numeric | Slice(UInt8) | String | Time | UInt16 | UInt32 | UInt64 | UInt8 | UUID | Nil","const":false,"namespace":{"html_id":"clear/Clear/SQL/UpdateQuery","kind":"class","full_name":"Clear::SQL::UpdateQuery","name":"UpdateQuery"}},{"html_id":"clear/Clear/SQL/UpdateQuery/UpdateInstruction","path":"Clear/SQL/UpdateQuery/UpdateInstruction.html","kind":"alias","full_name":"Clear::SQL::UpdateQuery::UpdateInstruction","name":"UpdateInstruction","abstract":false,"locations":[{"filename":"src/clear/sql/update_query.cr","line_number":8,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/sql/update_query.cr#L8"}],"repository_name":"clear","program":false,"enum":false,"alias":true,"aliased":"(Hash(String, Array(PG::BoolArray) | Array(PG::CharArray) | Array(PG::Float32Array) | Array(PG::Float64Array) | Array(PG::Int16Array) | Array(PG::Int32Array) | Array(PG::Int64Array) | Array(PG::NumericArray) | Array(PG::StringArray) | Array(PG::TimeArray) | Array(PG::UUIDArray) | BigDecimal | BigFloat | BigInt | Bool | Char | Clear::Expression::Literal | Crypto::Bcrypt::Password | Float32 | Float64 | Int16 | Int32 | Int64 | Int8 | JSON::Any | JSON::PullParser | PG::Geo::Box | PG::Geo::Circle | PG::Geo::Line | PG::Geo::LineSegment | PG::Geo::Path | PG::Geo::Point | PG::Geo::Polygon | PG::Interval | PG::Numeric | Slice(UInt8) | String | Time | UInt16 | UInt32 | UInt64 | UInt8 | UUID | Nil) | String)","aliased_html":"Hash(String, Array(PG::BoolArray) | Array(PG::CharArray) | Array(PG::Float32Array) | Array(PG::Float64Array) | Array(PG::Int16Array) | Array(PG::Int32Array) | Array(PG::Int64Array) | Array(PG::NumericArray) | Array(PG::StringArray) | Array(PG::TimeArray) | Array(PG::UUIDArray) | BigDecimal | BigFloat | BigInt | Bool | Char | Clear::Expression::Literal | Crypto::Bcrypt::Password | Float32 | Float64 | Int16 | Int32 | Int64 | Int8 | JSON::Any | JSON::PullParser | PG::Geo::Box | PG::Geo::Circle | PG::Geo::Line | PG::Geo::LineSegment | PG::Geo::Path | PG::Geo::Point | PG::Geo::Polygon | PG::Interval | PG::Numeric | Slice(UInt8) | String | Time | UInt16 | UInt32 | UInt64 | UInt8 | UUID | Nil) | String","const":false,"namespace":{"html_id":"clear/Clear/SQL/UpdateQuery","kind":"class","full_name":"Clear::SQL::UpdateQuery","name":"UpdateQuery"}}]}]},{"html_id":"clear/Clear/TimeInDay","path":"Clear/TimeInDay.html","kind":"struct","full_name":"Clear::TimeInDay","name":"TimeInDay","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/extensions/time_in_days/time_in_day.cr","line_number":29,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/time_in_days/time_in_day.cr#L29"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear","kind":"module","full_name":"Clear","name":"Clear"},"doc":"`Clear::TimeInDay` represents the \"time\" object of PostgreSQL\n\nIt can be converted automatically from/to a `time` column.\nIt offers helpers which makes it usable also as a stand alone.\n\n## Usage example\n\n```\ntime = Clear::TimeInDay.parse(\"12:33\")\nputs time.hour # 12\nputs time.minutes # 0\n\nTime.local.at(time) # Today at 12:33:00\ntime.to_s # 12:33:00\ntime.to_s(false) # don't show seconds => 12:33\n\ntime = time + 2.minutes # 12:35\n```\n\nAs with Interval, you might wanna use it as a column (use underlying `time` type in PostgreSQL):\n\n```\nclass MyModel\n include Clear::Model\n\n column time_in_day : Clear::TimeInDay\nend\n```","summary":"

Clear::TimeInDay represents the "time" object of PostgreSQL

","class_methods":[{"html_id":"parse(str:String)-class-method","name":"parse","doc":"Parse a string, of format HH:MM or HH:MM:SS","summary":"

Parse a string, of format HH:MM or HH:MM:SS

","abstract":false,"args":[{"name":"str","external_name":"str","restriction":"String"}],"args_string":"(str : String)","args_html":"(str : String)","location":{"filename":"src/clear/extensions/time_in_days/time_in_day.cr","line_number":113,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/time_in_days/time_in_day.cr#L113"},"def":{"name":"parse","args":[{"name":"str","external_name":"str","restriction":"String"}],"visibility":"Public","body":"if str =~ (/^[0-9]+:[0-9]{2}(:[0-9]{2})?$/)\nelse\n raise(\"Wrong format\")\nend\narr = (str.split(/\\:/)).map(&.try(&.to_i))\nhours = arr[0]\nminutes = arr[1]\nseconds = arr[2]?\nif seconds\n return Clear::TimeInDay.new(hours, minutes, seconds)\nend\nClear::TimeInDay.new(hours, minutes)\n"}}],"constructors":[{"html_id":"new(hours,minutes,seconds=0)-class-method","name":"new","abstract":false,"args":[{"name":"hours","external_name":"hours","restriction":""},{"name":"minutes","external_name":"minutes","restriction":""},{"name":"seconds","default_value":"0","external_name":"seconds","restriction":""}],"args_string":"(hours, minutes, seconds = 0)","args_html":"(hours, minutes, seconds = 0)","location":{"filename":"src/clear/extensions/time_in_days/time_in_day.cr","line_number":36,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/time_in_days/time_in_day.cr#L36"},"def":{"name":"new","args":[{"name":"hours","external_name":"hours","restriction":""},{"name":"minutes","external_name":"minutes","restriction":""},{"name":"seconds","default_value":"0","external_name":"seconds","restriction":""}],"visibility":"Public","body":"_ = allocate\n_.initialize(hours, minutes, seconds)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new(microseconds:UInt64=0)-class-method","name":"new","abstract":false,"args":[{"name":"microseconds","default_value":"0","external_name":"microseconds","restriction":"UInt64"}],"args_string":"(microseconds : UInt64 = 0)","args_html":"(microseconds : UInt64 = 0)","location":{"filename":"src/clear/extensions/time_in_days/time_in_day.cr","line_number":40,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/time_in_days/time_in_day.cr#L40"},"def":{"name":"new","args":[{"name":"microseconds","default_value":"0","external_name":"microseconds","restriction":"UInt64"}],"visibility":"Public","body":"_ = allocate\n_.initialize(microseconds)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"+(t:Time::Span)-instance-method","name":"+","abstract":false,"args":[{"name":"t","external_name":"t","restriction":"Time::Span"}],"args_string":"(t : Time::Span)","args_html":"(t : Time::Span)","location":{"filename":"src/clear/extensions/time_in_days/time_in_day.cr","line_number":43,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/time_in_days/time_in_day.cr#L43"},"def":{"name":"+","args":[{"name":"t","external_name":"t","restriction":"Time::Span"}],"visibility":"Public","body":"Clear::TimeInDay.new(microseconds: @microseconds + (t.total_nanoseconds.to_i64 // 1000))"}},{"html_id":"+(x:self)-instance-method","name":"+","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"self"}],"args_string":"(x : self)","args_html":"(x : self)","location":{"filename":"src/clear/extensions/time_in_days/time_in_day.cr","line_number":51,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/time_in_days/time_in_day.cr#L51"},"def":{"name":"+","args":[{"name":"x","external_name":"x","restriction":"self"}],"visibility":"Public","body":"TimeInDay.new(@microseconds + x.ms)"}},{"html_id":"-(t:Time::Span)-instance-method","name":"-","abstract":false,"args":[{"name":"t","external_name":"t","restriction":"Time::Span"}],"args_string":"(t : Time::Span)","args_html":"(t : Time::Span)","location":{"filename":"src/clear/extensions/time_in_days/time_in_day.cr","line_number":47,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/time_in_days/time_in_day.cr#L47"},"def":{"name":"-","args":[{"name":"t","external_name":"t","restriction":"Time::Span"}],"visibility":"Public","body":"Clear::TimeInDay.new(microseconds: @microseconds - (t.total_nanoseconds.to_i64 // 1000))"}},{"html_id":"hour-instance-method","name":"hour","abstract":false,"location":{"filename":"src/clear/extensions/time_in_days/time_in_day.cr","line_number":55,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/time_in_days/time_in_day.cr#L55"},"def":{"name":"hour","visibility":"Public","body":"(@microseconds // HOUR)"}},{"html_id":"inspect-instance-method","name":"inspect","doc":"Returns an unambiguous and information-rich string representation of this\nobject, typically intended for developers.\n\nThis method should usually **not** be overridden. It delegates to\n`#inspect(IO)` which can be overridden for custom implementations.\n\nAlso see `#to_s`.","summary":"

Returns an unambiguous and information-rich string representation of this object, typically intended for developers.

","abstract":false,"location":{"filename":"src/clear/extensions/time_in_days/time_in_day.cr","line_number":79,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/time_in_days/time_in_day.cr#L79"},"def":{"name":"inspect","visibility":"Public","body":"\"#{self.class.name}(#{self})\""}},{"html_id":"microseconds:UInt64-instance-method","name":"microseconds","abstract":false,"location":{"filename":"src/clear/extensions/time_in_days/time_in_day.cr","line_number":30,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/time_in_days/time_in_day.cr#L30"},"def":{"name":"microseconds","return_type":"UInt64","visibility":"Public","body":"@microseconds"}},{"html_id":"minutes-instance-method","name":"minutes","abstract":false,"location":{"filename":"src/clear/extensions/time_in_days/time_in_day.cr","line_number":59,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/time_in_days/time_in_day.cr#L59"},"def":{"name":"minutes","visibility":"Public","body":"(@microseconds % HOUR) // MINUTE"}},{"html_id":"seconds-instance-method","name":"seconds","abstract":false,"location":{"filename":"src/clear/extensions/time_in_days/time_in_day.cr","line_number":63,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/time_in_days/time_in_day.cr#L63"},"def":{"name":"seconds","visibility":"Public","body":"(@microseconds % MINUTE) // SECOND"}},{"html_id":"to_json(json:JSON::Builder):Nil-instance-method","name":"to_json","abstract":false,"args":[{"name":"json","external_name":"json","restriction":"JSON::Builder"}],"args_string":"(json : JSON::Builder) : Nil","args_html":"(json : JSON::Builder) : Nil","location":{"filename":"src/clear/extensions/time_in_days/time_in_day.cr","line_number":108,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/time_in_days/time_in_day.cr#L108"},"def":{"name":"to_json","args":[{"name":"json","external_name":"json","restriction":"JSON::Builder"}],"return_type":"Nil","visibility":"Public","body":"json.string(to_s)"}},{"html_id":"to_s(show_seconds:Bool=true)-instance-method","name":"to_s","doc":"Returns a nicely readable and concise string representation of this object,\ntypically intended for users.\n\nThis method should usually **not** be overridden. It delegates to\n`#to_s(IO)` which can be overridden for custom implementations.\n\nAlso see `#inspect`.","summary":"

Returns a nicely readable and concise string representation of this object, typically intended for users.

","abstract":false,"args":[{"name":"show_seconds","default_value":"true","external_name":"show_seconds","restriction":"Bool"}],"args_string":"(show_seconds : Bool = true)","args_html":"(show_seconds : Bool = true)","location":{"filename":"src/clear/extensions/time_in_days/time_in_day.cr","line_number":83,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/time_in_days/time_in_day.cr#L83"},"def":{"name":"to_s","args":[{"name":"show_seconds","default_value":"true","external_name":"show_seconds","restriction":"Bool"}],"visibility":"Public","body":"io = IO::Memory.new\nto_s(io, show_seconds)\nio.rewind\nio.to_s\n"}},{"html_id":"to_s(io,show_seconds:Bool=true)-instance-method","name":"to_s","doc":"Return a string","summary":"

Return a string

","abstract":false,"args":[{"name":"io","external_name":"io","restriction":""},{"name":"show_seconds","default_value":"true","external_name":"show_seconds","restriction":"Bool"}],"args_string":"(io, show_seconds : Bool = true)","args_html":"(io, show_seconds : Bool = true)","location":{"filename":"src/clear/extensions/time_in_days/time_in_day.cr","line_number":91,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/time_in_days/time_in_day.cr#L91"},"def":{"name":"to_s","args":[{"name":"io","external_name":"io","restriction":""},{"name":"show_seconds","default_value":"true","external_name":"show_seconds","restriction":"Bool"}],"visibility":"Public","body":"hours, minutes, seconds = to_tuple\nif show_seconds\n io << ({hours.to_s.rjust(2, '0'), minutes.to_s.rjust(2, '0'), seconds.to_s.rjust(2, '0')}.join(':'))\nelse\n io << ({hours.to_s.rjust(2, '0'), minutes.to_s.rjust(2, '0')}.join(':'))\nend\n"}},{"html_id":"to_tuple-instance-method","name":"to_tuple","abstract":false,"location":{"filename":"src/clear/extensions/time_in_days/time_in_day.cr","line_number":71,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/time_in_days/time_in_day.cr#L71"},"def":{"name":"to_tuple","visibility":"Public","body":"hours, left = @microseconds.divmod(HOUR)\nminutes, left = left.divmod(MINUTE)\nseconds = left // SECOND\n{hours, minutes, seconds}\n"}},{"html_id":"total_seconds-instance-method","name":"total_seconds","abstract":false,"location":{"filename":"src/clear/extensions/time_in_days/time_in_day.cr","line_number":67,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/time_in_days/time_in_day.cr#L67"},"def":{"name":"total_seconds","visibility":"Public","body":"@microseconds // SECOND"}}],"types":[{"html_id":"clear/Clear/TimeInDay/Converter","path":"Clear/TimeInDay/Converter.html","kind":"module","full_name":"Clear::TimeInDay::Converter","name":"Converter","abstract":false,"locations":[{"filename":"src/clear/extensions/time_in_days/time_in_day_converter.cr","line_number":23,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/time_in_days/time_in_day_converter.cr#L23"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/TimeInDay","kind":"struct","full_name":"Clear::TimeInDay","name":"TimeInDay"},"class_methods":[{"html_id":"to_column(x):TimeInDay|Nil-class-method","name":"to_column","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x) : TimeInDay | Nil","args_html":"(x) : TimeInDay | Nil","location":{"filename":"src/clear/extensions/time_in_days/time_in_day_converter.cr","line_number":24,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/time_in_days/time_in_day_converter.cr#L24"},"def":{"name":"to_column","args":[{"name":"x","external_name":"x","restriction":""}],"return_type":"TimeInDay | ::Nil","visibility":"Public","body":"case x\nwhen TimeInDay\n x\nwhen UInt64\n TimeInDay.new(x)\nwhen Slice\n mem = IO::Memory.new(x, writeable: false)\n TimeInDay.new(mem.read_bytes(UInt64, IO::ByteFormat::BigEndian))\nwhen String\n TimeInDay.parse(x)\nwhen Nil\n nil\nelse\n raise(\"Cannot convert to TimeInDay from #{x.class}\")\nend"}},{"html_id":"to_db(x:TimeInDay|Nil)-class-method","name":"to_db","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"TimeInDay | ::Nil"}],"args_string":"(x : TimeInDay | Nil)","args_html":"(x : TimeInDay | Nil)","location":{"filename":"src/clear/extensions/time_in_days/time_in_day_converter.cr","line_number":42,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/time_in_days/time_in_day_converter.cr#L42"},"def":{"name":"to_db","args":[{"name":"x","external_name":"x","restriction":"TimeInDay | ::Nil"}],"visibility":"Public","body":"x ? x.to_s : nil"}}]}]},{"html_id":"clear/Clear/TSVector","path":"Clear/TSVector.html","kind":"class","full_name":"Clear::TSVector","name":"TSVector","abstract":false,"superclass":{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/extensions/full_text_searchable/tsvector.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/full_text_searchable/tsvector.cr#L1"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear","kind":"module","full_name":"Clear","name":"Clear"},"class_methods":[{"html_id":"decode(x:Slice(UInt8))-class-method","name":"decode","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"Slice(UInt8)"}],"args_string":"(x : Slice(UInt8))","args_html":"(x : Slice(UInt8))","location":{"filename":"src/clear/extensions/full_text_searchable/tsvector.cr","line_number":70,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/full_text_searchable/tsvector.cr#L70"},"def":{"name":"decode","args":[{"name":"x","external_name":"x","restriction":"Slice(UInt8)"}],"visibility":"Public","body":"io = IO::Memory.new(x, writeable: false)\nClear::TSVector.new(io)\n"}}],"constructors":[{"html_id":"new(io)-class-method","name":"new","abstract":false,"args":[{"name":"io","external_name":"io","restriction":""}],"args_string":"(io)","args_html":"(io)","location":{"filename":"src/clear/extensions/full_text_searchable/tsvector.cr","line_number":56,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/full_text_searchable/tsvector.cr#L56"},"def":{"name":"new","args":[{"name":"io","external_name":"io","restriction":""}],"visibility":"Public","body":"_ = allocate\n_.initialize(io)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"[](key:String)-instance-method","name":"[]","abstract":false,"args":[{"name":"key","external_name":"key","restriction":"String"}],"args_string":"(key : String)","args_html":"(key : String)","location":{"filename":"src/clear/extensions/full_text_searchable/tsvector.cr","line_number":39,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/full_text_searchable/tsvector.cr#L39"},"def":{"name":"[]","args":[{"name":"key","external_name":"key","restriction":"String"}],"visibility":"Public","body":"lexems[key]"}},{"html_id":"[]?(key:String)-instance-method","name":"[]?","abstract":false,"args":[{"name":"key","external_name":"key","restriction":"String"}],"args_string":"(key : String)","args_html":"(key : String)","location":{"filename":"src/clear/extensions/full_text_searchable/tsvector.cr","line_number":43,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/full_text_searchable/tsvector.cr#L43"},"def":{"name":"[]?","args":[{"name":"key","external_name":"key","restriction":"String"}],"visibility":"Public","body":"lexems[key]?"}},{"html_id":"lexems:Hash(String,Lexem)-instance-method","name":"lexems","abstract":false,"location":{"filename":"src/clear/extensions/full_text_searchable/tsvector.cr","line_number":37,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/full_text_searchable/tsvector.cr#L37"},"def":{"name":"lexems","return_type":"Hash(String, Lexem)","visibility":"Public","body":"@lexems"}},{"html_id":"to_sql-instance-method","name":"to_sql","abstract":false,"location":{"filename":"src/clear/extensions/full_text_searchable/tsvector.cr","line_number":47,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/full_text_searchable/tsvector.cr#L47"},"def":{"name":"to_sql","visibility":"Public","body":"@lexems.values.join(\" \") do |v|\n {Clear::Expression[v.value], v.positions.join(\",\") do |p|\n {p.position, p.weight}.join\n end}.join(\":\")\nend"}}],"types":[{"html_id":"clear/Clear/TSVector/Converter","path":"Clear/TSVector/Converter.html","kind":"module","full_name":"Clear::TSVector::Converter","name":"Converter","abstract":false,"locations":[{"filename":"src/clear/extensions/full_text_searchable/tsvector.cr","line_number":75,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/full_text_searchable/tsvector.cr#L75"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/TSVector","kind":"class","full_name":"Clear::TSVector","name":"TSVector"},"class_methods":[{"html_id":"to_column(x):Clear::TSVector|Nil-class-method","name":"to_column","abstract":false,"args":[{"name":"x","external_name":"x","restriction":""}],"args_string":"(x) : Clear::TSVector | Nil","args_html":"(x) : Clear::TSVector | Nil","location":{"filename":"src/clear/extensions/full_text_searchable/tsvector.cr","line_number":76,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/full_text_searchable/tsvector.cr#L76"},"def":{"name":"to_column","args":[{"name":"x","external_name":"x","restriction":""}],"return_type":"Clear::TSVector | ::Nil","visibility":"Public","body":"case x\nwhen Slice\n Clear::TSVector.decode(x.as(Slice(UInt8)))\nwhen Clear::TSVector\n x\nwhen Nil\n nil\nelse\n raise(Clear::ErrorMessages.converter_error(x.class, \"TSVector\"))\nend"}},{"html_id":"to_db(x:TSVector|Nil)-class-method","name":"to_db","abstract":false,"args":[{"name":"x","external_name":"x","restriction":"TSVector | ::Nil"}],"args_string":"(x : TSVector | Nil)","args_html":"(x : TSVector | Nil)","location":{"filename":"src/clear/extensions/full_text_searchable/tsvector.cr","line_number":89,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/full_text_searchable/tsvector.cr#L89"},"def":{"name":"to_db","args":[{"name":"x","external_name":"x","restriction":"TSVector | ::Nil"}],"visibility":"Public","body":"x.try(&.to_sql)"}}]},{"html_id":"clear/Clear/TSVector/Lexem","path":"Clear/TSVector/Lexem.html","kind":"struct","full_name":"Clear::TSVector::Lexem","name":"Lexem","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/extensions/full_text_searchable/tsvector.cr","line_number":2,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/full_text_searchable/tsvector.cr#L2"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"WEIGHTS","name":"WEIGHTS","value":"['A', 'B', 'C', 'D']"}],"namespace":{"html_id":"clear/Clear/TSVector","kind":"class","full_name":"Clear::TSVector","name":"TSVector"},"constructors":[{"html_id":"new(io)-class-method","name":"new","abstract":false,"args":[{"name":"io","external_name":"io","restriction":""}],"args_string":"(io)","args_html":"(io)","location":{"filename":"src/clear/extensions/full_text_searchable/tsvector.cr","line_number":10,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/full_text_searchable/tsvector.cr#L10"},"def":{"name":"new","args":[{"name":"io","external_name":"io","restriction":""}],"visibility":"Public","body":"_ = allocate\n_.initialize(io)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"positions:Array(Position)-instance-method","name":"positions","abstract":false,"location":{"filename":"src/clear/extensions/full_text_searchable/tsvector.cr","line_number":6,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/full_text_searchable/tsvector.cr#L6"},"def":{"name":"positions","return_type":"Array(Position)","visibility":"Public","body":"@positions"}},{"html_id":"value:String-instance-method","name":"value","abstract":false,"location":{"filename":"src/clear/extensions/full_text_searchable/tsvector.cr","line_number":5,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/full_text_searchable/tsvector.cr#L5"},"def":{"name":"value","return_type":"String","visibility":"Public","body":"@value"}}],"types":[{"html_id":"clear/Clear/TSVector/Lexem/Position","path":"Clear/TSVector/Lexem/Position.html","kind":"struct","full_name":"Clear::TSVector::Lexem::Position","name":"Position","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/extensions/full_text_searchable/tsvector.cr","line_number":3,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/full_text_searchable/tsvector.cr#L3"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear/TSVector/Lexem","kind":"struct","full_name":"Clear::TSVector::Lexem","name":"Lexem"},"constructors":[{"html_id":"new(weight:Char,position:UInt16)-class-method","name":"new","abstract":false,"args":[{"name":"weight","external_name":"weight","restriction":"Char"},{"name":"position","external_name":"position","restriction":"UInt16"}],"args_string":"(weight : Char, position : UInt16)","args_html":"(weight : Char, position : UInt16)","location":{"filename":"src/clear/extensions/full_text_searchable/tsvector.cr","line_number":3,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/full_text_searchable/tsvector.cr#L3"},"def":{"name":"new","args":[{"name":"weight","external_name":"weight","restriction":"Char"},{"name":"position","external_name":"position","restriction":"UInt16"}],"visibility":"Public","body":"_ = allocate\n_.initialize(weight, position)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"clone-instance-method","name":"clone","abstract":false,"location":{"filename":"src/clear/extensions/full_text_searchable/tsvector.cr","line_number":3,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/full_text_searchable/tsvector.cr#L3"},"def":{"name":"clone","visibility":"Public","body":"self.class.new(@weight.clone, @position.clone)"}},{"html_id":"copy_with(weight_weight=@weight,position_position=@position)-instance-method","name":"copy_with","abstract":false,"args":[{"name":"_weight","default_value":"@weight","external_name":"weight","restriction":""},{"name":"_position","default_value":"@position","external_name":"position","restriction":""}],"args_string":"(weight _weight = @weight, position _position = @position)","args_html":"(weight _weight = @weight, position _position = @position)","location":{"filename":"src/clear/extensions/full_text_searchable/tsvector.cr","line_number":3,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/full_text_searchable/tsvector.cr#L3"},"def":{"name":"copy_with","args":[{"name":"_weight","default_value":"@weight","external_name":"weight","restriction":""},{"name":"_position","default_value":"@position","external_name":"position","restriction":""}],"visibility":"Public","body":"self.class.new(_weight, _position)"}},{"html_id":"position:UInt16-instance-method","name":"position","abstract":false,"def":{"name":"position","return_type":"UInt16","visibility":"Public","body":"@position"}},{"html_id":"weight:Char-instance-method","name":"weight","abstract":false,"def":{"name":"weight","return_type":"Char","visibility":"Public","body":"@weight"}}]}]}]},{"html_id":"clear/Clear/Util","path":"Clear/Util.html","kind":"module","full_name":"Clear::Util","name":"Util","abstract":false,"locations":[{"filename":"src/clear/util.cr","line_number":2,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/util.cr#L2"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"extended_modules":[{"html_id":"clear/Clear/Util","kind":"module","full_name":"Clear::Util","name":"Util"}],"namespace":{"html_id":"clear/Clear","kind":"module","full_name":"Clear","name":"Clear"},"doc":"A set of method(s) useful for building Clear ORM.","summary":"

A set of method(s) useful for building Clear ORM.

","instance_methods":[{"html_id":"hash_union(h1:Hash(A,B),h2:Hash(C,D))forallA,B,C,D-instance-method","name":"hash_union","doc":"Return a new hash which is union of two hash (some kind of deep merge)","summary":"

Return a new hash which is union of two hash (some kind of deep merge)

","abstract":false,"args":[{"name":"h1","external_name":"h1","restriction":"Hash(A, B)"},{"name":"h2","external_name":"h2","restriction":"Hash(C, D)"}],"args_string":"(h1 : Hash(A, B), h2 : Hash(C, D)) forall A, B, C, D","args_html":"(h1 : Hash(A, B), h2 : Hash(C, D)) forall A, B, C, D","location":{"filename":"src/clear/util.cr","line_number":12,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/util.cr#L12"},"def":{"name":"hash_union","args":[{"name":"h1","external_name":"h1","restriction":"Hash(A, B)"},{"name":"h2","external_name":"h2","restriction":"Hash(C, D)"}],"visibility":"Public","body":"o = Hash(A | C, B | D).new\nh1.each do |k, v|\n o[k] = v\nend\nh2.each do |k, v|\n case v\n when Hash\n if (v1 = o[k]).is_a?(Hash)\n o[k] = hash_union(v1, v)\n else\n o[k] = v\n end\n else\n o[k] = v\n end\nend\no\n"}},{"html_id":"lambda(u:U.class,v:V.class,&block:U->V)forallU,V-instance-method","name":"lambda","doc":"Equivalent to ruby's lambda with one parameter.\nThis method is useful combined with the macro system of Crystal.","summary":"

Equivalent to ruby's lambda with one parameter.

","abstract":false,"args":[{"name":"u","external_name":"u","restriction":"U.class"},{"name":"v","external_name":"v","restriction":"V.class"}],"args_string":"(u : U.class, v : V.class, &block : U -> V) forall U, V","args_html":"(u : U.class, v : V.class, &block : U -> V) forall U, V","location":{"filename":"src/clear/util.cr","line_number":7,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/util.cr#L7"},"def":{"name":"lambda","args":[{"name":"u","external_name":"u","restriction":"U.class"},{"name":"v","external_name":"v","restriction":"V.class"}],"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(U -> V)"},"visibility":"Public","body":"block"}}]},{"html_id":"clear/Clear/Validation","path":"Clear/Validation.html","kind":"module","full_name":"Clear::Validation","name":"Validation","abstract":false,"locations":[{"filename":"src/clear/model/validation/helper.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/validation/helper.cr#L1"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear","kind":"module","full_name":"Clear","name":"Clear"},"types":[{"html_id":"clear/Clear/Validation/Helper","path":"Clear/Validation/Helper.html","kind":"module","full_name":"Clear::Validation::Helper","name":"Helper","abstract":false,"locations":[{"filename":"src/clear/model/validation/helper.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/validation/helper.cr#L1"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"clear/Clear/Model/HasValidation","kind":"module","full_name":"Clear::Model::HasValidation","name":"HasValidation"}],"namespace":{"html_id":"clear/Clear/Validation","kind":"module","full_name":"Clear::Validation","name":"Validation"},"macros":[{"html_id":"ensure_than(field,message,&block)-macro","name":"ensure_than","doc":"Usage example:\n\n```\nensure_than email, \"must be an email\" do |v|\n EmailRegexp.valid?(v)\nend\n```","summary":"

Usage example:

","abstract":false,"args":[{"name":"field","external_name":"field","restriction":""},{"name":"message","external_name":"message","restriction":""}],"args_string":"(field, message, &block)","args_html":"(field, message, &block)","location":{"filename":"src/clear/model/validation/helper.cr","line_number":15,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/validation/helper.cr#L15"},"def":{"name":"ensure_than","args":[{"name":"field","external_name":"field","restriction":""},{"name":"message","external_name":"message","restriction":""}],"block_arg":{"name":"block","external_name":"block","restriction":""},"visibility":"Public","body":" if \n{{ field.id }}\n_column.defined?\n o = \n{{ field.id }}\n\n\n fn = Clear::Util.lambda(typeof(o), Object) \n{{ block }}\n\n\n unless fn.call(o)\n add_error(\n{{ field.stringify }}\n, \n{{ message }}\n)\n \nend\n \nend\n\n \n"}},{"html_id":"on_presence(*fields,&block)-macro","name":"on_presence","abstract":false,"args":[{"name":"fields","external_name":"fields","restriction":""}],"args_string":"(*fields, &block)","args_html":"(*fields, &block)","location":{"filename":"src/clear/model/validation/helper.cr","line_number":2,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/model/validation/helper.cr#L2"},"def":{"name":"on_presence","args":[{"name":"fields","external_name":"fields","restriction":""}],"splat_index":0,"block_arg":{"name":"block","external_name":"block","restriction":""},"visibility":"Public","body":" if \n{{ (fields.map do |x|\n \"self.#{x.id}_column.defined?\"\nend.join(\" && \")).id }}\n\n \n{{ yield }}\n\n \nend\n \n"}}]}]},{"html_id":"clear/Clear/View","path":"Clear/View.html","kind":"class","full_name":"Clear::View","name":"View","abstract":false,"superclass":{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"clear/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/view/base.cr","line_number":48,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/view/base.cr#L48"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"clear/Clear","kind":"module","full_name":"Clear","name":"Clear"},"doc":"Create and maintain your database views directly in the code.\n\nYou could use the migration system to create and drop your views. However this\nis proven to be difficult, even more if you want to update a view which depends on\nanother subviews.\n\n## How it works ?\n\nWhen you migrate using the migration system, all the views registered\nare going to be destroyed and recreated again.\nOrder of creation depends of the requirement for each views\n\n## Example\n\n```\nClear::View.register :room_per_days do |view|\n view.require(:rooms, :year_days)\n\n view.query <<-SQL\n SELECT room_id, day\n FROM year_days\n CROSS JOIN rooms\n SQL\nend\n\nClear::View.register :rooms do |view|\n view.query <<-SQL\n SELECT room.id as room_id\n FROM generate_series(1, 4) AS room(id)\n SQL\nend\n\nClear::View.register :year_days do |view|\n view.query <<-SQL\n SELECT date.day::date as day\n FROM generate_series(\n date_trunc('day', NOW()),\n date_trunc('day', NOW() + INTERVAL '364 days'),\n INTERVAL '1 day'\n ) AS date(day)\n SQL\nend\n```\n\nIn the example above, room_per_days will be first dropped before a migration\nstart and last created after the migration finished, to prevent issue where some\nviews are linked to others","summary":"

Create and maintain your database views directly in the code.

","class_methods":[{"html_id":"apply(direction:Symbol,view_name:String,apply_cache:Set(String))-class-method","name":"apply","doc":"install the view into postgresql using CREATE VIEW","summary":"

install the view into postgresql using CREATE VIEW

","abstract":false,"args":[{"name":"direction","external_name":"direction","restriction":"Symbol"},{"name":"view_name","external_name":"view_name","restriction":"String"},{"name":"apply_cache","external_name":"apply_cache","restriction":"Set(String)"}],"args_string":"(direction : Symbol, view_name : String, apply_cache : Set(String))","args_html":"(direction : Symbol, view_name : String, apply_cache : Set(String))","location":{"filename":"src/clear/view/base.cr","line_number":76,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/view/base.cr#L76"},"def":{"name":"apply","args":[{"name":"direction","external_name":"direction","restriction":"Symbol"},{"name":"view_name","external_name":"view_name","restriction":"String"},{"name":"apply_cache","external_name":"apply_cache","restriction":"Set(String)"}],"visibility":"Public","body":"if apply_cache.includes?(view_name)\n return\nend\nview = @@views[view_name]\nview.requirement.each do |dep_view|\n apply(direction, dep_view, apply_cache)\nend\nClear::SQL.execute(view.connection, direction == (:drop) ? view.to_drop_sql : view.to_create_sql)\napply_cache << view_name\n"}},{"html_id":"apply(direction:Symbol,apply_cache=Set(String).new)-class-method","name":"apply","doc":"install the view into postgresql using CREATE VIEW","summary":"

install the view into postgresql using CREATE VIEW

","abstract":false,"args":[{"name":"direction","external_name":"direction","restriction":"Symbol"},{"name":"apply_cache","default_value":"Set(String).new","external_name":"apply_cache","restriction":""}],"args_string":"(direction : Symbol, apply_cache = Set(String).new)","args_html":"(direction : Symbol, apply_cache = Set(String).new)","location":{"filename":"src/clear/view/base.cr","line_number":68,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/view/base.cr#L68"},"def":{"name":"apply","args":[{"name":"direction","external_name":"direction","restriction":"Symbol"},{"name":"apply_cache","default_value":"Set(String).new","external_name":"apply_cache","restriction":""}],"visibility":"Public","body":"@@views.values.each do |view|\n if apply_cache.includes?(view.name)\n next\n end\n apply(direction, view.name, apply_cache)\nend"}},{"html_id":"register(name:Clear::SQL::Symbolic,&)-class-method","name":"register","doc":"Call the DSL to register a new view\n\n```\nClear::View.register(:name) do |view|\n # describe the view here.\nend\n```","summary":"

Call the DSL to register a new view

","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"Clear::SQL::Symbolic"}],"args_string":"(name : Clear::SQL::Symbolic, &)","args_html":"(name : Clear::SQL::Symbolic, &)","location":{"filename":"src/clear/view/base.cr","line_number":56,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/view/base.cr#L56"},"def":{"name":"register","args":[{"name":"name","external_name":"name","restriction":"Clear::SQL::Symbolic"}],"yields":1,"block_arity":1,"visibility":"Public","body":"view = Clear::View.new\nview.name(name)\nyield view\nif view.name == \"\"\n raise(\"Your view need to have a name\")\nend\nif view.query == \"\"\n raise(\"View `#{view.name}` need to have a query body\")\nend\n@@views[view.name] = view\n"}}],"instance_methods":[{"html_id":"connection(connection:String)-instance-method","name":"connection","doc":"database connection where is installed the view","summary":"

database connection where is installed the view

","abstract":false,"args":[{"name":"connection","external_name":"connection","restriction":"String"}],"args_string":"(connection : String)","args_html":"(connection : String)","location":{"filename":"src/clear/view/base.cr","line_number":118,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/view/base.cr#L118"},"def":{"name":"connection","args":[{"name":"connection","external_name":"connection","restriction":"String"}],"visibility":"Public","body":"@connection = connection"}},{"html_id":"connection:String-instance-method","name":"connection","abstract":false,"location":{"filename":"src/clear/view/base.cr","line_number":99,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/view/base.cr#L99"},"def":{"name":"connection","return_type":"String","visibility":"Public","body":"@connection"}},{"html_id":"full_name-instance-method","name":"full_name","abstract":false,"location":{"filename":"src/clear/view/base.cr","line_number":137,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/view/base.cr#L137"},"def":{"name":"full_name","visibility":"Public","body":"{@schema, @name}.join(\".\") do |x|\n Clear::SQL.escape(x)\nend"}},{"html_id":"materialized(mat:Bool)-instance-method","name":"materialized","doc":"whether the view is materialized or not. I would recommend to use\nmigration execute create/drop whenever the view is a materialized view","summary":"

whether the view is materialized or not.

","abstract":false,"args":[{"name":"mat","external_name":"mat","restriction":"Bool"}],"args_string":"(mat : Bool)","args_html":"(mat : Bool)","location":{"filename":"src/clear/view/base.cr","line_number":124,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/view/base.cr#L124"},"def":{"name":"materialized","args":[{"name":"mat","external_name":"mat","restriction":"Bool"}],"visibility":"Public","body":"@materialized = mat"}},{"html_id":"materialized?:Bool-instance-method","name":"materialized?","abstract":false,"location":{"filename":"src/clear/view/base.cr","line_number":100,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/view/base.cr#L100"},"def":{"name":"materialized?","return_type":"Bool","visibility":"Public","body":"@materialized"}},{"html_id":"name(value:String|Symbol)-instance-method","name":"name","doc":"name of the view","summary":"

name of the view

","abstract":false,"args":[{"name":"value","external_name":"value","restriction":"String | Symbol"}],"args_string":"(value : String | Symbol)","args_html":"(value : String | Symbol)","location":{"filename":"src/clear/view/base.cr","line_number":103,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/view/base.cr#L103"},"def":{"name":"name","args":[{"name":"value","external_name":"value","restriction":"String | Symbol"}],"visibility":"Public","body":"@name = value.to_s"}},{"html_id":"name:String-instance-method","name":"name","abstract":false,"location":{"filename":"src/clear/view/base.cr","line_number":95,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/view/base.cr#L95"},"def":{"name":"name","return_type":"String","visibility":"Public","body":"@name"}},{"html_id":"query(query:String)-instance-method","name":"query","doc":"query body related to the view. Must be a SELECT clause","summary":"

query body related to the view.

","abstract":false,"args":[{"name":"query","external_name":"query","restriction":"String"}],"args_string":"(query : String)","args_html":"(query : String)","location":{"filename":"src/clear/view/base.cr","line_number":113,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/view/base.cr#L113"},"def":{"name":"query","args":[{"name":"query","external_name":"query","restriction":"String"}],"visibility":"Public","body":"@query = query"}},{"html_id":"query:String-instance-method","name":"query","abstract":false,"location":{"filename":"src/clear/view/base.cr","line_number":97,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/view/base.cr#L97"},"def":{"name":"query","return_type":"String","visibility":"Public","body":"@query"}},{"html_id":"require(*req)-instance-method","name":"require","doc":"list of dependencies from the other view related to this view","summary":"

list of dependencies from the other view related to this view

","abstract":false,"args":[{"name":"req","external_name":"req","restriction":""}],"args_string":"(*req)","args_html":"(*req)","location":{"filename":"src/clear/view/base.cr","line_number":129,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/view/base.cr#L129"},"def":{"name":"require","args":[{"name":"req","external_name":"req","restriction":""}],"splat_index":0,"visibility":"Public","body":"req.map(&.to_s).each do |s|\n @requirement.add(s)\nend"}},{"html_id":"requirement:Set(String)-instance-method","name":"requirement","abstract":false,"location":{"filename":"src/clear/view/base.cr","line_number":98,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/view/base.cr#L98"},"def":{"name":"requirement","visibility":"Public","body":"@requirement"}},{"html_id":"schema(value:String|Symbol)-instance-method","name":"schema","doc":"schema to store the view (default public)","summary":"

schema to store the view (default public)

","abstract":false,"args":[{"name":"value","external_name":"value","restriction":"String | Symbol"}],"args_string":"(value : String | Symbol)","args_html":"(value : String | Symbol)","location":{"filename":"src/clear/view/base.cr","line_number":108,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/view/base.cr#L108"},"def":{"name":"schema","args":[{"name":"value","external_name":"value","restriction":"String | Symbol"}],"visibility":"Public","body":"@schema = value.to_s"}},{"html_id":"schema:String-instance-method","name":"schema","abstract":false,"location":{"filename":"src/clear/view/base.cr","line_number":96,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/view/base.cr#L96"},"def":{"name":"schema","return_type":"String","visibility":"Public","body":"@schema"}},{"html_id":"to_create_sql-instance-method","name":"to_create_sql","abstract":false,"location":{"filename":"src/clear/view/base.cr","line_number":141,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/view/base.cr#L141"},"def":{"name":"to_create_sql","visibility":"Public","body":"{\"CREATE OR REPLACE\", (materialized? ? \"MATERIALIZED VIEW\" : \"VIEW\"), full_name, \"AS (\", @query, \")\"}.join(' ')"}},{"html_id":"to_drop_sql-instance-method","name":"to_drop_sql","abstract":false,"location":{"filename":"src/clear/view/base.cr","line_number":133,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/view/base.cr#L133"},"def":{"name":"to_drop_sql","visibility":"Public","body":"\"DROP VIEW IF EXISTS #{@name}\""}}]}]},{"html_id":"clear/Slice","path":"Slice.html","kind":"struct","full_name":"Slice(T)","name":"Slice","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"},{"html_id":"clear/Indexable/Mutable","kind":"module","full_name":"Indexable::Mutable","name":"Mutable"},{"html_id":"clear/Indexable","kind":"module","full_name":"Indexable","name":"Indexable"},{"html_id":"clear/Enumerable","kind":"module","full_name":"Enumerable","name":"Enumerable"},{"html_id":"clear/Iterable","kind":"module","full_name":"Iterable","name":"Iterable"},{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/extensions/core_ext.cr","line_number":109,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/core_ext.cr#L109"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"clear/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"},{"html_id":"clear/Indexable/Mutable","kind":"module","full_name":"Indexable::Mutable","name":"Mutable"}],"doc":"A `Slice` is a `Pointer` with an associated size.\n\nWhile a pointer is unsafe because no bound checks are performed when reading from and writing to it,\nreading from and writing to a slice involve bound checks.\nIn this way, a slice is a safe alternative to `Pointer`.\n\nA Slice can be created as read-only: trying to write to it\nwill raise. For example the slice of bytes returned by\n`String#to_slice` is read-only.","summary":"

A Slice is a Pointer with an associated size.

","instance_methods":[{"html_id":"to_json(json:JSON::Builder)-instance-method","name":"to_json","abstract":false,"args":[{"name":"json","external_name":"json","restriction":"JSON::Builder"}],"args_string":"(json : JSON::Builder)","args_html":"(json : JSON::Builder)","location":{"filename":"src/clear/extensions/core_ext.cr","line_number":110,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/core_ext.cr#L110"},"def":{"name":"to_json","args":[{"name":"json","external_name":"json","restriction":"JSON::Builder"}],"visibility":"Public","body":"json.string(Base64.strict_encode(to_s))"}}]},{"html_id":"clear/Time","path":"Time.html","kind":"struct","full_name":"Time","name":"Time","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Steppable","kind":"module","full_name":"Steppable","name":"Steppable"},{"html_id":"clear/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"},{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/extensions/interval/interval_converter.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/interval/interval_converter.cr#L1"},{"filename":"src/clear/extensions/time_in_days/time_in_day_converter.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/time_in_days/time_in_day_converter.cr#L1"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"clear/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"},{"html_id":"clear/Steppable","kind":"module","full_name":"Steppable","name":"Steppable"}],"doc":"`Time` represents a date-time instant in\n[incremental time](https://www.w3.org/International/articles/definitions-time/#incremental_time)\nobserved in a specific time zone.\n\nThe calendaric calculations are based on the rules of the proleptic Gregorian\ncalendar as specified in [ISO 8601](http://xml.coverpages.org/ISO-FDIS-8601.pdf).\nLeap seconds are ignored.\n\nInternally, the time is stored as an `Int64` representing seconds from epoch\n(`0001-01-01 00:00:00.0 UTC`) and an `Int32` representing\nnanosecond-of-second with value range `0..999_999_999`.\n\nThe supported date range is `0001-01-01 00:00:00.0` to\n`9999-12-31 23:59:59.999_999_999` in any local time zone.\n\n### Telling the Time\n\nThere are several methods to retrieve a `Time` instance representing the\ncurrent time:\n\n```\nTime.utc # returns the current time in UTC\nTime.local Time::Location.load(\"Europe/Berlin\") # returns the current time in time zone Europe/Berlin\nTime.local # returns the current time in current time zone\n```\n\nIt is generally recommended to keep instances in UTC and only apply a\nlocal time zone when formatting for user display, unless the domain logic\nrequires having a specific time zone (for example for calendaric operations).\n\n### Creating a Specific Instant\n\n`Time` instances representing a specific instant can be created by\n`.utc` or `.new` with the date-time specified as individual arguments:\n\n```\ntime = Time.utc(2016, 2, 15, 10, 20, 30)\ntime.to_s # => \"2016-02-15 10:20:30 UTC\"\ntime = Time.local(2016, 2, 15, 10, 20, 30, location: Time::Location.load(\"Europe/Berlin\"))\ntime.to_s # => \"2016-02-15 10:20:30 +01:00\"\n# The time-of-day can be omitted and defaults to midnight (start of day):\ntime = Time.utc(2016, 2, 15)\ntime.to_s # => \"2016-02-15 00:00:00 UTC\"\n```\n\n### Retrieving Time Information\n\nEach `Time` instance allows querying calendar data:\n\n```\ntime = Time.utc(2016, 2, 15, 10, 20, 30)\ntime.year # => 2016\ntime.month # => 2\ntime.day # => 15\ntime.hour # => 10\ntime.minute # => 20\ntime.second # => 30\ntime.millisecond # => 0\ntime.nanosecond # => 0\ntime.day_of_week # => Time::DayOfWeek::Monday\ntime.day_of_year # => 46\ntime.monday? # => true\ntime.time_of_day # => 10:20:30\n```\n\nFor querying if a time is at a specific day of week, `Time` offers named\npredicate methods, delegating to `#day_of_week`:\n\n```\ntime.monday? # => true\n# ...\ntime.sunday? # => false\n```\n\n### Time Zones\n\nEach time is attached to a specific time zone, represented by a `Location`\n(see `#location`).\n`#zone` returns the time zone observed in this location at the current time\n(i.e. the instant represented by this `Time`).\n`#offset` returns the offset of the current zone in seconds.\n\n```\ntime = Time.local(2018, 3, 8, 22, 5, 13, location: Time::Location.load(\"Europe/Berlin\"))\ntime # => 2018-03-08 22:05:13 +01:00 Europe/Berlin\ntime.location # => #\ntime.zone # => #\ntime.offset # => 3600\n```\n\nUsing `.utc`, the location is `Time::Location::UTC`:\n\n```\ntime = Time.utc(2018, 3, 8, 22, 5, 13)\ntime # => 2018-03-08 22:05:13.0 UTC\ntime.location # => #\ntime.zone # => #\ntime.offset # => 0\n```\n\nA `Time` instance can be transformed to a different time zone while retaining\nthe same instant using `#in`:\n\n```\ntime_de = Time.local(2018, 3, 8, 22, 5, 13, location: Time::Location.load(\"Europe/Berlin\"))\ntime_ar = time_de.in Time::Location.load(\"America/Buenos_Aires\")\ntime_de # => 2018-03-08 22:05:13 +01:00 Europe/Berlin\ntime_ar # => 2018-03-08 18:05:13 -03:00 America/Buenos_Aires\n```\n\nBoth `Time` instances show a different local date-time, but they represent\nthe same date-time in the instant time-line, therefore they are considered\nequal:\n\n```\ntime_de.to_utc # => 2018-03-08 21:05:13 UTC\ntime_ar.to_utc # => 2018-03-08 21:05:13 UTC\ntime_de == time_ar # => true\n```\n\nThere are also two special methods for converting to UTC and local time zone:\n\n```\ntime.to_utc # equals time.in(Location::UTC)\ntime.to_local # equals time.in(Location.local)\n```\n\n`#to_local_in` allows changing the time zone while keeping\nthe same local date-time (wall clock) which results in a different instant\non the time line.\n\n### Formatting and Parsing Time\n\nTo make date-time instances exchangeable between different computer systems\nor readable to humans, they are usually converted to and from a string\nrepresentation.\n\nThe method `#to_s` formats the date-time according to a specified pattern.\n\n```\ntime = Time.utc(2015, 10, 12, 10, 30, 0)\ntime.to_s(\"%Y-%m-%d %H:%M:%S %:z\") # => \"2015-10-12 10:30:00 +00:00\"\n```\n\nSimilarly, `Time.parse` and `Time.parse!` are used to construct a `Time` instance from date-time\ninformation in a string, according to a specified pattern:\n\n```\nTime.parse(\"2015-10-12 10:30:00 +00:00\", \"%Y-%m-%d %H:%M:%S %z\", Time::Location::UTC)\nTime.parse!(\"2015-10-12 10:30:00 +00:00\", \"%Y-%m-%d %H:%M:%S %z\")\n```\n\nSee `Time::Format` for all directives.\n\n### Calculations\n\n```\nTime.utc(2015, 10, 10) - 5.days # => 2015-10-05 00:00:00 +00:00\n\nspan = Time.utc(2015, 10, 10) - Time.utc(2015, 9, 10)\nspan.days # => 30\nspan.total_hours # => 720\nspan.total_minutes # => 43200\n```\n\n## Measuring Time\n\nThe typical time representation provided by the operating system is based on\na \"wall clock\" which is subject to changes for clock synchronization.\nThis can result in discontinuous jumps in the time-line making it not\nsuitable for accurately measuring elapsed time.\n\nInstances of `Time` are focused on telling time – using a \"wall clock\".\nWhen `Time.local` is called multiple times, the difference between the\nreturned instances is not guaranteed to equal to the time elapsed between\nmaking the calls; even the order of the returned `Time` instances might\nnot reflect invocation order.\n\n```\nt1 = Time.utc\n# operation that takes 1 minute\nt2 = Time.utc\nt2 - t1 # => ?\n```\n\nThe resulting `Time::Span` could be anything, even negative, if the\ncomputer's wall clock has changed between both calls.\n\nAs an alternative, the operating system also provides a monotonic clock.\nIts time-line has no specified starting point but is strictly linearly\nincreasing.\n\nThis monotonic clock should always be used for measuring elapsed time.\n\nA reading from this clock can be taken using `.monotonic`:\n\n```\nt1 = Time.monotonic\n# operation that takes 1 minute\nt2 = Time.monotonic\nt2 - t1 # => 1.minute (approximately)\n```\n\nThe execution time of a block can be measured using `.measure`:\n\n```\nelapsed_time = Time.measure do\n # operation that takes 20 milliseconds\nend\nelapsed_time # => 20.milliseconds (approximately)\n```","summary":"

Time represents a date-time instant in incremental time observed in a specific time zone.

","instance_methods":[{"html_id":"+(interval:Clear::Interval)-instance-method","name":"+","abstract":false,"args":[{"name":"interval","external_name":"interval","restriction":"Clear::Interval"}],"args_string":"(interval : Clear::Interval)","args_html":"(interval : Clear::Interval)","location":{"filename":"src/clear/extensions/interval/interval_converter.cr","line_number":2,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/interval/interval_converter.cr#L2"},"def":{"name":"+","args":[{"name":"interval","external_name":"interval","restriction":"Clear::Interval"}],"visibility":"Public","body":"[interval.months.months, interval.days.days, interval.hours.hours, interval.minutes.minutes, interval.seconds.seconds, interval.milliseconds.milliseconds, interval.microseconds.microseconds].reduce(self) do |acc, e|\n acc + e\nend"}},{"html_id":"+(time_in_day:Clear::TimeInDay)-instance-method","name":"+","abstract":false,"args":[{"name":"time_in_day","external_name":"time_in_day","restriction":"Clear::TimeInDay"}],"args_string":"(time_in_day : Clear::TimeInDay)","args_html":"(time_in_day : Clear::TimeInDay)","location":{"filename":"src/clear/extensions/time_in_days/time_in_day_converter.cr","line_number":14,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/time_in_days/time_in_day_converter.cr#L14"},"def":{"name":"+","args":[{"name":"time_in_day","external_name":"time_in_day","restriction":"Clear::TimeInDay"}],"visibility":"Public","body":"self + time_in_day.microseconds.microseconds"}},{"html_id":"-(interval:Clear::Interval)-instance-method","name":"-","abstract":false,"args":[{"name":"interval","external_name":"interval","restriction":"Clear::Interval"}],"args_string":"(interval : Clear::Interval)","args_html":"(interval : Clear::Interval)","location":{"filename":"src/clear/extensions/interval/interval_converter.cr","line_number":14,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/interval/interval_converter.cr#L14"},"def":{"name":"-","args":[{"name":"interval","external_name":"interval","restriction":"Clear::Interval"}],"visibility":"Public","body":"[interval.months.months, interval.days.days, interval.hours.hours, interval.minutes.minutes, interval.seconds.seconds, interval.milliseconds.milliseconds, interval.microseconds.microseconds].reduce(self) do |acc, e|\n acc - e\nend"}},{"html_id":"-(time_in_day:Clear::TimeInDay)-instance-method","name":"-","abstract":false,"args":[{"name":"time_in_day","external_name":"time_in_day","restriction":"Clear::TimeInDay"}],"args_string":"(time_in_day : Clear::TimeInDay)","args_html":"(time_in_day : Clear::TimeInDay)","location":{"filename":"src/clear/extensions/time_in_days/time_in_day_converter.cr","line_number":18,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/time_in_days/time_in_day_converter.cr#L18"},"def":{"name":"-","args":[{"name":"time_in_day","external_name":"time_in_day","restriction":"Clear::TimeInDay"}],"visibility":"Public","body":"self - time_in_day.microseconds.microseconds"}},{"html_id":"at(time_in_day:Clear::TimeInDay,timezone=nil):Time-instance-method","name":"at","abstract":false,"args":[{"name":"time_in_day","external_name":"time_in_day","restriction":"Clear::TimeInDay"},{"name":"timezone","default_value":"nil","external_name":"timezone","restriction":""}],"args_string":"(time_in_day : Clear::TimeInDay, timezone = nil) : Time","args_html":"(time_in_day : Clear::TimeInDay, timezone = nil) : Time","location":{"filename":"src/clear/extensions/time_in_days/time_in_day_converter.cr","line_number":2,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/time_in_days/time_in_day_converter.cr#L2"},"def":{"name":"at","args":[{"name":"time_in_day","external_name":"time_in_day","restriction":"Clear::TimeInDay"},{"name":"timezone","default_value":"nil","external_name":"timezone","restriction":""}],"return_type":"Time","visibility":"Public","body":"if timezone\n if timezone.is_a?(String)\n timezone = Time::Location.load(timezone)\n end\n (self.in(timezone)).at_beginning_of_day + time_in_day.microseconds.microseconds\nelse\n at_beginning_of_day + time_in_day.microseconds.microseconds\nend"}}]},{"html_id":"clear/UUID","path":"UUID.html","kind":"struct","full_name":"UUID","name":"UUID","abstract":false,"superclass":{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"clear/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"},{"html_id":"clear/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"clear/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"clear/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/clear/extensions/uuid/uuid.cr","line_number":1,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/uuid/uuid.cr#L1"}],"repository_name":"clear","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"clear/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"}],"doc":"Represents a UUID (Universally Unique IDentifier).\n\nNOTE: To use `UUID`, you must explicitly import it with `require \"uuid\"`","summary":"

Represents a UUID (Universally Unique IDentifier).

","instance_methods":[{"html_id":"to_json(json:JSON::Builder)-instance-method","name":"to_json","abstract":false,"args":[{"name":"json","external_name":"json","restriction":"JSON::Builder"}],"args_string":"(json : JSON::Builder)","args_html":"(json : JSON::Builder)","location":{"filename":"src/clear/extensions/uuid/uuid.cr","line_number":2,"url":"https://github.com/crystal-garage/clear/blob/dd57cd6262e58b196e10686d759980d464ca7a77/src/clear/extensions/uuid/uuid.cr#L2"},"def":{"name":"to_json","args":[{"name":"json","external_name":"json","restriction":"JSON::Builder"}],"visibility":"Public","body":"json.string(to_s)"}}]}]}}) \ No newline at end of file diff --git a/toplevel.html b/toplevel.html new file mode 100644 index 000000000..2ee4aa0bc --- /dev/null +++ b/toplevel.html @@ -0,0 +1,1651 @@ + + + + + + + + + + + + + + + + + Top Level Namespace - clear develop + + + + + + + + + + +
+

+ + Top Level Namespace + +

+ + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ ARRAY_TYPEMAP = {"Bool" => "boolean[]", "String" => "text[]", "Float32" => "real[]", "Float64" => "double precision[]", "Int32" => "int[]", "Int64" => "bigint[]"} +
+ + +
+ ARRAY_VALUES = {bool: Bool, s: String, f32: Float32, f: Float64, i: Int32, i64: Int64} +
+ + +
+ + + + + + + +

+ + + + Macro Summary +

+ + + + + + +
+ +
+ + + + + + +

+ + + + Macro Detail +

+ +
+
+ + macro columns_to_instance_vars + + # +
+ +
+ +

Used internally to deserialise json

+
+ +
+
+ + [View source] + +
+
+ + + + + +
+ + +