Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Glide-Core: Refactor and cleanup value_conversion.rs #1819

Open
2 tasks
acarbonetto opened this issue Jul 5, 2024 · 0 comments
Open
2 tasks

Glide-Core: Refactor and cleanup value_conversion.rs #1819

acarbonetto opened this issue Jul 5, 2024 · 0 comments

Comments

@acarbonetto
Copy link
Collaborator

Describe the feature

Our value_conversion.rs file contains duplicate code and some unspecified/generic implementation logic. We should refactor typings to cover duplicate code and be as specific as possible for type (for example: bulk string vs simple string).

From discussion: #1816 (comment)

Use Case

Currently, we have the following types available:

#[derive(Clone, Copy)]
pub(crate) enum ExpectedReturnType<'a> {
    Map {
        key_type: &'a Option<ExpectedReturnType<'a>>,
        value_type: &'a Option<ExpectedReturnType<'a>>,
    },
    MapOfStringToDouble,
    Double,
    Boolean,
    BulkString,
    Set,
    DoubleOrNull,
    ZRankReturnType,
    JsonToggleReturnType,
    ArrayOfStrings,
    ArrayOfBools,
    ArrayOfDoubleOrNull,
    Lolwut,
    ArrayOfStringAndArrays,
    ArrayOfArraysOfDoubleOrNull,
    ArrayOfMaps(&'a Option<ExpectedReturnType<'a>>),
    StringOrSet,
    ArrayOfPairs,
    ArrayOfMemberScorePairs,
    ZMPopReturnType,
    KeyWithMemberAndScore,
    FunctionStatsReturnType,
    GeoSearchReturnType,
    SimpleString,
    XAutoClaimReturnType,
    XInfoStreamFullReturnType,
}

We should divide and organize types based on common uses. For example, we have a lot of ArrayOfX types, which could take advantage of recursive typing like we now have for Maps. Array { element_type: type } could replace all of these.

Proposed Solution

No response

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

Client version used

All

Environment details (OS name and version, etc.)

All

@acarbonetto acarbonetto changed the title (topic): (short issue description) Glide-Core: Refactor and cleanup value_conversion.rs Jul 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

No branches or pull requests

2 participants