diff --git a/README.md b/README.md
index 025cb92..9832ca9 100644
--- a/README.md
+++ b/README.md
@@ -32,8 +32,8 @@ go get -u github.com/mindstand/gogm/v2
Primary key strategies allow more customization over primary keys. A strategy is provided to gogm on initialization.
Built in primary key strategies are:
-- gogm.DefaultPrimaryKeyStrategy -- just use the graph id from neo4j as the primary key
-- gogm.UUIDPrimaryKeyStrategy -- uuid's as primary keys
+- `gogm.DefaultPrimaryKeyStrategy` -- just use the graph id from neo4j as the primary key
+- `gogm.UUIDPrimaryKeyStrategy` -- uuid's as primary keys
```go
// Example of the internal UUID strategy
PrimaryKeyStrategy{
@@ -52,6 +52,17 @@ PrimaryKeyStrategy{
}
```
+### Load Strategy
+Load strategies allow control over the queries generated by `Load` operations.
+Different strategies change the size of the queries sent to the database as well as the amount of work the database has to do.
+A load strategy is provided to gomg on initialization.
+
+The defined load strategies are:
+- `gogm.PATH_LOAD_STRATEGY` -- Use cypher path queries to generate simple queries for load operations.
+- `gogm.SCHEMA_LOAD_STRATEGY` -- Leverage the GoGM schema to generate more complex queries for load operations which results in less work for the database.
+
+Depending on your use case, `PATH_LOAD_STRATEGY` may result in higher latency.
+
### Struct Configuration
##### text notates deprecation
diff --git a/config.go b/config.go
index 9309338..83c6fa6 100644
--- a/config.go
+++ b/config.go
@@ -95,6 +95,14 @@ func (c *Config) validate() error {
c.TargetDbs = []string{"neo4j"}
}
+ if err := c.IndexStrategy.validate(); err != nil {
+ return err
+ }
+
+ if err := c.LoadStrategy.validate(); err != nil {
+ return err
+ }
+
return nil
}
@@ -128,3 +136,12 @@ const (
// IGNORE_INDEX skips the index step of setup
IGNORE_INDEX IndexStrategy = 2
)
+
+func (is IndexStrategy) validate() error {
+ switch is {
+ case ASSERT_INDEX, VALIDATE_INDEX, IGNORE_INDEX:
+ return nil
+ default:
+ return fmt.Errorf("invalid index strategy %d", is)
+ }
+}
diff --git a/load_strategy.go b/load_strategy.go
index 3424f4d..6938a40 100644
--- a/load_strategy.go
+++ b/load_strategy.go
@@ -37,6 +37,15 @@ const (
SCHEMA_LOAD_STRATEGY
)
+func (ls LoadStrategy) validate() error {
+ switch ls {
+ case PATH_LOAD_STRATEGY, SCHEMA_LOAD_STRATEGY:
+ return nil
+ default:
+ return fmt.Errorf("invalid load strategy %d", ls)
+ }
+}
+
// PathLoadStrategyMany loads many using path strategy
func PathLoadStrategyMany(variable, label string, depth int, additionalConstraints dsl.ConditionOperator) (dsl.Cypher, error) {
if variable == "" {