Skip to content
New issue

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

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

Already on GitHub? # to your account

Feature Request: Allow key field to point to functions #21

Open
Swoorup opened this issue Dec 16, 2024 · 0 comments
Open

Feature Request: Allow key field to point to functions #21

Swoorup opened this issue Dec 16, 2024 · 0 comments

Comments

@Swoorup
Copy link

Swoorup commented Dec 16, 2024

Description

Currently, the key field in the venndb library is limited to pointing to struct fields. We could an enhancement to allow the key field to point to functions inside the struct, providing more flexibility in key definitions and usage.

Example

#[derive(VennDB)]
#[venndb(key = "get_dynamic_key")]
struct ExampleStruct {
    #[venndb(key)]
    id: u32,
    name: String,
}

impl ExampleStruct {
    fn get_dynamic_key(&self) -> u32 {
    }
}

Benefits

Increased flexibility in defining keys for the venndb library.
Support for dynamic key generation based on custom logic.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant