Documentation
¶
Overview ¶
Package sdcodegen 生成源代码
Index ¶
- Constants
- func Expand(filename string) string
- func SimplePrint(action Action, fn, absFn string)
- func Slog(action Action, fn, absFn string)
- func TryExpand(filename string) (string, error)
- type Action
- type Buffer
- func (b *Buffer) Bytes() []byte
- func (b *Buffer) Clear()
- func (b *Buffer) F(format string, a ...any) Writer
- func (b *Buffer) FL(format string, a ...any) Writer
- func (b *Buffer) Filename() string
- func (b *Buffer) I(n int) Writer
- func (b *Buffer) If(cond bool, s string) Writer
- func (b *Buffer) IfElse(cond bool, s, els string) Writer
- func (b *Buffer) IfElseFunc(cond bool, f, els func()) Writer
- func (b *Buffer) IfFunc(cond bool, f func()) Writer
- func (b *Buffer) IsEmpty() bool
- func (b *Buffer) Join(l []string, sep, lastSep string) Writer
- func (b *Buffer) JoinPairs(pairs []Pair, space, sep, lastSep string) Writer
- func (b *Buffer) L(s string) Writer
- func (b *Buffer) Len() int
- func (b *Buffer) Modify(f func(s string) string) Writer
- func (b *Buffer) NL() Writer
- func (b *Buffer) Overwrite() bool
- func (b *Buffer) P(s string) Writer
- func (b *Buffer) Perm() fs.FileMode
- func (b *Buffer) Repeat(s string, n int) Writer
- func (b *Buffer) Save(root string, mkdirs bool, logger func(action Action, fn, absFn string)) error
- func (b *Buffer) SetFilename(filename string) Writer
- func (b *Buffer) SetOverwrite(overwrite bool) Writer
- func (b *Buffer) SetPerm(perm fs.FileMode) Writer
- func (b *Buffer) String() string
- func (b *Buffer) T(template string, data any) Writer
- func (b *Buffer) TL(template string, data any) Writer
- func (b *Buffer) UsePlaceholder(name string, f func(p *Placeholder)) Writer
- func (b *Buffer) WritePlaceholder(p *Placeholder) Writer
- type BufferOptions
- type Buffers
- func (bs *Buffers) Add(filename string, f func(w Writer)) *Buffer
- func (bs *Buffers) Append(filename string) *Buffer
- func (bs *Buffers) Data(filename string) string
- func (bs *Buffers) Dump(out io.Writer)
- func (bs *Buffers) Filenames() []string
- func (bs *Buffers) Find(pattern string) []*Buffer
- func (bs *Buffers) Get(filename string) *Buffer
- func (bs *Buffers) Has(filename string) bool
- func (bs *Buffers) Open(filename string) *Buffer
- func (bs *Buffers) Put(filename string, f func(w Writer)) *Buffer
- func (bs *Buffers) Save(root string, logger func(action Action, fn, absFn string)) error
- func (bs *Buffers) String() string
- type Pair
- type Placeholder
- type Writer
Constants ¶
View Source
const ( I = Action("ignore") W = Action("write") C = Action("create") )
Variables ¶
This section is empty.
Functions ¶
func SimplePrint ¶
Types ¶
type Buffer ¶
type Buffer struct {
// contains filtered or unexported fields
}
func NewBuffer ¶
func NewBuffer(opts *BufferOptions) *Buffer
func (*Buffer) IfElseFunc ¶
func (*Buffer) SetFilename ¶
func (*Buffer) SetOverwrite ¶
func (*Buffer) UsePlaceholder ¶
func (b *Buffer) UsePlaceholder(name string, f func(p *Placeholder)) Writer
func (*Buffer) WritePlaceholder ¶
func (b *Buffer) WritePlaceholder(p *Placeholder) Writer
type BufferOptions ¶
type Buffers ¶
type Buffers struct {
// contains filtered or unexported fields
}
func NewBuffers ¶
func NewBuffers() *Buffers
type Placeholder ¶
type Writer ¶
type Writer interface { Len() int IsEmpty() bool Filename() string SetFilename(filename string) Writer Perm() fs.FileMode SetPerm(perm fs.FileMode) Writer Overwrite() bool SetOverwrite(b bool) Writer Modify(func(s string) string) Writer WritePlaceholder(p *Placeholder) Writer UsePlaceholder(name string, f func(p *Placeholder)) Writer P(s string) Writer F(format string, a ...any) Writer T(template string, data any) Writer L(s string) Writer FL(format string, a ...any) Writer TL(template string, data any) Writer NL() Writer I(n int) Writer Repeat(s string, n int) Writer If(cond bool, s string) Writer IfFunc(cond bool, f func()) Writer IfElse(cond bool, s, els string) Writer IfElseFunc(cond bool, f, els func()) Writer Join(l []string, sep, lastSep string) Writer JoinPairs(pairs []Pair, space, sep, lastSep string) Writer }
Click to show internal directories.
Click to hide internal directories.