Skip to content

Commit

Permalink
3 tweaks:
Browse files Browse the repository at this point in the history
LState: IncludeGoStackTraces
peerdb.RowColumns: start indexing at 1
Time: rename `unix` to `unix_seconds`, expose `unix` as returning a floating point number of seconds since unix epoch
  • Loading branch information
serprex committed Mar 18, 2024
1 parent 85ad7a8 commit 0bae8c4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion flow/connectors/kafka/kafka.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func (c *KafkaConnector) SyncRecords(ctx context.Context, req *model.SyncRecords
var fn *lua.LFunction
var ls *lua.LState
if req.Script != "" {
ls = lua.NewState(lua.Options{SkipOpenLibs: true})
ls = lua.NewState(lua.Options{SkipOpenLibs: true, IncludeGoStackTrace: true})
defer ls.Close()
ls.SetContext(wgCtx)
for _, pair := range []struct {
Expand Down
6 changes: 4 additions & 2 deletions flow/pua/peerdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ func LuaRowColumns(ls *lua.LState) int {
_, row := LuaRow.Check(ls, 1)
tbl := ls.CreateTable(len(row.ColToValIdx), 0)
for col, idx := range row.ColToValIdx {
tbl.RawSetInt(idx, lua.LString(col))
tbl.RawSetInt(idx+1, lua.LString(col))
}
ls.Push(tbl)
return 1
Expand Down Expand Up @@ -509,8 +509,10 @@ func LuaTimeIndex(ls *lua.LState) int {
ls.Push(LuaI64.New(ls, tm.UnixMicro()))
case "unix_milli":
ls.Push(LuaI64.New(ls, tm.UnixMilli()))
case "unix":
case "unix_second":
ls.Push(LuaI64.New(ls, tm.Unix()))
case "unix":
ls.Push(lua.LNumber(float64(tm.Unix()) + float64(tm.Nanosecond())/1e9))
case "year":
ls.Push(lua.LNumber(tm.Year()))
case "month":
Expand Down

0 comments on commit 0bae8c4

Please sign in to comment.