Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/panzer-vor/sqlgenerator
# 函数解析成SQL语句
https://github.com/panzer-vor/sqlgenerator
Last synced: 25 days ago
JSON representation
# 函数解析成SQL语句
- Host: GitHub
- URL: https://github.com/panzer-vor/sqlgenerator
- Owner: panzer-vor
- Created: 2019-01-08T08:40:29.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-01-27T07:59:07.000Z (almost 6 years ago)
- Last Synced: 2024-11-11T20:13:05.794Z (about 2 months ago)
- Language: JavaScript
- Size: 119 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# SQLgenerator
# 函数解析成SQL语句- 通过JS函数输入输出成SQL语句的简易工具
generator sql string looks like this:
```javascript
const sqlG = require('sqlG')
sqlG
.createSelectQuery('table_name')
.getQuery()
```output: ```'SELECT * FROM table_name'```
## API
- createSelectQuery
```typescript
createSelectQuery(
tableName: string,
tableRename?: string,
)
```
- createUpdateQuery
```typescript
createUpdateQuery(
tableName: string,
)
```
- createDeleteQuery
```typescript
createDeleteQuery(
tableName: string,
)
```
- createInsertQuery
```typescript
createInsertQuery(
tableName: string,
)
```
- createInsertQuery
```typescript
createInsertQuery(
tableName: string,
) {}
```
- select
```typescript
select(
fields: [string[]]
)
```
- where
```typescript
where(
where: [key: string, value: string | number, link?: string]
)
```
- inWhere
```typescript
inWhere(
where: string[] | number[],
field: string,
)
```
- orWhere
```typescript
orWhere(
...where: [key: string, value: string | number, link?: string]
prefix?: 'AND' | 'OR'
)
```
- andWhere
```typescript
andWhere(
...where: [key: string, value: string | number, link?: string]
prefix?: 'AND' | 'OR'
)
```
- orderBy
```typescript
orderBy(
field: string,
)
```
- limit
```typescript
limit(
start: number,
size: number,
)
```
- leftJoin
```typescript
leftJoin(
joinTable: string[],
...condition: string,
type?: string,
autoFill?: boolean
)
```
- innerJoin
```typescript
innerJoin(
joinTable: string[],
...condition: string,
type?: string,
autoFill?: boolean
)
```
- groupBy
```typescript
groupBy(
field: string,
)
```
- input
```typescript
input(str: string): string
```
- getQuery
```typescript
getQuery(): string
```