Skip to content

Commit

Permalink
rename migration, add peerdb.UUID function
Browse files Browse the repository at this point in the history
  • Loading branch information
serprex committed Mar 14, 2024
1 parent edcfd60 commit 89faa7f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
4 changes: 2 additions & 2 deletions flow/model/qrecord_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import (
)

func TestEquals(t *testing.T) {
uuidVal1, _ := uuid.NewRandom()
uuidVal2, _ := uuid.NewRandom()
uuidVal1 := uuid.New()
uuidVal2 := uuid.New()

tests := []struct {
name string
Expand Down
16 changes: 10 additions & 6 deletions flow/pua/peerdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ func RegisterTypes(ls *lua.LState) {
peerdb.RawSetString("RowToJSON", ls.NewFunction(LuaRowToJSON))
peerdb.RawSetString("RowColumns", ls.NewFunction(LuaRowColumns))
peerdb.RawSetString("Now", ls.NewFunction(LuaNow))
peerdb.RawSetString("UUID", ls.NewFunction(LuaUUID))
ls.Env.RawSetString("peerdb", peerdb)
}

Expand Down Expand Up @@ -138,18 +139,16 @@ func LuaRecordIndex(ls *lua.LState) int {
record, key := LuaRecord.StartIndex(ls)
switch key {
case "kind":
var tyname string
switch record.(type) {
case *model.InsertRecord:
tyname = "insert"
ls.Push(lua.LString("insert"))
case *model.UpdateRecord:
tyname = "update"
ls.Push(lua.LString("update"))
case *model.DeleteRecord:
tyname = "delete"
ls.Push(lua.LString("delete"))
case *model.RelationRecord:
tyname = "relation"
ls.Push(lua.LString("relation"))
}
ls.Push(lua.LString(tyname))
case "row":
items := record.GetItems()
if items != nil {
Expand Down Expand Up @@ -334,6 +333,11 @@ func LuaNow(ls *lua.LState) int {
return 1
}

func LuaUUID(ls *lua.LState) int {
ls.Push(LuaUuid.New(ls, uuid.New()))
return 1
}

func LuaTimeIndex(ls *lua.LState) int {
tm, key := LuaTime.StartIndex(ls)
switch key {
Expand Down
File renamed without changes.

0 comments on commit 89faa7f

Please sign in to comment.