aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/vektah/gqlgen/codegen/import.go
blob: b511e8f6fcc7ede37442503541989e8a088449e0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package codegen

import (
	"strconv"
)

type Import struct {
	Name string
	Path string

	alias string
}

type Imports struct {
	imports []*Import
	destDir string
}

func (i *Import) Write() string {
	return i.Alias() + " " + strconv.Quote(i.Path)
}

func (i *Import) Alias() string {
	if i.alias == "" {
		panic("alias called before imports are finalized")
	}

	return i.alias
}