package hiredis-value

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Hiredis_value provides access to the RESP value type

type t =
  1. | Nil
  2. | Error of string
  3. | Integer of int64
  4. | String of string
  5. | Array of t array
  6. | Status of string
val nil : t

Get a nil value

val string : string -> t

Convert an OCaml string to a Hiredis string

val int64 : int64 -> t

Convert an int64 to Hiredis number

val int : int -> t

Convert an int to Hiredis number

val array : t array -> t

Convert an OCaml array to Hiredis array

val error : string -> t

Create an error value

val status : string -> t

Create a status or "simple string" value

exception Invalid_value
val is_nil : t -> bool
val is_error : t -> bool
val to_string : t -> string

to_string v converts v to a string, otherwise Invalid_value is raised

val to_int64 : t -> int64

to_int64 v converts v to an int64, otherwise Invalid_value is raised

val to_int : t -> int

to_int v converts v to an int, otherwise Invalid_value is raised

val to_float : t -> float

to_float v converts v to a float, otherwise Invalid_value is raised

val to_array : t -> t array

to_array v converts v to an array of values if v is an array value, * otherwise Invalid_value is raised

val to_list : t -> t list

to_list v converts v to a list of values if v is an array value, * otherwise Invalid_value is raised

val to_hashtbl : t -> (string, t) Hashtbl.t

to_hashtbl v converts v to a Hashtbl.t if v is an array value and * the array can be interpreted as a hash table, otherwise Invalid_value is * raised