From 6ef42d1ccbe0c6d26193dcbca46aaa04d082d2aa Mon Sep 17 00:00:00 2001 From: Leonardo Domingues Date: Fri, 5 Nov 2021 18:03:02 -0300 Subject: [PATCH] =?UTF-8?q?Implementa=C3=A7=C3=A3o=20de=20Registro=20simpl?= =?UTF-8?q?ificado=20da=20LCR?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/dataapi/lib_test.go | 65 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 64 insertions(+), 1 deletion(-) diff --git a/api/dataapi/lib_test.go b/api/dataapi/lib_test.go index a4b0dab..7c03e6a 100644 --- a/api/dataapi/lib_test.go +++ b/api/dataapi/lib_test.go @@ -1,9 +1,10 @@ package dataapi_test import ( - "go.digitalcircle.com.br/open/replaycli-go/api/dataapi" "log" "testing" + + "go.digitalcircle.com.br/open/replaycli-go/api/dataapi" ) func TestAPIRetrieve(t *testing.T) { @@ -80,3 +81,65 @@ func TestAPICreate(t *testing.T) { log.Printf("%#v", res) } + +func LCR_Create(t *testing.T) { + c := dataapi.NewCli("RnJpIDA1IE5vdiAyMDIxIDExOjE1OjIyIEFNIFVUQwo") + + res, err := c.Do(&dataapi.DataAPIRequest{ + Col: "LCR_Bot", + Op: dataapi.CREATE, + Data: map[string]interface{}{ + "Registro": "1", + }, + }) + if err != nil { + t.Fatal(err.Error()) + } + + log.Printf("%#v", res) +} + +/*func CreateControl(t *testing.T, table string) { + c := dataapi.NewCli("RnJpIDA1IE5vdiAyMDIxIDExOjE1OjIyIEFNIFVUQwo") + current := time.Now().Format("2006-01") + res, err := c.Do(&dataapi.DataAPIRequest{ + Col: table, + Op: dataapi.CREATE, + Data: map[string]interface{}{ + "date": current, + "qtd": 0, + }, + }) + if err != nil { + t.Fatal(err.Error()) + } + + log.Printf("%#v", res) +} + +func UpdateControl(t *testing.T, table string) { + c := dataapi.NewCli("RnJpIDA1IE5vdiAyMDIxIDExOjE1OjIyIEFNIFVUQwo") + current := time.Now().Format("2006-01") + res, err := c.Do(&dataapi.DataAPIRequest{ + Col: table, + Op: dataapi.RETRIEVE, + Q: "@[?date=="+current+"]", + }) + if err != nil { + t.Fatal(err.Error()) + } + res.Data()[0] + res, err := c.Do(&dataapi.DataAPIRequest{ + Col: "C1", + Op: dataapi.UPDATE, + Id: "2", + Data: map[string]interface{}{ + "F2": "Novo Campo", + }, + }) + if err != nil { + t.Fatal(err.Error()) + } + + log.Printf("%#v", res) +}*/