anon

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Replace

func Replace(s string) sllm.ParamWriter

Types

type ByName

type ByName struct {
	Clear sllm.ParamWriter
	Anon  map[string]sllm.ParamWriter
}
Example
anon := ByName{
	Clear: func(wr io.Writer, idx int, name string) (int, error) {
		return fmt.Printf("<param #%d %s>", idx, name)
	},
	Anon: map[string]sllm.ParamWriter{
		"bar": Replace("XXXXX"),
	},
}
sllm.Expand(os.Stdout, "msg is `foo`, `bar`, `baz`", anon.Param)
Output:

msg is `foo:<param #0 foo>`, `bar:XXXXX`, `baz:<param #2 baz>`

func (ByName) Param

func (a ByName) Param(wr io.Writer, idx int, name string) (int, error)

Jump to

Keyboard shortcuts

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