Comparing version 1.3.0 to 1.3.1
{ | ||
"name": "pg-mem", | ||
"version": "1.3.0", | ||
"version": "1.3.1", | ||
"description": "A memory version of postgres", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -93,2 +93,36 @@ # What is it ? | ||
## Custom functions | ||
You can declare custom functions like this: | ||
```typescript | ||
db.public.registerFunction({ | ||
name: 'say_hello', | ||
args: [DataType.text], | ||
returns: DataType.text, | ||
implementation: x => 'hello ' + x, | ||
}) | ||
``` | ||
And then use them like in SQL `select say_hello('world')`. | ||
Custom functions support overloading and variadic arguments. | ||
⚠ However, the value you return is not type checked. It MUST correspond to the datatype you provided as 'returns' (wont fail if not, but could lead to weird bugs). | ||
## Extensions | ||
No native extension is implemented (pull requests are welcome), but you can define kind-of extensions like this: | ||
```typescript | ||
db.registerExtension('my-ext', schema => { | ||
// install your ext in 'schema' | ||
// ex: schema.registerFunction(...) | ||
}); | ||
``` | ||
Statements like `create extension "my-ext"` will then be supported. | ||
# 📃 Libraries adapters | ||
@@ -194,41 +228,5 @@ | ||
# Other features | ||
# Inspection | ||
## Custom functions | ||
You can declare custom functions like this: | ||
```typescript | ||
db.public.registerFunction({ | ||
name: 'say_hello', | ||
args: [DataType.text], | ||
returns: DataType.text, | ||
implementation: x => 'hello ' + x, | ||
}) | ||
``` | ||
And then use them like in SQL `select say_hello('world')`. | ||
Custom functions support overloading and variadic arguments. | ||
⚠ However, the value you return is not type checked. It MUST correspond to the datatype you provided as 'returns' (wont fail if not, but could lead to weird bugs). | ||
## Extensions | ||
No native extension is implemented (pull requests are welcome), but you can define kind-of extensions like this: | ||
```typescript | ||
db.registerExtension('my-ext', schema => { | ||
// install your ext in 'schema' | ||
// ex: schema.registerFunction(...) | ||
}); | ||
``` | ||
Statements like `create extension "my-ext"` will then be supported. | ||
## Extensions | ||
## 💥 Inspection subscriptions | ||
## 💥 Subscribe to events | ||
You can subscribe to some events, like: | ||
@@ -249,3 +247,3 @@ | ||
## Experimental inspection subscriptions | ||
## Experimental events | ||
@@ -283,3 +281,3 @@ `pg-mem` implements a basic support for indices. | ||
- [ ] Cartesian Joins | ||
- [ ] Most of the pg functions are not implemented - ask for them, [they're easy to implement](src/functions.ts) ! | ||
- [ ] Most of the pg functions are not implemented - ask for them, [they're easy to implement](src/functions) ! | ||
- [ ] Some [aggregations](src/transforms/aggregation.ts) are to be implemented (avg, count, ...) - easy job, but not yet done. | ||
@@ -307,1 +305,3 @@ - [ ] Stored procedures | ||
To debug tests: Just hit "run" (F5, or whatever)... vscode should attach the mocha worker. Then run the test you want to debug. | ||
Alternatively, you could just run `npm run test` wihtout installing anything, but this is a bit long. |
@@ -12,2 +12,3 @@ import { ISchema, Schema, QueryResult, FunctionDefinition } from './interfaces'; | ||
private fns; | ||
private installedExtensions; | ||
constructor(name: string, db: _IDb); | ||
@@ -14,0 +15,0 @@ none(query: string): void; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
891370
9407