From 90e86438d5da96cb345b2ea8d32ece27bd207e22 Mon Sep 17 00:00:00 2001 From: Watson Date: Fri, 24 Nov 2023 05:04:42 +0900 Subject: [PATCH] Update RBS definitions --- sig/ilios.rbs | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/sig/ilios.rbs b/sig/ilios.rbs index 585539f..8f98333 100644 --- a/sig/ilios.rbs +++ b/sig/ilios.rbs @@ -1,4 +1,39 @@ module Ilios VERSION: String - # See the writing guide of rbs: https://github.com/ruby/rbs#guides + + module Cassandra + def self.config=: (Hash[Symbol, untyped]) -> void + def self.session: () -> Ilios::Cassandra::Session + def self.connect: () -> Ilios::Cassandra::Session + + class Session + def prepare_async: (String) -> Ilios::Cassandra::Future + def prepare: (String) -> Ilios::Cassandra::Statement + + def execute_async: (Ilios::Cassandra::Statement) -> Ilios::Cassandra::Future + def execute: (Ilios::Cassandra::Statement) -> Ilios::Cassandra::Result + end + + class Statement + def bind: (Hash[Symbol, untyped] | Hash[String, untyped]) -> self + def page_size: (Integer) -> self + end + + class Future + def on_success: () { (Ilios::Cassandra::Result) -> void } -> self + def on_failure: () { () -> void } -> self + def await: () -> Ilios::Cassandra::Future + end + + class Result + type row_type = Hash[String, untyped] + + include Enumerable[row_type] + + def each: () { (row_type) -> void } -> void | + () -> ::Enumerator[row_type, self] + def next_page: () -> Ilios::Cassandra::Result | + () -> nil + end + end end