finox 0.1.0-aarch64-linux-musl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.rspec +3 -0
- data/.rubocop.yml +8 -0
- data/CHANGELOG.md +5 -0
- data/LICENSE.txt +21 -0
- data/README.md +60 -0
- data/Rakefile +22 -0
- data/lib/finox/3.1/finox.so +0 -0
- data/lib/finox/3.2/finox.so +0 -0
- data/lib/finox/3.3/finox.so +0 -0
- data/lib/finox/3.4/finox.so +0 -0
- data/lib/finox/version.rb +5 -0
- data/lib/finox.rb +11 -0
- metadata +65 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: aa68af93475284e3ff73a9d32c10ddec73b37f608def0e54303e7615cf35dc59
|
|
4
|
+
data.tar.gz: b6a6112e5a6c38511b8be475ede6adca31ec8bdb374bafb352774ac5d6f5f221
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: dd79a33e02e875f33fcdd368218507b2bbafb496ce0b65c97e8ba3b2110f47d1aa83dd3d7cce0ed8b11c0fe398830df110f0876568ca1c6189e2b2e71207882f
|
|
7
|
+
data.tar.gz: 25df346201fe3c6fb733d5eee3adf2a011bd3256770982926235117908803b0a1697f3f9bf7d6a8e463c9fca421bc00fbef62112ed85d0820c0a4dcfd8e0db6c
|
data/.rspec
ADDED
data/.rubocop.yml
ADDED
data/CHANGELOG.md
ADDED
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 kyuuri1791
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# Finox
|
|
2
|
+
|
|
3
|
+
A MySQL query parser for Ruby, powered by [sqlparser-rs](https://github.com/apache/datafusion-sqlparser-rs).
|
|
4
|
+
|
|
5
|
+
Finox parses SQL with Rust and returns the AST as plain Ruby Hashes and Arrays.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
Add to your Gemfile:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
bundle add finox
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Or install directly:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
gem install finox
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
A Rust toolchain is required to build the native extension.
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
```ruby
|
|
26
|
+
require "finox"
|
|
27
|
+
|
|
28
|
+
ast = Finox.parse("SELECT `name` FROM `users` WHERE id = 1")
|
|
29
|
+
# => [{"Query" => {with: nil, body: {"Select" => {...}}, ...}}]
|
|
30
|
+
|
|
31
|
+
ast.dig(0, "Query", :body, "Select", :projection)
|
|
32
|
+
# => [{"UnnamedExpr" =>
|
|
33
|
+
# {"Identifier" =>
|
|
34
|
+
# {value: "name",
|
|
35
|
+
# quote_style: "`",
|
|
36
|
+
# span: {start: {line: 1, column: 8}, end: {line: 1, column: 14}}}}}]
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
`Finox.parse` returns one Hash per statement, so `"SELECT 1; SELECT 2"` yields an array of two.
|
|
40
|
+
|
|
41
|
+
Key convention (from serde's externally tagged enums): enum variant names are `String` keys (`"Query"`, `"Select"`, `"Identifier"`), struct fields are `Symbol` keys (`:body`, `:projection`, `:value`).
|
|
42
|
+
|
|
43
|
+
Invalid SQL raises `Finox::ParseError`:
|
|
44
|
+
|
|
45
|
+
```ruby
|
|
46
|
+
Finox.parse("SELEKT 1")
|
|
47
|
+
# => Finox::ParseError: sql parser error: Expected: an SQL statement, found: SELEKT at Line: 1, Column: 1
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Development
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
bundle install
|
|
54
|
+
bundle exec rake compile # build the Rust extension
|
|
55
|
+
bundle exec rake # compile + spec + rubocop
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## License
|
|
59
|
+
|
|
60
|
+
[MIT](LICENSE.txt)
|
data/Rakefile
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "bundler/gem_tasks"
|
|
4
|
+
require "rspec/core/rake_task"
|
|
5
|
+
|
|
6
|
+
RSpec::Core::RakeTask.new(:spec)
|
|
7
|
+
|
|
8
|
+
require "rubocop/rake_task"
|
|
9
|
+
|
|
10
|
+
RuboCop::RakeTask.new
|
|
11
|
+
|
|
12
|
+
require "rb_sys/extensiontask"
|
|
13
|
+
|
|
14
|
+
task build: :compile
|
|
15
|
+
|
|
16
|
+
GEMSPEC = Gem::Specification.load("finox.gemspec")
|
|
17
|
+
|
|
18
|
+
RbSys::ExtensionTask.new("finox", GEMSPEC) do |ext|
|
|
19
|
+
ext.lib_dir = "lib/finox"
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
task default: %i[compile spec rubocop]
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
data/lib/finox.rb
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "finox/version"
|
|
4
|
+
|
|
5
|
+
begin
|
|
6
|
+
# Precompiled native gems ship one shared object per minor Ruby version.
|
|
7
|
+
ruby_minor = RUBY_VERSION[/\d+\.\d+/]
|
|
8
|
+
require_relative "finox/#{ruby_minor}/finox"
|
|
9
|
+
rescue LoadError
|
|
10
|
+
require_relative "finox/finox"
|
|
11
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: finox
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: aarch64-linux-musl
|
|
6
|
+
authors:
|
|
7
|
+
- kyuuri1791
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: exe
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2026-07-17 00:00:00.000000000 Z
|
|
12
|
+
dependencies: []
|
|
13
|
+
description: Parses MySQL queries with the Rust sqlparser crate (via magnus) and returns
|
|
14
|
+
the AST as plain Ruby Hashes and Arrays.
|
|
15
|
+
email:
|
|
16
|
+
executables: []
|
|
17
|
+
extensions: []
|
|
18
|
+
extra_rdoc_files: []
|
|
19
|
+
files:
|
|
20
|
+
- ".rspec"
|
|
21
|
+
- ".rubocop.yml"
|
|
22
|
+
- CHANGELOG.md
|
|
23
|
+
- LICENSE.txt
|
|
24
|
+
- README.md
|
|
25
|
+
- Rakefile
|
|
26
|
+
- lib/finox.rb
|
|
27
|
+
- lib/finox/3.1/finox.so
|
|
28
|
+
- lib/finox/3.2/finox.so
|
|
29
|
+
- lib/finox/3.3/finox.so
|
|
30
|
+
- lib/finox/3.4/finox.so
|
|
31
|
+
- lib/finox/version.rb
|
|
32
|
+
homepage: https://github.com/kyuuri1791/finox
|
|
33
|
+
licenses:
|
|
34
|
+
- MIT
|
|
35
|
+
metadata:
|
|
36
|
+
homepage_uri: https://github.com/kyuuri1791/finox
|
|
37
|
+
source_code_uri: https://github.com/kyuuri1791/finox
|
|
38
|
+
changelog_uri: https://github.com/kyuuri1791/finox/blob/main/CHANGELOG.md
|
|
39
|
+
rubygems_mfa_required: 'true'
|
|
40
|
+
post_install_message:
|
|
41
|
+
rdoc_options: []
|
|
42
|
+
require_paths:
|
|
43
|
+
- lib
|
|
44
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
45
|
+
requirements:
|
|
46
|
+
- - ">="
|
|
47
|
+
- !ruby/object:Gem::Version
|
|
48
|
+
version: '3.1'
|
|
49
|
+
- - "<"
|
|
50
|
+
- !ruby/object:Gem::Version
|
|
51
|
+
version: 3.5.dev
|
|
52
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
53
|
+
requirements:
|
|
54
|
+
- - ">="
|
|
55
|
+
- !ruby/object:Gem::Version
|
|
56
|
+
version: 3.3.11
|
|
57
|
+
- - ">="
|
|
58
|
+
- !ruby/object:Gem::Version
|
|
59
|
+
version: 3.3.22
|
|
60
|
+
requirements: []
|
|
61
|
+
rubygems_version: 3.5.23
|
|
62
|
+
signing_key:
|
|
63
|
+
specification_version: 4
|
|
64
|
+
summary: MySQL query parser for Ruby, powered by sqlparser-rs.
|
|
65
|
+
test_files: []
|