api

package
v6.25.0 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Union

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

func NewUnionFromOne

func NewUnionFromOne(v api.Struct1) Union

func NewUnionFromTwo

func NewUnionFromTwo(v api1.Struct2) Union

func (*Union) Accept

func (u *Union) Accept(v UnionVisitor) error

func (*Union) AcceptFuncs

func (u *Union) AcceptFuncs(oneFunc func(api.Struct1) error, twoFunc func(api1.Struct2) error, unknownFunc func(string) error) error

func (*Union) AcceptWithContext

func (u *Union) AcceptWithContext(ctx context.Context, v UnionVisitorWithContext) error

func (*Union) ErrorOnUnknown

func (u *Union) ErrorOnUnknown(typeName string) error

func (Union) MarshalJSON

func (u Union) MarshalJSON() ([]byte, error)

func (Union) MarshalYAML

func (u Union) MarshalYAML() (interface{}, error)

func (*Union) OneNoopSuccess

func (u *Union) OneNoopSuccess(api.Struct1) error

func (*Union) TwoNoopSuccess

func (u *Union) TwoNoopSuccess(api1.Struct2) error

func (*Union) UnmarshalJSON

func (u *Union) UnmarshalJSON(data []byte) error

func (*Union) UnmarshalYAML

func (u *Union) UnmarshalYAML(unmarshal func(interface{}) error) error

type UnionVisitor

type UnionVisitor interface {
	VisitOne(v api.Struct1) error
	VisitTwo(v api1.Struct2) error
	VisitUnknown(typeName string) error
}

type UnionVisitorWithContext

type UnionVisitorWithContext interface {
	VisitOneWithContext(ctx context.Context, v api.Struct1) error
	VisitTwoWithContext(ctx context.Context, v api1.Struct2) error
	VisitUnknownWithContext(ctx context.Context, typeName string) error
}

type UnionVisitorWithT added in v6.18.0

type UnionVisitorWithT[T any] interface {
	VisitOne(ctx context.Context, v api.Struct1) (T, error)
	VisitTwo(ctx context.Context, v api1.Struct2) (T, error)
	VisitUnknown(ctx context.Context, typ string) (T, error)
}

type UnionWithT added in v6.18.0

type UnionWithT[T any] Union

func (*UnionWithT[T]) Accept added in v6.18.0

func (u *UnionWithT[T]) Accept(ctx context.Context, v UnionVisitorWithT[T]) (T, error)

Jump to

Keyboard shortcuts

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