jid

package
v0.410.1 Latest Latest
Warning

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

Go to latest
Published: May 28, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package jid provides JaWS element identifiers and helpers for writing them into HTML.

Index

Constants

View Source
const Invalid = Jid(-1)

Invalid is returned by parsers when text does not contain a valid Jid.

View Source
const Prefix = "Jid."

Prefix prefixes HTML IDs based on Jid values.

Variables

This section is empty.

Functions

This section is empty.

Types

type Jid

type Jid int64

Jid is the basis for the HTML id attribute for a UI element within an active request.

It is request-scoped, meaning Jid(1) in one request is not the same element as Jid(1) in another request.

func ParseInt

func ParseInt(s string) Jid

ParseInt parses a Jid integer and returns it as a Jid.

Returns Invalid if s is not a valid Jid integer or an error occurs.

func ParseString

func ParseString(s string) Jid

ParseString parses an unquoted Jid string, such as `Jid.2`, and returns the corresponding value.

Returns Invalid if s is not a valid Jid string.

func (Jid) Append

func (j Jid) Append(dst []byte) []byte

Append appends the unquoted string format of the Jid.

func (Jid) AppendInt

func (j Jid) AppendInt(dst []byte) []byte

AppendInt appends just the text format of the Jid's numerical value.

func (Jid) AppendQuote

func (j Jid) AppendQuote(dst []byte) []byte

AppendQuote appends the string format of the Jid surrounded by double quotes.

func (Jid) AppendStartTagAttr

func (j Jid) AppendStartTagAttr(dst []byte, startTag string) []byte

AppendStartTagAttr appends `<startTag` followed by the quoted Jid as an HTML id attribute when jid is non-zero.

func (Jid) IsValid

func (j Jid) IsValid() bool

IsValid reports whether jid can identify an element or the request as a whole.

func (Jid) String

func (j Jid) String() string

String returns the unquoted string representation of the Jid.

Jump to

Keyboard shortcuts

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