Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
na57 committed May 20, 2024
1 parent 4a50827 commit b1eabd1
Show file tree
Hide file tree
Showing 15 changed files with 4,816 additions and 381 deletions.
61 changes: 47 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,57 @@
# esm-template
# NaguTriples

[![Node.js CI](https://github.com/liudonghua123/esm-template/actions/workflows/node.js.yml/badge.svg)](https://github.com/liudonghua123/esm-template/actions/workflows/node.js.yml)
## Introduction

This is a simple NodeJS template project.
`NaguTriples` implements the persistent storage of triples in the form of `<subject, predicate, object>`。Main features include:

## Support features
- All parts of the triples are stored as `String` in `UTF-8`, with the maximum length of `512B`.
- The current version is only supports storage in `Mysql`.

- Default esm module support
- Type support in pure javascript
- Auto doc generation, need to write doc comments
- Format and Lint support
## Installation

## TODOs
`npm install nagu-triples`

- [x] Add unit tests
- [x] Add github actions for testing
## Usage

### 引入包

## License
`import triples from 'nagu-triples'`

MIT License
每一个方法调用都需要带入Mysql的连接信息:

```
const options = {
host: '192.168.0.231',
database: 'owl',
user: 'owl',
password: 'password',
port: 3306,
};
```

### 类型

#### Notion
三元组中subject, predicate, object 都是一个Notion,Notion是一个对象,包括id和name两个字段。

### getOrCreate

获取或创建一个三元组

```
const trpileId = getOrCreate('a', 'b', 'c', options);
```
注意:
- 前三个参数分别是subject, predicate, object, 可以是String或Notion(如果传入Notion,将忽略name属性)。

### 查询

查询函数包括:
- getById
- listByS
- listByP
- listByO
...

Copyright (c) 2024 liudonghua
Loading

0 comments on commit b1eabd1

Please sign in to comment.