Skip to content

Commit

Permalink
feat: add method to create a model adapter from database service
Browse files Browse the repository at this point in the history
  • Loading branch information
thetutlage committed Sep 20, 2023
1 parent 054554f commit 1f6cf33
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/database/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ import {
} from '../types/database.js'

import { LucidModel } from '../types/model.js'
import { QueryClient } from '../query_client/index.js'
import { Adapter } from '../orm/adapter/index.js'
import { RawBuilder } from './static_builder/raw.js'
import { QueryClient } from '../query_client/index.js'
import { prettyPrint } from '../helpers/pretty_print.js'
import { ConnectionManager } from '../connection/manager.js'
import { InsertQueryBuilder } from './query_builder/insert.js'
Expand Down Expand Up @@ -185,6 +186,13 @@ export class Database extends Macroable {
return this.connection(this.primaryConnectionName, options).modelQuery<T, Result>(model)
}

/**
* Returns an adapter lucid models
*/
modelAdapter() {
return new Adapter(this)
}

/**
* Returns an instance of raw query builder. Optionally one can
* defined the `read/write` mode in which to execute the
Expand Down

0 comments on commit 1f6cf33

Please sign in to comment.