tag

package
v1.7.12 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2025 License: Unlicense Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Key = iota
	Value
	Relay
)

The tag position meanings so they are clear when reading.

View Source
const (
	MarkerReply   = "reply"
	MarkerRoot    = "root"
	MarkerMention = "mention"
)

T marker strings for e (reference) tags.

Variables

This section is empty.

Functions

This section is empty.

Types

type BS

type BS[Z []byte | string] []byte

type T

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

T is a list of strings with a literal ordering.

Not a set, there can be repeating elements.

func FromBytesSlice

func FromBytesSlice(fields ...[]byte) (t *T)

func New

func New[V string | []byte](fields ...V) (t *T)

func NewWithCap

func NewWithCap(c int) *T

func (*T) Append

func (t *T) Append(b ...[]byte) (tt *T)

func (*T) B

func (t *T) B(i int) (b []byte)

func (*T) BS

func (t *T) BS() (bs [][]byte)

func (*T) Cap

func (t *T) Cap() int

func (*T) Clear

func (t *T) Clear()

func (*T) Clone

func (t *T) Clone() (c *T)

Clone makes a new tag.T with the same members.

func (*T) Contains

func (t *T) Contains(s []byte) (b bool)

Contains returns true if the provided element is found in the tag slice.

func (*T) Equal

func (t *T) Equal(ta *T) bool

Equal checks that the provided tag list matches.

func (*T) F

func (t *T) F() (b [][]byte)

func (*T) FilterKey

func (t *T) FilterKey() []byte

FilterKey returns the first element of a filter tag (the key) with the # removed

func (*T) Key

func (t *T) Key() []byte

Key returns the first element of the tags.

func (*T) Len

func (t *T) Len() int

func (*T) Less

func (t *T) Less(i, j int) bool

func (*T) Marshal

func (t *T) Marshal(dst []byte) (b []byte)

func (*T) Relay

func (t *T) Relay() (s []byte)

Relay returns the third element of the tag.

func (*T) S

func (t *T) S(i int) (s string)

func (*T) Slice

func (t *T) Slice(start, end int) *T

func (*T) StartsWith

func (t *T) StartsWith(prefix *T) bool

StartsWith checks a tag has the same initial set of elements.

The last element is treated specially in that it is considered to match if the candidate has the same initial substring as its corresponding element.

func (*T) Swap

func (t *T) Swap(i, j int)

func (*T) ToByteSlice

func (t *T) ToByteSlice() (b [][]byte)

func (*T) ToStringSlice

func (t *T) ToStringSlice() (b []string)

func (*T) Unmarshal

func (t *T) Unmarshal(b []byte) (r []byte, err error)

func (*T) Value

func (t *T) Value() []byte

Value returns the second element of the tag.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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