Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

add basic doc structure & add basic types #429

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
25 changes: 25 additions & 0 deletions docs/1.API&Examples/Model.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Model

- [types](#types)
- [entities](#entities)
- [database](#database)
- [warnings](#warnings)

Methods

- [preprocess](#preprocess)
- [dts](#dts)

---

## types

## entities

## database

## warnings

## preprocess

## dts
64 changes: 64 additions & 0 deletions docs/1.API&Examples/Shema.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Shema

- [kind](#kind)
- [references](#references)
- [relations](#relations)
- [scope](#scope)
- [allow](#allow)
- [parent](#parent)
- [indexes](#indexes)
- [custom](#custom)
- [fields](#fields)
- [name](#name)
- [namespaces](#namespaces)

Methods

- [from](#from)
- [types](#types)
- [checkConsistency](#checkConsistency)
- [check](#check)
- [toInterface](#toInterface)
- [toString](#toString)
- [toJSON](#toJSON)
- [validate](#validate)

---

## kind

## references

## relations

## scope

## allow

## parent

## indexes

## custom

## fields

## name

## namespaces

## from

## types

## checkConsistency

## check

## toInterface

## toString

## toJSON

## validate
60 changes: 60 additions & 0 deletions docs/1.API&Examples/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# API and Examples

Methods

- [createSchema](#createSchema)
- [loadSchema](#loadSchema)
- [readDirectory](#readDirectory)
- [loadModel](#loadModel)
- [saveTypes](#saveTypes)

---

## [Schema](/)

- [kind](/)
- [references](/)
- [relations](/)
- [scope](/)
- [allow](/)
- [parent](/)
- [indexes](/)
- [custom](/)
- [fields](/)
- [name](/)
- [namespaces](/)

Methods

- [from](/)
- [types](/)
- [checkConsistency](/)
- [check](/)
- [toInterface](/)
- [toString](/)
- [toJSON](/)
- [validate](/)

## [Model](/)

- [types](/)
- [entities](/)
- [database](/)
- [warnings](/)

Methods

- [preprocess](/)
- [dts](/)

---

### createSchema

### loadSchema

### readDirectory

### loadModel

### saveTypes
1 change: 1 addition & 0 deletions docs/2..Tutorials/1.about.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# About Metaschema
1 change: 1 addition & 0 deletions docs/2..Tutorials/2.concepts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Concepts
115 changes: 115 additions & 0 deletions docs/2..Tutorials/3.guides.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
# Guides

## Use datatypes for write shema

### Basic types

- string
- number
- boolean
- bigint

```javascript
// shema
({
/* STRING */
field1: { type: 'string' }, // or short { field1: "string" }

// use string length limit (static length - 5 chars)
field2: { type: 'string', length: 5 },
// use string length limit (minimum length - 10 chars)
field3: { type: 'string', length: { min: 10 } },
// setup string min and max length limit (min- 5, max - 12)
field4: { type: 'string', length: [5, 12] },

/* NUMBER */
field5: { type: 'number' }, // or short {field2: "number"}

/* BOOLEAN */
field6: { type: 'boolean' }, // or short {field3: "boolean"}

/* BIGINT */
field7: { type: 'bigint' }, // or short {field7: "bigint"}
});
```

```javascript
// valid data for shema
const data = {
field1: 'tihs is another string', // use 'string' type
field2: 'abcde', // use string length limit (static length - 5 chars)
field3: '123456789aebene', // use 'string' type end min(10) length limit
field4: '12345678ee', // use 'string' type end min(5) + max(12) length limit
field5: 1234, // use 'number' type
field6: true, // use 'boolean' type
field7: 123456789n, // use 'bigint' type
};
```

---

### Advanced (structured) types

#### 馃憠馃徏 Object collection

#### 馃憠馃徏 Collections

```javascript
/* BASE */

// shema
({
field1: { array: 'number' },
});

// valid data for shema
const data = {
field1: [1, 2, 3],
};
```

```javascript
/* LENGTH LIMIT */

// shema
({
field1: { type: 'array', value: 'number', length: 10 }
// or short alternative
field2: { array: 'number', length: 10 }
})

// valid data for shema
const data = {
field1: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
field2: [11, 12, 13, 14, 15, 16, 17, 18, 19,20]
}

```

#### 馃憠馃徏 Set

#### 馃憠馃徏 Map

#### 馃憠馃徏 Tuples

---

### Nested types

---

### Type variations

### Optional types

### Helpers

- required (true | false)
- default

```javascript
({
field1: { type: 'string', required: false }, // use 'required' case
field2: { type: 'number', default: 150 }, // use 'default' case
});
```
1 change: 1 addition & 0 deletions docs/2..Tutorials/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Tutorials
1 change: 1 addition & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Metashema