bind

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenBindFunc

func GenBindFunc(conf *GenFuncConf) (string, error)

func GenFile

func GenFile(config *GenFileConf) (string, error)

func PackageImport

func PackageImport(val any) [2]string

Types

type GenFileConf

type GenFileConf struct {
	Entities     []GenFileEntityConf
	ExtraImports [][2]string
}

type GenFileEntityConf

type GenFileEntityConf struct {
	Actions       []any
	ConfigBuilder func(act any) *GenFuncConf
}

type GenFuncConf

type GenFuncConf struct {
	IgnoreFields  []string // fields to ignore, e.g.  example.FieldID, example.FieldCreatedAt
	SourcePkgName string   // package name of source, e.g. "ent"
	TargetPkgName string   // package name of target, e.g. "entpb"
	// contains filtered or unexported fields
}

func NewGenFuncConf

func NewGenFuncConf(source, target, action any) *GenFuncConf

func (*GenFuncConf) WithIgnoreFields

func (c *GenFuncConf) WithIgnoreFields(fields ...string) *GenFuncConf

func (*GenFuncConf) WithSourcePkgName

func (c *GenFuncConf) WithSourcePkgName(pkgName string) *GenFuncConf

func (*GenFuncConf) WithTargetPkgName

func (c *GenFuncConf) WithTargetPkgName(pkgName string) *GenFuncConf

type Option

type Option func(*Options)

func ClearOnNilField

func ClearOnNilField(fields ...string) Option

func IgnoreField

func IgnoreField(fields ...string) Option

func IgnoreSetZeroField

func IgnoreSetZeroField(fields ...string) Option

func KeepFieldsOnly

func KeepFieldsOnly(fields ...string) Option

type Options

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

func NewBindOptions

func NewBindOptions(options ...Option) *Options

func (*Options) CanSetField

func (o *Options) CanSetField(field string) bool

func (*Options) CanSetZero

func (o *Options) CanSetZero(field string) bool

func (*Options) ClearOnNil

func (o *Options) ClearOnNil(field string) bool

func (*Options) IgnoreSetZero

func (o *Options) IgnoreSetZero(field string) bool

Jump to

Keyboard shortcuts

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