@sideloop/core
Preparing search index...
ModelConstructor
Interface ModelConstructor<M, TB>
interface
ModelConstructor
<
M
,
TB
>
{
new
ModelConstructor
(
attrs
:
DrainOuterGeneric
<
{
[
K
in
string
|
number
|
symbol
]
:
SelectType
<
TB
[
K
]
>
}
,
>
,
)
:
ModelShape
<
TB
>
;
all
()
:
Promise
<
M
[]
>
;
count
()
:
Promise
<
number
>
;
create
(
attrs
:
Insertable
<
TB
>
,
options
?:
{
ignoreConflict
:
keyof
Insertable
<
TB
>
}
,
)
:
Promise
<
M
>
;
createAll
(
attrs
:
Insertable
<
TB
>
[]
)
:
Promise
<
M
[]
>
;
createUnique
(
attrs
:
Insertable
<
TB
>
,
uniqueBy
:
keyof
Insertable
<
TB
>
,
)
:
Promise
<
null
|
M
>
;
destroy
(
cb
:
(
db
:
Kysely
<
Database
>
)
=>
CompiledQuery
)
:
Promise
<
number
>
;
findAll
(
cb
:
(
db
:
Kysely
<
Database
>
)
=>
CompiledQuery
)
:
Promise
<
M
[]
>
;
findById
(
id
:
number
)
:
Promise
<
null
|
M
>
;
findByIdOrThrow
(
id
:
number
)
:
Promise
<
M
>
;
findOne
(
cb
:
(
db
:
Kysely
<
Database
>
)
=>
CompiledQuery
)
:
Promise
<
null
|
M
>
;
findOneOrThrow
(
cb
:
(
db
:
Kysely
<
Database
>
)
=>
CompiledQuery
)
:
Promise
<
M
>
;
last
()
:
Promise
<
null
|
M
>
;
last
(
limit
:
1
)
:
Promise
<
null
|
M
>
;
last
(
limit
:
number
)
:
Promise
<
M
[]
>
;
transaction
<
T
>
(
cb
:
(
tx
:
Transaction
<
Database
>
)
=>
Promise
<
T
>
)
:
Promise
<
T
>
;
updateAll
(
cb
:
(
db
:
Kysely
<
Database
>
)
=>
CompiledQuery
)
:
Promise
<
number
>
;
}
Type Parameters
M
TB
Hierarchy (
View Summary
)
ModelConstructor
ExecutionContructor
Index
Constructors
constructor
Methods
all
count
create
create
All
create
Unique
destroy
find
All
find
By
Id
find
By
Id
Or
Throw
find
One
find
One
Or
Throw
last
transaction
update
All
Constructors
constructor
new
ModelConstructor
(
attrs
:
DrainOuterGeneric
<
{
[
K
in
string
|
number
|
symbol
]
:
SelectType
<
TB
[
K
]
>
}
,
>
,
)
:
ModelShape
<
TB
>
Parameters
attrs
:
DrainOuterGeneric
<
{
[
K
in
string
|
number
|
symbol
]
:
SelectType
<
TB
[
K
]
>
}
>
Returns
ModelShape
<
TB
>
Methods
all
all
()
:
Promise
<
M
[]
>
Returns
Promise
<
M
[]
>
count
count
()
:
Promise
<
number
>
Returns
Promise
<
number
>
create
create
(
attrs
:
Insertable
<
TB
>
,
options
?:
{
ignoreConflict
:
keyof
Insertable
<
TB
>
}
,
)
:
Promise
<
M
>
Parameters
attrs
:
Insertable
<
TB
>
Optional
options
:
{
ignoreConflict
:
keyof
Insertable
<
TB
>
}
Returns
Promise
<
M
>
create
All
createAll
(
attrs
:
Insertable
<
TB
>
[]
)
:
Promise
<
M
[]
>
Parameters
attrs
:
Insertable
<
TB
>
[]
Returns
Promise
<
M
[]
>
create
Unique
createUnique
(
attrs
:
Insertable
<
TB
>
,
uniqueBy
:
keyof
Insertable
<
TB
>
,
)
:
Promise
<
null
|
M
>
Parameters
attrs
:
Insertable
<
TB
>
uniqueBy
:
keyof
Insertable
<
TB
>
Returns
Promise
<
null
|
M
>
destroy
destroy
(
cb
:
(
db
:
Kysely
<
Database
>
)
=>
CompiledQuery
)
:
Promise
<
number
>
Parameters
cb
:
(
db
:
Kysely
<
Database
>
)
=>
CompiledQuery
Returns
Promise
<
number
>
find
All
findAll
(
cb
:
(
db
:
Kysely
<
Database
>
)
=>
CompiledQuery
)
:
Promise
<
M
[]
>
Parameters
cb
:
(
db
:
Kysely
<
Database
>
)
=>
CompiledQuery
Returns
Promise
<
M
[]
>
find
By
Id
findById
(
id
:
number
)
:
Promise
<
null
|
M
>
Parameters
id
:
number
Returns
Promise
<
null
|
M
>
find
By
Id
Or
Throw
findByIdOrThrow
(
id
:
number
)
:
Promise
<
M
>
Parameters
id
:
number
Returns
Promise
<
M
>
find
One
findOne
(
cb
:
(
db
:
Kysely
<
Database
>
)
=>
CompiledQuery
)
:
Promise
<
null
|
M
>
Parameters
cb
:
(
db
:
Kysely
<
Database
>
)
=>
CompiledQuery
Returns
Promise
<
null
|
M
>
find
One
Or
Throw
findOneOrThrow
(
cb
:
(
db
:
Kysely
<
Database
>
)
=>
CompiledQuery
)
:
Promise
<
M
>
Parameters
cb
:
(
db
:
Kysely
<
Database
>
)
=>
CompiledQuery
Returns
Promise
<
M
>
last
last
()
:
Promise
<
null
|
M
>
Returns
Promise
<
null
|
M
>
last
(
limit
:
1
)
:
Promise
<
null
|
M
>
Parameters
limit
:
1
Returns
Promise
<
null
|
M
>
last
(
limit
:
number
)
:
Promise
<
M
[]
>
Parameters
limit
:
number
Returns
Promise
<
M
[]
>
transaction
transaction
<
T
>
(
cb
:
(
tx
:
Transaction
<
Database
>
)
=>
Promise
<
T
>
)
:
Promise
<
T
>
Type Parameters
T
Parameters
cb
:
(
tx
:
Transaction
<
Database
>
)
=>
Promise
<
T
>
Returns
Promise
<
T
>
update
All
updateAll
(
cb
:
(
db
:
Kysely
<
Database
>
)
=>
CompiledQuery
)
:
Promise
<
number
>
Parameters
cb
:
(
db
:
Kysely
<
Database
>
)
=>
CompiledQuery
Returns
Promise
<
number
>
Settings
Member Visibility
Protected
Inherited
External
Theme
OS
Light
Dark
On This Page
Constructors
constructor
Methods
all
count
create
create
All
create
Unique
destroy
find
All
find
By
Id
find
By
Id
Or
Throw
find
One
find
One
Or
Throw
last
transaction
update
All
@sideloop/core
Loading...