Skip to content

Setting: matchIgnoreCase

matchIgnoreCase [yes,no] is a boolean setting and can be defined as CLI argument, conversion comment or method comment. This setting is inheritable.

Enable matchIgnoreCase to instructs goverter to match fields ignoring differences in capitalization. If there are multiple matches then goverter will prefers an exact match (if present) or reports an error. Use map to fix an ambiquous match error.

go
package example

// goverter:converter
type Converter interface {
	// goverter:matchIgnoreCase
	Convert(Input) Output
}

type Input struct {
	Age      int
	Fullname string
}
type Output struct {
	Age      int
	FULLNAME string
}
go
// Code generated by github.com/jmattheis/goverter, DO NOT EDIT.
//go:build !goverter

package generated

import matchignorecase "github.com/jmattheis/goverter/example/match-ignore-case"

type ConverterImpl struct{}

func (c *ConverterImpl) Convert(source matchignorecase.Input) matchignorecase.Output {
	var exampleOutput matchignorecase.Output
	exampleOutput.Age = source.Age
	exampleOutput.FULLNAME = source.Fullname
	return exampleOutput
}