Skip to content

Commit

Permalink
docs: added TYPE command documentation (#135)
Browse files Browse the repository at this point in the history
Added TYPE command documentation. - @zenc0derr 

---------

Co-authored-by: Tejesh Kumar S <zenc0derr>
Co-authored-by: Kelvin Mwinuka <[email protected]>
  • Loading branch information
zenc0derr and kelvinmwinuka authored Oct 4, 2024
1 parent 4915f90 commit 5d3313d
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,8 @@ MSET (10 keys): 56022.41 requests per second, p50=0.463 msec
* [RENAME](https://sugardb.io/docs/commands/generic/rename)
* [SET](https://sugardb.io/docs/commands/generic/set)
* [TTL](https://sugardb.io/docs/commands/generic/ttl)
* [TYPE](https://sugardb.io/docs/commands/generic/type)


<a name="commands-hash"></a>
## HASH
Expand Down
48 changes: 48 additions & 0 deletions docs/docs/commands/generic/type.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

# TYPE

### Syntax
```
TYPE key
```

### Module
<span className="acl-category">generic</span>

### Categories
<span className="acl-category">fast</span>
<span className="acl-category">keyspace</span>
<span className="acl-category">read</span>

### Description
Returns the string representation of the value type stored at the key.
The types that can be returned are string, integer, float, list, set, set, and hash.

### Examples

<Tabs
defaultValue="go"
values={[
{ label: 'Go (Embedded)', value: 'go', },
{ label: 'CLI', value: 'cli', },
]}
>
<TabItem value="go">
Retrieve the type of the value stored at key:
```go
db, err := sugardb.NewSugarDB()
if err != nil {
log.Fatal(err)
}
type, err := db.Type("key")
```
</TabItem>
<TabItem value="cli">
Retrieve the type of the value stored at key:
```
> TYPE key
```
</TabItem>
</Tabs>

0 comments on commit 5d3313d

Please sign in to comment.