codegen

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: MIT Imports: 10 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WriteFile added in v0.16.0

func WriteFile(filename string, data []byte) error

WriteFile writes data to a file named by filename. If the file does not exist, WriteFile creates it and its upper level paths.

Types

type CodeGen

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

func New

func New(md []*ens.EntityDescriptor, opts ...Option) *CodeGen

func (*CodeGen) Bytes

func (g *CodeGen) Bytes() []byte

Bytes returns the CodeBuf's buffer.

func (*CodeGen) FormatSource

func (g *CodeGen) FormatSource() ([]byte, error)

FormatSource return formats and adjusts imports contents of the CodeGen's buffer.

func (*CodeGen) GenDDL

func (g *CodeGen) GenDDL() *CodeGen

func (*CodeGen) GenMapper

func (g *CodeGen) GenMapper() *CodeGen

func (*CodeGen) GenModel

func (g *CodeGen) GenModel() *CodeGen

func (*CodeGen) GenRapier added in v0.0.3

func (g *CodeGen) GenRapier(modelImportPath string) *CodeGen

func (*CodeGen) Print

func (g *CodeGen) Print(a ...any) (n int, err error)

Print formats using the default formats for its operands and writes to the generated output. Spaces are added between operands when neither is a string. It returns the number of bytes written and any write error encountered.

func (*CodeGen) Printf

func (g *CodeGen) Printf(format string, a ...any) (n int, err error)

Printf formats according to a format specifier for its operands and writes to the generated output. It returns the number of bytes written and any write error encountered.

func (*CodeGen) Println

func (g *CodeGen) Println(a ...any) (n int, err error)

Fprintln formats using the default formats to the generated output. Spaces are always added between operands and a newline is appended. It returns the number of bytes written and any write error encountered.

func (*CodeGen) Write

func (g *CodeGen) Write(b []byte) (n int, err error)

Write appends the contents of p to the buffer,

type CodeGenRapier added in v0.16.0

type CodeGenRapier struct {
	OutputDir string
	// contains filtered or unexported fields
}

func NewCodeGenRapier added in v0.16.0

func NewCodeGenRapier(outputDir string, opts ...Option) *CodeGenRapier

func (*CodeGenRapier) Gen added in v0.16.0

func (g *CodeGenRapier) Gen(modelImportPath string, models ...any) error

type Option

type Option func(*CodeGen)

func WithByName

func WithByName(s string) Option

WithByName the code generator by which executables name.

func WithDisableDocComment

func WithDisableDocComment(b bool) Option

func WithHasColumn

func WithHasColumn(b bool) Option

func WithOptions

func WithOptions(mp map[string]string) Option

func WithPackageName

func WithPackageName(s string) Option

func WithSkipColumns

func WithSkipColumns(mp map[string]struct{}) Option

func WithVersion

func WithVersion(version string) Option

Jump to

Keyboard shortcuts

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