예제 #1
0
        /// <summary>
        /// `JSON.GET`
        ///
        /// Return the value at `path` as a deserialized value.
        ///
        /// https://oss.redislabs.com/rejson/commands/#jsonget
        /// </summary>
        /// <param name="db"></param>
        /// <param name="key">Key where JSON object is stored.</param>
        /// <param name="noEscape">This option will disable the sending of \uXXXX escapes for non-ascii characters. This option should be used for efficiency if you deal mainly with such text.</param>
        /// <param name="indent">Sets the indentation string for nested levels</param>
        /// <param name="newline">Sets the string that's printed at the end of each line</param>
        /// <param name="space">Sets the string that's put between a key and a value</param>
        /// <param name="commandFlags"></param>
        /// <param name="paths">The path(s) of the JSON properties that you want to return. By default, the entire JSON object will be returned.</param>
        /// <typeparam name="TResult">The type to deserialize the value as.</typeparam>
        /// <returns></returns>
        public static async Task <PathedResult <TResult> > JsonGetAsync <TResult>(this IDatabaseAsync db, RedisKey key,
                                                                                  bool noEscape             = false,
                                                                                  string indent             = default, string newline = default, string space = default,
                                                                                  CommandFlags commandFlags = CommandFlags.None, params string[] paths)
        {
            var serializedResult =
                await db.JsonGetAsync(key, noEscape, indent, newline, space, commandFlags, paths).ConfigureAwait(false);

            return(PathedResult <TResult> .Create(serializedResult));
        }
예제 #2
0
 /// <summary>
 /// `JSON.GET`
 ///
 /// Return the value at `path` as a deserialized value.
 ///
 /// `NOESCAPE` is `true` by default.
 ///
 /// https://oss.redislabs.com/rejson/commands/#jsonget
 /// </summary>
 /// <param name="db"></param>
 /// <param name="key">Key where JSON object is stored.</param>
 /// <param name="paths">The path(s) of the JSON properties that you want to return. By default, the entire JSON object will be returned.</param>
 /// <typeparam name="TResult">The type to deserialize the value as.</typeparam>
 /// <returns></returns>
 public static Task <PathedResult <TResult> > JsonGetAsync <TResult>(this IDatabaseAsync db, RedisKey key,
                                                                     params string[] paths) =>
 db.JsonGetAsync <TResult>(key, noEscape: true, paths: paths, commandFlags: CommandFlags.None);