Last active
May 21, 2024 19:15
-
-
Save gszr/bcf525dd80ca216e183672984b95c6d0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local inspect = require "inspect" | |
require("kong.globalpatches")({ | |
cli = true, | |
}) | |
local conf_loader = require "kong.conf_loader" | |
local DB = require "kong.db" | |
local conf = assert(conf_loader(TEST_CONF_PATH)) | |
conf.database = "postgres" | |
local db = assert(DB.new(conf)) | |
assert(db:init_connector()) | |
local ok, err | |
consumer, err = db.consumers:insert({ | |
username = "c1", | |
}) | |
print("res = ", inspect(consumer)) | |
print("err = ", inspect(err)) | |
ok, err = db.consumers:select({ | |
id = consumer.id, | |
}) | |
print("res = ", inspect(ok)) | |
print("err = ", inspect(err)) | |
ok, err = db.consumers:delete({ | |
id = consumer.id, | |
}) | |
print("res = ", inspect(ok)) | |
print("err = ", inspect(err)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment