tag

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2024 License: CC0-1.0 Imports: 4 Imported by: 1

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 B | S] B

type T

type T struct {
	Field []BS[B]
}

T is a list of strings with a literal ordering.

Not a set, there can be repeating elements.

func FromBytesSlice added in v0.1.7

func FromBytesSlice(fields ...B) (t *T)

func New

func New[V S | B](fields ...V) (t *T)

func NewWithCap

func NewWithCap(c int) *T

func (*T) Append

func (t *T) Append(b B)

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 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) FilterKey added in v0.1.7

func (t *T) FilterKey() B

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

func (*T) Key

func (t *T) Key() B

Key returns the first element of the tags.

func (*T) Len

func (t *T) Len() int

func (*T) Less added in v0.1.6

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

func (*T) MarshalJSON

func (t *T) MarshalJSON(dst B) (b B, err error)

MarshalJSON appends the JSON form to the passed bytes.

func (*T) Relay

func (t *T) Relay() (s B)

Relay returns the third element of the tag.

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 added in v0.1.6

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

func (*T) ToByteSlice

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

func (*T) ToStringSlice

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

func (*T) UnmarshalJSON

func (t *T) UnmarshalJSON(b B) (r B, err error)

UnmarshalJSON decodes the provided JSON tag list (array of strings), and returns any remainder after the close bracket has been encountered.

func (*T) Value

func (t *T) Value() B

Value returns the second element of the tag.

Jump to

Keyboard shortcuts

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