types

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Licensed to Elasticsearch B.V. under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. Elasticsearch B.V. licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Identifier added in v0.0.10

func Identifier(t *Type) string

Identifier generates the non-unique identifier for the type, disregarding it being a e.g. a list or pointer, and will thus be the same for both *Foo and Foo. Use Type's UID for a unique identifier.

Types

type EnumValue added in v0.0.13

type EnumValue struct {
	Name string
	Doc  string
}

EnumValue describes a constant value for enumerations

type Field

type Field struct {
	Name       string
	Embedded   bool // Embedded struct in Go typing
	Inlined    bool // Inlined struct in serialization
	Doc        string
	Default    string
	Validation []string
	Markers    markers.MarkerValues
	Type       *Type
}

Field describes a field in a struct.

type Fields added in v0.0.9

type Fields []*Field

type GroupVersionDetails

type GroupVersionDetails struct {
	schema.GroupVersion
	Doc   string
	Kinds []string
	Types TypeMap
}

GroupVersionDetails encapsulates details about a discovered API group.

func (GroupVersionDetails) GroupVersionString

func (gvd GroupVersionDetails) GroupVersionString() string

func (GroupVersionDetails) SortedKinds added in v0.0.5

func (gvd GroupVersionDetails) SortedKinds() []string

func (GroupVersionDetails) SortedTypes

func (gvd GroupVersionDetails) SortedTypes() []*Type

func (GroupVersionDetails) TypeForKind

func (gvd GroupVersionDetails) TypeForKind(k string) *Type

type Kind

type Kind int

Kind describes the kind of the type (alias, array, etc.)

const (
	AliasKind Kind = iota
	BasicKind
	InterfaceKind
	MapKind
	PointerKind
	SliceKind
	StructKind
	UnknownKind
	UnsupportedKind
)

func (Kind) MarshalJSON

func (k Kind) MarshalJSON() ([]byte, error)

func (*Kind) UnmarshalJSON

func (k *Kind) UnmarshalJSON(b []byte) error

type Type

type Type struct {
	UID            string                   `json:"uid"`
	Name           string                   `json:"name"`
	Package        string                   `json:"package"`
	Doc            string                   `json:"doc"`
	Default        string                   `json:"default"`
	Validation     []string                 `json:"validation"`
	Markers        markers.MarkerValues     `json:"markers"`
	GVK            *schema.GroupVersionKind `json:"gvk"`
	Kind           Kind                     `json:"kind"`
	Imported       bool                     `json:"imported"`
	UnderlyingType *Type                    `json:"underlyingType"` // for aliases, slices and pointers
	KeyType        *Type                    `json:"keyType"`        // for maps
	ValueType      *Type                    `json:"valueType"`      // for maps
	Fields         Fields                   `json:"fields"`         // for structs
	References     []*Type                  `json:"-"`              // other types that refer to this type
	EnumValues     []EnumValue              `json:"enumValues"`     // for enum values of aliased string types
}

Type describes a declared type

func (*Type) ContainsInlinedTypes added in v0.0.9

func (t *Type) ContainsInlinedTypes() bool

func (*Type) IsAlias

func (t *Type) IsAlias() bool

func (*Type) IsBasic

func (t *Type) IsBasic() bool

func (*Type) Members

func (t *Type) Members() Fields

func (*Type) SortedReferences added in v0.0.3

func (t *Type) SortedReferences() []*Type

func (*Type) String

func (t *Type) String() string

type TypeMap added in v0.0.9

type TypeMap map[string]*Type

TypeMap is a map of Type elements

func (TypeMap) InlineTypes added in v0.0.9

func (types TypeMap) InlineTypes(propagateReference func(original *Type, additional *Type))

func (TypeMap) PropagateMarkers added in v0.0.11

func (types TypeMap) PropagateMarkers()

PropagateMarkers propagates markers to struct fields and certain types, from their underlying types.

Jump to

Keyboard shortcuts

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