generated from alecodes/base-template
perf: do a bulk insert in fetchCollection
Improve performance over inserting each item individually
This commit is contained in:
parent
8c660053e5
commit
3cf643c83d
5 changed files with 118 additions and 12 deletions
29
pkg/node.go
29
pkg/node.go
|
|
@ -1,6 +1,13 @@
|
|||
package synchronizator
|
||||
|
||||
type StandardNode interface{}
|
||||
type StandardNode interface {
|
||||
GetClass() string
|
||||
GetName() string
|
||||
GetMetadata() []byte
|
||||
|
||||
SetId(int64)
|
||||
SetConnection(*DB)
|
||||
}
|
||||
|
||||
// A node in the database.
|
||||
// It adds some helper methods to easily manage the node.
|
||||
|
|
@ -13,6 +20,26 @@ type Node struct {
|
|||
metadata []byte // Arbitrary data. This is stored as a jsonb in the database
|
||||
}
|
||||
|
||||
func (node *Node) GetClass() string {
|
||||
return node._class
|
||||
}
|
||||
|
||||
func (node *Node) GetName() string {
|
||||
return node.name
|
||||
}
|
||||
|
||||
func (node *Node) GetMetadata() []byte {
|
||||
return node.metadata
|
||||
}
|
||||
|
||||
func (node *Node) SetId(id int64) {
|
||||
node.Id = id
|
||||
}
|
||||
|
||||
func (node *Node) SetConnection(conn *DB) {
|
||||
node._conn = conn
|
||||
}
|
||||
|
||||
// Creates a new relation of type StandardRelationship to the node with the
|
||||
// provided id. An error is returned if the relation already exists.
|
||||
//
|
||||
|
|
|
|||
Reference in a new issue