Facet Q - Facet Models For SQL Database Queries
facetq - "stand-alone" facet (activerecord) models for easy (re)use for sql database queries and more
Usage
require 'facetq'
config = {
adapter: 'postgresql',
encoding: 'unicode',
database: 'ethscriptions_vm_development',
username: '<your username here>',
password: '<your password here>'
}
ActiveRecord::Base.establish_connection( config )
puts " #{EthBlock.count} block(s)"
puts " #{Ethscription.count} ethscription(s)"
puts " #{TransactionReceipt.count} receipt(s)"
puts " #{ContractArtifact.count} contract artifact(s)"
puts " #{Contract.count} contract(s)"
puts " #{ContractTransaction.count} contract transaction(s)"
puts " #{ContractCall.count} contract call(s)"
puts " #{ContractState.count} countract state(s)"
puts " #{SystemConfigVersion.count} system config version(s)"
data = EthBlock.order(:block_number).limit(1)
pp data
puts
pp data.as_json
That's it for now.
Bonus - More Blockchain (Crypto) Tools, Libraries & Scripts In Ruby
See /blockchain
at the ruby code commons (rubycocos) org.
Join us in the Rubidity (community) discord (chat server). Yes you can.
Your questions and commentary welcome.
Or post them over at the Help & Support page. Thanks.