Skip to content

Commit 280db65

Browse files
Fix commands and swift
1 parent 24806d2 commit 280db65

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

templates/python/package/id.py.twig

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ from datetime import datetime
22
import random
33

44
class ID:
5-
// Generate a unique ID based on timestamp
6-
// Recreated from https://www.php.net/manual/en/function.uniqid.php
5+
# Generate a unique ID based on timestamp
6+
# Recreated from https://www.php.net/manual/en/function.uniqid.php
77
@staticmethod
88
def __uniqueId():
99
now = datetime.now()
@@ -16,8 +16,8 @@ class ID:
1616
def custom(id):
1717
return id
1818

19-
// Generate a unique ID with padding to have a longer ID
20-
// Recreated from https://github.com/utopia-php/database/blob/main/src/Database/ID.php#L13
19+
# Generate a unique ID with padding to have a longer ID
20+
# Recreated from https://github.com/utopia-php/database/blob/main/src/Database/ID.php#L13
2121
@staticmethod
2222
def unique(padding = 7):
2323
base_id = ID.__uniqueId()

templates/ruby/lib/container/id.rb.twig

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
require 'securerandom'
22

3-
// Generate a unique ID based on timestamp
4-
// Recreated from https://www.php.net/manual/en/function.uniqid.php
3+
#Generate a unique ID based on timestamp
4+
#Recreated from https://www.php.net/manual/en/function.uniqid.php
55
def uniqueId
66
now = Time.now
77
seconds_since_epoch = now.to_i
@@ -16,6 +16,8 @@ module {{spec.title | caseUcfirst}}
1616
id
1717
end
1818

19+
# Generate a unique ID with padding to have a longer ID
20+
# Recreated from https://github.com/utopia-php/database/blob/main/src/Database/ID.php#L13
1921
def self.unique(padding=7)
2022
base_id = uniqueId
2123
random_padding = SecureRandom.hex(padding)

templates/swift/Sources/ID.swift.twig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ public class ID {
1919
// Recreated from https://github.com/utopia-php/database/blob/main/src/Database/ID.php#L13
2020
public static func unique(padding: Int = 7) -> String {
2121
let baseId = uniqueId()
22-
let randomPadding = (1...padding).map {
23-
String(format: "%x", Int.random(in: 0..<16))
22+
let randomPadding = (1...padding).map {
23+
_ in String(format: "%x", Int.random(in: 0..<16))
2424
}.joined()
2525
return baseId + randomPadding
2626
}

0 commit comments

Comments
 (0)