---
title: "Discussion on \"Python实现长度16位十进制整数的客制化雪花算法(Snowflake)生成器\" | Hashnode"
description: "Discussion on \"Python实现长度16位十进制整数的客制化雪花算法(Snowflake)生成器\". 我们知道，雪花算法(SnowFlake)生成的雪花ID是 2^64 位，如果直接使用雪花算法(SnowFlake)生成器，前端是没办法直接拿到int类型的雪花ID，需要后端先将其转换为string类型才行。\n\n使用雪花算法(SnowFlake)的很重要一个原因就是，int类型对数据库索引是很友好的，为了前后端数"
url: "https://hashnode.com/posts/pythonsnowflake/63ac957d34d6a6b14ff435a6"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Python实现长度16位十进制整数的客制化雪花算法(Snowflake)生成器](https://asiones.hashnode.dev/pythonsnowflake?utm_source=hashnode&utm_medium=feed)

我们知道，雪花算法(SnowFlake)生成的雪花ID是 2^64 位，如果直接使用雪花算法(SnowFlake)生成器，前端是没办法直接拿到int类型的雪花ID，需要后端先将其转换为string类型才行。 使用雪花算法(SnowFlake)的很重要一个原因就是，int类型对数据库索引是很友好的，为了前后端数

Dec 28, 2022 · 2 min read · asiones.hashnode.dev  
Updated Jan 3, 2023  
Read the article

-   [#python](https://hashnode.com/tag/python)
-   [#snowflake](https://hashnode.com/tag/snowflake)

## Written by

[Asiones Jia](https://hashnode.com/@asionesjia)

@asionesjia

  
[View profile](https://hashnode.com/@asionesjia)

白毛浮绿水，红掌拨清波。

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
