Bind go-ruby-redis, go-ruby-pg and go-ruby-sequel into rbgo as native modules#99
Merged
Conversation
…utor seam wired to go-ruby-sqlite3 for real execution Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ocket = injected IO seam; 100% coverage on new binding code Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ake), socket = injected IO seam; 100% coverage on new binding code Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ution); 100% coverage on new binding code Executor seam wired to go-ruby-sqlite3 so DB[:t].all runs against a live SQLite database. Adds classOf cases for the new wrapper types. 100% coverage on all new binding code (redis/pg/sequel), full test suite green, gofmt+vet clean. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Binds three database libraries into rbgo (
require "redis"/require "pg"/require "sequel") as native modules, following the proven per-module pattern (<mod>.go+<mod>_bind.go, registered inbuiltins.go,providedFeaturesinrequire.go, value wrappers wired intoobject_model.go'sclassOf).Ruby API per module
redis —
Redis.new(connection: io, db:, username:, password:, protocol:)plus the command surface:get/set/setnx/getset/append/incr/decrfamily,hset/hget/hgetall/hdel/hmget(hashes),lpush/rpush/lpop/lrange(lists),sadd/smembers/sismember(sets),zadd/zscore/zrange/zrank(sorted sets),call(arbitrary command),pipelined { |p| ... }andmulti { |m| ... }. Value model:string→String,int64→Integer,float64→Float,bool→true|false,nil→nil,Array→Array,Map→Hash,Set→Set, big number → Integer,CommandError→ a raisedRedis::CommandError. Error treeRedis::BaseError < StandardErrorwithCommandError/ConnectionError.pg —
PG.connect(connection: io, user:, dbname:/database:, password:, ...)drives the StartupMessage + AuthenticationOk/MD5/SCRAM handshake, thenconn.exec/query/exec_params/prepare/exec_prepared→PG::Result(ntuples/nfields/fields/fname/fnumber/getvalue/getisnull/values/[]→Hash/each/cmd_tuples/cmd_status) with the OID type decoders, plusescape_string/escape_literal/escape_identifier/quote_ident. Error treePG::Error < StandardErrorwithConnectionBad/ServerError.sequel —
Sequel.sqlite(path)/Sequel.connect(adapter:/URL)/Sequel.mock(host:)→Sequel::Database;DB[:table]→Sequel::Datasetwith the chainable builders (where/exclude/select/order/reverse/group/having/distinct/limit/offset/join/inner_join/left_join/right_join) and terminals (sql/select_sql/insert_sql/update_sql/delete_sql/all/first/each/count/insert/update/delete); schema DSL viacreate_table(:t) { ... }(primary_key, typed columnsString/Integer/Bignum/Float/Numeric/Bool/Date/DateTime/Time,column,foreign_key,index).Sequel::Modeldeferred.Seams wired to what
#read/#write, e.g. a duck-typed socket).rubyConnbridges that object to the libraries'io.ReadWriterConn; pg'sPasswordAuthenticatordrives MD5/SCRAM over it. Documented in the binding headers. When rbgo grows a native socket it is wired here the same way.sqliteExecutorruns generated SQL throughExecuteHash.sequel → sqlite3 real execution: yes
DB[:t].all/first/countreally run the generated SELECT against a live in-memory SQLite database and return live rows;create_table/insert/update/deleteexecute their DDL/DML for real, withinsertreturning the SQLitelast_insert_rowidandupdate/deletethe affected-row count.Gates
go test ./...green (the one failure,TestChronicParse, is a pre-existing TZ-dependent test that passes underTZ=UTCas CI runs — unrelated to this PR).redis.go/redis_bind.go/pg.go/pg_bind.go/sequel.go/sequel_bind.go/sequel_schema.go), including socket-seam error paths (via injected fake sockets and canned RESP / PostgreSQL v3 backend byte streams) and executor error paths; genuinely-dead guards were deleted.gofmt+go vetclean.🤖 Generated with Claude Code