예제 #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.NUMMULTBY`
 ///
 /// Multiplies the number value stored at `path` by `number`.
 ///
 /// https://oss.redislabs.com/rejson/commands/#jsonnummultby
 /// </summary>
 /// <param name="db"></param>
 /// <param name="key">They key of the JSON object which contains the number value you want to multiply.</param>
 /// <param name="path">The path of the JSON value you want to multiply.</param>
 /// <param name="number">The value you want to multiply by.</param>
 /// <param name="commandFlags">Optional command flags.</param>
 public static async Task <PathedResult <double?> > JsonMultiplyNumberAsync(this IDatabaseAsync db, RedisKey key,
                                                                            string path,
                                                                            double number, CommandFlags commandFlags = CommandFlags.None) =>
 PathedResult <double?> .Create(await db.ExecuteAsync(JsonCommands.NUMMULTBY,
                                                      CombineArguments(key, path, number), flags: CommandFlags.None));
예제 #3
0
 /// <summary>
 /// `JSON.NUMMULTBY`
 ///
 /// Multiplies the number value stored at `path` by `number`.
 ///
 /// https://oss.redislabs.com/rejson/commands/#jsonnummultby
 /// </summary>
 /// <param name="db"></param>
 /// <param name="key">They key of the JSON object which contains the number value you want to multiply.</param>
 /// <param name="path">The path of the JSON value you want to multiply.</param>
 /// <param name="number">The value you want to multiply by.</param>
 /// <param name="commandFlags">Optional command flags.</param>
 public static PathedResult <double?> JsonMultiplyNumber(this IDatabase db, RedisKey key, string path, double number,
                                                         CommandFlags commandFlags = CommandFlags.None) =>
 PathedResult <double?> .Create(db.Execute(JsonCommands.NUMMULTBY, CombineArguments(key, path, number), flags: commandFlags));
예제 #4
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">Optional command flags.</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 PathedResult <TResult> JsonGet <TResult>(this IDatabase db, RedisKey key, bool noEscape = false,
                                                        string indent             = default, string newline = default, string space = default,
                                                        CommandFlags commandFlags = CommandFlags.None, params string[] paths) =>
 PathedResult <TResult> .Create(db.JsonGet(key, noEscape, indent, newline, space, commandFlags, paths));