File: value_string_test.go

package info (click to toggle)
golang-github-zclconf-go-cty-debug 0.0~git20191215.b22d67c-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 108 kB
  • sloc: makefile: 2
file content (49 lines) | stat: -rw-r--r-- 1,705 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package ctydebug_test

import (
	"fmt"

	"github.com/zclconf/go-cty-debug/ctydebug"
	"github.com/zclconf/go-cty/cty"
)

func ExampleValueString() {
	v := cty.ObjectVal(map[string]cty.Value{
		"source_account":  cty.StringVal("GBAMSPIE6NRUVRV4ZIPI2ZFR3NAIAIXQHGCMVLPSVQCM46IPWTHEVOID"),
		"fee":             cty.NumberIntVal(2),
		"sequence_number": cty.NumberIntVal(4523452343),
		"time_bounds": cty.TupleVal([]cty.Value{
			cty.StringVal("2019-12-14T00:00:00Z"),
			cty.StringVal("2019-12-14T00:05:00Z"),
		}),
		"memo": cty.MapValEmpty(cty.String),
		"payments": cty.ListVal([]cty.Value{
			cty.ObjectVal(map[string]cty.Value{
				"destination_account": cty.StringVal("GALAXYVOIDAOPZTDLHILAJQKCVVFMD4IKLXLSZV5YHO7VY74IWZILUTO"),
				"asset":               cty.StringVal("XLM"),
				"amount":              cty.NumberIntVal(55442098181),
			}),
		}),
	})

	fmt.Print(ctydebug.ValueString(v))

	// Output:
	// cty.ObjectVal(map[string]cty.Value{
	//     "fee": cty.NumberIntVal(2),
	//     "memo": cty.MapValEmpty(cty.String),
	//     "payments": cty.ListVal([]cty.Value{
	//         cty.ObjectVal(map[string]cty.Value{
	//             "amount": cty.NumberIntVal(5.5442098181e+10),
	//             "asset": cty.StringVal("XLM"),
	//             "destination_account": cty.StringVal("GALAXYVOIDAOPZTDLHILAJQKCVVFMD4IKLXLSZV5YHO7VY74IWZILUTO"),
	//         }),
	//     }),
	//     "sequence_number": cty.NumberIntVal(4.523452343e+09),
	//     "source_account": cty.StringVal("GBAMSPIE6NRUVRV4ZIPI2ZFR3NAIAIXQHGCMVLPSVQCM46IPWTHEVOID"),
	//     "time_bounds": cty.TupleVal([]cty.Value{
	//         cty.StringVal("2019-12-14T00:00:00Z"),
	//         cty.StringVal("2019-12-14T00:05:00Z"),
	//     }),
	// })
}