From 2801aa96473e0b119bc26a125ee448e1751cb76d Mon Sep 17 00:00:00 2001 From: wanglei <34475144@qqcom> Date: Tue, 14 Oct 2025 17:16:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=B5=8B=E8=AF=95=E4=BE=8B?= =?UTF-8?q?=E5=AD=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- conf/nginx.conf | 2 +- src/share/orm/model.lua | 2 ++ src/test/testOrm.lua | 12 ++++++------ 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 07d0c48..4751128 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -7,7 +7,7 @@ events { } http { - lua_package_path 'src/?/?.lua;src/?.lua;src/share/?/?.lua;src/share/?.lua;/home/frankly/work/AuthPlatform/src/share/lib/?/?.lub;/home/frankly/work/AuthPlatform/src/share/lib/ngx-oauth/?.lua;;'; + lua_package_path 'src/?/?.lua;src/?.lua;src/share/?/?.lua;src/share/?.lua;/home/frankly/work/AuthPlatform/src/share/lib/?/?.lub;/home/frankly/work/AuthPlatform/src/share/lib/ngx-oauth/?.lua;/home/frankly/work/AuthPlatform/src/share/?/?.lub;/home/frankly/work/AuthPlatform/src/share/?.lua;;'; lua_package_cpath 'src/share/lib/?.so;;'; # Path of the file with trusted CA certificates. diff --git a/src/share/orm/model.lua b/src/share/orm/model.lua index 79eb0e5..0e28b63 100644 --- a/src/share/orm/model.lua +++ b/src/share/orm/model.lua @@ -47,6 +47,8 @@ DB = { password = DB.password or nil } +print(DB) + local sql, _connect -- Get database by settings diff --git a/src/test/testOrm.lua b/src/test/testOrm.lua index 89f3993..bf4497b 100644 --- a/src/test/testOrm.lua +++ b/src/test/testOrm.lua @@ -4,10 +4,10 @@ DB = { DEBUG = true, new = true, backtrace = true, - name = "AuthDB", + name = "postgres", type = "postgresql", - username = "postgresql", - password = "Admin123", + username = "postgres", + password = "1qaz2wsx", host = "127.0.0.1", port = 5432 } @@ -37,15 +37,15 @@ local user = User({ }) user:save() -print("User " .. user.username .. " has id " .. user.id) +ngx.say("User " .. user.username .. " has id " .. user.id) -- User Bob Smith has id 1 ----------------------------- GET DATA -------------------------------- local first_user = User.get:first() -print("First user name is: " .. first_user.username) +ngx.say("First user name is: " .. first_user.username) -- First user name is: First user local users = User.get:all() -print("We get " .. users:count() .. " users") +ngx.say("We get " .. users:count() .. " users") -- We get 5 users