config

package
v1.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 23, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnumActionPanic  = "@panic"
	EnumActionError  = "@error"
	EnumActionIgnore = "@ignore"
)

Variables

View Source
var DefaultConfig = ConverterConfig{
	OutputFile:        "./generated/generated.go",
	OutputPackageName: "generated",
	Common:            Common{Enum: enum.Config{Enabled: true}},
}

Functions

func IsEnumAction added in v1.4.0

func IsEnumAction(s string) bool

Types

type Common

type Common struct {
	FieldSettings                      []string
	WrapErrors                         bool
	WrapErrorsUsing                    string
	IgnoreUnexported                   bool
	MatchIgnoreCase                    bool
	IgnoreMissing                      bool
	SkipCopySameType                   bool
	UseZeroValueOnPointerInconsistency bool
	UseUnderlyingTypeMethods           bool
	Enum                               enum.Config
}

type ConfiguredTransformer added in v1.4.0

type ConfiguredTransformer struct {
	Name        string
	Transformer enum.Transformer
	Config      string
}

type Converter

type Converter struct {
	ConverterConfig
	Package    string
	FileSource string
	Type       types.Type
	Methods    map[string]*Method
}

func Parse

func Parse(raw *Raw) ([]*Converter, error)

type ConverterConfig

type ConverterConfig struct {
	Common
	Name              string
	OutputFile        string
	OutputPackagePath string
	OutputPackageName string
	Extend            []*method.Definition
	Comments          []string
}

func (*ConverterConfig) PackageID added in v1.2.0

func (conf *ConverterConfig) PackageID() string

type EnumMapping added in v1.4.0

type EnumMapping struct {
	Transformers []ConfiguredTransformer
	Map          map[string]string
}

type FieldMapping

type FieldMapping struct {
	Source   string
	Function *method.Definition
	Ignore   bool
}

type Method

type Method struct {
	*method.Definition
	Common

	Constructor *method.Definition
	AutoMap     []string
	Fields      map[string]*FieldMapping
	EnumMapping *EnumMapping

	RawFieldSettings []string
}

func (*Method) Field

func (m *Method) Field(targetName string) *FieldMapping

type Raw

type Raw struct {
	Converters []RawConverter
	Global     RawLines

	WorkDir              string
	BuildTags            string
	OuputBuildConstraint string

	EnumTransformers map[string]enum.Transformer
}

type RawConverter

type RawConverter struct {
	Package       string
	InterfaceName string
	Converter     RawLines
	Methods       map[string]RawLines
	FileSource    string
}

type RawLines

type RawLines struct {
	Location string
	Lines    []string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL