MCPcopy Create free account
hub / github.com/compozy/agh / configScalarNode

Function configScalarNode

internal/cli/config.go:1032–1050  ·  view source on GitHub ↗
(value reflect.Value)

Source from the content-addressed store, hash-verified

1030}
1031
1032func configScalarNode(value reflect.Value) (any, bool) {
1033 switch value.Kind() {
1034 case reflect.String:
1035 return value.String(), true
1036 case reflect.Bool:
1037 return value.Bool(), true
1038 case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
1039 return value.Int(), true
1040 case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
1041 return value.Uint(), true
1042 case reflect.Float32, reflect.Float64:
1043 return value.Float(), true
1044 default:
1045 if value.CanInterface() {
1046 return fmt.Sprint(value.Interface()), true
1047 }
1048 return nil, false
1049 }
1050}
1051
1052func tomlFieldName(field reflect.StructField) (string, bool, bool) {
1053 tag := field.Tag.Get("toml")

Callers 1

configNodeFromValueFunction · 0.70

Calls 2

KindMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected