Esempio n. 1
0
func displayDefault(d *pb.Argument) string {
	if d.GetValue() == nil {
		return ""
	}
	var out interface{}
	switch val := d.GetValue().(type) {
	case *pb.Argument_Number:
		out = val.Number
	case *pb.Argument_Str:
		out = val.Str
	case *pb.Argument_Boolean:
		out = val.Boolean
	}
	return fmt.Sprintf("(%v) ", out)
}
Esempio n. 2
0
// simpleArgApply is used when no formatting template string is given.
func simpleArgApply(field *pb.Field, arg *pb.Argument) error {
	switch val := arg.GetValue().(type) {
	case *pb.Argument_Number:
		field.Value = &pb.Field_Number{Number: val.Number}
	case *pb.Argument_Str:
		field.Value = &pb.Field_Str{Str: val.Str}
	case *pb.Argument_Boolean:
		field.Value = &pb.Field_Boolean{Boolean: val.Boolean}
	default:
		field.Value = nil
	}

	return nil
}