๐Ÿ‘ฉโ€๐Ÿš’ Firefighters API written in Gleam!
lustre gleam

:truck: use "sow" for generating new users

kacaii.dev a89fad00 cff3ec04

verified
+7 -6
+6 -5
server/dev/server_dev.gleam
··· 9 import server/user 10 import shared/role 11 12 - pub fn main() { 13 let db_process_name = process.new_name("db_conn") 14 let db = pog.named_connection(db_process_name) 15 ··· 21 let ctx = Context(db:, priv:, secret_key:) 22 23 case argv.load().arguments { 24 - ["mock"] -> mock_data(ctx) 25 _ -> Nil 26 } 27 } 28 29 - const max_users = 50 30 31 - fn mock_data(ctx: Context) { 32 int.range(1, max_users, with: Nil, run: fn(_, i) { 33 let id = int.to_string(i) 34 ··· 46 Nil 47 }) 48 49 - io.println("๓ฐšฉ " <> int.to_string(max_users) <> " users generated") 50 }
··· 9 import server/user 10 import shared/role 11 12 + pub fn main() -> Nil { 13 let db_process_name = process.new_name("db_conn") 14 let db = pog.named_connection(db_process_name) 15 ··· 21 let ctx = Context(db:, priv:, secret_key:) 22 23 case argv.load().arguments { 24 + ["sow"] -> sow_users(ctx) 25 + 26 _ -> Nil 27 } 28 } 29 30 + fn sow_users(ctx: Context) -> Nil { 31 + let max_users = 50 32 33 int.range(1, max_users, with: Nil, run: fn(_, i) { 34 let id = int.to_string(i) 35 ··· 47 Nil 48 }) 49 50 + io.println("๓ฑข— " <> int.to_string(max_users) <> " users generated") 51 }
+1 -1
server/justfile
··· 19 20 # ๎ˆฏ Populate the database with mock data 21 mock: 22 - gleam dev mock 23 24 # ๏ข Update project dependencies 25 deps-update:
··· 19 20 # ๎ˆฏ Populate the database with mock data 21 mock: 22 + gleam dev sow 23 24 # ๏ข Update project dependencies 25 deps-update: