Redis String Index Type (Enums/StringIndexType.cs)

StackExchange.Redis · src/StackExchange.Redis/Enums/StringIndexType.cs · csharp · MIT
database, lang:csharp, tag:enum, tag:extensions

Defines enumeration and extension mappings for byte- or bit-level string indexing in Redis operations. Use when performing bitfield or string manipulation commands.

// Source: https://github.com/StackExchange/StackExchange.Redis | License: MIT | Copyright 2014 Stack Exchange
// Provided via justclaw.it.com; keep this notice with the code.
using System;

namespace StackExchange.Redis;

/// <summary>
/// Indicates if we index into a string based on bits or bytes.
/// </summary>
public enum StringIndexType
{
    /// <summary>
    /// Indicates the index is the number of bytes into a string.
    /// </summary>
    Byte,

    /// <summary>
    /// Indicates the index is the number of bits into a string.
    /// </summary>
    Bit,
}

internal static class StringIndexTypeExtensions
{
    internal static RedisValue ToLiteral(this StringIndexType indexType) => indexType switch
    {
        StringIndexType.Bit => RedisLiterals.BIT,
        StringIndexType.By

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key