Skip to content

Apparently we convert integers to strings before storing them, let's not #53

Description

@TheDiscordian

return db.dB.Put([]byte(fmt.Sprintf("%s.%s", table, key)), []byte(strconv.Itoa(i)), nil)

As you see, we could be storing the integer as raw bytes, but instead we're converting it to a string representation first for some reason.

I believe (*[unsafe.Sizeof(i)]byte)(unsafe.Pointer(&i)) should do the trick.

It will need to be rolled out with some sort of database upgrade ... as old numbers will be stored completely differently. Figuring out how to roll this out is the hardest part, but considering OneBot is supposed to be considered unstable, a warning could be enough... (users could always downgrade if an upgrade breaks their kit anyhow)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions