Documentation
¶
Overview ¶
Package common contains some helpers we use across multiple major-version implementations of the provider protocol.
Index ¶
- func CtyValueAsJSON(v cty.Value, ty cty.Type) ([]byte, error)
- func CtyValueAsMsgpack(v cty.Value, ty cty.Type) ([]byte, error)
- func MapSeq[FromV, ToV any](seq iter.Seq[FromV], f func(v FromV) ToV) iter.Seq[ToV]
- func MapSeq2[FromK, FromV, ToK, ToV any](seq iter.Seq2[FromK, FromV], f func(k FromK, v FromV) (ToK, ToV)) iter.Seq2[ToK, ToV]
- func MapSeq2ToSeq[FromK, FromV, ToV any](seq iter.Seq2[FromK, FromV], f func(k FromK, v FromV) ToV) iter.Seq[ToV]
- func MapSeqToSeq2[FromV, ToK, ToV any](seq iter.Seq[FromV], f func(v FromV) (ToK, ToV)) iter.Seq2[ToK, ToV]
- type CtyTypeJSON
- type CtyValueJSON
- type CtyValueMsgpack
- type Sealed
- type SealedImpl
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MapSeq ¶
MapSeq performs a systematic transformation of each item in seq, producing a new sequence of the same length based on the results.
(Hopefully there will be something like this in the Go standard library one day, at which point we should use it and remove this.)
func MapSeq2 ¶
func MapSeq2[FromK, FromV, ToK, ToV any](seq iter.Seq2[FromK, FromV], f func(k FromK, v FromV) (ToK, ToV)) iter.Seq2[ToK, ToV]
MapSeq performs a systematic transformation of each item in seq, producing a new sequence of the same length based on the results.
(Hopefully there will be something like this in the Go standard library one day, at which point we should use it and remove this.)
Types ¶
type CtyTypeJSON ¶
type CtyTypeJSON []byte
CtyTypeJSON makes a byte array containing a standard JSON serialization of cty.Type implement [providerschema.TypeConstraint].
type Sealed ¶
type Sealed interface {
// contains filtered or unexported methods
}
Sealed is an interface that we embed in various other interface types to ensure that they can't be implemented by types outside of this module, because we need to be able to grow those interfaces over time as the underlying protocols evolve.
This module uses interfaces only for dynamic dispatch over a fixed set of implementations covering different versions of the plugin protocol, and not to support third-party implementations.
type SealedImpl ¶
type SealedImpl struct{}
SealedImpl is a zero-sized type that implements Sealed, intended to be embedded into other struct types to make them implement that interface even though they can't directly implement the "sealed()" method.