Movatterモバイル変換


[0]ホーム

URL:


label

package
v0.37.0Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2025 License:BSD-3-ClauseImports:5Imported by:0

Details

Repository

cs.opensource.google/go/x/tools

Links

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

typeKey

type Key interface {// Name returns the key name.Name()string// Description returns a string that can be used to describe the value.Description()string// Format is used in formatting to append the value of the label to the// supplied buffer.// The formatter may use the supplied buf as a scratch area to avoid// allocations.Format(wio.Writer, buf []byte, lLabel)}

Key is used as the identity of a Label.Keys are intended to be compared by pointer only, the name should be uniquefor communicating with external systems, but it is not required or enforced.

typeLabel

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

Label holds a key and value pair.It is normally used when passing around lists of labels.

funcOf64

func Of64(kKey, vuint64)Label

Of64 creates a new label from a key and a uint64. This is oftenused for non uint64 values that can be packed into a uint64.This method is for implementing new key types, label creation shouldnormally be done with the Of method of the key.

funcOfString

func OfString(kKey, vstring)Label

OfString creates a new label from a key and a string.This method is for implementing new key types, label creation shouldnormally be done with the Of method of the key.

funcOfValue

func OfValue(kKey, valueany)Label

OfValue creates a new label from the key and value.This method is for implementing new key types, label creation shouldnormally be done with the Of method of the key.

func (Label)Format

func (tLabel) Format(ffmt.State, rrune)

Format is used for debug printing of labels.

func (Label)Key

func (tLabel) Key()Key

Key returns the key of this Label.

func (Label)Unpack64

func (tLabel) Unpack64()uint64

Unpack64 assumes the label was built using LabelOf64 and returns the value thatwas passed to that constructor.This method is for implementing new key types, for type safety normalaccess should be done with the From method of the key.

func (Label)UnpackString

func (tLabel) UnpackString()string

UnpackString assumes the label was built using LabelOfString and returns thevalue that was passed to that constructor.This method is for implementing new key types, for type safety normalaccess should be done with the From method of the key.

func (Label)UnpackValue

func (tLabel) UnpackValue()any

UnpackValue assumes the label was built using LabelOfValue and returns the valuethat was passed to that constructor.This method is for implementing new key types, for type safety normalaccess should be done with the From method of the key.

func (Label)Valid

func (tLabel) Valid()bool

Valid returns true if the Label is a valid one (it has a key).

typeList

type List interface {// Valid returns true if the index is within range for the list.// It does not imply the label at that index will itself be valid.Valid(indexint)bool// Label returns the label at the given index.Label(indexint)Label}

List is the interface to something that provides an iterablelist of labels.Iteration should start from 0 and continue until Valid returns false.

funcFilter

func Filter(lList, keys ...Key)List

funcNewList

func NewList(labels ...Label)List

typeMap

type Map interface {// Find returns the label that matches the supplied key.Find(keyKey)Label}

Map is the interface to a collection of Labels indexed by key.

funcMergeMaps

func MergeMaps(srcs ...Map)Map

funcNewMap

func NewMap(labels ...Label)Map

Source Files

View all Source files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp