-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added rusty db * Externalize rusty-store-kv * Added close and init functions * Added matrix * Removed lint * Fixed mysql * Increased timeout * Fixed. * Fixed it. * Removed postgresql * Fixed elasticsearch
- Loading branch information
1 parent
c798d0d
commit 5607409
Showing
34 changed files
with
1,585 additions
and
573 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,57 +11,12 @@ on: | |
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
services: | ||
couchdb: | ||
image: couchdb | ||
ports: | ||
- 5984:5984 | ||
env: | ||
COUCHDB_USER: ueberdb | ||
COUCHDB_PASSWORD: ueberdb | ||
elasticsearch: | ||
image: elasticsearch:7.17.3 | ||
ports: | ||
- 9200:9200 | ||
env: | ||
discovery.type: single-node | ||
mongo: | ||
image: mongo | ||
ports: | ||
- 27017:27017 | ||
mysql: | ||
# The default authentication used in MySQL 8.0 isn't supported by the | ||
# mysql npm package: https://github.com/mysqljs/mysql/issues/2002 | ||
image: mariadb | ||
ports: | ||
- 3306:3306 | ||
env: | ||
MYSQL_ROOT_PASSWORD: password | ||
MYSQL_USER: ueberdb | ||
MYSQL_PASSWORD: ueberdb | ||
MYSQL_DATABASE: ueberdb | ||
postgres: | ||
image: postgres | ||
ports: | ||
- 5432:5432 | ||
env: | ||
POSTGRES_USER: ueberdb | ||
POSTGRES_PASSWORD: ueberdb | ||
POSTGRES_DB: ueberdb | ||
options: >- | ||
--health-cmd="pg_isready -d postgresql://ueberdb:[email protected]/ueberdb" | ||
--health-interval=10s | ||
--health-timeout=5s | ||
--health-retries=5 | ||
redis: | ||
image: redis | ||
ports: | ||
- 6379:6379 | ||
timeout-minutes: 30 | ||
strategy: | ||
matrix: | ||
db: [couch, elasticsearch, mongo, mysql, redis, mock, sqlite, redis, memory] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- | ||
uses: actions/setup-node@v4 | ||
- uses: actions/setup-node@v4 | ||
- uses: pnpm/action-setup@v4 | ||
name: Install pnpm | ||
with: | ||
|
@@ -78,23 +33,11 @@ jobs: | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
restore-keys: | | ||
${{ runner.os }}-pnpm-store- | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- run: pnpm i | ||
|
||
# Verify databases are reachable. | ||
- name: MySQL client and server check | ||
run: | | ||
mysql --version && | ||
mysql -h 127.0.0.1 -u ueberdb -pueberdb -e "SHOW TABLES;" ueberdb | ||
- name: PostgreSQL client and server check | ||
run: | | ||
psql --version && | ||
psql -d postgresql://ueberdb:[email protected]/ueberdb -c '\dt' | ||
- name: Create javascript files from typescript | ||
run: pnpm run build | ||
- run: pnpm run test | ||
env: | ||
SURREALDB_CI: false | ||
- run: pnpm run lint | ||
name: Install pnpm dependencies | ||
- run: pnpm run test ${{ matrix.db }} | ||
|
||
publish-npm: | ||
if: github.event_name == 'push' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import AbstractDatabase from "../lib/AbstractDatabase"; | ||
import {KeyValueDB} from "rusty-store-kv"; | ||
|
||
export default class Rusty_db extends AbstractDatabase { | ||
db: KeyValueDB|null | ||
|
||
|
||
constructor(settings: {filename: string}) { | ||
super(settings); | ||
this.db = new KeyValueDB(this.settings.filename!); | ||
|
||
// set default settings | ||
this.settings.cache = 0; | ||
this.settings.writeInterval = 0; | ||
this.settings.json = false; | ||
} | ||
|
||
get isAsync() { | ||
return true; | ||
} | ||
|
||
findKeys(key: string, notKey?:string) { | ||
return this.db!.findKeys(key, notKey); | ||
} | ||
|
||
get(key: string) { | ||
return this.db!.get(key); | ||
} | ||
|
||
async init() { | ||
console.log("Init") | ||
} | ||
|
||
close() { | ||
|
||
} | ||
|
||
remove(key: string) { | ||
this.db!.remove(key); | ||
} | ||
|
||
set(key: string, value: string) { | ||
this.db!.set(key, value); | ||
} | ||
|
||
destroy() { | ||
this.db!.destroy(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.