Update GoDoc.

This commit is contained in:
2021-04-02 21:19:02 +01:00
parent 3e146bf794
commit 05daf928f1
3 changed files with 40 additions and 0 deletions
+21
View File
@@ -1,6 +1,7 @@
package gql
import (
"fmt"
"testing"
"github.com/stretchr/testify/assert"
@@ -73,3 +74,23 @@ func Test_queryAgainstDatabaseExecution(t *testing.T) {
expected := `{"tbl_user_group_admins":[{"id":109,"is_admin":1}]}`
assert.Equal(expected, string(result), "Query result execution should be equal")
}
func ExampleQuery() {
variables := map[string]interface{}{
"fileHash": "123deadc0w321",
}
var query = `query searchFileKnown($fileHash: String) {
tbl_file_scans(where: {file_hash: {_eq: $fileHash}}) {
porn
racy
violence
virus
}
}`
result, err := Query(query, variables, nil)
if err != nil {
fmt.Println("Query error", err)
return
}
fmt.Println(result)
}