model

package
v0.57.0 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Field

type Field ast.Field

Field is a representation of a struct field.

func (*Field) Description

func (f *Field) Description() interface{}

Description returns the description of the field inferred from the comment string preceding it.

func (*Field) HasInternalType

func (f *Field) HasInternalType() bool

HasInternalType returns true when the data type of the field is defined in the prometheus-operator project.

func (*Field) IsInlined

func (f *Field) IsInlined() bool

IsInlined returns true when the field has the `inline` annotation.

func (*Field) IsRequired

func (f *Field) IsRequired() interface{}

IsRequired returns true if the field is mandatory.

func (*Field) Name

func (f *Field) Name() string

Name returns the name of the field as it should appear in JSON format "-" indicates that this field is not part of the JSON representation.

func (f *Field) TypeLink(typeSet TypeSet) string

TypeLink returns a link to the data type of the field in the API documentation.

func (*Field) TypeName

func (f *Field) TypeName() string

TypeName returns the name of the field's data type.

type StructType

type StructType struct {
	Name   string
	Fields []Field
	// contains filtered or unexported fields
}

StructType is a struct data type.

func (*StructType) Description

func (s *StructType) Description() string

Description returns the description of the struct inferred from the comment preceding it.

func (StructType) IsOnlyEmbedded

func (s StructType) IsOnlyEmbedded() bool

IsOnlyEmbedded returns true if the struct is only used as an embedded field in other structs.

type TypeSet

type TypeSet map[string]*StructType

TypeSet is a map from type name to *StructType.

func Load

func Load(path string) (TypeSet, error)

Load parses a go file and returns a TypeSet.

func (TypeSet) Keys

func (ts TypeSet) Keys() []string

Keys returns the keys of the TypeSet.

func (TypeSet) SortedKeys

func (ts TypeSet) SortedKeys() []string

SortedKeys returns a lexicographically sirted slice with the keys of the TypeSet.

Jump to

Keyboard shortcuts

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