Beispiel #1
0
func getBuilderMap(builder interface{}) ps.Map {
	b := convert(builder, Builder{}).(Builder)

	if b.builderMap == nil {
		return ps.NewMap()
	}

	return b.builderMap
}
Beispiel #2
0
)

// Builder stores a set of named values.
//
// New types can be declared with underlying type Builder and used with the
// functions in this package. See example.
//
// Instances of Builder should be treated as immutable. It is up to the
// implementor to ensure mutable values set on a Builder are not mutated while
// the Builder is in use.
type Builder struct {
	builderMap ps.Map
}

var (
	EmptyBuilder      = Builder{ps.NewMap()}
	emptyBuilderValue = reflect.ValueOf(EmptyBuilder)
)

func getBuilderMap(builder interface{}) ps.Map {
	b := convert(builder, Builder{}).(Builder)

	if b.builderMap == nil {
		return ps.NewMap()
	}

	return b.builderMap
}

// Set returns a copy of the given builder with a new value set for the given
// name.