Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ on:
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v2
Expand All @@ -32,8 +35,7 @@ jobs:
id: release

- name: Publish to NPM Registry
run: cd build && npm publish --access public
run: cd build && npm publish --provenance --access public
if: steps.release.outputs.released == 'true'
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
name: Deploy
4 changes: 2 additions & 2 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@athenna/database",
"version": "5.38.0",
"version": "5.39.0",
"description": "The Athenna database handler for SQL/NoSQL.",
"license": "MIT",
"author": "João Lenon <lenon@athenna.io>",
Expand Down
91 changes: 44 additions & 47 deletions src/database/builders/QueryBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ export class QueryBuilder<
/**
* Calculate the average of a given column using distinct.
*/
public async count(column: string | ModelColumns<T> = '*'): Promise<string> {
public async count(column: string | ModelColumns<T> = '*'): Promise<number> {
return this.driver.count(column as string)
}

Expand All @@ -159,7 +159,7 @@ export class QueryBuilder<
*/
public async countDistinct(
column: string | ModelColumns<T>
): Promise<string> {
): Promise<number> {
return this.driver.countDistinct(column as string)
}

Expand Down Expand Up @@ -583,24 +583,6 @@ export class QueryBuilder<
return this
}

/**
* Set a having exists statement in your query.
*/
public havingExists(closure: (query: Driver) => void) {
this.driver.havingExists(closure)

return this
}

/**
* Set a having not exists statement in your query.
*/
public havingNotExists(closure: (query: Driver) => void) {
this.driver.havingNotExists(closure)

return this
}

/**
* Set a having in statement in your query.
*/
Expand Down Expand Up @@ -680,33 +662,6 @@ export class QueryBuilder<
return this
}

/**
* Set an or having exists statement in your query.
*/
public orHavingExists(closure: (query: Driver) => void) {
this.driver.orHavingExists(closure)

return this
}

/**
* Set an or having not exists statement in your query.
*/
public orHavingNotExists(closure: (query: Driver) => void) {
this.driver.orHavingNotExists(closure)

return this
}

/**
* Set an or having in statement in your query.
*/
public orHavingIn(column: string | ModelColumns<T>, values: any[]) {
this.driver.orHavingIn(column as string, values)

return this
}

/**
* Set an or having not in statement in your query.
*/
Expand Down Expand Up @@ -887,6 +842,27 @@ export class QueryBuilder<
return this
}

public whereJson(
column: string | ModelColumns<T>,
operation: any,
value?: any
): this

public whereJson(column: string | ModelColumns<T>, value: any): this

/**
* Set a where json statement in your query.
*/
public whereJson(
column: string | ModelColumns<T>,
operation: any,
value?: any
) {
this.driver.whereJson(column as string, operation, value)

return this
}

public orWhere(statement: (query: this) => void): this
public orWhere(statement: Partial<T>): this
public orWhere(statement: Record<string, any>): this
Expand Down Expand Up @@ -1030,6 +1006,27 @@ export class QueryBuilder<
return this
}

public orWhereJson(
column: string | ModelColumns<T>,
operation: Operations,
value?: any
): this

public orWhereJson(column: string | ModelColumns<T>, value: any): this

/**
* Set an orWhereJson statement in your query.
*/
public orWhereJson(
column: string | ModelColumns<T>,
operation: Operations,
value?: any
) {
this.driver.orWhereJson(column as string, operation, value)

return this
}

/**
* Set an order by statement in your query.
*/
Expand Down
Loading
Loading