https://github.com/alexwayfer/sequel-at_time_zone
Sequel extension that provides API for `AT TIME ZONE` SQL construct
https://github.com/alexwayfer/sequel-at_time_zone
Last synced: over 1 year ago
JSON representation
Sequel extension that provides API for `AT TIME ZONE` SQL construct
- Host: GitHub
- URL: https://github.com/alexwayfer/sequel-at_time_zone
- Owner: AlexWayfer
- License: mit
- Created: 2017-11-09T20:31:06.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2020-11-06T20:16:58.000Z (over 5 years ago)
- Last Synced: 2025-01-31T04:34:04.057Z (over 1 year ago)
- Language: Ruby
- Size: 6.84 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Sequel at_time_zone extension
A Sequel extension that provides API for `AT TIME ZONE` SQL construct.
## Status
[](https://badge.fury.io/rb/sequel-at_time_zone)
[](https://travis-ci.org/AlexWayfer/sequel-at_time_zone)
[](https://codecov.io/gh/AlexWayfer/sequel-at_time_zone)
[](https://codeclimate.com/github/AlexWayfer/sequel-at_time_zone/maintainability)
[](https://gemnasium.com/github.com/AlexWayfer/sequel-at_time_zone)
## Installation
### Bundler
Add this line to your project's Gemfile:
```ruby
gem 'sequel-at_time_zone', require: 'sequel/extensions/at_time_zone'
```
And then execute:
```
$ bundle
```
### Manually
Install this gem as:
```
$ gem install sequel-at_time_zone
```
And then require it in your project:
```ruby
require 'sequel/extensions/at_time_zone'
```
## Usage
If you have database schema like this:
```ruby
create_table :items do
primary_key :id
column :created_at, DateTime
end
```
Then you can use it like this:
```ruby
Sequel.extension :at_time_zone
DB[:items].select { [created_at, created_at.at_time_zone('America/New_York')] }
# => SELECT created_at, created_at AT TIME ZONE 'America/New_York' FROM items
```
## Contributing
1. Fork it
2. Create your feature branch
3. Commit your changes
4. Push to the branch
5. Create new Pull Request