// GoNativeType returns the Go built-in type from which instances of t can be initialized.
971717
func GoNativeType(t design.DataType) string {
	switch actual := t.(type) {
	case design.Primitive:
		switch actual.Kind() {
		case design.BooleanKind:
			return "bool"
		case design.IntegerKind:
			return "int"
		case design.NumberKind:
			return "float64"
		case design.StringKind:
			return "string"
		case design.DateTimeKind:
			return "time.Time"
		case design.UUIDKind:
			return "uuid.UUID"
		case design.AnyKind:
			return "interface{}"
		case design.FileKind:
			return "multipart.FileHeader"
		default:
			panic(fmt.Sprintf("goa bug: unknown primitive type %#v", actual))
		}
	case *design.Array:
		return "[]" + GoNativeType(actual.ElemType.Type)
	case design.Object:
		return "map[string]interface{}"
	case *design.Hash:
		return fmt.Sprintf("map[%s]%s", GoNativeType(actual.KeyType.Type), GoNativeType(actual.ElemType.Type))
	case *design.MediaTypeDefinition:
		return GoNativeType(actual.Type)
	case *design.UserTypeDefinition:
		return GoNativeType(actual.Type)
	default:
		panic(fmt.Sprintf("goa bug: unknown type %#v", actual))
	}
}
314593
func (that *JSONNode) SetType(t JSONNodeType) *JSONNode {
	if that.t != TypeUndefined && that.t != t {
		panic(ErrorMultipleType)
	}
	if t >= typeError {
		panic(ErrorUnknowType)
	}
	that.t = t
	switch t {
	case TypeMap:
		that.m = make(map[string]*JSONNode, 0)
	case TypeArray:
		that.a = make([]JSONNode, 0)
	case TypeValue:
		that.Val(nil)
	}
	return that
}
3100
func (b *Builder) walkType(u types.Universe, useName *types.Name, in tc.Type) *types.Type {
	// Most of the cases are underlying types of the named type.
	name := tcNameToName(in.String())
	if useName != nil {
		name = *useName
	}

	switch t := in.(type) {
	case *tc.Struct:
		out := u.Type(name)
		if out.Kind != types.Unknown {
			return out
		}
		out.Kind = types.Struct
		for i := 0; i < t.NumFields(); i++ {
			f := t.Field(i)
			m := types.Member{
				Name:         f.Name(),
				Embedded:     f.Anonymous(),
				Tags:         t.Tag(i),
				Type:         b.walkType(u, nil, f.Type()),
				CommentLines: splitLines(b.priorCommentLines(f.Pos(), 1).Text()),
			}
			out.Members = append(out.Members, m)
		}
		return out
	case *tc.Map:
		out := u.Type(name)
		if out.Kind != types.Unknown {
			return out
		}
		out.Kind = types.Map
		out.Elem = b.walkType(u, nil, t.Elem())
		out.Key = b.walkType(u, nil, t.Key())
		return out
	case *tc.Pointer:
		out := u.Type(name)
		if out.Kind != types.Unknown {
			return out
		}
		out.Kind = types.Pointer
		out.Elem = b.walkType(u, nil, t.Elem())
		return out
	case *tc.Slice:
		out := u.Type(name)
		if out.Kind != types.Unknown {
			return out
		}
		out.Kind = types.Slice
		out.Elem = b.walkType(u, nil, t.Elem())
		return out
	case *tc.Array:
		out := u.Type(name)
		if out.Kind != types.Unknown {
			return out
		}
		out.Kind = types.Array
		out.Elem = b.walkType(u, nil, t.Elem())
		// TODO: need to store array length, otherwise raw type name
		// cannot be properly written.
		return out
	case *tc.Chan:
		out := u.Type(name)
		if out.Kind != types.Unknown {
			return out
		}
		out.Kind = types.Chan
		out.Elem = b.walkType(u, nil, t.Elem())
		// TODO: need to store direction, otherwise raw type name
		// cannot be properly written.
		return out
	case *tc.Basic:
		out := u.Type(types.Name{
			Package: "",
			Name:    t.Name(),
		})
		if out.Kind != types.Unknown {
			return out
		}
		out.Kind = types.Unsupported
		return out
	case *tc.Signature:
		out := u.Type(name)
		if out.Kind != types.Unknown {
			return out
		}
		out.Kind = types.Func
		out.Signature = b.convertSignature(u, t)
		return out
	case *tc.Interface:
		out := u.Type(name)
		if out.Kind != types.Unknown {
			return out
		}
		out.Kind = types.Interface
		t.Complete()
		for i := 0; i < t.NumMethods(); i++ {
			if out.Methods == nil {
				out.Methods = map[string]*types.Type{}
			}
			out.Methods[t.Method(i).Name()] = b.walkType(u, nil, t.Method(i).Type())
		}
		return out
	case *tc.Named:
		var out *types.Type
		switch t.Underlying().(type) {
		case *tc.Named, *tc.Basic, *tc.Map, *tc.Slice:
			name := tcNameToName(t.String())
			out = u.Type(name)
			if out.Kind != types.Unknown {
				return out
			}
			out.Kind = types.Alias
			out.Underlying = b.walkType(u, nil, t.Underlying())
		default:
			// tc package makes everything "named" with an
			// underlying anonymous type--we remove that annoying
			// "feature" for users. This flattens those types
			// together.
			name := tcNameToName(t.String())
			if out := u.Type(name); out.Kind != types.Unknown {
				return out // short circuit if we've already made this.
			}
			out = b.walkType(u, &name, t.Underlying())
		}
		// If the underlying type didn't already add methods, add them.
		// (Interface types will have already added methods.)
		if len(out.Methods) == 0 {
			for i := 0; i < t.NumMethods(); i++ {
				if out.Methods == nil {
					out.Methods = map[string]*types.Type{}
				}
				out.Methods[t.Method(i).Name()] = b.walkType(u, nil, t.Method(i).Type())
			}
		}
		return out
	default:
		out := u.Type(name)
		if out.Kind != types.Unknown {
			return out
		}
		out.Kind = types.Unsupported
		klog.Warningf("Making unsupported type entry %q for: %#v\n", out, t)
		return out
	}
}
1256044
func (s *GetService) Type(typ string) *GetService {
	s.typ = typ
	return s
}
1111706
func convertToGoType(ctx *context, binapiType string) (typ string) {
	if t, ok := binapiTypes[binapiType]; ok {
		// basic types
		typ = t
	} else if r, ok := ctx.packageData.RefMap[binapiType]; ok {
		// specific types (enums/types/unions)
		typ = camelCaseName(r)
	} else {
		switch binapiType {
		case "bool", "string":
			typ = binapiType
		default:
			// fallback type
			log.Warnf("found unknown VPP binary API type %q, using byte", binapiType)
			typ = "byte"
		}
	}
	return typ
}
160420
func (r Virtual_Storage_Repository) GetType() (resp datatypes.Virtual_Storage_Repository_Type, err error) {
	err = r.Session.DoRequest("SoftLayer_Virtual_Storage_Repository", "getType", nil, &r.Options, &resp)
	return
}
1142968
func GetType(tname string) (reflect.Type, error) {
	t, found := typemap[tname]
	if !found {
		return nil, errors.New("type not found: " + tname)
	}
	return t, nil

}
177483
func (r *RepositoryContent) GetType() string {
	if r == nil || r.Type == nil {
		return ""
	}
	return *r.Type
}
894548
func (t Type) IsJSONType() bool {
	tStr := t.TypeString()
	tStr = strings.TrimSpace(tStr)
	return strings.HasPrefix(tStr, "{") && strings.HasSuffix(tStr, "}")
}
1042528
func (g *Generator) ConvertType(from, to string) {
	g.typeConversions[from] = to
}
374899
func (r *RepositoryLicense) GetType() string {
	if r == nil || r.Type == nil {
		return ""
	}
	return *r.Type
}
820138
func NewNativeJSONEncoder(w io.Writer) JSONEncoder {
	return &jsonEncoder{
		w:  w,
		bo: NativeEndian,
	}
}
786726
func parseType(def string) typeParserResult {
	parser := &typeParser{input: def}
	return parser.parse()
}
906742
func (g *goFileGenerator) FormatType(t *api.Type) (string, error) {
	switch {
	case t.SimpleType != nil:
		switch *t.SimpleType {
		case api.SimpleTypeBool:
			return "bool", nil
		case api.SimpleTypeByte:
			return "byte", nil
		case api.SimpleTypeInt8:
			return "int8", nil
		case api.SimpleTypeInt16:
			return "int16", nil
		case api.SimpleTypeInt32:
			return "int32", nil
		case api.SimpleTypeInt64:
			return "int64", nil
		case api.SimpleTypeFloat64:
			return "float64", nil
		case api.SimpleTypeString:
			return "string", nil
		case api.SimpleTypeStructEmpty:
			return "struct{}", nil
		default:
			return "", fmt.Errorf("unknown simple type: %v", *t.SimpleType)
		}
	case t.SliceType != nil:
		v, err := g.FormatType(t.SliceType)
		return "[]" + v, err
	case t.KeyValueSliceType != nil:
		k, err := g.FormatType(t.KeyValueSliceType.Left)
		if err != nil {
			return "", err
		}

		v, err := g.FormatType(t.KeyValueSliceType.Right)
		return fmt.Sprintf("[]struct{Key %v; Value %v}", k, v), err
	case t.MapType != nil:
		k, err := g.FormatType(t.MapType.Left)
		if err != nil {
			return "", err
		}

		v, err := g.FormatType(t.MapType.Right)
		return fmt.Sprintf("map[%v]%v", k, v), err
	case t.ReferenceType != nil:
		if g.importPath == t.ReferenceType.ImportPath {
			// Target is in the same package. No need to import.
			return t.ReferenceType.Name, nil
		}

		importName := g.Import(t.ReferenceType.ImportPath)
		return importName + "." + t.ReferenceType.Name, nil
	case t.PointerType != nil:
		v, err := g.FormatType(t.PointerType)
		return "*" + v, err
	default:
		return "", fmt.Errorf("unknown type: %v", t)
	}
}
975016
func IsInputType(ttype Type) bool {
	switch GetNamed(ttype).(type) {
	case *Scalar, *Enum, *InputObject:
		return true
	default:
		return false
	}
}
700792
func (s *IndicesGetFieldMappingService) Type(types ...string) *IndicesGetFieldMappingService {
	s.typ = append(s.typ, types...)
	return s
}
599884
func (c *Connect) GetType() (string, error) {
	var err C.virError
	str := C.virConnectGetTypeWrapper(c.ptr, &err)
	if str == nil {
		return "", makeError(&err)
	}
	hypDriver := C.GoString(str)
	return hypDriver, nil
}