generator

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package generator to generate conversions code

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FieldMatchCastable

type FieldMatchCastable struct{}

FieldMatchCastable branch of FieldMatchDescription

func (*FieldMatchCastable) String

func (a *FieldMatchCastable) String() string

type FieldMatchConversion

type FieldMatchConversion struct {
	// MethodPrimary метод на primary-типе возвращающий значение secondary-типа
	MethodPrimary string
	// PrimaryToSecondary функция в пакете primary типа конвертирующая его в secondary
	PrimaryToSecondary string
	// PrimaryFromSecondary функция в пакете primary типа возвращающая его значение из secondary
	PrimaryFromSecondary string
	// MethodPrimary метод на secondary-типе возвращающий значение primary-типа
	MethodSecondary string
	// SecondaryToPrimary функция в пакете secondary-типа конвертирующая его в primary
	SecondaryToPrimary string
	// SecondaryToPrimary функция в пакете secondary типа возвращающая его значение из primary
	SecondaryFromPrimary string
}

FieldMatchConversion branch of FieldMatchDescription

func (*FieldMatchConversion) String

func (c *FieldMatchConversion) String() string

type FieldMatchDescription

type FieldMatchDescription interface {
	fmt.Stringer
	// contains filtered or unexported methods
}

FieldMatchDescription is an interface to limit available implementations to partially replicate discriminated union type functionality

type FieldMatchDirect

type FieldMatchDirect struct{}

FieldMatchDirect branch of FieldMatchDescription

func (*FieldMatchDirect) String

func (d *FieldMatchDirect) String() string

type FieldMatchEnum

type FieldMatchEnum struct {
	Primary   *enumDescription
	Secondary *enumDescription
}

FieldMatchEnum branch of FieldMatchDescription

func (*FieldMatchEnum) String

func (e *FieldMatchEnum) String() string

type FieldMatchMap

type FieldMatchMap struct {
	Key  FieldMatchDescription
	Elem FieldMatchDescription
}

FieldMatchMap branch of FieldMatchDescription

func (*FieldMatchMap) String

func (m *FieldMatchMap) String() string

type FieldMatchNoMatch

type FieldMatchNoMatch struct{}

FieldMatchNoMatch branch of FieldMatchDescription

func (*FieldMatchNoMatch) String

func (m *FieldMatchNoMatch) String() string

type FieldMatchSlice

type FieldMatchSlice struct {
	Elem FieldMatchDescription
}

FieldMatchSlice branch of FieldMatchDescription

func (*FieldMatchSlice) String

func (s *FieldMatchSlice) String() string

type Generator

type Generator struct {
	// contains filtered or unexported fields
}

Generator генератор преобразований структур

func New

func New(primPkg, primName, secPkg, secName, method string, customErrs bool, xclude []string) (*Generator, error)

New конструктор генератора сущностей

func (*Generator) Generate

func (g *Generator) Generate(prj *gogh.Module[*imports.Imports]) error

Generate генерация кода

Jump to

Keyboard shortcuts

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