-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.cr
39 lines (30 loc) · 921 Bytes
/
init.cr
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
require "./src/selenite-db"
Selenite::DB::Configuration.configure do |conf|
conf.client_encoding = "utf8"
conf.port = "5432"
conf.database = "crystal"
conf.user = "root"
conf.password = ""
conf.host = "localhost"
conf.env = "development"
end
class Users < Selenite::DB::Persistence
def self.table_name
"users"
end
@name : String?
@email : String?
@password : String?
@password_digest : String?
@token : String?
@temp_hash : String?
@status : String?
@gender : String?
property(id, created_at, updated_at)
set_property(name, email, password, password_digest, token, temp_hash, status, gender)
set_initializer(true, name, email, password, password_digest, token, temp_hash, status, gender)
end
user = Users.new({"name" => "Vitor Hugo", "email" => "[email protected]"})
user.save
puts "Nome do usuário é: #{user.name}"
puts "Nome do email é: #{user.email}"