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
|
|
@ -28,6 +28,20 @@ type Collection struct {
|
|||
childs []*Node // Child nodes
|
||||
}
|
||||
|
||||
// NewCollectionObject creates a new Collection instance without persisting it to the database.
|
||||
// This is useful when you want to prepare a Collection for later storage.
|
||||
func NewCollection(name string, metadata []byte) *Collection {
|
||||
return &Collection{
|
||||
Node: Node{
|
||||
name: name,
|
||||
_class: "COLLECTION",
|
||||
metadata: metadata,
|
||||
Id: -1, // Use -1 to indicate not persisted
|
||||
},
|
||||
childs: make([]*Node, 0),
|
||||
}
|
||||
}
|
||||
|
||||
// Internal RelationshipClass to handle the collection to node relationship
|
||||
type collection_relation struct{}
|
||||
|
||||
|
|
|
|||
Reference in a new issue