snowflaked 0.1.0-aarch64-linux → 0.1.2-aarch64-linux
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 +4 -4
- data/README.md +13 -2
- data/lib/snowflaked/3.2/snowflaked.so +0 -0
- data/lib/snowflaked/3.3/snowflaked.so +0 -0
- data/lib/snowflaked/3.4/snowflaked.so +0 -0
- data/lib/snowflaked/4.0/snowflaked.so +0 -0
- data/lib/snowflaked/model_extensions.rb +1 -1
- data/lib/snowflaked/schema_definitions.rb +5 -10
- data/lib/snowflaked/version.rb +1 -1
- data/lib/snowflaked.rb +9 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 75cbb2a00b48882b805caf24b928190d9e3fc814bf34e7efc0284975278d92d3
|
|
4
|
+
data.tar.gz: 90b1780dbadd717618235648424082d3fa8af19a1d1d729613d082f24d3fc241
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3dd253994c2010c0280288b87fea5e2341e764364365e3151713d6b7642bde7de4da3e3aef28822d38095442bf664b71142d8b743e8136aaf53cebe9c874050a
|
|
7
|
+
data.tar.gz: c89a0a6e3f55c0f45c037e9cd683fdff2d9103cf4b55ab120dd1f691685e3a110da416769158767990d98d310c7a539a1e4836f338f9584b06b18c03c8c73820
|
data/README.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# Snowflaked
|
|
2
2
|
|
|
3
|
+
[](https://github.com/luizkowalski/snowflaked/actions/workflows/ci.yml)
|
|
4
|
+
[](https://badge.fury.io/rb/snowflaked)
|
|
5
|
+
[](https://rubygems.org/gems/snowflaked)
|
|
6
|
+
[](LICENSE.txt)
|
|
7
|
+
|
|
3
8
|
A high-performance, thread-safe Snowflake ID generator for Ruby, powered by Rust.
|
|
4
9
|
|
|
5
10
|
Snowflake IDs are 64-bit unique identifiers that encode a timestamp, machine ID, and sequence number. They're time-sortable (IDs created later are always larger), making them ideal for distributed systems where you need unique IDs without coordination between machines. Unlike UUIDs, Snowflake IDs are smaller, sortable, and index-friendly for databases.
|
|
@@ -38,16 +43,22 @@ class CreateUsers < ActiveRecord::Migration[8.1]
|
|
|
38
43
|
def change
|
|
39
44
|
create_table :users do |t|
|
|
40
45
|
t.snowflake :external_id
|
|
46
|
+
t.bigint :uid
|
|
41
47
|
end
|
|
42
48
|
end
|
|
43
49
|
end
|
|
44
50
|
```
|
|
45
51
|
|
|
52
|
+
Columns created with `t.snowflake` are automatically detected and will have Snowflake IDs generated for them.
|
|
53
|
+
|
|
54
|
+
> [!WARNING]
|
|
55
|
+
> SQLite does not support column comments, which Snowflaked uses to auto-detect snowflake columns other than `:id`. When using SQLite, you must explicitly declare snowflake columns using the `snowflake_id` helper in your model.
|
|
56
|
+
|
|
46
57
|
If you want to generate Snowflake IDs for additional columns, you can do so by using the `snowflake_id` method, without having to migrate the table:
|
|
47
58
|
|
|
48
59
|
```ruby
|
|
49
60
|
class User < ApplicationRecord
|
|
50
|
-
snowflake_id :
|
|
61
|
+
snowflake_id :uid
|
|
51
62
|
end
|
|
52
63
|
```
|
|
53
64
|
|
|
@@ -72,7 +83,7 @@ end
|
|
|
72
83
|
```ruby
|
|
73
84
|
Snowflaked.configure do |config|
|
|
74
85
|
config.machine_id = 42
|
|
75
|
-
config.epoch = Time.utc(
|
|
86
|
+
config.epoch = Time.utc(1989, 1, 3) # When not configured, the epoch is set to the Unix epoch (January 1, 1970)
|
|
76
87
|
end
|
|
77
88
|
```
|
|
78
89
|
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -19,7 +19,7 @@ module Snowflaked
|
|
|
19
19
|
def _snowflake_columns_from_comments
|
|
20
20
|
return [] unless table_exists?
|
|
21
21
|
|
|
22
|
-
columns.
|
|
22
|
+
columns.filter_map { |col| col.name.to_sym if col.comment == Snowflaked::SchemaDefinitions::COMMENT }
|
|
23
23
|
end
|
|
24
24
|
end
|
|
25
25
|
|
|
@@ -4,18 +4,13 @@ module Snowflaked
|
|
|
4
4
|
module SchemaDefinitions
|
|
5
5
|
COMMENT = "snowflaked"
|
|
6
6
|
|
|
7
|
-
module
|
|
8
|
-
def snowflake(name, **
|
|
9
|
-
|
|
10
|
-
column(name, :snowflake, **options)
|
|
7
|
+
module SnowflakeColumn
|
|
8
|
+
def snowflake(name, **)
|
|
9
|
+
column(name, :snowflake, comment: COMMENT, **)
|
|
11
10
|
end
|
|
12
11
|
end
|
|
13
12
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
options[:comment] = Snowflaked::SchemaDefinitions::COMMENT
|
|
17
|
-
column(name, :snowflake, **options)
|
|
18
|
-
end
|
|
19
|
-
end
|
|
13
|
+
TableDefinition = SnowflakeColumn
|
|
14
|
+
Table = SnowflakeColumn
|
|
20
15
|
end
|
|
21
16
|
end
|
data/lib/snowflaked/version.rb
CHANGED
data/lib/snowflaked.rb
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require_relative "snowflaked/version"
|
|
4
|
-
|
|
4
|
+
|
|
5
|
+
# Load precompiled extension for the current Ruby version
|
|
6
|
+
begin
|
|
7
|
+
ruby_version = /(\d+\.\d+)/.match(RUBY_VERSION)
|
|
8
|
+
require "snowflaked/#{ruby_version}/snowflaked"
|
|
9
|
+
rescue LoadError
|
|
10
|
+
require "snowflaked/snowflaked"
|
|
11
|
+
end
|
|
12
|
+
|
|
5
13
|
require "socket"
|
|
6
14
|
|
|
7
15
|
require_relative "snowflaked/railtie" if defined?(Rails::Railtie)
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: snowflaked
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.2
|
|
5
5
|
platform: aarch64-linux
|
|
6
6
|
authors:
|
|
7
7
|
- Luiz Eduardo Kowalski
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-01-
|
|
11
|
+
date: 2026-01-10 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: A Ruby gem for generating Twitter Snowflake IDs using a high-performance
|
|
14
14
|
Rust backend. Thread-safe with configurable machine ID and custom epoch support.
|