tag

package
v1.2.21 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2024 License: Unlicense Imports: 5 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 B

type B = []byte

type BS

type BS[Z B | S] B

type Ctx

type Ctx = context.T

type E

type E = error

type N

type N = int

type S

type S = string

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 ...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) (tt *T)

func (*T) B added in v1.0.4

func (t *T) B(i int) (b B)

func (*T) BS added in v1.2.1

func (t *T) BS() (bs []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) (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 added in v1.0.4

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

func (*T) FilterKey

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

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) S added in v1.0.4

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

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 []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