strings

package
v0.0.0-...-2616f5a Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2024 License: BSD-3-Clause Imports: 7 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compile

func Compile(args CompileArgs, singles ...any) string

Compile all values into a single comma-separated string. Any string values are quoted with quote.

func CompileStrings

func CompileStrings(args CompileArgs, singles ...string) string

CompileStrings compiles all values into a single comma-separated string. Any string values are quoted with quote.

func GetWriter

func GetWriter(eb errors.Block) io.StringWriter

GetWriter removes and answers a new string writer from the global pool.

func MqttMatch

func MqttMatch(pattern, topic string) bool

MqttMatch answers true if the topic matches the pattern according to MQTT rules: * Pattern is a slash-separated hierarchy. Wildcard "+" matches a single level in the hierarchy. Wildcard "#" matches all further levels in the hierarchy.

Examples: Pattern a/b matches topic a/b a/# matches a/b, a/c, a/b/c etc a/+/c matches a/b/c, a/c/c, but not a/b, not a/b/c/c, etc.

func PutWriter

func PutWriter(w io.StringWriter)

PutWriter places a writer into the global pool.

func String

func String(w io.StringWriter) string

func StringErr

func StringErr(w io.StringWriter) error

func StringLen

func StringLen(w io.StringWriter) int

Types

type CompileArgs

type CompileArgs struct {
	Quote     string
	Separator string
	Eb        errors.Block
}

type Pool

type Pool interface {
	// Acquire takes a writer out of the pool.
	Get(errors.Block) io.StringWriter

	// Release puts a writer in the pool.
	Put(io.StringWriter)

	// Close puts all writers back in the master pool.
	Close() error
}

--------------------------------------------------------- Pool interface describes an object that gives and receives ownership of string writers.

Jump to

Keyboard shortcuts

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