Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • T torque-postgresql
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 6
    • Issues 6
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 1
    • Merge requests 1
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Carlos
  • torque-postgresql
  • Wiki
  • Arel

Arel · Changes

Page history
Created Arel (markdown) authored Aug 18, 2019 by Carlos's avatar Carlos
Hide whitespace changes
Inline Side-by-side
Arel.md 0 → 100644
View page @ 5a26440d
Additional Arel features. In order to provide correct and smooth statements for the new features provided by this GEM, a bunch of Arel extensions where provided.
### Inflix operators
PostgreSQL allows a bunch of custom operators while working with [Arrays](https://www.postgresql.org/docs/9.6/functions-array.html), [Ranges](https://www.postgresql.org/docs/9.6/functions-range.html), and [Hashes](https://www.postgresql.org/docs/9.6/hstore.html).
These are the ones implemented and can be used with Arel nodes and attributes:
- `.overlaps` => &&
- `.contains` => @>
- `.contained_by` => <@
- `.has_key` => ?
- `.has_all_keys` => ?&
- `.has_any_keys` => ?|
- `.strictly_left` => <<
- `.strictly_right` => >>
- `.doesnt_right_extend` => &<
- `.doesnt_left_extend` => &>
- `.adjacent_to` => -|-
### Cast values
One of the things that allowed array associations and the period operations is being able to cast things from one type to another right on Arel. This means that time columns can be casted into dates and have all the capabilities of a normal Arel node.
If you are used to Arel, to cast something it's pretty simple:
```ruby
Event.arel_table[:created_at].cast(:date)
```
which will produce
```
"events"."created_at"::date
```
\ No newline at end of file
Clone repository
  • Wiki
  • Configuring

Core Extensions

  • Range

Data types

  • Enum
  • Enum Set
  • Interval
  • Date/Time Range
  • Box
  • Circle
  • Line
  • Segment

Querying

  • Arel
  • Has Many
  • Belongs to Many
  • Dynamic Attributes
  • Distinct On
  • Auxiliary Statements
  • Inherited Tables