fields

package
v0.0.0-...-a5a32a1 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TagName          = "structfieldorder"
	OptionalTagValue = "optional"
)

Variables

This section is empty.

Functions

func HasOptionalTag

func HasOptionalTag(tags string) bool

Types

type StructField

type StructField struct {
	Name     string
	Exported bool
	Optional bool
}

type StructFields

type StructFields []*StructField

func NewStructFields

func NewStructFields(strct *types.Struct) StructFields

NewStructFields creates a new StructFields from a given struct type. StructFields items are listed in order they appear in the struct.

func (StructFields) OrderedFields

func (sf StructFields) OrderedFields(lit *ast.CompositeLit, onlyExported bool) (bool, StructFields)

OrderedFields returns true if the fields are the correct order otherwise false.

func (StructFields) String

func (sf StructFields) String() (res string)

String returns a comma-separated list of field names.

Jump to

Keyboard shortcuts

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