file

package
v0.0.35 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DisableLog

func DisableLog() func(opt *Options)

DisableLog disables the log that the file was written

func Write

func Write(w Writer, opts ...func(opt *Options)) error

func WriteOnce

func WriteOnce() func(opt *Options)

WriteOnce specifes that writing to path provided should not occur if the file already exists This is usually configured via code

func WriteOnceMaybe

func WriteOnceMaybe(forceOverwrite bool) func(opt *Options)

WriteOnceMaybe takes a flag (usually provided via user action) and determines if we should add the writeOnce flag to Options

Types

type Options

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

Options provides a way to configure the file writing process as needed TODO: maybe move things like createDirIfNeeded to here?

type TemplatedBasedFileWriter

type TemplatedBasedFileWriter struct {
	Data               interface{}
	AbsPathToTemplate  string
	OtherTemplateFiles []string // should also be an absolute path
	TemplateName       string
	PathToFile         string
	CreateDirIfNeeded  bool
	FuncMap            template.FuncMap
	PackageName        string
	Imports            *intimports.Imports
	TsImports          *tsimport.Imports
	Config             *codegen.Config
	EditableCode       bool
}

func (*TemplatedBasedFileWriter) Write

func (fw *TemplatedBasedFileWriter) Write(opts ...func(opt *Options)) error

type Writer

type Writer interface {
	Write(opts ...func(opt *Options)) error
	// contains filtered or unexported methods
}

type YamlFileWriter

type YamlFileWriter struct {
	Config            *codegen.Config
	Data              interface{}
	PathToFile        string
	CreateDirIfNeeded bool
}

func (*YamlFileWriter) Write

func (fw *YamlFileWriter) Write(opts ...func(opt *Options)) error

Jump to

Keyboard shortcuts

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