Documentation
¶
Index ¶
- func GetRelativePathForRoot(cfg Config, filePath string) string
- func ImportPathEqual(ip1, ip2 *ImportPath) bool
- func ImportPathsEqual(l1, l2 []*ImportPath) bool
- type Config
- type ImportPath
- func NewEntActionImportPath(typ string) *ImportPath
- func NewEntGraphQLImportPath(typ string) *ImportPath
- func NewEntImportPath(typ string) *ImportPath
- func NewGQLClassImportPath(typ string) *ImportPath
- func NewGQLImportPath(typ string) *ImportPath
- func NewGraphQLJSONImportPath(typ string) *ImportPath
- func NewGraphQLScalarsImportPath(typ string) *ImportPath
- func NewLocalEntConnectionImportPath(typ string) *ImportPath
- func NewLocalEntImportPath(typ string) *ImportPath
- func NewLocalGraphQLEntImportPath(typ string) *ImportPath
- func NewLocalGraphQLInputEntImportPath(typ string) *ImportPath
- func NewTypesEntImportPath(typ string) *ImportPath
- type Imports
- func (imps *Imports) ConditionallyReserveImportPath(imp *ImportPath, external bool) (string, error)
- func (imps *Imports) ConditionallyReserveTypeImportPath(imp *ImportPath, external bool) (string, error)
- func (imps *Imports) Export(path string, exports ...string) (string, error)
- func (imps *Imports) ExportAll(path string) (string, error)
- func (imps *Imports) ExportAllAs(path, as string) (string, error)
- func (imps *Imports) ExportType(path string, exports ...string) (string, error)
- func (imps *Imports) FuncMap() template.FuncMap
- func (imps *Imports) Reserve(path string, imports ...string) (string, error)
- func (imps *Imports) ReserveAll(path, as string) (string, error)
- func (imps *Imports) ReserveDefault(path, defaultImport string, imports ...string) (string, error)
- func (imps *Imports) ReserveImportPath(imp *ImportPath, external bool) (string, error)
- func (imps *Imports) ReserveType(path string, imports ...string) (string, error)
- func (imps *Imports) ReserveTypeImportPath(imp *ImportPath, external bool) (string, error)
- func (imps *Imports) String() (string, error)
- func (imps *Imports) Use(impItem string) (string, error)
- func (imps *Imports) UseMaybe(export string) (string, error)
- func (imps *Imports) UseType(impItem string) (string, error)
- func (imps *Imports) UseTypeMaybe(export string) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetRelativePathForRoot ¶ added in v0.2.0
func ImportPathEqual ¶ added in v0.0.38
func ImportPathEqual(ip1, ip2 *ImportPath) bool
func ImportPathsEqual ¶ added in v0.0.38
func ImportPathsEqual(l1, l2 []*ImportPath) bool
Types ¶
type ImportPath ¶ added in v0.0.38
type ImportPath struct {
ImportPath string `json:"importPath"`
Import string `json:"import"`
DefaultImport bool `json:"defaultImport,omitempty"`
// we name this originalImport so that clients everywhere can just keep calling useImport .Import
OriginalImport string `json:"originalImport,omitempty"`
// only used in graphql (at least for now)
// defaults to no. if function, call it instead of just referencing the import when used?
Function bool `json:"function,omitempty"`
Class bool `json:"class,omitempty"`
TransformedForGraphQLMutation bool `json:"transformedForGraphQLMutation,omitempty"`
TransformedForExternalEnt bool `json:"transformedForExternalEnt,omitempty"`
// automatically imported and we don't need to use it
// imported as follows: `import "{path}";`
SideEffect bool `json:"sideEffect"`
// indicates this should be imported as a type-only import
TypeOnly bool `json:"typeOnly,omitempty"`
}
func NewEntActionImportPath ¶ added in v0.0.38
func NewEntActionImportPath(typ string) *ImportPath
func NewEntGraphQLImportPath ¶ added in v0.0.38
func NewEntGraphQLImportPath(typ string) *ImportPath
func NewEntImportPath ¶ added in v0.0.38
func NewEntImportPath(typ string) *ImportPath
func NewGQLClassImportPath ¶ added in v0.1.0
func NewGQLClassImportPath(typ string) *ImportPath
func NewGQLImportPath ¶ added in v0.0.38
func NewGQLImportPath(typ string) *ImportPath
NewGQLImportPath creates a new import from "graphql"
func NewGraphQLJSONImportPath ¶ added in v0.0.38
func NewGraphQLJSONImportPath(typ string) *ImportPath
func NewGraphQLScalarsImportPath ¶ added in v0.1.8
func NewGraphQLScalarsImportPath(typ string) *ImportPath
func NewLocalEntConnectionImportPath ¶ added in v0.0.38
func NewLocalEntConnectionImportPath(typ string) *ImportPath
func NewLocalEntImportPath ¶ added in v0.0.38
func NewLocalEntImportPath(typ string) *ImportPath
func NewLocalGraphQLEntImportPath ¶ added in v0.0.38
func NewLocalGraphQLEntImportPath(typ string) *ImportPath
func NewLocalGraphQLInputEntImportPath ¶ added in v0.1.0
func NewLocalGraphQLInputEntImportPath(typ string) *ImportPath
func NewTypesEntImportPath ¶ added in v0.1.0
func NewTypesEntImportPath(typ string) *ImportPath
func (*ImportPath) Clone ¶ added in v0.3.2
func (ip *ImportPath) Clone() *ImportPath
type Imports ¶
type Imports struct {
// contains filtered or unexported fields
}
Imports keeps track of imports in a generated typescript file
func NewImports ¶
NewImports is the constructor for Imports filePath is path that's currently being written
func (*Imports) ConditionallyReserveImportPath ¶ added in v0.1.0
func (imps *Imports) ConditionallyReserveImportPath(imp *ImportPath, external bool) (string, error)
ConditionallyReserveImportPath skips importing when the import path is same as file path
func (*Imports) ConditionallyReserveTypeImportPath ¶ added in v0.3.2
func (imps *Imports) ConditionallyReserveTypeImportPath(imp *ImportPath, external bool) (string, error)
ConditionallyReserveTypeImportPath skips importing when the import path is same as file path and reserves the import as type-only.
func (*Imports) ExportType ¶ added in v0.3.2
ExportType exports type-only bindings from a path.
func (*Imports) ReserveAll ¶
ReserveAll reserves importing all from a path as the alias
func (*Imports) ReserveDefault ¶
ReserveDefault reserves the default export from a path and a list of exports
func (*Imports) ReserveImportPath ¶ added in v0.0.38
func (imps *Imports) ReserveImportPath(imp *ImportPath, external bool) (string, error)
ReserveImportPath takes an instance of importPath and reserves importing from it should be default eventually
func (*Imports) ReserveType ¶ added in v0.3.2
ReserveType reserves a type-only import from a path.
func (*Imports) ReserveTypeImportPath ¶ added in v0.3.2
func (imps *Imports) ReserveTypeImportPath(imp *ImportPath, external bool) (string, error)
ReserveTypeImportPath takes an instance of importPath and reserves importing it as type-only.