Skip to content

Fix next_key in table rows response #41

@poplexity

Description

@poplexity

match params.lower_bound {
Some(TableIndexType::NAME(_)) => {
next_key = Some(TableIndexType::NAME(name!(next_key_str.as_str())));
}
Some(TableIndexType::UINT64(_)) => {
next_key = Some(TableIndexType::UINT64(next_key_str.parse().unwrap()));
}
Some(TableIndexType::UINT128(_)) => {
next_key = Some(TableIndexType::UINT128(next_key_str.parse().unwrap()));
}
Some(TableIndexType::CHECKSUM160(_)) => {
next_key = Some(TableIndexType::CHECKSUM160(
Checksum160::from_bytes(hex_to_bytes(&next_key_str).as_slice()).unwrap(),
));
}
Some(TableIndexType::CHECKSUM256(_)) => {
next_key = Some(TableIndexType::CHECKSUM256(
Checksum256::from_bytes(hex_to_bytes(&next_key_str).as_slice()).unwrap(),
));
}
Some(TableIndexType::FLOAT64(_)) => {
next_key = Some(TableIndexType::FLOAT64(next_key_str.parse().unwrap()));
}
None => {}

When the lower_bound is not specified in the request params, it's None, which means it defaults to the u64 of the primary key. So we should default to treating/parsing next_key as u64.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions