docs: annotate Foundry source and deployment lifecycle in Chinese [skip ci]
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
// 资源别名使用小写连字符格式,避免与受保护路由可直接接受的 UUID 引用发生歧义。
|
||||
package platform
|
||||
|
||||
import "regexp"
|
||||
@@ -7,6 +8,7 @@ var slugPattern = regexp.MustCompile(`^[a-z0-9]+(-[a-z0-9]+)*$`)
|
||||
var uuidSlugPattern = regexp.MustCompile(`^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$`)
|
||||
|
||||
// Slugs remain stable across renames unless explicitly changed by an authorized edit.
|
||||
// validSlug 的 nil 表示创建时由数据库生成或更新时保留原值;非 nil 必须非空、最多百字节且非 UUID。
|
||||
func validSlug(slug *string) bool {
|
||||
return slug == nil || (len(*slug) <= 100 && slugPattern.MatchString(*slug) && !uuidSlugPattern.MatchString(*slug))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user