Skip to content

Commit c11e068

Browse files
authored
Fix some typos (go-gorm#4294)
1 parent 80ed284 commit c11e068

File tree

9 files changed

+19
-19
lines changed

9 files changed

+19
-19
lines changed

.github/workflows/tests.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ jobs:
8484
matrix:
8585
dbversion: ['postgres:latest', 'postgres:11', 'postgres:10']
8686
go: ['1.16', '1.15', '1.14']
87-
platform: [ubuntu-latest] # can not run in macOS and widnowsOS
87+
platform: [ubuntu-latest] # can not run in macOS and Windows
8888
runs-on: ${{ matrix.platform }}
8989

9090
services:

errors.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ var (
3333
ErrEmptySlice = errors.New("empty slice found")
3434
// ErrDryRunModeUnsupported dry run mode unsupported
3535
ErrDryRunModeUnsupported = errors.New("dry run mode unsupported")
36-
// ErrInvaildDB invalid db
37-
ErrInvaildDB = errors.New("invalid db")
36+
// ErrInvalidDB invalid db
37+
ErrInvalidDB = errors.New("invalid db")
3838
// ErrInvalidValue invalid value
3939
ErrInvalidValue = errors.New("invalid value")
4040
// ErrInvalidValueOfLength invalid values do not match length

gorm.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ func (db *DB) DB() (*sql.DB, error) {
348348
return sqldb, nil
349349
}
350350

351-
return nil, ErrInvaildDB
351+
return nil, ErrInvalidDB
352352
}
353353

354354
func (db *DB) getInstance() *DB {

logger/sql.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ func isPrintable(s []byte) bool {
2828
return true
2929
}
3030

31-
var convertableTypes = []reflect.Type{reflect.TypeOf(time.Time{}), reflect.TypeOf(false), reflect.TypeOf([]byte{})}
31+
var convertibleTypes = []reflect.Type{reflect.TypeOf(time.Time{}), reflect.TypeOf(false), reflect.TypeOf([]byte{})}
3232

3333
func ExplainSQL(sql string, numericPlaceholder *regexp.Regexp, escaper string, avars ...interface{}) string {
3434
var convertParams func(interface{}, int)
@@ -91,7 +91,7 @@ func ExplainSQL(sql string, numericPlaceholder *regexp.Regexp, escaper string, a
9191
} else if rv.Kind() == reflect.Ptr && !rv.IsZero() {
9292
convertParams(reflect.Indirect(rv).Interface(), idx)
9393
} else {
94-
for _, t := range convertableTypes {
94+
for _, t := range convertibleTypes {
9595
if rv.Type().ConvertibleTo(t) {
9696
convertParams(rv.Convert(t).Interface(), idx)
9797
return

prepare_stmt.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ func (db *PreparedStmtDB) GetDBConn() (*sql.DB, error) {
2727
return sqldb, nil
2828
}
2929

30-
return nil, ErrInvaildDB
30+
return nil, ErrInvalidDB
3131
}
3232

3333
func (db *PreparedStmtDB) Close() {

schema/naming.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -73,16 +73,16 @@ func (ns NamingStrategy) IndexName(table, column string) string {
7373
}
7474

7575
func (ns NamingStrategy) formatName(prefix, table, name string) string {
76-
formatedName := strings.Replace(fmt.Sprintf("%v_%v_%v", prefix, table, name), ".", "_", -1)
76+
formattedName := strings.Replace(fmt.Sprintf("%v_%v_%v", prefix, table, name), ".", "_", -1)
7777

78-
if utf8.RuneCountInString(formatedName) > 64 {
78+
if utf8.RuneCountInString(formattedName) > 64 {
7979
h := sha1.New()
80-
h.Write([]byte(formatedName))
80+
h.Write([]byte(formattedName))
8181
bs := h.Sum(nil)
8282

83-
formatedName = fmt.Sprintf("%v%v%v", prefix, table, name)[0:56] + string(bs)[:8]
83+
formattedName = fmt.Sprintf("%v%v%v", prefix, table, name)[0:56] + string(bs)[:8]
8484
}
85-
return formatedName
85+
return formattedName
8686
}
8787

8888
var (

schema/relationship.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ func (schema *Schema) parseRelation(field *Field) *Relationship {
8989
}
9090

9191
if relation.Type == has {
92-
// don't add relations to embeded schema, which might be shared
92+
// don't add relations to embedded schema, which might be shared
9393
if relation.FieldSchema != relation.Schema && relation.Polymorphic == nil && field.OwnerSchema == nil {
9494
relation.FieldSchema.Relationships.Relations["_"+relation.Schema.Name+"_"+relation.Name] = relation
9595
}
@@ -308,9 +308,9 @@ func (schema *Schema) buildMany2ManyRelation(relation *Relationship, field *Fiel
308308
f.Size = fieldsMap[f.Name].Size
309309
}
310310
relation.JoinTable.PrimaryFields = append(relation.JoinTable.PrimaryFields, f)
311-
ownPriamryField := schema == fieldsMap[f.Name].Schema && ownFieldsMap[f.Name]
311+
ownPrimaryField := schema == fieldsMap[f.Name].Schema && ownFieldsMap[f.Name]
312312

313-
if ownPriamryField {
313+
if ownPrimaryField {
314314
joinRel := relation.JoinTable.Relationships.Relations[relName]
315315
joinRel.Field = relation.Field
316316
joinRel.References = append(joinRel.References, &Reference{
@@ -331,7 +331,7 @@ func (schema *Schema) buildMany2ManyRelation(relation *Relationship, field *Fiel
331331
relation.References = append(relation.References, &Reference{
332332
PrimaryKey: fieldsMap[f.Name],
333333
ForeignKey: f,
334-
OwnPrimaryKey: ownPriamryField,
334+
OwnPrimaryKey: ownPrimaryField,
335335
})
336336
}
337337
}

schema/schema_helper_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func checkSchema(t *testing.T, s *schema.Schema, v schema.Schema, primaryFields
2929
}
3030

3131
if !found {
32-
t.Errorf("schema %v failed to found priamry key: %v", s, field)
32+
t.Errorf("schema %v failed to found primary key: %v", s, field)
3333
}
3434
}
3535
})

statement.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ func (stmt *Statement) BuildCondition(query interface{}, args ...interface{}) []
328328
} else if _, ok := v[key].(Valuer); ok {
329329
conds = append(conds, clause.Eq{Column: key, Value: v[key]})
330330
} else {
331-
// optimize relect value length
331+
// optimize reflect value length
332332
valueLen := reflectValue.Len()
333333
values := make([]interface{}, valueLen)
334334
for i := 0; i < valueLen; i++ {
@@ -398,7 +398,7 @@ func (stmt *Statement) BuildCondition(query interface{}, args ...interface{}) []
398398
if len(args) == 1 {
399399
switch reflectValue.Kind() {
400400
case reflect.Slice, reflect.Array:
401-
// optimize relect value length
401+
// optimize reflect value length
402402
valueLen := reflectValue.Len()
403403
values := make([]interface{}, valueLen)
404404
for i := 0; i < valueLen; i++ {

0 commit comments

Comments
 (0)