git-bug/vendor/github.com/vektah/gqlgen/codegen/import.go
2018-08-14 14:48:41 +02:00

30 lines
379 B
Go

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
}