vadv / gopher-lua-libs Goto Github PK
View Code? Open in Web Editor NEWLibs for gopher lua
License: BSD 3-Clause "New" or "Revised" License
Libs for gopher lua
License: BSD 3-Clause "New" or "Revised" License
Greetings!
Thank you for your libs.
If I make select query against type timestamp
query:
local result, err = pg:query("SELECT insert_date FROM table WHERE state = 0 LIMIT 1")
parse:
for _, r in pairs(result.rows) do
for id, column in pairs(result.columns) do
print(column, r[id])
end
end
2019/01/15 18:25:11 [ERROR] unknown type (value: `time.Time{wall:0xfd2b478, ext:63683068860, loc:(*time.Location)(0xc0001d41e0)}`, converted: `time.Time{wall:0xfd2b478, ext:63683068860, loc:(*time.Location)(0xc0001d41e0)}`)
insert_date nil
Is it possible to convent it to right type?
In typelist of Gopher-lua I did not found type time
.
Thanks!
Please create a release (v0.1.3?) so that the new module "shellescape" can be used without grabbing the latest from the sha via v0.1.3-0.20220321153755-354f4b160461
Greetings. Let's assume we have any golang package for glua-libs in somewhere outside of this repo. For example, ssh
- https://github.com/spigell/luscheduler/tree/master/libs/ssh. There is no big deal to add glua-libs and custom resources to project, but if we will use plugin
package with 3rd party modules inside then it seems to not loading.
local plugin = require("plugin")
local plugin_body = [[
local time = require("time")
local chef = require("chef")
local cron = require("ssh")
local i = 1
print(i)
time.sleep(2)
]]
local string_plugin = plugin.do_string(plugin_body)
string_plugin:run()
time.sleep(1)
if file_plugin:is_running() then
print("RUNNING")
else
print("NOT RUNNING")
print(string_plugin:error())
end
NOT RUNNING
<string>:3: module ssh not found:
no field package.preload['ssh']
stat ./ssh.lua: no such file or directory
stat /usr/local/share/lua/5.1/ssh.lua: no such file or directory
stat /usr/local/share/lua/5.1/ssh/init.lua: no such file or directory,
stack traceback:
[G]: in function 'require'
<string>:3: in main chunk
[G]: ?
In plugin package creates a new Lua state with only static list of modules - https://github.com/vadv/gopher-lua-libs/blob/master/plugin/api.go#L75
Is there any change add modules to preload table in the state?
Loader
returned by require
contains only Lua table with methods without metadata and do not fit for PreloadModules function.
Do you have any plans to support XML?
If you json.encode(json.decode("{}") you get "[]"
It should return {}
Greetings. Just warning. With recent updates of cbroglie/mustache and go-sql-driver/mysql CI runs is broken. Go modules not working there, because Travis worker clones git repo and put it inside GOPATH and GO111MODULE set to 'auto'.
go get: warning: modules disabled by GO111MODULE=auto in GOPATH/src;
ignoring go.mod;
see 'go help modules'
This behavior changed in go 1.13 - https://github.com/golang/go/wiki/Modules#recent-changes
Refered issues:
cbroglie/mustache#36
go-sql-driver/mysql#1040
With next update of this dependencies glua-libs can't be compiled with go < 1.13
The json library supports both Encoding and Decoding.
Would you accept a PR to make YAML encoding work, too?
This would simplify the work I've done in my own library.
As I'd like to have your extensions to use.
Greetings! I try to start http service as plugin. But if main loop tries to restart server after error I got error binding for port. This is example.
local plugin = require("plugin")
local time = require("time")
local plugin_server = [[
http = require("http")
inspect = require("inspect")
s = {}
local server, err = http.server("127.0.0.1:5001")
if err then error(err) end
function s.start()
while true do
local req, resp = server:accept()
print(inspect(req))
if req then
print("received")
resp:code(500)
resp:done()
error("I am broken")
end
end
end
s.start()
]]
server = plugin.do_string(plugin_server)
server:run()
while true do
time.sleep(1)
if not server:is_running() then
print("error:", tostring(server:error()))
server:run()
end
end
error: <string>:20: I am broken
stack traceback:
[G]: in function 'error'
<string>:20: in function 'start'
<string>:26: in main chunk
[G]: ?
error: <string>:7: listen tcp 127.0.0.1:5001: bind: address already in use
stack traceback:
[G]: in function 'error'
<string>:7: in main chunk
[G]: ?
Is any way to use http.server like this?
Thank you!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.