From 9703eb775f203e916759bfa51af6724b05ff04ba Mon Sep 17 00:00:00 2001 From: Name <1911860538@qq.com> Date: Wed, 21 May 2025 10:35:56 +0800 Subject: [PATCH] perf: use strings.IndexByte to replace strings.Index (#7454) Co-authored-by: 1911860538 --- schema/index.go | 2 +- schema/relationship.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/schema/index.go b/schema/index.go index a1cdc639..2690a0cb 100644 --- a/schema/index.go +++ b/schema/index.go @@ -105,7 +105,7 @@ func parseFieldIndexes(field *Field) (indexes []Index, err error) { var ( name string tag = strings.Join(v[1:], ":") - idx = strings.Index(tag, ",") + idx = strings.IndexByte(tag, ',') tagSetting = strings.Join(strings.Split(tag, ",")[1:], ",") settings = ParseTagSetting(tagSetting, ",") length, _ = strconv.Atoi(settings["LENGTH"]) diff --git a/schema/relationship.go b/schema/relationship.go index def4a595..b600f040 100644 --- a/schema/relationship.go +++ b/schema/relationship.go @@ -675,7 +675,7 @@ func (rel *Relationship) ParseConstraint() *Constraint { var ( name string - idx = strings.Index(str, ",") + idx = strings.IndexByte(str, ',') settings = ParseTagSetting(str, ",") )