mapc

package module
v0.0.0-...-c955e10 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2023 License: MIT Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	RootDirPath string
	RootPkgPath string
)

Functions

This section is empty.

Types

type Generated

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

func (Generated) Save

func (g Generated) Save() error

func (Generated) Sprint

func (g Generated) Sprint() (string, error)

func (Generated) Write

func (g Generated) Write(w io.Writer) error

type GeneratedStore

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

GeneratedStore stores Generated elements. tempMap has elements that have OutPath. Generated elements are shared with same OutPath value. tempList has elements that doesn't have OutPath.

func NewGeneratedStore

func NewGeneratedStore() *GeneratedStore

func (*GeneratedStore) Get

func (gs *GeneratedStore) Get(outPath, pkgPath string) *Generated

func (*GeneratedStore) List

func (gs *GeneratedStore) List() []*Generated

func (*GeneratedStore) Set

func (gs *GeneratedStore) Set(outPath string, g *Generated)

type Group

type Group struct {
	*MapC
	Option *Option
	// contains filtered or unexported fields
}

func (*Group) Group

func (g *Group) Group(optFns ...func(*Option)) *Group

func (*Group) Register

func (g *Group) Register(src, dest any, optFns ...func(*Option))

type MapC

type MapC struct {
	Option *Option
	// contains filtered or unexported fields
}

func New

func New() *MapC

func (*MapC) Generate

func (m *MapC) Generate() (res []*Generated, errs []error)

func (*MapC) Group

func (m *MapC) Group(optFns ...func(*Option)) *Group

func (*MapC) Register

func (m *MapC) Register(src, dest any, optFns ...func(*Option))

type Mode

type Mode int
const (
	PrioritizeGenerated Mode = iota
	PrioritizeExisted
	Deterministic
)

func (Mode) Editable

func (m Mode) Editable() bool

type Option

type Option struct {
	Mode                 Mode
	OutPath              string
	OutPkgPath           string
	FuncName             string
	FuncComment          bool
	NoMapperFieldComment bool
	FieldMappers         []mapcstd.FieldMapper
	TypeMappers          []mapcstd.TypeMapper
}

type Registerer

type Registerer interface {
	Register(src, dest any, optFns ...func(option *Option))
	Group(optFns ...func(*Option)) *Group
}

Directories

Path Synopsis
example module
internal
str

Jump to

Keyboard shortcuts

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