tzngio

package
v0.33.0 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2021 License: BSD-3-Clause Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OutFormatUnescaped = OutFmt(iota)
	OutFormatZNG
	OutFormatZeek
	OutFormatZeekAscii
)

Variables

View Source
var ErrEmptyTypeList = errors.New("empty type list in set or union")

Functions

func ColumnString

func ColumnString(prefix string, columns []zed.Column, suffix string) string

func FormatName

func FormatName(name string) string

func FormatValue

func FormatValue(v zed.Value, fmt OutFmt) string

func ParseBstring

func ParseBstring(in []byte) (zcode.Bytes, error)

func ParseString

func ParseString(in []byte) (zcode.Bytes, error)

func ShouldEscape

func ShouldEscape(r rune, fmt OutFmt, pos int, inContainer bool) bool

ShouldEscape determines if the given code point at the given position in a value should be escaped for the given output format. This function does not account for unprintable characters, its main purpose is to centralize the logic about which characters are syntatically significant in each output format and hence must be escaped. The inContainer parameter specifies whether this values is inside a set or vector (which is needed to correctly implement zeek log escaping rules).

func StringOf

func StringOf(zv zed.Value, out OutFmt, b bool) string

func StringOfArray

func StringOfArray(t *zed.TypeArray, zv zcode.Bytes, fmt OutFmt, _ bool) string

func StringOfBstring

func StringOfBstring(data zcode.Bytes, fmt OutFmt, inContainer bool) string

Values of type bstring may contain a mix of valid UTF-8 and arbitrary binary data. These are represented in output using the same formatting with "\x.." escapes as Zeek. In general, valid UTF-8 code points are passed through unmodified, though for the ZEEK_ASCII output format, all non-ascii bytes are escaped for compatibility with older versions of Zeek.

func StringOfDuration

func StringOfDuration(t *zed.TypeOfDuration, zv zcode.Bytes, _ OutFmt, _ bool) string

func StringOfMap

func StringOfMap(t *zed.TypeMap, zv zcode.Bytes, fmt OutFmt, _ bool) string

func StringOfNet

func StringOfNet(t *zed.TypeOfNet, zv zcode.Bytes, _ OutFmt, _ bool) string

func StringOfRecord

func StringOfRecord(t *zed.TypeRecord, zv zcode.Bytes, fmt OutFmt, _ bool) string

func StringOfSet

func StringOfSet(t *zed.TypeSet, zv zcode.Bytes, fmt OutFmt, _ bool) string

func StringOfString

func StringOfString(t *zed.TypeOfString, zv zcode.Bytes, fmt OutFmt, inContainer bool) string

func StringOfTime

func StringOfTime(t *zed.TypeOfTime, zv zcode.Bytes, _ OutFmt, _ bool) string

func StringOfUnion

func StringOfUnion(t *zed.TypeUnion, zv zcode.Bytes, ofmt OutFmt, _ bool) string

func StringRecord

func StringRecord(t *zed.TypeRecord) string

func StringTypeEnum

func StringTypeEnum(t *zed.TypeEnum) string

func StringTypeUnion

func StringTypeUnion(t *zed.TypeUnion) string

func TypeRecordString

func TypeRecordString(columns []zed.Column) string

func TypeString

func TypeString(typ zed.Type) string

func UnescapeString

func UnescapeString(data []byte) []byte

UnescapeString replaces all the escaped characters defined in the for the zng spec for the string type with their unescaped equivalents.

Types

type OutFmt

type OutFmt int

The fmt paramter passed to Type.StringOf() must be one of the following values, these are used to inform the formatter how containers should be encoded and what sort of escaping should be applied to string types.

type TypeParser

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

func NewTypeParser

func NewTypeParser(zctx *zed.Context) *TypeParser

func (*TypeParser) Parse

func (t *TypeParser) Parse(in string) (zed.Type, error)

Jump to

Keyboard shortcuts

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