Skip to content

Commit

Permalink
Rename method in OpenSearchDateType
Browse files Browse the repository at this point in the history
  • Loading branch information
varfrog committed Jan 8, 2025
1 parent 38026f5 commit a3133ba
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions mapping_properties_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ func (b *MappingPropertiesBuilder) resolveFieldType(field *fieldWrapper) (string
}
if field.kind == reflect.Struct {
if x, ok := field.value.Interface().(OpenSearchDateType); ok {
if x.GetOpenSearchFieldType() != "" {
if x.GetOpenSearchDateFieldType() != "" {
return "date", nil
}
}
Expand All @@ -164,8 +164,8 @@ func (b *MappingPropertiesBuilder) resolveFieldFormat(field *fieldWrapper) (*str
}
if field.kind == reflect.Struct {
if x, ok := field.value.Interface().(OpenSearchDateType); ok {
if x.GetOpenSearchFieldType() != "" {
return MakePtr(x.GetOpenSearchFieldType()), nil
if x.GetOpenSearchDateFieldType() != "" {
return MakePtr(x.GetOpenSearchDateFieldType()), nil
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions time_formats.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ type (

// OpenSearchDateType tells MappingPropertiesBuilder that a type is a "date" OpenSearch type.
type OpenSearchDateType interface {
GetOpenSearchFieldType() string
GetOpenSearchDateFieldType() string
}

//goland:noinspection GoMixedReceiverTypes
Expand All @@ -63,7 +63,7 @@ func (t *TimeBasicDateTime) UnmarshalText(text []byte) error {
}

//goland:noinspection GoMixedReceiverTypes
func (t TimeBasicDateTime) GetOpenSearchFieldType() string {
func (t TimeBasicDateTime) GetOpenSearchDateFieldType() string {
return "basic_date_time"
}

Expand All @@ -85,7 +85,7 @@ func (t *TimeBasicDateTimeNoMillis) UnmarshalText(text []byte) error {
}

//goland:noinspection GoMixedReceiverTypes
func (t TimeBasicDateTimeNoMillis) GetOpenSearchFieldType() string {
func (t TimeBasicDateTimeNoMillis) GetOpenSearchDateFieldType() string {
return "basic_date_time_no_millis"
}

Expand All @@ -107,7 +107,7 @@ func (t *TimeBasicDate) UnmarshalText(text []byte) error {
}

//goland:noinspection GoMixedReceiverTypes
func (t TimeBasicDate) GetOpenSearchFieldType() string {
func (t TimeBasicDate) GetOpenSearchDateFieldType() string {
return "basic_date"
}

Expand Down

0 comments on commit a3133ba

Please sign in to comment.