# smart-common **Repository Path**: hubert_rust/smart-common ## Basic Information - **Project Name**: smart-common - **Description**: 和smart-core, smart-common, smart-cluster, smart-front为一个整体 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-05-17 - **Last Updated**: 2026-05-17 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # smart-common 身份、组、策略、凭证、**Cookie + Redis 会话** 等公共能力(Go 库)。详细设计见 [DESIGN.md](./DESIGN.md)。 ## 被其它工程引用(与 smart-cluster 同级目录时) 在业务仓库的 `go.mod` 中: ```go require smart-common v0.0.0 replace smart-common => ../smart-common ``` ```go import "smart-common/identity/model" ``` ## HTTP Controller(Gin) 包 **`controller`**:将登录、会话、用户/组/策略/凭证、鉴权等挂到 `*gin.RouterGroup`(响应格式与 **`smart-core/httpgin`** 一致)。见包内 `Register` 与 `Deps` 注释。 ## 持久化(生产) - **建表**:执行 [`migrations/001_identity_mysql.sql`](./migrations/001_identity_mysql.sql)(MySQL 8+ / MariaDB 10.5+,InnoDB + utf8mb4)。 - **仓储实现**:`identity/store/gormstore`,`gormstore.New(db *gorm.DB)`;也可用 **`gormstore.NewStoreFromMySQL`**(基于 [`smart-core`](../smart-core) 的 `database.OpenGORM`)独立建连。 - **内存版**:`identity/store/memory` 仅用于单测与本地,不用于生产。 ## 实现阶段 以 `DESIGN.md` 中 **§8 实现阶段建议** 为准;身份域表与 GORM 仓储已对齐迁移脚本,会话仍以 Redis 实现为准。