Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions libs/dyn/convert/from_typed.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"slices"

"github.com/databricks/cli/libs/dyn"
"github.com/databricks/cli/libs/dyn/dynvar"
"github.com/databricks/cli/libs/structs/structvar"
)

type fromTypedOptions int
Expand Down Expand Up @@ -96,7 +96,7 @@ func fromTypedStruct(src reflect.Value, ref dyn.Value, options ...fromTypedOptio
switch ref.Kind() {
case dyn.KindString:
// Ignore pure variable references (e.g. ${var.foo}).
if dynvar.IsPureVariableReference(ref.MustString()) {
if structvar.IsPureVariableReference(ref.MustString()) {
return ref, nil
}
case dyn.KindMap, dyn.KindNil:
Expand Down Expand Up @@ -174,7 +174,7 @@ func fromTypedMap(src reflect.Value, ref dyn.Value) (dyn.Value, error) {
switch ref.Kind() {
case dyn.KindString:
// Ignore pure variable references (e.g. ${var.foo}).
if dynvar.IsPureVariableReference(ref.MustString()) {
if structvar.IsPureVariableReference(ref.MustString()) {
return ref, nil
}
case dyn.KindMap, dyn.KindNil:
Expand Down Expand Up @@ -222,7 +222,7 @@ func fromTypedSlice(src reflect.Value, ref dyn.Value) (dyn.Value, error) {
switch ref.Kind() {
case dyn.KindString:
// Ignore pure variable references (e.g. ${var.foo}).
if dynvar.IsPureVariableReference(ref.MustString()) {
if structvar.IsPureVariableReference(ref.MustString()) {
return ref, nil
}
case dyn.KindSequence, dyn.KindNil:
Expand Down Expand Up @@ -297,7 +297,7 @@ func fromTypedBool(src reflect.Value, ref dyn.Value, options ...fromTypedOptions
return dyn.V(src.Bool()), nil
case dyn.KindString:
// Ignore pure variable references (e.g. ${var.foo}).
if dynvar.IsPureVariableReference(ref.MustString()) {
if structvar.IsPureVariableReference(ref.MustString()) {
return ref, nil
}
default:
Expand All @@ -324,7 +324,7 @@ func fromTypedInt(src reflect.Value, ref dyn.Value, options ...fromTypedOptions)
return dyn.V(src.Int()), nil
case dyn.KindString:
// Ignore pure variable references (e.g. ${var.foo}).
if dynvar.IsPureVariableReference(ref.MustString()) {
if structvar.IsPureVariableReference(ref.MustString()) {
return ref, nil
}
default:
Expand All @@ -351,7 +351,7 @@ func fromTypedFloat(src reflect.Value, ref dyn.Value, options ...fromTypedOption
return dyn.V(src.Float()), nil
case dyn.KindString:
// Ignore pure variable references (e.g. ${var.foo}).
if dynvar.IsPureVariableReference(ref.MustString()) {
if structvar.IsPureVariableReference(ref.MustString()) {
return ref, nil
}
default:
Expand Down
14 changes: 7 additions & 7 deletions libs/dyn/convert/normalize.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (

"github.com/databricks/cli/libs/diag"
"github.com/databricks/cli/libs/dyn"
"github.com/databricks/cli/libs/dyn/dynvar"
"github.com/databricks/cli/libs/structs/structvar"
)

// NormalizeOption is the type for options that can be passed to Normalize.
Expand Down Expand Up @@ -242,7 +242,7 @@ func (n normalizeOptions) normalizeStruct(typ reflect.Type, src dyn.Value, seen

case dyn.KindString:
// Return verbatim if it's a pure variable reference.
if dynvar.IsPureVariableReference(src.MustString()) {
if structvar.IsPureVariableReference(src.MustString()) {
return src, nil
}
default:
Expand Down Expand Up @@ -282,7 +282,7 @@ func (n normalizeOptions) normalizeMap(typ reflect.Type, src dyn.Value, seen []r

case dyn.KindString:
// Return verbatim if it's a pure variable reference.
if dynvar.IsPureVariableReference(src.MustString()) {
if structvar.IsPureVariableReference(src.MustString()) {
return src, nil
}
default:
Expand Down Expand Up @@ -319,7 +319,7 @@ func (n normalizeOptions) normalizeSlice(typ reflect.Type, src dyn.Value, seen [

case dyn.KindString:
// Return verbatim if it's a pure variable reference.
if dynvar.IsPureVariableReference(src.MustString()) {
if structvar.IsPureVariableReference(src.MustString()) {
return src, nil
}
default:
Expand Down Expand Up @@ -369,7 +369,7 @@ func (n normalizeOptions) normalizeBool(typ reflect.Type, src dyn.Value, path dy
return dyn.NewValue(false, src.Locations()), nil
default:
// Return verbatim if it's a pure variable reference.
if dynvar.IsPureVariableReference(src.MustString()) {
if structvar.IsPureVariableReference(src.MustString()) {
return src, nil
}

Expand Down Expand Up @@ -408,7 +408,7 @@ func (n normalizeOptions) normalizeInt(typ reflect.Type, src dyn.Value, path dyn
out, err := strconv.ParseInt(src.MustString(), 10, 64)
if err != nil {
// Return verbatim if it's a pure variable reference.
if dynvar.IsPureVariableReference(src.MustString()) {
if structvar.IsPureVariableReference(src.MustString()) {
return src, nil
}

Expand Down Expand Up @@ -452,7 +452,7 @@ func (n normalizeOptions) normalizeFloat(typ reflect.Type, src dyn.Value, path d
out, err := strconv.ParseFloat(src.MustString(), 64)
if err != nil {
// Return verbatim if it's a pure variable reference.
if dynvar.IsPureVariableReference(src.MustString()) {
if structvar.IsPureVariableReference(src.MustString()) {
return src, nil
}

Expand Down
6 changes: 3 additions & 3 deletions libs/dyn/convert/sdk_native_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"slices"

"github.com/databricks/cli/libs/dyn"
"github.com/databricks/cli/libs/dyn/dynvar"
"github.com/databricks/cli/libs/structs/structvar"
sdkduration "github.com/databricks/databricks-sdk-go/common/types/duration"
sdkfieldmask "github.com/databricks/databricks-sdk-go/common/types/fieldmask"
sdktime "github.com/databricks/databricks-sdk-go/common/types/time"
Expand All @@ -30,7 +30,7 @@ func fromTypedSDKNative(src reflect.Value, ref dyn.Value, options ...fromTypedOp
switch ref.Kind() {
case dyn.KindString:
// Ignore pure variable references (e.g. ${var.foo}).
if dynvar.IsPureVariableReference(ref.MustString()) {
if structvar.IsPureVariableReference(ref.MustString()) {
return ref, nil
}
case dyn.KindNil:
Expand Down Expand Up @@ -72,7 +72,7 @@ func toTypedSDKNative(dst reflect.Value, src dyn.Value) error {
switch src.Kind() {
case dyn.KindString:
// Ignore pure variable references (e.g. ${var.foo}).
if dynvar.IsPureVariableReference(src.MustString()) {
if structvar.IsPureVariableReference(src.MustString()) {
dst.SetZero()
return nil
}
Expand Down
14 changes: 7 additions & 7 deletions libs/dyn/convert/to_typed.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"strconv"

"github.com/databricks/cli/libs/dyn"
"github.com/databricks/cli/libs/dyn/dynvar"
"github.com/databricks/cli/libs/structs/structvar"
)

// Populate a destination typed value from a source dynamic value.
Expand Down Expand Up @@ -118,7 +118,7 @@ func toTypedStruct(dst reflect.Value, src dyn.Value) error {
return nil
case dyn.KindString:
// Ignore pure variable references (e.g. ${var.foo}).
if dynvar.IsPureVariableReference(src.MustString()) {
if structvar.IsPureVariableReference(src.MustString()) {
dst.SetZero()
return nil
}
Expand Down Expand Up @@ -175,7 +175,7 @@ func toTypedMap(dst reflect.Value, src dyn.Value) error {
return nil
case dyn.KindString:
// Ignore pure variable references (e.g. ${var.foo}).
if dynvar.IsPureVariableReference(src.MustString()) {
if structvar.IsPureVariableReference(src.MustString()) {
dst.SetZero()
return nil
}
Expand Down Expand Up @@ -208,7 +208,7 @@ func toTypedSlice(dst reflect.Value, src dyn.Value) error {
return nil
case dyn.KindString:
// Ignore pure variable references (e.g. ${var.foo}).
if dynvar.IsPureVariableReference(src.MustString()) {
if structvar.IsPureVariableReference(src.MustString()) {
dst.SetZero()
return nil
}
Expand Down Expand Up @@ -262,7 +262,7 @@ func toTypedBool(dst reflect.Value, src dyn.Value) error {
return nil
}
// Ignore pure variable references (e.g. ${var.foo}).
if dynvar.IsPureVariableReference(src.MustString()) {
if structvar.IsPureVariableReference(src.MustString()) {
dst.SetZero()
return nil
}
Expand Down Expand Up @@ -300,7 +300,7 @@ func toTypedInt(dst reflect.Value, src dyn.Value) error {
return nil
}
// Ignore pure variable references (e.g. ${var.foo}).
if dynvar.IsPureVariableReference(src.MustString()) {
if structvar.IsPureVariableReference(src.MustString()) {
dst.SetZero()
return nil
}
Expand All @@ -325,7 +325,7 @@ func toTypedFloat(dst reflect.Value, src dyn.Value) error {
return nil
}
// Ignore pure variable references (e.g. ${var.foo}).
if dynvar.IsPureVariableReference(src.MustString()) {
if structvar.IsPureVariableReference(src.MustString()) {
dst.SetZero()
return nil
}
Expand Down
21 changes: 0 additions & 21 deletions libs/dyn/dynvar/lookup.go

This file was deleted.

27 changes: 0 additions & 27 deletions libs/dyn/dynvar/lookup_test.go

This file was deleted.

Loading
Loading