Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
dgraph
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mirror
dgraph
Commits
a7373c42
Commit
a7373c42
authored
9 years ago
by
Pawan Rawal
Browse files
Options
Downloads
Patches
Plain Diff
Added new file client.go and client_test.go and moved relevant code there.
parent
a69c5819
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
client/client.go
+42
-0
42 additions, 0 deletions
client/client.go
client/client_test.go
+1
-1
1 addition, 1 deletion
client/client_test.go
client/go/main.go
+0
-23
0 additions, 23 deletions
client/go/main.go
with
43 additions
and
24 deletions
client/client.go
0 → 100644
+
42
−
0
View file @
a7373c42
/*
* Copyright 2016 DGraph Labs, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
client
import
"github.com/dgraph-io/dgraph/query/pb"
func
NumChildren
(
resp
*
pb
.
GraphResponse
)
int
{
return
len
(
resp
.
Children
)
}
func
HasValue
(
resp
*
pb
.
GraphResponse
)
bool
{
for
_
,
val
:=
range
resp
.
Result
.
Values
{
if
len
(
val
)
>
0
{
return
true
}
}
return
false
}
func
Values
(
resp
*
pb
.
GraphResponse
)
[]
string
{
values
:=
[]
string
{}
for
_
,
val
:=
range
resp
.
Result
.
Values
{
if
len
(
val
)
>
0
{
values
=
append
(
values
,
string
(
val
))
}
}
return
values
}
This diff is collapsed.
Click to expand it.
client/
go/main
_test.go
→
client/
client
_test.go
+
1
−
1
View file @
a7373c42
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
* limitations under the License.
* limitations under the License.
*/
*/
package
main
package
client
import
(
import
(
"io/ioutil"
"io/ioutil"
...
...
This diff is collapsed.
Click to expand it.
client/go/main.go
+
0
−
23
View file @
a7373c42
...
@@ -31,29 +31,6 @@ var glog = x.Log("client")
...
@@ -31,29 +31,6 @@ var glog = x.Log("client")
var
ip
=
flag
.
String
(
"ip"
,
"127.0.0.1:8081"
,
"Port to communicate with server"
)
var
ip
=
flag
.
String
(
"ip"
,
"127.0.0.1:8081"
,
"Port to communicate with server"
)
var
q
=
flag
.
String
(
"query"
,
""
,
"Query sent to the server"
)
var
q
=
flag
.
String
(
"query"
,
""
,
"Query sent to the server"
)
func
NumChildren
(
resp
*
pb
.
GraphResponse
)
int
{
return
len
(
resp
.
Children
)
}
func
HasValue
(
resp
*
pb
.
GraphResponse
)
bool
{
for
_
,
val
:=
range
resp
.
Result
.
Values
{
if
len
(
val
)
>
0
{
return
true
}
}
return
false
}
func
Values
(
resp
*
pb
.
GraphResponse
)
[]
string
{
values
:=
[]
string
{}
for
_
,
val
:=
range
resp
.
Result
.
Values
{
if
len
(
val
)
>
0
{
values
=
append
(
values
,
string
(
val
))
}
}
return
values
}
func
main
()
{
func
main
()
{
flag
.
Parse
()
flag
.
Parse
()
// TODO(pawan): Pick address for server from config
// TODO(pawan): Pick address for server from config
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment