Browse Source

chore: updates README.md

e22m4u 2 years ago
parent
commit
d1093b4930
82 changed files with 69 additions and 17 deletions
  1. 40 2
      README.md
  2. 24 10
      docs/assets/highlight.css
  3. 0 0
      docs/classes/Adapter.html
  4. 0 0
      docs/classes/AdapterLoader.html
  5. 0 0
      docs/classes/AdapterRegistry.html
  6. 0 0
      docs/classes/BelongsToResolver.html
  7. 0 0
      docs/classes/DatasourceDefinitionValidator.html
  8. 0 0
      docs/classes/DefinitionRegistry.html
  9. 0 0
      docs/classes/FieldsClauseTool.html
  10. 0 0
      docs/classes/HasManyResolver.html
  11. 0 0
      docs/classes/HasOneResolver.html
  12. 0 0
      docs/classes/IncludeClauseTool.html
  13. 0 0
      docs/classes/InvalidArgumentError.html
  14. 0 0
      docs/classes/InvalidOperatorValueError.html
  15. 0 0
      docs/classes/ModelDataSanitizer.html
  16. 0 0
      docs/classes/ModelDataValidator.html
  17. 0 0
      docs/classes/ModelDefinitionUtils.html
  18. 0 0
      docs/classes/ModelDefinitionValidator.html
  19. 0 0
      docs/classes/NotImplementedError.html
  20. 0 0
      docs/classes/OperatorClauseTool.html
  21. 0 0
      docs/classes/OrderClauseTool.html
  22. 0 0
      docs/classes/PrimaryKeysDefinitionValidator.html
  23. 0 0
      docs/classes/PropertiesDefinitionValidator.html
  24. 0 0
      docs/classes/ReferencesManyResolver.html
  25. 0 0
      docs/classes/RelationsDefinitionValidator.html
  26. 0 0
      docs/classes/Repository.html
  27. 0 0
      docs/classes/RepositoryRegistry.html
  28. 0 0
      docs/classes/Schema.html
  29. 0 0
      docs/classes/SliceClauseTool.html
  30. 0 0
      docs/classes/WhereClauseTool.html
  31. 0 0
      docs/enums/DataType.html
  32. 0 0
      docs/enums/RelationType.html
  33. 0 0
      docs/functions/capitalize.html
  34. 0 0
      docs/functions/cloneDeep.html
  35. 0 0
      docs/functions/excludeObjectKeys.html
  36. 0 0
      docs/functions/getCtorName.html
  37. 0 0
      docs/functions/getValueByPath.html
  38. 0 0
      docs/functions/isCtor.html
  39. 0 0
      docs/functions/isPureObject.html
  40. 0 0
      docs/functions/selectObjectKeys.html
  41. 0 0
      docs/functions/singularize.html
  42. 0 0
      docs/functions/stringToRegexp.html
  43. 1 1
      docs/index.html
  44. 0 0
      docs/interfaces/AndClause.html
  45. 0 0
      docs/interfaces/OrClause.html
  46. 0 0
      docs/types/AnyObject.html
  47. 0 0
      docs/types/BelongsToDefinition.html
  48. 0 0
      docs/types/DEFAULT_PRIMARY_KEY_PROPERTY_NAME.html
  49. 0 0
      docs/types/DatasourceDefinition.html
  50. 0 0
      docs/types/FieldsClause.html
  51. 0 0
      docs/types/FilterClause.html
  52. 0 0
      docs/types/Flatten.html
  53. 0 0
      docs/types/FullPropertyDefinition.html
  54. 0 0
      docs/types/HasManyDefinition.html
  55. 0 0
      docs/types/HasOneDefinition.html
  56. 0 0
      docs/types/Identity.html
  57. 4 4
      docs/types/IncludeClause.html
  58. 0 0
      docs/types/ItemFilterClause.html
  59. 0 0
      docs/types/ModelData.html
  60. 0 0
      docs/types/ModelDefinition.html
  61. 0 0
      docs/types/ModelId.html
  62. 0 0
      docs/types/NestedIncludeClause.html
  63. 0 0
      docs/types/NormalizedFieldsClause.html
  64. 0 0
      docs/types/NormalizedIncludeClause.html
  65. 0 0
      docs/types/OperatorClause.html
  66. 0 0
      docs/types/OptionalUnlessRequiredId.html
  67. 0 0
      docs/types/OrderClause.html
  68. 0 0
      docs/types/PartialBy.html
  69. 0 0
      docs/types/PartialWithoutId.html
  70. 0 0
      docs/types/PolyBelongsToDefinition.html
  71. 0 0
      docs/types/PolyHasManyDefinitionWithTargetKeys.html
  72. 0 0
      docs/types/PolyHasManyDefinitionWithTargetRelationName.html
  73. 0 0
      docs/types/PolyHasOneDefinitionWithTargetKeys.html
  74. 0 0
      docs/types/PolyHasOneDefinitionWithTargetRelationName.html
  75. 0 0
      docs/types/PropertiesClause.html
  76. 0 0
      docs/types/PropertyDefinition.html
  77. 0 0
      docs/types/PropertyDefinitionMap.html
  78. 0 0
      docs/types/ReferencesManyDefinition.html
  79. 0 0
      docs/types/RelationDefinition.html
  80. 0 0
      docs/types/RelationDefinitionMap.html
  81. 0 0
      docs/types/WhereClause.html
  82. 0 0
      docs/types/WithoutId.html

+ 40 - 2
README.md

@@ -15,11 +15,49 @@ npm install @e22m4u/js-repository
 | `memory`  | виртуальная база в памяти процесса (не требует установки)                                                                      |
 | `memory`  | виртуальная база в памяти процесса (не требует установки)                                                                      |
 | `mongodb` | MongoDB - система управления NoSQL базами (*[установка](https://www.npmjs.com/package/@e22m4u/js-repository-mongodb-adapter))* |
 | `mongodb` | MongoDB - система управления NoSQL базами (*[установка](https://www.npmjs.com/package/@e22m4u/js-repository-mongodb-adapter))* |
 
 
-## Интерфейс
+## Пример
 
 
-### Schema
+Определение источника данных, модели и добавление нового документа в коллекцию.
 
 
+```js
+import {Schema} from '@e22m4u/js-repository'
 
 
+// создание экземпляра схемы
+const schema = new Schema();
+
+// определение источника "myMemory"
+schema.defineDatasource({
+  name: 'myMemory', // название нового источника
+  adapter: 'memory', // выбранный адаптер
+});
+
+// определение модели "country"
+schema.defineModel({
+  name: 'country', // название новой модели
+  datasource: 'myMemory', // выбранный источник
+  properties: { // поля модели
+    name: DataType.STRING, // поле "name" типа "string"
+    population: DataType.NUMBER, // поле "population" типа "number"
+  },
+})
+
+// получение репозитория для модели "country"
+const countryRep = schema.getRepository('country');
+
+// добавление нового документа в коллекцию "country"
+const country = await countryRep.create({
+  name: 'Russia',
+  population: 143400000,
+});
+
+// вывод результата
+console.log(country);
+// {
+//   "id": 1,
+//   "name": "Russia",
+//   "population": 143400000,
+// }
+```
 
 
 ## Тесты
 ## Тесты
 
 

+ 24 - 10
docs/assets/highlight.css

@@ -5,18 +5,22 @@
     --dark-hl-1: #D4D4D4;
     --dark-hl-1: #D4D4D4;
     --light-hl-2: #A31515;
     --light-hl-2: #A31515;
     --dark-hl-2: #CE9178;
     --dark-hl-2: #CE9178;
-    --light-hl-3: #000000;
-    --dark-hl-3: #C8C8C8;
-    --light-hl-4: #098658;
-    --dark-hl-4: #B5CEA8;
-    --light-hl-5: #0000FF;
-    --dark-hl-5: #569CD6;
-    --light-hl-6: #001080;
-    --dark-hl-6: #9CDCFE;
+    --light-hl-3: #AF00DB;
+    --dark-hl-3: #C586C0;
+    --light-hl-4: #001080;
+    --dark-hl-4: #9CDCFE;
+    --light-hl-5: #008000;
+    --dark-hl-5: #6A9955;
+    --light-hl-6: #0000FF;
+    --dark-hl-6: #569CD6;
     --light-hl-7: #0070C1;
     --light-hl-7: #0070C1;
     --dark-hl-7: #4FC1FF;
     --dark-hl-7: #4FC1FF;
-    --light-hl-8: #CD3131;
-    --dark-hl-8: #F44747;
+    --light-hl-8: #098658;
+    --dark-hl-8: #B5CEA8;
+    --light-hl-9: #000000;
+    --dark-hl-9: #C8C8C8;
+    --light-hl-10: #CD3131;
+    --dark-hl-10: #F44747;
     --light-code-background: #FFFFFF;
     --light-code-background: #FFFFFF;
     --dark-code-background: #1E1E1E;
     --dark-code-background: #1E1E1E;
 }
 }
@@ -31,6 +35,8 @@
     --hl-6: var(--light-hl-6);
     --hl-6: var(--light-hl-6);
     --hl-7: var(--light-hl-7);
     --hl-7: var(--light-hl-7);
     --hl-8: var(--light-hl-8);
     --hl-8: var(--light-hl-8);
+    --hl-9: var(--light-hl-9);
+    --hl-10: var(--light-hl-10);
     --code-background: var(--light-code-background);
     --code-background: var(--light-code-background);
 } }
 } }
 
 
@@ -44,6 +50,8 @@
     --hl-6: var(--dark-hl-6);
     --hl-6: var(--dark-hl-6);
     --hl-7: var(--dark-hl-7);
     --hl-7: var(--dark-hl-7);
     --hl-8: var(--dark-hl-8);
     --hl-8: var(--dark-hl-8);
+    --hl-9: var(--dark-hl-9);
+    --hl-10: var(--dark-hl-10);
     --code-background: var(--dark-code-background);
     --code-background: var(--dark-code-background);
 } }
 } }
 
 
@@ -57,6 +65,8 @@
     --hl-6: var(--light-hl-6);
     --hl-6: var(--light-hl-6);
     --hl-7: var(--light-hl-7);
     --hl-7: var(--light-hl-7);
     --hl-8: var(--light-hl-8);
     --hl-8: var(--light-hl-8);
+    --hl-9: var(--light-hl-9);
+    --hl-10: var(--light-hl-10);
     --code-background: var(--light-code-background);
     --code-background: var(--light-code-background);
 }
 }
 
 
@@ -70,6 +80,8 @@
     --hl-6: var(--dark-hl-6);
     --hl-6: var(--dark-hl-6);
     --hl-7: var(--dark-hl-7);
     --hl-7: var(--dark-hl-7);
     --hl-8: var(--dark-hl-8);
     --hl-8: var(--dark-hl-8);
+    --hl-9: var(--dark-hl-9);
+    --hl-10: var(--dark-hl-10);
     --code-background: var(--dark-code-background);
     --code-background: var(--dark-code-background);
 }
 }
 
 
@@ -82,4 +94,6 @@
 .hl-6 { color: var(--hl-6); }
 .hl-6 { color: var(--hl-6); }
 .hl-7 { color: var(--hl-7); }
 .hl-7 { color: var(--hl-7); }
 .hl-8 { color: var(--hl-8); }
 .hl-8 { color: var(--hl-8); }
+.hl-9 { color: var(--hl-9); }
+.hl-10 { color: var(--hl-10); }
 pre, code { background: var(--code-background); }
 pre, code { background: var(--code-background); }

File diff suppressed because it is too large
+ 0 - 0
docs/classes/Adapter.html


File diff suppressed because it is too large
+ 0 - 0
docs/classes/AdapterLoader.html


File diff suppressed because it is too large
+ 0 - 0
docs/classes/AdapterRegistry.html


File diff suppressed because it is too large
+ 0 - 0
docs/classes/BelongsToResolver.html


File diff suppressed because it is too large
+ 0 - 0
docs/classes/DatasourceDefinitionValidator.html


File diff suppressed because it is too large
+ 0 - 0
docs/classes/DefinitionRegistry.html


File diff suppressed because it is too large
+ 0 - 0
docs/classes/FieldsClauseTool.html


File diff suppressed because it is too large
+ 0 - 0
docs/classes/HasManyResolver.html


File diff suppressed because it is too large
+ 0 - 0
docs/classes/HasOneResolver.html


File diff suppressed because it is too large
+ 0 - 0
docs/classes/IncludeClauseTool.html


File diff suppressed because it is too large
+ 0 - 0
docs/classes/InvalidArgumentError.html


File diff suppressed because it is too large
+ 0 - 0
docs/classes/InvalidOperatorValueError.html


File diff suppressed because it is too large
+ 0 - 0
docs/classes/ModelDataSanitizer.html


File diff suppressed because it is too large
+ 0 - 0
docs/classes/ModelDataValidator.html


File diff suppressed because it is too large
+ 0 - 0
docs/classes/ModelDefinitionUtils.html


File diff suppressed because it is too large
+ 0 - 0
docs/classes/ModelDefinitionValidator.html


File diff suppressed because it is too large
+ 0 - 0
docs/classes/NotImplementedError.html


File diff suppressed because it is too large
+ 0 - 0
docs/classes/OperatorClauseTool.html


File diff suppressed because it is too large
+ 0 - 0
docs/classes/OrderClauseTool.html


File diff suppressed because it is too large
+ 0 - 0
docs/classes/PrimaryKeysDefinitionValidator.html


File diff suppressed because it is too large
+ 0 - 0
docs/classes/PropertiesDefinitionValidator.html


File diff suppressed because it is too large
+ 0 - 0
docs/classes/ReferencesManyResolver.html


File diff suppressed because it is too large
+ 0 - 0
docs/classes/RelationsDefinitionValidator.html


File diff suppressed because it is too large
+ 0 - 0
docs/classes/Repository.html


File diff suppressed because it is too large
+ 0 - 0
docs/classes/RepositoryRegistry.html


File diff suppressed because it is too large
+ 0 - 0
docs/classes/Schema.html


File diff suppressed because it is too large
+ 0 - 0
docs/classes/SliceClauseTool.html


File diff suppressed because it is too large
+ 0 - 0
docs/classes/WhereClauseTool.html


File diff suppressed because it is too large
+ 0 - 0
docs/enums/DataType.html


File diff suppressed because it is too large
+ 0 - 0
docs/enums/RelationType.html


File diff suppressed because it is too large
+ 0 - 0
docs/functions/capitalize.html


File diff suppressed because it is too large
+ 0 - 0
docs/functions/cloneDeep.html


File diff suppressed because it is too large
+ 0 - 0
docs/functions/excludeObjectKeys.html


File diff suppressed because it is too large
+ 0 - 0
docs/functions/getCtorName.html


File diff suppressed because it is too large
+ 0 - 0
docs/functions/getValueByPath.html


File diff suppressed because it is too large
+ 0 - 0
docs/functions/isCtor.html


File diff suppressed because it is too large
+ 0 - 0
docs/functions/isPureObject.html


File diff suppressed because it is too large
+ 0 - 0
docs/functions/selectObjectKeys.html


File diff suppressed because it is too large
+ 0 - 0
docs/functions/singularize.html


File diff suppressed because it is too large
+ 0 - 0
docs/functions/stringToRegexp.html


File diff suppressed because it is too large
+ 1 - 1
docs/index.html


File diff suppressed because it is too large
+ 0 - 0
docs/interfaces/AndClause.html


File diff suppressed because it is too large
+ 0 - 0
docs/interfaces/OrClause.html


File diff suppressed because it is too large
+ 0 - 0
docs/types/AnyObject.html


File diff suppressed because it is too large
+ 0 - 0
docs/types/BelongsToDefinition.html


File diff suppressed because it is too large
+ 0 - 0
docs/types/DEFAULT_PRIMARY_KEY_PROPERTY_NAME.html


File diff suppressed because it is too large
+ 0 - 0
docs/types/DatasourceDefinition.html


File diff suppressed because it is too large
+ 0 - 0
docs/types/FieldsClause.html


File diff suppressed because it is too large
+ 0 - 0
docs/types/FilterClause.html


File diff suppressed because it is too large
+ 0 - 0
docs/types/Flatten.html


File diff suppressed because it is too large
+ 0 - 0
docs/types/FullPropertyDefinition.html


File diff suppressed because it is too large
+ 0 - 0
docs/types/HasManyDefinition.html


File diff suppressed because it is too large
+ 0 - 0
docs/types/HasOneDefinition.html


File diff suppressed because it is too large
+ 0 - 0
docs/types/Identity.html


File diff suppressed because it is too large
+ 4 - 4
docs/types/IncludeClause.html


File diff suppressed because it is too large
+ 0 - 0
docs/types/ItemFilterClause.html


File diff suppressed because it is too large
+ 0 - 0
docs/types/ModelData.html


File diff suppressed because it is too large
+ 0 - 0
docs/types/ModelDefinition.html


File diff suppressed because it is too large
+ 0 - 0
docs/types/ModelId.html


File diff suppressed because it is too large
+ 0 - 0
docs/types/NestedIncludeClause.html


File diff suppressed because it is too large
+ 0 - 0
docs/types/NormalizedFieldsClause.html


File diff suppressed because it is too large
+ 0 - 0
docs/types/NormalizedIncludeClause.html


File diff suppressed because it is too large
+ 0 - 0
docs/types/OperatorClause.html


File diff suppressed because it is too large
+ 0 - 0
docs/types/OptionalUnlessRequiredId.html


File diff suppressed because it is too large
+ 0 - 0
docs/types/OrderClause.html


File diff suppressed because it is too large
+ 0 - 0
docs/types/PartialBy.html


File diff suppressed because it is too large
+ 0 - 0
docs/types/PartialWithoutId.html


File diff suppressed because it is too large
+ 0 - 0
docs/types/PolyBelongsToDefinition.html


File diff suppressed because it is too large
+ 0 - 0
docs/types/PolyHasManyDefinitionWithTargetKeys.html


File diff suppressed because it is too large
+ 0 - 0
docs/types/PolyHasManyDefinitionWithTargetRelationName.html


File diff suppressed because it is too large
+ 0 - 0
docs/types/PolyHasOneDefinitionWithTargetKeys.html


File diff suppressed because it is too large
+ 0 - 0
docs/types/PolyHasOneDefinitionWithTargetRelationName.html


File diff suppressed because it is too large
+ 0 - 0
docs/types/PropertiesClause.html


File diff suppressed because it is too large
+ 0 - 0
docs/types/PropertyDefinition.html


File diff suppressed because it is too large
+ 0 - 0
docs/types/PropertyDefinitionMap.html


File diff suppressed because it is too large
+ 0 - 0
docs/types/ReferencesManyDefinition.html


File diff suppressed because it is too large
+ 0 - 0
docs/types/RelationDefinition.html


File diff suppressed because it is too large
+ 0 - 0
docs/types/RelationDefinitionMap.html


File diff suppressed because it is too large
+ 0 - 0
docs/types/WhereClause.html


File diff suppressed because it is too large
+ 0 - 0
docs/types/WithoutId.html


Some files were not shown because too many files changed in this diff