refactor: rename id_generator to snowflake

This commit is contained in:
luwenpeng
2024-08-16 11:02:19 +08:00
parent 6fbce43afc
commit f4d437d58b
23 changed files with 177 additions and 177 deletions

23
src/snowflake/snowflake.h Normal file
View File

@@ -0,0 +1,23 @@
#pragma once
#ifdef __cplusplus
extern "C"
{
#endif
#include <stdint.h>
struct snowflake_options
{
uint8_t snowflake_base;
uint8_t snowflake_offset;
};
// return 0: success
// return -1: failed
int snowflake_id_init(const struct snowflake_options *opts);
uint64_t snowflake_id_generate(uint64_t now_sec);
#ifdef __cplusplus
}
#endif