This repository has been archived by the owner on Oct 25, 2024. It is now read-only.
How do you index strings longer than 32 characters? #1233
Answered
by
ra0x3
PaulZhemanov
asked this question in
Q&A
-
Hi. How do you index strings longer than 32 characters? |
Beta Was this translation helpful? Give feedback.
Answered by
ra0x3
Aug 9, 2023
Replies: 1 comment 2 replies
-
@PaulZhemanov We use the type Person {
id: ID!
name: Charfield! # Can be up to 255 characters long
} In your indexer handler you can convert mod my_module {
fn my_handler(event: MyEvent) {
// Assuming event.name is a str[32] defined in your contract
let p = Person::new(event.name.to_string());
}
} Let me know if this helps. Also gonna move this to a discussion :) |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
PaulZhemanov
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@PaulZhemanov We use the
Charfield
scalar for indexing strings.In your indexer handler you can convert
SizedAsciiString
(the SDK's string type) to indexer string types by just doingLet me know if this helps. Also gonna move this to a discussion :)