Skip to content

Commit

Permalink
0.1.6 - Postgres support
Browse files Browse the repository at this point in the history
  • Loading branch information
benjamint08 committed Apr 6, 2024
1 parent f25b54d commit bda2413
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 0 deletions.
Binary file modified bun.lockb
Binary file not shown.
7 changes: 7 additions & 0 deletions lib/helpers/helper.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
declare function SendJSON(json: any, status?: number): Promise<Response>;
declare function Success(message: string, status?: number): Promise<Response>;
declare function Failure(message: string, status?: number): Promise<Response>;
declare function ServerFailure(message: string, status?: number): Promise<Response>;
declare function Redirect(destination: string, status?: number): Response;
declare function Html(html: string, status?: number): Response;
export { SendJSON, Success, Failure, ServerFailure, Redirect, Html };
1 change: 1 addition & 0 deletions lib/helpers/param.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export declare function param(req: Request): Promise<string | null>;
1 change: 1 addition & 0 deletions lib/helpers/query.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export declare function query(query: string, req: Request): Promise<string | undefined>;
18 changes: 18 additions & 0 deletions lib/instances/mongodb.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
declare class Mongo {
private client;
connect(url: string): Promise<void>;
getCollection(db: string, col: string): Promise<any>;
getDatabase(db: string): Promise<any>;
update(db: string, col: string, query: any, update: any): Promise<any>;
insert(db: string, col: string, data: any): Promise<any>;
find(db: string, col: string, query: any): Promise<any[]>;
findOne(db: string, col: string, query: any): Promise<any>;
delete(db: string, col: string, query: any): Promise<any>;
close(): Promise<void>;
}
declare class MongoService {
private static instance;
constructor();
static getInstance(): Mongo;
}
export default MongoService;
12 changes: 12 additions & 0 deletions lib/instances/postgres.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
declare class Pg {
private pool;
connect(config: object): Promise<void>;
endConnection(): Promise<void>;
query(text: string, params?: any[]): Promise<any>;
}
declare class PgService {
private static instance;
constructor();
static getInstance(): Pg;
}
export default PgService;
23 changes: 23 additions & 0 deletions lib/main/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { SendJSON, Success, Failure, ServerFailure, Redirect, Html } from "../helpers/helper.ts";
import { query } from "../helpers/query.ts";
import { param } from "../helpers/param.ts";
import MongoService from "../instances/mongodb.ts";
import PgService from "../instances/postgres.ts";
declare class ProBun {
private port;
private routes;
private logger;
private mongoUri;
private pgConfig;
constructor(props: {
port: number;
routes: string;
logger: boolean;
mongoUri?: any;
pgConfig?: any;
});
start(): Promise<void>;
definePreMiddleware(middleware: any): void;
definePostMiddleware(middleware: any): void;
}
export { ProBun, SendJSON, Success, Failure, ServerFailure, Redirect, Html, query, param, MongoService, PgService };
2 changes: 2 additions & 0 deletions lib/main/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit bda2413

Please sign in to comment.