mirror of
https://github.com/darksaid98/overextended.github.io.git
synced 2026-12-02 22:22:46 +00:00
new docs
This commit is contained in:
1 parent
3cebaf7fa5
commit
b5eba8423f
229 files changed
+6238
-10690
No files matched your search
@@ -0,0 +1,77 @@
|
||||
---
|
||||
title: Single
|
||||
---
|
||||
|
||||
import { Tab, Tabs } from 'nextra-theme-docs';
|
||||
|
||||
Returns all selected columns for a single row.
|
||||
|
||||
## Promise
|
||||
|
||||
<Tabs items={['Lua', 'JS']}>
|
||||
<Tab>
|
||||
|
||||
```lua
|
||||
local row = MySQL.single.await('SELECT `firstname`, `lastname` FROM `users` WHERE `identifier` = ? LIMIT 1', {
|
||||
identifier
|
||||
})
|
||||
|
||||
if not row then return end
|
||||
|
||||
print(row.firstname, row.lastname)
|
||||
```
|
||||
|
||||
</Tab>
|
||||
<Tab>
|
||||
|
||||
```js
|
||||
const row = await MySQL.single('SELECT `firstname`, `lastname` FROM `users` WHERE `identifier` = ? LIMIT 1', [
|
||||
identifier
|
||||
])
|
||||
|
||||
if (!row) return;
|
||||
|
||||
console.log(row.firstname, row.lastname)
|
||||
```
|
||||
|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
**Aliases**
|
||||
|
||||
- `exports.oxmysql.single_async`
|
||||
|
||||
## Callback
|
||||
|
||||
<Tabs items={['Lua', 'JS']}>
|
||||
<Tab>
|
||||
|
||||
```lua
|
||||
MySQL.single('SELECT `firstname`, `lastname` FROM `users` WHERE `identifier` = ? LIMIT 1', {
|
||||
identifier
|
||||
}, function(row)
|
||||
if not row then return end
|
||||
|
||||
print(row.firstname, row.lastname)
|
||||
end)
|
||||
```
|
||||
|
||||
</Tab>
|
||||
<Tab>
|
||||
|
||||
```js
|
||||
MySQL.single('SELECT `firstname`, `lastname` FROM `users` WHERE `identifier` = ? LIMIT 1', [
|
||||
identifier
|
||||
], (row) => {
|
||||
if (!row) return;
|
||||
|
||||
console.log(row.firstname, row.lastname)
|
||||
})
|
||||
```
|
||||
|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
**Aliases**
|
||||
|
||||
- `exports.oxmysql.single`
|
||||
Reference in new issue
Block a user