Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
MKCLOS
Core Development Platform
corepkgv2
Commits
157fafb1
Commit
157fafb1
authored
4 years ago
by
Akshay Bharambe
Browse files
Options
Downloads
Patches
Plain Diff
Remove: Commented code from dgraph
parent
8d30bcec
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!188
V2 : mep deployemet28 april2020
,
!183
Add: Transactions support for graph db operations.
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dalmdl/dgraph/dgraph.go
+0
-51
dalmdl/dgraph/dgraph.go
with
0 additions
and
51 deletions
dalmdl/dgraph/dgraph.go
+
0
−
51
View file @
157fafb1
...
@@ -185,10 +185,6 @@ func GetTransaction(hostName string) (*dgo.Txn, error) {
...
@@ -185,10 +185,6 @@ func GetTransaction(hostName string) (*dgo.Txn, error) {
//
//
// The result is against the provided key in the query.
// The result is against the provided key in the query.
func
(
dg
*
DGraphDAO
)
GetData
(
ctx
context
.
Context
,
query
string
,
vars
map
[
string
]
string
)
([]
byte
,
error
)
{
func
(
dg
*
DGraphDAO
)
GetData
(
ctx
context
.
Context
,
query
string
,
vars
map
[
string
]
string
)
([]
byte
,
error
)
{
// instance, err := GetInstance(dg.HostName)
// if err != nil {
// return nil, err
// }
txn
:=
dg
.
instance
.
client
.
NewReadOnlyTxn
()
.
BestEffort
()
txn
:=
dg
.
instance
.
client
.
NewReadOnlyTxn
()
.
BestEffort
()
var
(
var
(
...
@@ -256,10 +252,6 @@ func (dg *DGraphDAO) DeleteDataTXN(ctx context.Context, txn *dgo.Txn, data []byt
...
@@ -256,10 +252,6 @@ func (dg *DGraphDAO) DeleteDataTXN(ctx context.Context, txn *dgo.Txn, data []byt
//
//
// Ex. Persion1 `follows` Person2.
// Ex. Persion1 `follows` Person2.
func
(
dg
*
DGraphDAO
)
DeleteEdge
(
ctx
context
.
Context
,
uid
string
,
predicates
...
string
)
error
{
func
(
dg
*
DGraphDAO
)
DeleteEdge
(
ctx
context
.
Context
,
uid
string
,
predicates
...
string
)
error
{
// instance, err := GetInstance(dg.HostName)
// if err != nil {
// return err
// }
mu
:=
&
api
.
Mutation
{
mu
:=
&
api
.
Mutation
{
CommitNow
:
true
,
CommitNow
:
true
,
...
@@ -276,10 +268,6 @@ func (dg *DGraphDAO) DeleteEdge(ctx context.Context, uid string, predicates ...s
...
@@ -276,10 +268,6 @@ func (dg *DGraphDAO) DeleteEdge(ctx context.Context, uid string, predicates ...s
//
//
// Ex. Persion1 `follows` Person2.
// Ex. Persion1 `follows` Person2.
func
(
dg
*
DGraphDAO
)
DeleteEdgeTXN
(
ctx
context
.
Context
,
txn
*
dgo
.
Txn
,
uid
string
,
predicates
...
string
)
error
{
func
(
dg
*
DGraphDAO
)
DeleteEdgeTXN
(
ctx
context
.
Context
,
txn
*
dgo
.
Txn
,
uid
string
,
predicates
...
string
)
error
{
// instance, err := GetInstance(dg.HostName)
// if err != nil {
// return err
// }
mu
:=
&
api
.
Mutation
{
mu
:=
&
api
.
Mutation
{
CommitNow
:
true
,
CommitNow
:
true
,
...
@@ -287,17 +275,11 @@ func (dg *DGraphDAO) DeleteEdgeTXN(ctx context.Context, txn *dgo.Txn, uid string
...
@@ -287,17 +275,11 @@ func (dg *DGraphDAO) DeleteEdgeTXN(ctx context.Context, txn *dgo.Txn, uid string
dgo
.
DeleteEdges
(
mu
,
uid
,
predicates
...
)
dgo
.
DeleteEdges
(
mu
,
uid
,
predicates
...
)
// // mu.CommitNow = true
// _, err := dg.instance.client.NewTxn().Mutate(ctx, mu)
return
dg
.
mutateTXN
(
ctx
,
mu
,
txn
)
return
dg
.
mutateTXN
(
ctx
,
mu
,
txn
)
}
}
// mutate creates or updates or deletes the node data.
// mutate creates or updates or deletes the node data.
func
(
dg
*
DGraphDAO
)
mutate
(
ctx
context
.
Context
,
mtn
*
api
.
Mutation
)
error
{
func
(
dg
*
DGraphDAO
)
mutate
(
ctx
context
.
Context
,
mtn
*
api
.
Mutation
)
error
{
// instance, err := GetInstance(dg.HostName)
// if err != nil {
// return err
// }
txn
:=
dg
.
instance
.
client
.
NewTxn
()
txn
:=
dg
.
instance
.
client
.
NewTxn
()
...
@@ -314,59 +296,26 @@ func (dg *DGraphDAO) mutateTXN(ctx context.Context, mtn *api.Mutation, txn *dgo.
...
@@ -314,59 +296,26 @@ func (dg *DGraphDAO) mutateTXN(ctx context.Context, mtn *api.Mutation, txn *dgo.
return
err
return
err
}
}
// // DropEdge deletes the edges for the mentioned node. predicate is the name of relationship between the node.
// //
// // Ex. Persion1 `follows` Person2.
// func (dg *DGraphDAO) DropEdge(ctx context.Context, uid string, predicates ...string) error {
// // instance, err := GetInstance(dg.HostName)
// // if err != nil {
// // return err
// // }
// mu := &api.Mutation{}
// dgo.DeleteEdges(mu, uid, predicates...)
// mu.CommitNow = true
// _, err := dg.instance.client.NewTxn().Mutate(ctx, mu)
// return err
// }
// CreateSchema sets the provided schema for the nodes data.
// CreateSchema sets the provided schema for the nodes data.
func
(
dg
*
DGraphDAO
)
CreateSchema
(
ctx
context
.
Context
,
schema
string
)
error
{
func
(
dg
*
DGraphDAO
)
CreateSchema
(
ctx
context
.
Context
,
schema
string
)
error
{
// instance, err := GetInstance(dg.HostName)
// if err != nil {
// return err
// }
return
dg
.
instance
.
client
.
Alter
(
ctx
,
&
api
.
Operation
{
Schema
:
schema
})
return
dg
.
instance
.
client
.
Alter
(
ctx
,
&
api
.
Operation
{
Schema
:
schema
})
}
}
// DropSchema deletes the current schema along with the data.
// DropSchema deletes the current schema along with the data.
func
(
dg
*
DGraphDAO
)
DropSchema
(
ctx
context
.
Context
)
error
{
func
(
dg
*
DGraphDAO
)
DropSchema
(
ctx
context
.
Context
)
error
{
// instance, err := GetInstance(dg.HostName)
// if err != nil {
// return err
// }
return
dg
.
instance
.
client
.
Alter
(
ctx
,
&
api
.
Operation
{
DropOp
:
api
.
Operation_ALL
})
return
dg
.
instance
.
client
.
Alter
(
ctx
,
&
api
.
Operation
{
DropOp
:
api
.
Operation_ALL
})
}
}
// DropData deletes complete data but maintains the schema.
// DropData deletes complete data but maintains the schema.
func
(
dg
*
DGraphDAO
)
DropData
(
ctx
context
.
Context
)
error
{
func
(
dg
*
DGraphDAO
)
DropData
(
ctx
context
.
Context
)
error
{
// instance, err := GetInstance(dg.HostName)
// if err != nil {
// return err
// }
return
dg
.
instance
.
client
.
Alter
(
ctx
,
&
api
.
Operation
{
DropOp
:
api
.
Operation_DATA
})
return
dg
.
instance
.
client
.
Alter
(
ctx
,
&
api
.
Operation
{
DropOp
:
api
.
Operation_DATA
})
}
}
// DropAttr deletes a specific attribute completely from data and the schema.
// DropAttr deletes a specific attribute completely from data and the schema.
func
(
dg
*
DGraphDAO
)
DropAttr
(
ctx
context
.
Context
,
attr
string
)
error
{
func
(
dg
*
DGraphDAO
)
DropAttr
(
ctx
context
.
Context
,
attr
string
)
error
{
// instance, err := GetInstance(dg.HostName)
// if err != nil {
// return err
// }
return
dg
.
instance
.
client
.
Alter
(
ctx
,
&
api
.
Operation
{
DropOp
:
api
.
Operation_ATTR
,
DropValue
:
attr
})
return
dg
.
instance
.
client
.
Alter
(
ctx
,
&
api
.
Operation
{
DropOp
:
api
.
Operation_ATTR
,
DropValue
:
attr
})
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
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
Menu
Explore
Projects
Groups
Topics
Snippets