
Security News
Astral Launches pyx: A Python-Native Package Registry
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.
require 'rubygems' require 'lib/relaxdb'
RelaxDB.configure :host => "localhost", :port => 5984, :design_doc => "app" #, :logger => Logger.new(STDOUT) RelaxDB.delete_db "relaxdb_scratch" rescue :ok RelaxDB.use_db "relaxdb_scratch" RelaxDB.enable_view_creation # creates views when class definition is executed
class User < RelaxDB::Document property :name end
class Invite < RelaxDB::Document
property :created_at
property :event_name
property :state, :default => "awaiting_response", :validator => lambda { |s| %w(accepted rejected awaiting_response).include? s }
references :sender, :validator => :required
references :recipient, :validator => :required
property :sender_name, :derived => [:sender, lambda { |p, o| o.sender.name } ]
view_docs_by :sender_name view_docs_by :sender_id view_docs_by :recipient_id, :created_at, :descending => true
def on_update_conflict puts "conflict!" end
end
sofa = User.new(:name => "sofa").save! futon = User.new(:name => "futon").save!
i = Invite.new :sender => sofa, :recipient => futon, :event_name => "CouchCamp" i.save!
il = RelaxDB.load i._id puts i == il # true
ir = Invite.by_sender_name "sofa" puts i == ir # true
ix = Invite.by_sender_name(:key => "sofa").first puts i == ix # true
puts ix.sender_name # prints sofa, no requests to CouchDB made puts ix.sender.name # prints sofa, a single CouchDB request made
idup = i.dup i.save! idup.save # conflict printed
i = Invite.new :sender => sofa, :event_name => "CouchCamp"
i.save! rescue :ok # save! throws an exception on validation failure or conflict i.save # returns false rather than throwing an exception puts i.errors.inspect # prints {:recipient=>"invalid:"}
i.validation_skip_list << :recipient # Any and all validations may be skipped i.save # succeeds
FAQs
Unknown package
We found that relaxdb 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
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.
Security News
The Latio podcast explores how static and runtime reachability help teams prioritize exploitable vulnerabilities and streamline AppSec workflows.
Security News
The latest Opengrep releases add Apex scanning, precision rule tuning, and performance gains for open source static code analysis.