adaptors

package
v0.0.0-...-e537141 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2023 License: GPL-3.0 Imports: 40 Imported by: 0

Documentation

Index

Constants

View Source
const FsID deps.ID = "deps.afero.fs"

Variables

View Source
var DefaultOptions = lua.Options{
	CallStackSize: lua.CallStackSize,
	RegistrySize:  lua.RegistrySize,
}
View Source
var ErrCodersUnset = fmt.Errorf("multiple coders were not initialized")
View Source
var ErrEmptyString = fmt.Errorf("received empty string from lua state")
View Source
var ErrNilTable = fmt.Errorf("table retreived from lua is nil")
View Source
var TomlCoder = payload.Coder{
	Decoder: TomlDecoder{},
	Encoder: TomlEncoder{},
}

Functions

func DefaultWrapper

func DefaultWrapper(s *LuaSandbox, name string, fun SandboxFunc) (wr lua.LGFunction, err error)

func GetDep

func GetDep[T any](s *Sandbox, id deps.ID) (T, error)

func Mkdir

func Mkdir(fsys afero.Fs, path string, perm fs.FileMode, all bool) error

func NamedComponent

func NamedComponent(l zerolog.Logger, name string) (out zerolog.Logger)

func NewLexer

func NewLexer(r io.Reader) command.Lexer

func NewShlexer

func NewShlexer() command.Shlex

func Remove

func Remove(fsys afero.Fs, path string, all bool) error

func ResolveReader

func ResolveReader(fs *FS, r Reader) (io.ReadCloser, error)

func SetVarAtStrings

func SetVarAtStrings[T any](s StringKeyedStorage, val T, keys ...string) error

func SetVarsAtString

func SetVarsAtString[T any](s StringKeyedStorage, vals map[string]T) error

func Shlex

func Shlex(s string) ([]string, error)

func SliceAtStrings

func SliceAtStrings[T any](s StringKeyedStorage, keys ...string) ([]T, error)

func Transform

func Transform(fs *FS, req Request) (payload.Request, io.Closer, error)

func VarAtStrings

func VarAtStrings[T any](s StringKeyedStorage, keys ...string) (T, error)

Types

type AnyFormatter

type AnyFormatter struct {
	IntoWriter generate.WriteInto
	Separator  string
	Log        zerolog.Logger
}

func (AnyFormatter) FormatAnySlice

func (a AnyFormatter) FormatAnySlice(w io.Writer, vals []any) error

func (AnyFormatter) WriteInto

func (a AnyFormatter) WriteInto(w io.Writer, val any) error

type BufReader

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

func BufferedReader

func BufferedReader(r io.ReadCloser) BufReader

func (BufReader) Close

func (br BufReader) Close() error

func (BufReader) Read

func (br BufReader) Read(b []byte) (int, error)

type BufioPoolFs

type BufioPoolFs struct {
	afero.Fs
	// contains filtered or unexported fields
}

type Builder

type Builder struct {
	Methods   DomainMapMethods
	Caching   set.Set[Domain]
	LogConfig LogConfig
	BufferdIO bool
}

func DefaultBuilder

func DefaultBuilder(log zerolog.Logger) Builder

func (Builder) BuildFs

func (mb Builder) BuildFs(meth *mapping.Methods, fs afero.Fs) (afero.Fs, error)

func (Builder) BuildLuaMethods

func (b Builder) BuildLuaMethods(mapper *gluamapper.Mapper) (LuaMethods, error)

func (Builder) BuildTemplateManager

func (b Builder) BuildTemplateManager(parsers TemplateParsers) (TemplateManager, error)

func (Builder) CsvManager

func (mb Builder) CsvManager(fsys fs.FS) (csv.Manager, error)

func (Builder) DataMethods

func (mb Builder) DataMethods(meth *mapping.Methods) (data.Methods, error)

func (Builder) DeriveLogger

func (m Builder) DeriveLogger(parts ...string) (zerolog.Logger, error)

func (Builder) DeriveLoggerIf

func (b Builder) DeriveLoggerIf(d Domain, parts ...string) (zerolog.Logger, bool, error)

func (Builder) DomainLogger

func (b Builder) DomainLogger(d Domain, parts ...string) (zerolog.Logger, error)

func (Builder) GetMethods

func (b Builder) GetMethods(d Domain) *mapping.Methods

func (Builder) GlobManager

func (mb Builder) GlobManager(fsys fs.FS, csv csv.Manager, named data.NamedMethods) (GlobManager, error)

func (Builder) HasLogDomain

func (mb Builder) HasLogDomain(dom Domain) bool

func (Builder) MustDeriveLogger

func (m Builder) MustDeriveLogger(parts ...string) (log zerolog.Logger)

MustDeriveLogger is the same as DeriveLogger, but panics on error.

func (Builder) StreamManager

func (b Builder) StreamManager(fs afero.Fs, meth *mapping.Methods) (stream.Manager, error)

func (Builder) WrapMappingMethods

func (mb Builder) WrapMappingMethods(m *mapping.Methods) (mapping.Methods, error)

func (Builder) WrapParser

func (b Builder) WrapParser(parser template.Parser) (template.Parser, error)

type ConfigFunc

type ConfigFunc interface {
	LuaConfig(s *LuaSandbox, l *lua.LTable) (fn SandboxFunc, err error)
}

ConfigFunc can add a SandboxFunc that has acces to some share state configured during the call to OnConfig.

type ConfigFuncFn

type ConfigFuncFn func(s *LuaSandbox, l *lua.LTable) (fn SandboxFunc, err error)

ConfigFuncFn wraps a func so it implements ConfigFunc.

func (ConfigFuncFn) LuaConfig

func (c ConfigFuncFn) LuaConfig(s *LuaSandbox, l *lua.LTable) (fn SandboxFunc, err error)

type ConfigFuncs

type ConfigFuncs map[string]ConfigFunc

type ConfigModule

type ConfigModule interface {
	LuaConfig(s *LuaSandbox, l *lua.LTable) (funcs SandboxFuncs, err error)
}

ConfigModule can add a SandboxFuncs as a lua table that has acces to some share state configured during the call to OnConfig.

type ConfigModuleFunc

type ConfigModuleFunc func(s *Sandbox, l *lua.LTable) (funcs SandboxFuncs, err error)

ConfigModuleFunc wraps a func so it implements ConfigModule.

func (ConfigModuleFunc) LuaConfig

func (c ConfigModuleFunc) LuaConfig(s *Sandbox, l *lua.LTable) (funcs SandboxFuncs, err error)

type ConfigModules

type ConfigModules map[string]ConfigModule

type Context

type Context struct {
	Sandbox *LuaSandbox

	ConfigModules ConfigModules
	ConfigFuncs   ConfigFuncs
	Funcs         Funcs
	Modules       Modules
	Input         Input
	Options       lua.Options
	// contains filtered or unexported fields
}

func NewContext

func NewContext(inp Input, s *LuaSandbox) (c Context)

func (Context) AddConfigFuncs

func (c Context) AddConfigFuncs(funcs ConfigFuncs) (err error)

func (Context) AddConfigModules

func (c Context) AddConfigModules(modules ConfigModules) (err error)

func (Context) AddSandboxFn

func (c Context) AddSandboxFn(name string, fn SandboxFunc) (err error)

func (Context) AddSandboxFns

func (c Context) AddSandboxFns(funcs SandboxFuncs) (err error)

func (Context) OnConfig

func (ctx Context) OnConfig(s *LuaSandbox, L *lua.LState) (n int, err error)

type DecodeRequest

type DecodeRequest struct {
	Reader Reader
	Into   any
}

func (DecodeRequest) RequestKind

func (DecodeRequest) RequestKind() payload.RequestKind

type Domain

type Domain int

ENUM(

OnMissingKey
Policy
PolicyViolation
Fs
FileIO
Closer
LuaTypeCheck
LuaIterate
ChooseCommand
TemplateParser
TemplateRender
Executor

)

const (
	// DomainOnMissingKey is a Domain of type OnMissingKey.
	DomainOnMissingKey Domain = iota
	// DomainPolicy is a Domain of type Policy.
	DomainPolicy
	// DomainPolicyViolation is a Domain of type PolicyViolation.
	DomainPolicyViolation
	// DomainFs is a Domain of type Fs.
	DomainFs
	// DomainFileIO is a Domain of type FileIO.
	DomainFileIO
	// DomainCloser is a Domain of type Closer.
	DomainCloser
	// DomainLuaTypeCheck is a Domain of type LuaTypeCheck.
	DomainLuaTypeCheck
	// DomainLuaIterate is a Domain of type LuaIterate.
	DomainLuaIterate
	// DomainChooseCommand is a Domain of type ChooseCommand.
	DomainChooseCommand
	// DomainTemplateParser is a Domain of type TemplateParser.
	DomainTemplateParser
	// DomainTemplateRender is a Domain of type TemplateRender.
	DomainTemplateRender
	// DomainExecutor is a Domain of type Executor.
	DomainExecutor
)

func ParseDomain

func ParseDomain(name string) (Domain, error)

ParseDomain attempts to convert a string to a Domain.

func (Domain) MarshalText

func (x Domain) MarshalText() ([]byte, error)

MarshalText implements the text marshaller method.

func (Domain) String

func (x Domain) String() string

String implements the Stringer interface.

func (*Domain) UnmarshalText

func (x *Domain) UnmarshalText(text []byte) error

UnmarshalText implements the text unmarshaller method.

type DomainMapMethods

type DomainMapMethods map[Domain]*mapping.Methods

type Domains

type Domains = set.Set[Domain]

type DropCloser

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

func NewDropCloser

func NewDropCloser(creator drop.TryCreator) DropCloser

func (DropCloser) Close

func (dc DropCloser) Close(key string, cl io.Closer) error

type EncodeRequest

type EncodeRequest struct {
	Writer Writer
	From   any
}

func (EncodeRequest) RequestKind

func (EncodeRequest) RequestKind() payload.RequestKind

type ErrNoStdMode

type ErrNoStdMode struct {
	Name        string
	MatchedMode stream.Mode
	IOMode      stream.IOMode
}

func (*ErrNoStdMode) Error

func (err *ErrNoStdMode) Error() string

type Executor

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

func NewExecutor

func NewExecutor(l zerolog.Logger) (ex Executor)

func (Executor) Execute

func (ex Executor) Execute(ctx Context) (err error)

type FS

type FS struct {
	ResolveReaderImpl func(*FS, Reader) (io.ReadCloser, error)
	ResolveWriterImpl func(*FS, Writer) (io.WriteCloser, error)
	// contains filtered or unexported fields
}

func AferoFS

func AferoFS(fs afero.Fs) FS

func (FS) DepID

func (FS) DepID() deps.ID

func (*FS) OpenPath

func (fs *FS) OpenPath(pth string) (io.ReadCloser, error)

func (*FS) ResolveReader

func (fs *FS) ResolveReader(r Reader) (io.ReadCloser, error)

func (*FS) ResolveWriter

func (fs *FS) ResolveWriter(w Writer) (io.WriteCloser, error)

type FileOp

type FileOp int

ENUM(

Open
Create

)

const (
	// FileOpOpen is a FileOp of type Open.
	FileOpOpen FileOp = iota
	// FileOpCreate is a FileOp of type Create.
	FileOpCreate
)

func ParseFileOp

func ParseFileOp(name string) (FileOp, error)

ParseFileOp attempts to convert a string to a FileOp.

func (FileOp) Do

func (op FileOp) Do(fsys afero.Fs, path string) (afero.File, error)

func (FileOp) MarshalText

func (x FileOp) MarshalText() ([]byte, error)

MarshalText implements the text marshaller method.

func (FileOp) String

func (x FileOp) String() string

String implements the Stringer interface.

func (*FileOp) UnmarshalText

func (x *FileOp) UnmarshalText(text []byte) error

UnmarshalText implements the text unmarshaller method.

type FsRename

type FsRename struct {
	Renamer Renamer
	Fs      afero.Fs
	Log     zerolog.Logger
}

func (FsRename) Rename

func (fr FsRename) Rename(srcs string, rn build.ToRename) error

type Funcs

type Funcs = map[string]lua.LGFunction

type GeneratorConfig

type GeneratorConfig struct {
	generate.AnyToString
	generate.AnyToFormatter
	Separator string
	TypeOrder []any
}

func (GeneratorConfig) StringGenerator

func (gc GeneratorConfig) StringGenerator(log zerolog.Logger) (StringGenerator, error)

type GlobManager

type GlobManager struct {
	Csv      csv.Manager
	Parser   path.PatternsParser
	Fsys     fs.FS
	Named    data.NamedMethods
	Gatherer path.GatherPaths
	Log      zerolog.Logger
}

type GlobRequest

type GlobRequest struct {
	FilePaths path.PatternMap
	Out       io.Writer
}

func (GlobRequest) Glob

func (gr GlobRequest) Glob(g GlobManager) (err error)

type HandleFn

type HandleFn func(*FS, payload.HandlerFunc, Request) error

func HandleWithLog

func HandleWithLog(handle HandleFn, log *slog.Logger) HandleFn

type IO

type IO struct {
	Streams stream.Manager
	Fs      afero.Afero
	// Fsys is kept around for legacy
	// Deprecated: use the Fs field.
	Fsys fs.FS
}

func NewIO

func NewIO(afs afero.Fs, fsys fs.FS, man stream.Manager) IO

type IOKind

type IOKind int
const (
	IOKindPath IOKind = iota
	IOKindReader
	IOKindWriter
)

type Input

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

type InputMode

type InputMode int

ENUM(

String
Path

)

const (
	// InputModeString is a InputMode of type String.
	InputModeString InputMode = iota
	// InputModePath is a InputMode of type Path.
	InputModePath
)

func ParseInputMode

func ParseInputMode(name string) (InputMode, error)

ParseInputMode attempts to convert a string to a InputMode.

func (InputMode) MarshalText

func (x InputMode) MarshalText() ([]byte, error)

MarshalText implements the text marshaller method.

func (InputMode) New

func (in InputMode) New(pathOrData string) (inp Input)

func (InputMode) String

func (x InputMode) String() string

String implements the Stringer interface.

func (*InputMode) UnmarshalText

func (x *InputMode) UnmarshalText(text []byte) error

UnmarshalText implements the text unmarshaller method.

type IoOp

type IoOp int

ENUM(

Read
Write

)

const (
	// IoOpRead is a IoOp of type Read.
	IoOpRead IoOp = iota
	// IoOpWrite is a IoOp of type Write.
	IoOpWrite
)

func ParseIoOp

func ParseIoOp(name string) (IoOp, error)

ParseIoOp attempts to convert a string to a IoOp.

func (IoOp) Do

func (op IoOp) Do(f afero.File, p []byte) (int, error)

func (IoOp) DoAt

func (op IoOp) DoAt(f afero.File, p []byte, at int64) (int, error)

func (IoOp) MarshalText

func (x IoOp) MarshalText() ([]byte, error)

MarshalText implements the text marshaller method.

func (IoOp) String

func (x IoOp) String() string

String implements the Stringer interface.

func (*IoOp) UnmarshalText

func (x *IoOp) UnmarshalText(text []byte) error

UnmarshalText implements the text unmarshaller method.

type LState

type LState = lua.LState

type LogCloser

type LogCloser struct {
	Log zerolog.Logger
	// contains filtered or unexported fields
}

func (LogCloser) Close

func (lc LogCloser) Close(key string, cl io.Closer) error

type LogConfig

type LogConfig struct {
	Maker   log.NamedLoggerMaker
	Domains Domains
	Log     zerolog.Logger
}

func DefaultLogConfig

func DefaultLogConfig(log zerolog.Logger) LogConfig

func (LogConfig) DeriveLogger

func (lc LogConfig) DeriveLogger(parts ...string) (zerolog.Logger, error)

DeriveLogger creates a new logger using its internal logger and the @parts argument

func (LogConfig) HasDomain

func (lc LogConfig) HasDomain(dom Domain) bool

type LogExecutor

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

func WrapExecutor

func WrapExecutor(ex command.Executor, l *slog.Logger) LogExecutor

func (LogExecutor) Execute

func (l LogExecutor) Execute(ctx context.Context, s command.Setup, opt command.Options) error

type LogFS

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

func (LogFS) Chmod

func (lfs LogFS) Chmod(name string, mode os.FileMode) error

func (LogFS) Chown

func (lfs LogFS) Chown(name string, uid, gid int) error

func (LogFS) Chtimes

func (lfs LogFS) Chtimes(name string, atime, mtime time.Time) error

func (LogFS) Create

func (lfs LogFS) Create(path string) (afero.File, error)

func (LogFS) Mkdir

func (lfs LogFS) Mkdir(path string, perm fs.FileMode) error

func (LogFS) MkdirAll

func (lfs LogFS) MkdirAll(path string, perm fs.FileMode) error

func (LogFS) Name

func (lfs LogFS) Name() (s string)

func (LogFS) Open

func (lfs LogFS) Open(path string) (afero.File, error)

func (LogFS) OpenFile

func (lfs LogFS) OpenFile(path string, flag int, perm fs.FileMode) (afero.File, error)

func (LogFS) Remove

func (lfs LogFS) Remove(path string) error

func (LogFS) RemoveAll

func (lfs LogFS) RemoveAll(path string) error

func (LogFS) Rename

func (lfs LogFS) Rename(oldname, newname string) error

func (LogFS) Stat

func (lfs LogFS) Stat(name string) (os.FileInfo, error)

type LogFileOpsFs

type LogFileOpsFs struct {
	afero.Fs
	ComponentName []string
	// contains filtered or unexported fields
}

func (LogFileOpsFs) Create

func (lfo LogFileOpsFs) Create(path string) (afero.File, error)

func (LogFileOpsFs) Open

func (lfo LogFileOpsFs) Open(path string) (afero.File, error)

type LogIterator

type LogIterator struct {
	Log zerolog.Logger
}

func (LogIterator) ForEach

func (li LogIterator) ForEach(tbl *lua.LTable, fn glua.ForEachFn) error

type LogNamedGetter

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

func NewLogNamedParser

func NewLogNamedParser(log zerolog.Logger, names stream.NameToStd) (LogNamedGetter, error)

func (LogNamedGetter) NamedReadWriter

func (ln LogNamedGetter) NamedReadWriter(name string, m stream.Manager) (io.ReadWriter, error)

func (LogNamedGetter) NamedReader

func (ln LogNamedGetter) NamedReader(name string, m stream.Manager) (io.Reader, error)

func (LogNamedGetter) NamedWriter

func (ln LogNamedGetter) NamedWriter(name string, m stream.Manager) (io.Writer, error)

type LogOnMissingKey

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

func (LogOnMissingKey) HandleMissingAnyKey

func (lo LogOnMissingKey) HandleMissingAnyKey(key any) error

func (LogOnMissingKey) HandleMissingKey

func (lo LogOnMissingKey) HandleMissingKey(keys []string, key string) error

type LogPolicy

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

func (LogPolicy) AllowPolicy

func (lp LogPolicy) AllowPolicy(pol mapping.PolicyKind)

func (LogPolicy) PolicyAllowed

func (lp LogPolicy) PolicyAllowed(pol mapping.PolicyKind) bool

type LogPolicyViolation

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

func (LogPolicyViolation) HandlePolicyViolation

func (lp LogPolicyViolation) HandlePolicyViolation(pol mapping.PolicyKind) error

type LogRenamer

type LogRenamer struct {
	Log zerolog.Logger
}

func (LogRenamer) RenameIn

func (lr LogRenamer) RenameIn(r io.Reader, w io.Writer, rn build.ToRename) error

type LogTemplate

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

func (LogTemplate) Render

func (lt LogTemplate) Render(ctx context.Context, w io.Writer, vals template.Values) error

type LogTypeOrder

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

func (LogTypeOrder) SortAnySlice

func (l LogTypeOrder) SortAnySlice(vals []any) error

type LogValChecker

type LogValChecker struct {
	OnMismatch glua.OnTypeMismatch
	Log        zerolog.Logger
}

func (LogValChecker) ValMustBeType

func (lv LogValChecker) ValMustBeType(val lua.LValue, ltype lua.LValueType) error

type LuaMethods

type LuaMethods struct {
	Checker  glua.ValChecker
	Iterator glua.Iterator
	Mapper   *gluamapper.Mapper
}

func (LuaMethods) CheckType

func (lm LuaMethods) CheckType(val lua.LValue, ltype lua.LValueType) error

func (LuaMethods) Map

func (lm LuaMethods) Map(tbl *lua.LTable, param any) error

type LuaSandbox

type LuaSandbox struct {
	LuaMethods  LuaMethods
	WrapperFunc WrapperFunc
	Sandbox     *Sandbox
	Log         zerolog.Logger
	Builder     Builder
}

func (*LuaSandbox) AppendStrings

func (s *LuaSandbox) AppendStrings(tbl *lua.LTable, strs []string) (err error)

func (*LuaSandbox) ArgToString

func (s *LuaSandbox) ArgToString(n int, L *lua.LState) (str string)

func (*LuaSandbox) CheckArgType

func (s *LuaSandbox) CheckArgType(n int, L *lua.LState, typ lua.LValueType)

func (*LuaSandbox) CheckType

func (s *LuaSandbox) CheckType(lval lua.LValue, typ lua.LValueType) error

func (*LuaSandbox) ForEach

func (s *LuaSandbox) ForEach(tbl *lua.LTable, fn glua.ForEachFn) error

func (*LuaSandbox) Get

func (s *LuaSandbox) Get(n int, L *lua.LState) (lval lua.LValue)

func (*LuaSandbox) LogArgPos

func (s *LuaSandbox) LogArgPos(n int, msg string)

func (*LuaSandbox) ParseTable

func (s *LuaSandbox) ParseTable(tbl *lua.LTable, param any) (err error)

func (*LuaSandbox) ParseTableArg

func (s *LuaSandbox) ParseTableArg(n int, L *lua.LState, param any) (err error)

func (*LuaSandbox) StringsToTable

func (s *LuaSandbox) StringsToTable(L *lua.LState, strs []string) (tbl *lua.LTable, err error)

func (*LuaSandbox) ToNonEmptyString

func (s *LuaSandbox) ToNonEmptyString(n int, L *lua.LState) (str string, err error)

func (*LuaSandbox) ToTable

func (s *LuaSandbox) ToTable(n int, L *lua.LState) (table *lua.LTable)

func (*LuaSandbox) ToTableCheck

func (s *LuaSandbox) ToTableCheck(n int, L *lua.LState) (t *lua.LTable, err error)

type Main

type Main struct {
	HandleFn HandleFn
	// contains filtered or unexported fields
}

func NewCoder

func NewCoder(fs *FS, main payload.HandlerFunc) Main

func (*Main) Decode

func (m *Main) Decode(r Reader, into any) error

func (*Main) DecodeWith

func (m *Main) DecodeWith(id payload.CoderID, r Reader, into any) error

func (*Main) Encode

func (m *Main) Encode(w Writer, from any) error

func (*Main) EncodeWith

func (m *Main) EncodeWith(id payload.CoderID, w Writer, from any) error

func (Main) GetCoder

func (m Main) GetCoder(id payload.CoderID) (payload.HandlerFunc, error)

func (*Main) Handle

func (m *Main) Handle(req Request) error

func (*Main) HandleWith

func (m *Main) HandleWith(id payload.CoderID, req Request) error

func (*Main) SetHandlers

func (m *Main) SetHandlers(mains mapping.Of[payload.CoderID, payload.HandlerFunc])

func (*Main) SetMainMap

func (m *Main) SetMainMap(mains map[payload.CoderID]payload.HandlerFunc)

type MapOther

type MapOther map[string]any

type Methods

type Methods struct {
	file.GroupResolver
}

type MissingCoderID

type MissingCoderID payload.CoderID

func (MissingCoderID) Error

func (m MissingCoderID) Error() string

type Modules

type Modules = map[string]lua.LGFunction

type MultiIntoWriter

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

func (MultiIntoWriter) WriteInto

func (m MultiIntoWriter) WriteInto(w io.Writer, val any) error

type OpenedReader

type OpenedReader struct {
	Reader   io.ReadCloser
	Buffered bool
}

func UnbufferedReader

func UnbufferedReader(r io.ReadCloser) OpenedReader

func (OpenedReader) ReaderKind

func (OpenedReader) ReaderKind() IOKind

type OpenedWriter

type OpenedWriter struct {
	Writer   io.Writer
	Buffered bool
}

func UnbufferedWriter

func UnbufferedWriter(w io.Writer) OpenedWriter

func (OpenedWriter) Kind

func (OpenedWriter) Kind() IOKind

type PanicFunc

type PanicFunc = func(*lua.LState)

type Parser

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

func (Parser) ParseTemplate

func (p Parser) ParseTemplate(name string, from io.Reader) (template.Template, error)

type Path

type Path string

func (Path) ReaderKind

func (Path) ReaderKind() IOKind

func (Path) WriterKind

func (Path) WriterKind() IOKind

type Reader

type Reader interface {
	ReaderKind() IOKind
}

type Renamer

type Renamer interface {
	RenameIn(r io.Reader, w io.Writer, rn build.ToRename) error
}

type Request

type Request interface {
	RequestKind() payload.RequestKind
}

type Sandbox

type Sandbox struct {
	Io            IO
	Csv           csv.Manager
	ErrGroupMaker errors.GroupMaker
	Reporter      errors.Reporter
	Deps          deps.Deps
	MapMethods    DomainMapMethods
	Glob          GlobManager
	Data          data.Methods
	Templates     TemplateManager
	Log           zerolog.Logger
	Coder         payload.MultiCoder
	Builder       Builder
}

func NewSandbox

func NewSandbox(l zerolog.Logger, io IO, c payload.MultiCoder) (s *Sandbox)

func (*Sandbox) DeriveLogger

func (s *Sandbox) DeriveLogger(parts ...string) (zerolog.Logger, error)

func (*Sandbox) ErrorGroup

func (s *Sandbox) ErrorGroup() (errors.Group, error)

func (*Sandbox) MustDeriveLogger

func (s *Sandbox) MustDeriveLogger(parts ...string) zerolog.Logger

type SandboxFunc

type SandboxFunc func(s *LuaSandbox, L *lua.LState) (n int, err error)

type SandboxFuncs

type SandboxFuncs map[string]SandboxFunc

func GlobModule

func GlobModule(s *Sandbox, _ *lua.LTable) (funcs SandboxFuncs, err error)

type StringGenerator

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

func (StringGenerator) GenerateString

func (sg StringGenerator) GenerateString(vals []any) (string, error)

type StringKeyedStorage

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

func (StringKeyedStorage) GetStrings

func (s StringKeyedStorage) GetStrings(keys ...string) ([]string, error)

type TemplateManager

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

func (TemplateManager) GetParser

func (tm TemplateManager) GetParser(d Domain) (template.Parser, error)

func (TemplateManager) ParseInlineString

func (tm TemplateManager) ParseInlineString(d Domain, str string) (template.Template, error)

func (TemplateManager) ParseString

func (tm TemplateManager) ParseString(d Domain, name, str string) (template.Template, error)

func (TemplateManager) ParseTemplate

func (tm TemplateManager) ParseTemplate(d Domain, name string, contents io.Reader) (template.Template, error)

type TemplateParsers

type TemplateParsers map[Domain]template.Parser

type TomlDecoder

type TomlDecoder struct{}

func (TomlDecoder) Decode

func (TomlDecoder) Decode(r io.Reader, v interface{}) (err error)

func (TomlDecoder) DecodePart

func (t TomlDecoder) DecodePart(r io.Reader, name string, v interface{}) (err error)

type TomlEncoder

type TomlEncoder struct{}

func (TomlEncoder) Encode

func (TomlEncoder) Encode(w io.Writer, v interface{}) (err error)

type WrapperFunc

type WrapperFunc func(s *LuaSandbox, name string, fun SandboxFunc) (wr lua.LGFunction, err error)

type Writer

type Writer interface {
	WriterKind() IOKind
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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