GenerateCustomPath - returns custom path based on sync_key_template
(data map[string]interface{})
| 473 | |
| 474 | //GenerateCustomPath - returns custom path based on sync_key_template |
| 475 | func (schema *Schema) GenerateCustomPath(data map[string]interface{}) (path string, err error) { |
| 476 | syncKeyTemplate, ok := schema.SyncKeyTemplate() |
| 477 | if !ok { |
| 478 | err = fmt.Errorf("Failed to read sync_key_template from schema %v", schema.URL) |
| 479 | return |
| 480 | } |
| 481 | tpl, err := pongo2.FromString(syncKeyTemplate) |
| 482 | if err != nil { |
| 483 | return |
| 484 | } |
| 485 | path, err = tpl.Execute(pongo2.Context{}.Update(data)) |
| 486 | return |
| 487 | } |
| 488 | |
| 489 | //GetResourceIDFromPath - parse path and gets resourceID from it |
| 490 | func (schema *Schema) GetResourceIDFromPath(schemaPath string) string { |
no test coverage detected