tag

package
v0.0.14 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2024 License: CC0-1.0 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 E

type E = error

type N added in v0.0.14

type N = int

type S

type S = string

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 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) Key

func (t *T) Key() B

Key returns the first element of the tags.

func (*T) Len

func (t *T) Len() int

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) String

func (t *T) String() string

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