mirror of
https://github.com/EchoVault/SugarDB.git
synced 2025-12-24 12:57:53 +08:00
48 lines
1014 B
Plaintext
48 lines
1014 B
Plaintext
import Tabs from '@theme/Tabs';
|
|
import TabItem from '@theme/TabItem';
|
|
|
|
# LPUSHX
|
|
|
|
### Syntax
|
|
```
|
|
LPUSHX key element [element ...]
|
|
```
|
|
|
|
### Module
|
|
<span className="acl-category">list</span>
|
|
|
|
### Categories
|
|
<span className="acl-category">fast</span>
|
|
<span className="acl-category">list</span>
|
|
<span className="acl-category">write</span>
|
|
|
|
### Description
|
|
Prepends a value to the beginning of a list only if the list exists.
|
|
|
|
### Examples
|
|
|
|
<Tabs
|
|
defaultValue="go"
|
|
values={[
|
|
{ label: 'Go (Embedded)', value: 'go', },
|
|
{ label: 'CLI', value: 'cli', },
|
|
]}
|
|
>
|
|
<TabItem value="go">
|
|
Prepends a value to the beginning of a list only if the list exists:
|
|
```go
|
|
vault, err := echovault.NewEchoVault()
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
length, err := vault.LPushX("key", "element1", "element2")
|
|
```
|
|
</TabItem>
|
|
<TabItem value="cli">
|
|
Prepends a value to the beginning of a list only if the list exists:
|
|
```
|
|
> LPUSHX key element1 element2
|
|
```
|
|
</TabItem>
|
|
</Tabs>
|