From 1511467d662bc97cdaba67fffd426a3f3f0c3543 Mon Sep 17 00:00:00 2001 From: CorvusYe Date: Fri, 12 May 2023 07:20:06 +0800 Subject: [PATCH] v0.0.1+2 --- CHANGELOG.md | 2 +- lib/src/types.dart | 23 ++++++++++++----------- lib/src/value_meta_data.dart | 16 ++++++++++------ pubspec.yaml | 2 +- 4 files changed, 24 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 925a24c..d93e04a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -## 0.0.1+1 +## 0.0.1+2 - Provided driver manager which can be used to register drivers and get a driver by its legal url diff --git a/lib/src/types.dart b/lib/src/types.dart index 48468ba..5593bc1 100644 --- a/lib/src/types.dart +++ b/lib/src/types.dart @@ -16,15 +16,17 @@ abstract class MetaKey { enum GdbTypes { // types in graph database - line, - point, - polygon, + none, node, - tag, - prop, - path, relationship, + path, + prop, step, + dataSet, + + list, + map, + set, // basic types in dart bool, @@ -43,11 +45,10 @@ enum GdbTypes { dateTime, duration, - list, - map, - set, - none, + line, + point, + polygon, + geo, unknown, - dataSet, } diff --git a/lib/src/value_meta_data.dart b/lib/src/value_meta_data.dart index 5dd897a..4232536 100644 --- a/lib/src/value_meta_data.dart +++ b/lib/src/value_meta_data.dart @@ -10,12 +10,16 @@ class ValueMetaData { final List submetas = []; /// add submeta (if absent) and return its index - int addSubmeta(ValueMetaData submeta) { - var idx = - submetas.lastIndexWhere((element) => element.name == submeta.name); + int addSubmeta(ValueMetaData submeta, List? values, dynamic val) { + var idx = submetas.lastIndexWhere( + (element) => element.name == submeta.name && submeta.name != null); if (idx == -1) { submetas.add(submeta); - return submetas.length - 1; + idx = submetas.length - 1; + } + if ((values?.length ?? 0) <= idx) { + values?.length = idx + 1; + values?[idx] = val; } return idx; } @@ -27,8 +31,8 @@ class ValueMetaData { Map toJson() { return { - "'type'": type?.index, - "'name'": "'$name'", + "'type'": '\'${type?.name}\'', + "'name'": name != null ? "'$name'" : null, "'submetas'": submetas.map((e) => e.toJson()).toList(), }; } diff --git a/pubspec.yaml b/pubspec.yaml index c609723..749b2ac 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: dart_gdbc description: A standard interface specification for accessing graph databases based on Dart language -version: 0.0.1+1 +version: 0.0.1+2 repository: https://github.com/graph-cn/dart_gdbc environment: