Skip to content

rekby/objwalker

Repository files navigation

Go Reference Coverage Status GoReportCard

Deep walk by object with reflection. With recursive loop protection.

	type S struct {
		Val1  int
		Slice []string
	}

	v := S{
		Val1:  2,
		Slice: []string{"hello", "world"},
	}
	_ = New(func(info WalkInfo) error {
		val := info.Value.Interface()
		_ = val
		if info.IsStructField {
			fmt.Println(info.Value.Interface())
		}
		return nil
	}).Walk(v)

	// Output:
	// 2
	// [hello world]

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages