diff --git a/README.md b/README.md index 1a86a0a4..ca685eb6 100644 --- a/README.md +++ b/README.md @@ -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) + ## HASH diff --git a/docs/docs/commands/generic/type.mdx b/docs/docs/commands/generic/type.mdx new file mode 100644 index 00000000..783393fd --- /dev/null +++ b/docs/docs/commands/generic/type.mdx @@ -0,0 +1,48 @@ +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# TYPE + +### Syntax +``` +TYPE key +``` + +### Module +generic + +### Categories +fast +keyspace +read + +### 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 + + + + 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") + ``` + + + Retrieve the type of the value stored at key: + ``` + > TYPE key + ``` + +