Exemple #1
0
func uint32ToGo(term *ast.Terminal) (uint32, error) {
	if term.Uint32Value == nil {
		return 0, &ErrWrongType{"uint32", term.String()}
	}
	return term.GetUint32Value(), nil
}
Exemple #2
0
func doubleToGo(term *ast.Terminal) (float64, error) {
	if term.DoubleValue == nil {
		return 0, &ErrWrongType{"double", term.String()}
	}
	return term.GetDoubleValue(), nil
}
Exemple #3
0
func bytesToGo(term *ast.Terminal) ([]byte, error) {
	if term.BytesValue == nil {
		return nil, &ErrWrongType{"[]byte", term.String()}
	}
	return term.GetBytesValue(), nil
}
Exemple #4
0
func stringToGo(term *ast.Terminal) (string, error) {
	if term.StringValue == nil {
		return "", &ErrWrongType{"string", term.String()}
	}
	return term.GetStringValue(), nil
}
Exemple #5
0
func boolToGo(term *ast.Terminal) (bool, error) {
	if term.BoolValue == nil {
		return false, &ErrWrongType{"bool", term.String()}
	}
	return term.GetBoolValue(), nil
}
Exemple #6
0
func int64ToGo(term *ast.Terminal) (int64, error) {
	if term.Int64Value == nil {
		return 0, &ErrWrongType{"int64", term.String()}
	}
	return term.GetInt64Value(), nil
}
Exemple #7
0
func floatToGo(term *ast.Terminal) (float32, error) {
	if term.FloatValue == nil {
		return 0, &ErrWrongType{"float", term.String()}
	}
	return term.GetFloatValue(), nil
}