
Security News
Follow-up and Clarification on Recent Malicious Ruby Gems Campaign
A clarification on our recent research investigating 60 malicious Ruby gems.
Generally, PgKingdom
is a set of tools to generate SQL queries for PostgreSQL.
Add this line to your application's Gemfile:
gem 'pgkingdom'
And then execute:
$ bundle
Or install it yourself as:
$ gem install pgkingdom
We used yard
gem to handle code documentation. Just do:
$ git clone git://github.com/indiesoft/pgkingdom.git
$ cd pgkingdom
$ bundle install
$ yard docs
And then you can view it by opening path_to_pgkingdom_source/docs/index.html
.
Currently this Gem has WIP status. To get all supported datatypes do:
PgKingdom.available_data_types
# => [:uuid, :boolean, :money, ... ]
If you ever need all PostgreSQL data types, sorted and grouped do:
PgKingdom.data_types
# => {
# "uuid": [ :uuid ],
# "boolean": [ :boolean ],
# "numeric": [
# [ :smallint, :integer, :bigint ],
# [ :smallserial, :serial, ...],
# [ ... ],
# ],
# ...
# }
Far far ago in a fairy SQL Kingdom powerful mages written magic scrolls. One day Princess found one and started to read...
Scroll
: The first spell you will learn is Table
spell. It used to (de)materialize containers for any type of essence of matter. First, define a table:
@frog_cage = PgKingdom::Table.new :abra_cadabra do
serial :id, :primary_key
varchar :name, 50, :not_null
boolean :prince, :default => 'FALSE'
end
# => #<PgKingdom::Table:...>
@frog_cage.schema # => :public
@frog_cage.name # => :abra_cadabra
Princess: But I don't want to create this frog cage at a festive fair!
(continued to read):
@frog_cage = PgKingdom::Table.new [:abra, :cadabra] do
# ...
end
# Ensure that cage will be created at your secret depot
@frog_cage.schema # => :abra
@frog_cage.name # => :cadabra
Princess
: Fine!
Scroll
: ...let's prepare materialization spell for frog cage, do:
@frog_cage.create
Scroll
: It will make fairy pen to write a new scroll with following spell:
CREATE TABLE IF NOT EXISTS public.abra_cadabra (
id SERIAL PRIMARY KEY,
name VARCHAR(50) NOT NULL,
prince BOOLEAN DEFAULT FALSE
);
Scroll
: If you're sure, that there is no frog cages near you, you can do:
@frog_cage.create! # => "CREATE TABLE public.abra_cadabra ( ... );\n"
Scroll
: In case, when you're not sure that princess from a neighboring fairy kingdom have her own frog cage, you can do:
@frog_cage = PgKingdom::Table.new [:neighborhood, :abra_cadabra] do
# ...
end
@frog_cage.table_exists?
# => "SELECT to_regclass('neighborhood.abra_cadabra') IS NOT NULL AS table_exists;"
Scroll
: Remember, if any container will make you tired, just do:
@frog_cage.drop # => "DROP TABLE IF EXISTS public.abra_cadabra;\n"
Princess
: I don't want to kiss frogs!....
After checking out the repo, run bin/setup
to install dependencies. Then, run rake spec
to run the tests. You can also run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
. To release a new version, update the version number in version.rb
, and then run bundle exec rake release
, which will create a git tag for the version, push git commits and tags, and push the .gem
file to rubygems.org.
Bug reports and pull requests are welcome on GitHub at https://github.com/indiesoft/pgkingdom.
The gem is available as open source under the terms of the MIT License.
FAQs
Unknown package
We found that pgkingdom demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A clarification on our recent research investigating 60 malicious Ruby gems.
Security News
ESLint now supports parallel linting with a new --concurrency flag, delivering major speed gains and closing a 10-year-old feature request.
Research
/Security News
A malicious Go module posing as an SSH brute forcer exfiltrates stolen credentials to a Telegram bot controlled by a Russian-speaking threat actor.