From 7baa7e74ec60f9547d9228af1234de840492fdc3 Mon Sep 17 00:00:00 2001 From: 1911860538 Date: Tue, 13 May 2025 22:47:10 +0800 Subject: [PATCH] perf: use strings.IndexByte to replace strings.Index --- 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 72fc6ca8..3bcf557f 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, ",") )