chore(schema): rename ReferenceType to ReferenceableType (#22698)
This commit is contained in:
parent
9d9c19c0f8
commit
1c4dc89ead
@ -3,7 +3,7 @@ package diff
|
||||
import "cosmossdk.io/schema"
|
||||
|
||||
// FieldDiff represents the difference between two fields.
|
||||
// The KindChanged, NullableChanged, and ReferenceTypeChanged methods can be used to determine
|
||||
// The KindChanged, NullableChanged, and ReferenceableTypeChanged methods can be used to determine
|
||||
// what specific changes were made to the field.
|
||||
type FieldDiff struct {
|
||||
// Name is the name of the field.
|
||||
@ -22,11 +22,11 @@ type FieldDiff struct {
|
||||
NewNullable bool
|
||||
|
||||
// OldReferencedType is the name of the old referenced type.
|
||||
// It will be empty if the field is not a reference type or if there was no change.
|
||||
// It will be empty if the field is not a referenceable type or if there was no change.
|
||||
OldReferencedType string
|
||||
|
||||
// NewReferencedType is the name of the new referenced type.
|
||||
// It will be empty if the field is not a reference type or if there was no change.
|
||||
// It will be empty if the field is not a referenceable type or if there was no change.
|
||||
NewReferencedType string
|
||||
}
|
||||
|
||||
@ -52,7 +52,7 @@ func compareField(oldField, newField schema.Field) FieldDiff {
|
||||
|
||||
// Empty returns true if the field diff has no changes.
|
||||
func (d FieldDiff) Empty() bool {
|
||||
return !d.KindChanged() && !d.NullableChanged() && !d.ReferenceTypeChanged()
|
||||
return !d.KindChanged() && !d.NullableChanged() && !d.ReferenceableTypeChanged()
|
||||
}
|
||||
|
||||
// KindChanged returns true if the field kind changed.
|
||||
@ -65,7 +65,7 @@ func (d FieldDiff) NullableChanged() bool {
|
||||
return d.OldNullable != d.NewNullable
|
||||
}
|
||||
|
||||
// ReferenceTypeChanged returns true if the referenced type changed.
|
||||
func (d FieldDiff) ReferenceTypeChanged() bool {
|
||||
// ReferenceableTypeChanged returns true if the referenced type changed.
|
||||
func (d FieldDiff) ReferenceableTypeChanged() bool {
|
||||
return d.OldReferencedType != d.NewReferencedType
|
||||
}
|
||||
|
||||
@ -45,7 +45,7 @@ func Test_compareField(t *testing.T) {
|
||||
OldReferencedType: "old",
|
||||
NewReferencedType: "new",
|
||||
},
|
||||
trueF: FieldDiff.ReferenceTypeChanged,
|
||||
trueF: FieldDiff.ReferenceableTypeChanged,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@ -41,8 +41,8 @@ func (e EnumType) TypeName() string {
|
||||
return e.Name
|
||||
}
|
||||
|
||||
func (EnumType) isType() {}
|
||||
func (EnumType) isReferenceType() {}
|
||||
func (EnumType) isType() {}
|
||||
func (EnumType) isReferenceableType() {}
|
||||
|
||||
// Validate validates the enum definition.
|
||||
func (e EnumType) Validate(TypeSet) error {
|
||||
|
||||
@ -13,13 +13,13 @@ type Type interface {
|
||||
isType()
|
||||
}
|
||||
|
||||
// ReferenceType is a marker interface that all types that can be the target of Field.ReferencedType implement.
|
||||
// ReferenceableType is a marker interface that all types that can be the target of Field.ReferencedType implement.
|
||||
// Currently, this is only EnumType.
|
||||
type ReferenceType interface {
|
||||
type ReferenceableType interface {
|
||||
Type
|
||||
|
||||
// isReferenceType is implemented if this is a reference type.
|
||||
isReferenceType()
|
||||
isReferenceableType()
|
||||
}
|
||||
|
||||
// TypeSet represents something that has types and allows them to be looked up by name.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user