mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-09 21:17:09 +08:00
vendor: update github.com/hashicorp/hcl/v2 to v2.19.1
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
16
vendor/github.com/zclconf/go-cty/cty/function/stdlib/general.go
generated
vendored
16
vendor/github.com/zclconf/go-cty/cty/function/stdlib/general.go
generated
vendored
@ -9,6 +9,7 @@ import (
|
||||
)
|
||||
|
||||
var EqualFunc = function.New(&function.Spec{
|
||||
Description: `Returns true if the two given values are equal, or false otherwise.`,
|
||||
Params: []function.Parameter{
|
||||
{
|
||||
Name: "a",
|
||||
@ -25,13 +26,15 @@ var EqualFunc = function.New(&function.Spec{
|
||||
AllowNull: true,
|
||||
},
|
||||
},
|
||||
Type: function.StaticReturnType(cty.Bool),
|
||||
Type: function.StaticReturnType(cty.Bool),
|
||||
RefineResult: refineNonNull,
|
||||
Impl: func(args []cty.Value, retType cty.Type) (ret cty.Value, err error) {
|
||||
return args[0].Equals(args[1]), nil
|
||||
},
|
||||
})
|
||||
|
||||
var NotEqualFunc = function.New(&function.Spec{
|
||||
Description: `Returns false if the two given values are equal, or true otherwise.`,
|
||||
Params: []function.Parameter{
|
||||
{
|
||||
Name: "a",
|
||||
@ -48,14 +51,16 @@ var NotEqualFunc = function.New(&function.Spec{
|
||||
AllowNull: true,
|
||||
},
|
||||
},
|
||||
Type: function.StaticReturnType(cty.Bool),
|
||||
Type: function.StaticReturnType(cty.Bool),
|
||||
RefineResult: refineNonNull,
|
||||
Impl: func(args []cty.Value, retType cty.Type) (ret cty.Value, err error) {
|
||||
return args[0].Equals(args[1]).Not(), nil
|
||||
},
|
||||
})
|
||||
|
||||
var CoalesceFunc = function.New(&function.Spec{
|
||||
Params: []function.Parameter{},
|
||||
Description: `Returns the first of the given arguments that isn't null, or raises an error if there are no non-null arguments.`,
|
||||
Params: []function.Parameter{},
|
||||
VarParam: &function.Parameter{
|
||||
Name: "vals",
|
||||
Type: cty.DynamicPseudoType,
|
||||
@ -74,6 +79,7 @@ var CoalesceFunc = function.New(&function.Spec{
|
||||
}
|
||||
return retType, nil
|
||||
},
|
||||
RefineResult: refineNonNull,
|
||||
Impl: func(args []cty.Value, retType cty.Type) (ret cty.Value, err error) {
|
||||
for _, argVal := range args {
|
||||
if !argVal.IsKnown() {
|
||||
@ -89,6 +95,10 @@ var CoalesceFunc = function.New(&function.Spec{
|
||||
},
|
||||
})
|
||||
|
||||
func refineNonNull(b *cty.RefinementBuilder) *cty.RefinementBuilder {
|
||||
return b.NotNull()
|
||||
}
|
||||
|
||||
// Equal determines whether the two given values are equal, returning a
|
||||
// bool value.
|
||||
func Equal(a cty.Value, b cty.Value) (cty.Value, error) {
|
||||
|
Reference in New Issue
Block a user