func idToPropertiesString(i Identifier) (string, error) { properties := map[string]interface{}{ "_ID": string(i), } encoder := gremlin.GremlinPropertiesEncoder{} err := encoder.Encode(properties) if err != nil { logging.GetLogger().Error("Error while retrieving a Node: %s", err.Error()) return "", err } return encoder.String(), nil }
func toPropertiesString(e graphElement) ([]byte, error) { properties := map[string]interface{}{ "_ID": string(e.ID), } for k, v := range e.metadatas { if k == "_ID" { return nil, errors.New("_ID is a reserved value, can not be overridden by metadata") } properties[k] = v } encoder := gremlin.GremlinPropertiesEncoder{} err := encoder.Encode(properties) return encoder.Bytes(), err }
func toPropertiesString(e graphElement) ([]byte, error) { properties := map[string]interface{}{ "_ID": string(e.ID), "_host": e.host, } for k, v := range e.metadata { if k[0] == '_' { return nil, errors.New("Properties starting with _ are reserved") } properties[k] = v } encoder := gremlin.GremlinPropertiesEncoder{} err := encoder.Encode(properties) return encoder.Bytes(), err }