domain

package
v0.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 29, 2019 License: MIT Imports: 5 Imported by: 0

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 CfgReader

type CfgReader interface {
	Read(string) (Config, error)
}

CfgReader reads and parses a configuration file.

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 Dest

type Dest struct {
	Package string
	File    string
}

Dest represents generated file's 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

type ImportSpec interface {
	Host() string
	Name() string
	Path() string
	String() string
}

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.

type Var

type Var interface {
	Name() string
	Type() string
	PkgName() string
	PkgPath() string
}

Var represents a method's parameter and return value.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL