style: fix linter check for NamingStrategy and onConflictOption (#5174)

This commit is contained in:
Jin 2022-03-20 09:02:45 +08:00 committed by GitHub
parent 0097b39a77
commit 2d5cb997ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -323,7 +323,7 @@ func SaveAfterAssociations(create bool) func(db *gorm.DB) {
}
}
func onConflictOption(stmt *gorm.Statement, s *schema.Schema, selectColumns map[string]bool, restricted bool, defaultUpdatingColumns []string) (onConflict clause.OnConflict) {
func onConflictOption(stmt *gorm.Statement, s *schema.Schema, defaultUpdatingColumns []string) (onConflict clause.OnConflict) {
if len(defaultUpdatingColumns) > 0 || stmt.DB.FullSaveAssociations {
onConflict.Columns = make([]clause.Column, 0, len(s.PrimaryFieldDBNames))
for _, dbName := range s.PrimaryFieldDBNames {
@ -349,7 +349,7 @@ func saveAssociations(db *gorm.DB, rel *schema.Relationship, rValues reflect.Val
var (
selects, omits []string
onConflict = onConflictOption(db.Statement, rel.FieldSchema, selectColumns, restricted, defaultUpdatingColumns)
onConflict = onConflictOption(db.Statement, rel.FieldSchema, defaultUpdatingColumns)
refName = rel.Name + "."
values = rValues.Interface()
)

View File

@ -85,9 +85,9 @@ func (ns NamingStrategy) IndexName(table, column string) string {
}
func (ns NamingStrategy) formatName(prefix, table, name string) string {
formattedName := strings.Replace(strings.Join([]string{
formattedName := strings.ReplaceAll(strings.Join([]string{
prefix, table, name,
}, "_"), ".", "_", -1)
}, "_"), ".", "_")
if utf8.RuneCountInString(formattedName) > 64 {
h := sha1.New()