refactor: rename id_generator to snowflake
This commit is contained in:
23
src/snowflake/snowflake.h
Normal file
23
src/snowflake/snowflake.h
Normal 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
|
||||
Reference in New Issue
Block a user