config

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Copyright 2022, Pulumi Corporation. All rights reserved.

Handle configuration types.

Index

Constants

This section is empty.

Variables

View Source
var (
	String      Type = typ{schema.StringType}
	StringList       = typ{&schema.ArrayType{ElementType: schema.StringType}}
	Number           = typ{schema.NumberType}
	NumberList       = typ{&schema.ArrayType{ElementType: schema.NumberType}}
	Boolean          = typ{schema.BoolType}
	BooleanList      = typ{&schema.ArrayType{ElementType: schema.NumberType}}
	Int              = typ{schema.IntType}
	IntList          = typ{&schema.ArrayType{ElementType: schema.IntType}}
)
View Source
var (
	ErrHeterogeneousList = HeterogeneousListErr{}
	ErrEmptyList         = fmt.Errorf("empty list")
	ErrUnexpectedType    = UnexpectedTypeErr{}
)
View Source
var Primitives = Types{
	String,
	Number,
	Int,
	Boolean,
}

Functions

func IsValidType

func IsValidType(c Type) bool

Types

type HeterogeneousListErr added in v0.5.5

type HeterogeneousListErr struct {
	T1 Type
	T2 Type
}

func (*HeterogeneousListErr) Error added in v0.5.5

func (e *HeterogeneousListErr) Error() string

func (*HeterogeneousListErr) Is added in v0.5.5

func (e *HeterogeneousListErr) Is(err error) bool

type Type

type Type interface {
	fmt.Stringer
	// Return the schema equivalent of this type
	Schema() schema.Type
	// Return the pcl equivalent of this type
	Pcl() model.Type
	// contains filtered or unexported methods
}

func Parse

func Parse(s string) (Type, bool)

func TypeValue added in v0.5.5

func TypeValue(v interface{}) (Type, error)

Type a go value into a configuration value. If an error is returned, it is one of - ErrHeterogeneousList - ErrEmptyList - ErrUnexpectedType

type Types

type Types []Type

func (Types) String

func (c Types) String() string

type UnexpectedTypeErr added in v0.5.5

type UnexpectedTypeErr struct {
	T interface{}
}

func (*UnexpectedTypeErr) Error added in v0.5.5

func (e *UnexpectedTypeErr) Error() string

func (*UnexpectedTypeErr) Is added in v0.5.5

func (e *UnexpectedTypeErr) Is(err error) bool

Jump to

Keyboard shortcuts

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