Files
SugarDB/docs/docs/commands/list/lpop.mdx
Kelvin Mwinuka 703ad2a802 Rename the project to SugarDB. (#130)
Renames project to "SugarDB" - @kelvinmwinuka
2024-09-22 21:31:12 +08:00

48 lines
873 B
Plaintext

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
# LPOP
### Syntax
```
LPOP key
```
### Module
<span className="acl-category">list</span>
### Categories
<span className="acl-category">list</span>
<span className="acl-category">write</span>
<span className="acl-category">fast</span>
### Description
Removes and returns the first element of a list.
### Examples
<Tabs
defaultValue="go"
values={[
{ label: 'Go (Embedded)', value: 'go', },
{ label: 'CLI', value: 'cli', },
]}
>
<TabItem value="go">
Removes and returns the first element of a list:
```go
db, err := sugardb.NewSugarDB()
if err != nil {
log.Fatal(err)
}
element, err := db.LPop("key")
```
</TabItem>
<TabItem value="cli">
Removes and returns the first element of a list:
```
> LPOP key
```
</TabItem>
</Tabs>