修改测试例子
This commit is contained in:
parent
4c18c0bdac
commit
2801aa9647
|
|
@ -7,7 +7,7 @@ events {
|
||||||
}
|
}
|
||||||
|
|
||||||
http {
|
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;;';
|
lua_package_cpath 'src/share/lib/?.so;;';
|
||||||
|
|
||||||
# Path of the file with trusted CA certificates.
|
# Path of the file with trusted CA certificates.
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,8 @@ DB = {
|
||||||
password = DB.password or nil
|
password = DB.password or nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
print(DB)
|
||||||
|
|
||||||
local sql, _connect
|
local sql, _connect
|
||||||
|
|
||||||
-- Get database by settings
|
-- Get database by settings
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,10 @@ DB = {
|
||||||
DEBUG = true,
|
DEBUG = true,
|
||||||
new = true,
|
new = true,
|
||||||
backtrace = true,
|
backtrace = true,
|
||||||
name = "AuthDB",
|
name = "postgres",
|
||||||
type = "postgresql",
|
type = "postgresql",
|
||||||
username = "postgresql",
|
username = "postgres",
|
||||||
password = "Admin123",
|
password = "1qaz2wsx",
|
||||||
host = "127.0.0.1",
|
host = "127.0.0.1",
|
||||||
port = 5432
|
port = 5432
|
||||||
}
|
}
|
||||||
|
|
@ -37,15 +37,15 @@ local user = User({
|
||||||
})
|
})
|
||||||
|
|
||||||
user:save()
|
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
|
-- User Bob Smith has id 1
|
||||||
|
|
||||||
----------------------------- GET DATA --------------------------------
|
----------------------------- GET DATA --------------------------------
|
||||||
|
|
||||||
local first_user = User.get:first()
|
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
|
-- First user name is: First user
|
||||||
|
|
||||||
local users = User.get:all()
|
local users = User.get:all()
|
||||||
print("We get " .. users:count() .. " users")
|
ngx.say("We get " .. users:count() .. " users")
|
||||||
-- We get 5 users
|
-- We get 5 users
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user