crudboy 0.2.0 → 0.2.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0b195104877b7807fcc50b78b278e7faad322cc6fd649355bfb5d0ac3ca44d61
4
- data.tar.gz: f20d2f0e5e0af9ce981ecec211bc3454c6a2df18f3c7a5b4a2f59fdeaeec1f28
3
+ metadata.gz: c6bcfe144b77ac91aa4ad9e8eae4532d1b24810cd624a7c87bab5db2c7cc604b
4
+ data.tar.gz: 29a225393068acf8e63d4e94fe9296b072aaea0b9b5a22a5fa6036dba17d7e0c
5
5
  SHA512:
6
- metadata.gz: 868fa74a46e9b0b3762ad828fe83423095d6f8c3c98a8200d9ec8e072d2f531476c049d5684f70f3ba007f4f4773fa058a13ec82635c84807c77be7c3f262ea2
7
- data.tar.gz: a6bcdc5a50f747a384b80126d6cf8d138de87e582d847d58af35fad0a15430c90c2f7e8dd080cfdd9938bbb14bdd783cd53f374a792111c6d9a9f2b235839ddf
6
+ metadata.gz: 491c91fd67de77810b7c2b34f0f8ed2e28d7ffafe3aa5dd7ae7e70dea26ab162b331eb1eccc1958939c8c347d507406075e19846befaf7c27d70d3e0b3659cd4
7
+ data.tar.gz: 06a30402773090b514e56c1bc7cf9e26f59ba63faa8e79bd366995cca0d6aaf50200fd6e6c6ab9f93d38571d11801c56f67ff6221417be0cd1b3277320733e3e
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- crudboy (0.2.0)
4
+ crudboy (0.2.2)
5
5
  activerecord (>= 6.0.3, < 6.2.0)
6
6
  activesupport (~> 6.0.3)
7
7
  composite_primary_keys (~> 12.0.3)
@@ -116,7 +116,14 @@ module Crudboy
116
116
  end
117
117
 
118
118
  def py_sqlmodel_primary_column_declaration
119
- format('%s: %s = Field(default_factory=gen_id, primary_key=True, max_length=%s, description="%s")', name, python_type, limit, comment)
119
+ raw_type = sql_type.scan(/^\w+/).first
120
+ if raw_type == 'varchar'
121
+ format('%s: %s = Field(default_factory=gen_uuid, primary_key=True, max_length=%s, description="%s")', name, python_type, limit, comment)
122
+ elsif raw_type == 'bigint'
123
+ format('%s: %s = Field(default_factory=gen_bigint_id, primary_key=True, max_length=%s, description="%s")', name, python_type, limit, comment)
124
+ else
125
+ format('%s: %s = Field(primary_key=True, max_length=%s, description="%s")', name, python_type, limit, comment)
126
+ end
120
127
  end
121
128
 
122
129
  def py_dto_column_declaration(optional = false)
data/lib/crudboy/model.rb CHANGED
@@ -14,6 +14,14 @@ module Crudboy
14
14
  columns.find { |c| c.name == active_record_model.primary_key }
15
15
  end
16
16
 
17
+ def created_at_column
18
+ columns.find { |c| c.created_at_column? }
19
+ end
20
+
21
+ def updated_at_column
22
+ columns.find { |c| c.updated_at_column? }
23
+ end
24
+
17
25
  def regular_columns
18
26
  columns.reject { |c| c.name == active_record_model.primary_key }
19
27
  end
@@ -1,3 +1,3 @@
1
1
  module Crudboy
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: crudboy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Liu Xiang
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-09-16 00:00:00.000000000 Z
11
+ date: 2025-11-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mysql2