Documentation ¶
Index ¶
Constants ¶
View Source
const ConfigTpl = `` /* 203-byte string literal not displayed */
ConfigTpl is a configuration file template.
View Source
const MockTpl = `` /* 1850-byte string literal not displayed */
MockTpl is a mock's template.
View Source
const (
// URL is the repository url.
URL = "https://github.com/suzuki-shunsuke/gomic"
)
View Source
const Version = "0.6.0"
Version is the gomic's version.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Default DefaultConfiguration Items []Item }
Config represents configuration.
type DefaultConfiguration ¶
type DefaultConfiguration struct {
SrcDefaultConfiguration `yaml:",inline"`
}
DefaultConfiguration represents default configuration.
type FileSystem ¶
type FileSystem interface { Exist(string) bool MkdirAll(string) error Write(string, []byte) error GetWriteCloser(string) (io.WriteCloser, error) Getwd() (string, error) }
FileSystem abstracts operations of the file system.
type ImportSpec ¶
ImportSpec represents an import statement.
type ImportSpecs ¶
type ImportSpecs interface { Add(ImportSpec) (ImportSpec, error) Names() map[string]ImportSpec Paths() map[string]ImportSpec }
ImportSpecs represents a collection of ImportSpec.
type Importer ¶
type Importer interface { GetFileByFilePath(filePath string, mode parser.Mode) (*ast.File, error) GetPkgsInDir(dirPath string, filter func(os.FileInfo) bool, mode parser.Mode) (map[string]*ast.Package, error) GetBuildPkgInDir(dir string) (*packages.Package, error) GetBuildPkgByPkgPath(pkgPath, srcDir string) (*packages.Package, error) }
Importer imports go's file and packages.
type Item ¶
type Item struct { Src Src Dest Dest DefaultConfiguration `yaml:",inline"` }
Item represents configuration of each mock.
type Method ¶
type Method interface { Name() string Declaration() string Definition() string SetReturnDefinition() string SetReturnInternalDefinition() string ParamsStr() string ResultValuesStr() string Imports() map[string]ImportSpec Results() []Var IsEllipsis() bool }
Method represents a mock's method.
type MockTemplateArg ¶
type MockTemplateArg interface { Version() string URL() string PackageName() string MockName() string Imports() [][]string Methods() []Method }
MockTemplateArg is a template argument and represents a mock.
type Src ¶
type Src struct { Package string Interface string Name string File string Dir string SrcDefaultConfiguration `yaml:",inline"` }
Src represents source configuration.
type SrcDefaultConfiguration ¶
type SrcDefaultConfiguration struct { InterfacePrefix string `yaml:"interface_prefix"` InterfaceSuffix string `yaml:"interface_suffix"` VendorDir string `yaml:"vendor_dir"` }
SrcDefaultConfiguration represents source's default configuration.
Click to show internal directories.
Click to hide internal directories.