structtag

package
v2.9.1 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

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

Option represents a single option from a struct field tag.

func (Option) Key

func (p Option) Key() string

Key returns the parsed key of the option, if available.

func (Option) String

func (p Option) String() string

String returns the original string represent of the option.

func (Option) Value

func (p Option) Value() string

Value returns the parsed value of the option, if available.

type Options

type Options []Option

Options represents a set of parsed options of a struct field tag.

func ParseOptions

func ParseOptions(tag string, optionSep, kvSep string) Options

ParseOptions parses tag into Options using optionSep and kvSep.

If optionSep is not empty, it splits tag into options using optionSep as separator, else the whole tag is considered as a single option. If kvSep is not empty, it splits each option into key value pair using kvSep as separator, else the option's key, value will be empty.

func (Options) Get

func (p Options) Get(option string) (Option, bool)

Jump to

Keyboard shortcuts

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