structtag

package
v0.0.0-...-5b643b5 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package structtag defines struct tag modification tool.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnpairedKey = errors.New("unpaired key")
	ErrNotFound    = errors.New("not found")
)

Functions

func AddTagOption

func AddTagOption(t reflect.StructTag, tag string, option string) (reflect.StructTag, error)

AddTagOption returns a new StructTag which has option added for tag. It assumes tag options are formatted as `tag:"name,opt,opt"` style. The name is allowed to be quoted by single quotation marks.

func Of

func Of(tags []Tag) reflect.StructTag

Types

type Tag

type Tag struct {
	Key   string
	Value string
}

func (Tag) String

func (t Tag) String() string

type Tags

type Tags []Tag

func ParseStructTag

func ParseStructTag(tag reflect.StructTag) (Tags, error)

func (Tags) Add

func (t Tags) Add(tagName string, option, value string) (Tags, error)

func (Tags) Delete

func (t Tags) Delete(tagName string, option string) (Tags, error)

func (Tags) Get

func (t Tags) Get(tagName string, option string) (escaped, unescaped string, err error)

func (Tags) StructTag

func (t Tags) StructTag() reflect.StructTag

Jump to

Keyboard shortcuts

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