Documentation ¶
Index ¶
- Variables
- type Block
- type Blockchain
- type Database
- type ExplorerServer
- type MockupBlock
- type MockupBlockchain
- type MockupDB
- type MockupExplorerServer
- type MockupRESTAPIServer
- type RESTAPIServer
- func InjectMockupInvalidReturnTest(config viperjacket.Config, blockchain Blockchain) (RESTAPIServer, func(), error)
- func InjectMockupRESTAPIServer(config viperjacket.Config, blockchain Blockchain) (RESTAPIServer, error)
- func NewMockupRESTAPIServer(config viperjacket.Config, blockchain Blockchain) RESTAPIServer
- type TestImplement
- type TestInterface
Constants ¶
This section is empty.
Variables ¶
View Source
var EagerInjectors = map[string]interface{}{ "mockup_explorerserver": InjectMockupExplorerServer, "mockup_restapiserver": InjectMockupRESTAPIServer, }
View Source
var Injectors = map[string]interface{}{ "mockup_database": InjectMockupDB, "mockup_blockchain": InjectMockupBlockchain, }
Dependency Injection List
Injectors stores module_name(key) with injector_func(value) using map. For wiring, name of implement using in config with injector function.
Examples :
var Injectors = map[string]interface{}{ "mockup_database": InjectMockupDB, "mockup_blockchain": InjectMockupBlockchain, } var EagerInjectors = map[string]interface{}{ "mockup_explorerserver": InjectMockupExplorerServer, "mockup_restapiserver": InjectMockupRESTAPIServer, }
Functions ¶
This section is empty.
Types ¶
type Blockchain ¶
type Blockchain interface { // Init inits blockchain. Init() error // AddBlock adds data to blockchain. AddBlock(data string) error // GetBlocks gets all the blocks. GetBlocks() []Block // Close closes blockchain. Close() error }
func InjectMockupBlockchain ¶
func InjectMockupBlockchain(db Database) (Blockchain, error)
InjectMockupBlockchain injects dependencies and inits of Blockchain.
func NewMockupBlockchain ¶
func NewMockupBlockchain(db Database) Blockchain
type Database ¶
type Database interface { // Connect DB. Connect() error // Close closes the REST API Server. Close() error }
func InjectMockupDB ¶
InjectMockupDB injects dependencies and inits of Database.
func NewMockupDB ¶
func NewMockupDB(config viperjacket.Config) Database
type ExplorerServer ¶
type ExplorerServer interface { // Serve serves server. Serve() error // GetAllBlockData return all blocks of blockchain. GetAllBlockData() []string // Close closes blockchain. Close() error }
func InjectMockupExplorerServer ¶
func InjectMockupExplorerServer(config viperjacket.Config, blockchain Blockchain) (ExplorerServer, error)
InjectMockupExplorerServer injects dependencies and inits of ExplorerServer.
func NewMockupExplorerServer ¶
func NewMockupExplorerServer(config viperjacket.Config, blockchain Blockchain) ExplorerServer
type MockupBlock ¶
type MockupBlock struct {
// contains filtered or unexported fields
}
func (*MockupBlock) GetData ¶
func (mb *MockupBlock) GetData() string
type MockupBlockchain ¶
type MockupBlockchain struct {
// contains filtered or unexported fields
}
func (*MockupBlockchain) AddBlock ¶
func (mbc *MockupBlockchain) AddBlock(data string) error
func (*MockupBlockchain) Close ¶
func (mbc *MockupBlockchain) Close() error
func (*MockupBlockchain) GetBlocks ¶
func (mbc *MockupBlockchain) GetBlocks() []Block
func (*MockupBlockchain) Init ¶
func (mbc *MockupBlockchain) Init() error
type MockupExplorerServer ¶
type MockupExplorerServer struct {
// contains filtered or unexported fields
}
func (*MockupExplorerServer) Close ¶
func (mes *MockupExplorerServer) Close() error
func (*MockupExplorerServer) GetAllBlockData ¶
func (mes *MockupExplorerServer) GetAllBlockData() []string
func (*MockupExplorerServer) Serve ¶
func (mes *MockupExplorerServer) Serve() error
type MockupRESTAPIServer ¶
type MockupRESTAPIServer struct {
// contains filtered or unexported fields
}
func (*MockupRESTAPIServer) Close ¶
func (mrs *MockupRESTAPIServer) Close() error
func (*MockupRESTAPIServer) GetPaths ¶
func (mrs *MockupRESTAPIServer) GetPaths() []string
func (*MockupRESTAPIServer) Serve ¶
func (mrs *MockupRESTAPIServer) Serve() error
type RESTAPIServer ¶
type RESTAPIServer interface { // Serve serves server. Serve() error // GetPaths gets all the paths of REST API. GetPaths() []string // Close closes blockchain. Close() error }
func InjectMockupInvalidReturnTest ¶
func InjectMockupInvalidReturnTest(config viperjacket.Config, blockchain Blockchain) (RESTAPIServer, func(), error)
InjectMockupInvalidReturnTest injects dependencies and inits of RESTAPIServer and return invalid format.
func InjectMockupRESTAPIServer ¶
func InjectMockupRESTAPIServer(config viperjacket.Config, blockchain Blockchain) (RESTAPIServer, error)
InjectMockupRESTAPIServer injects dependencies and inits of RESTAPIServer.
func NewMockupRESTAPIServer ¶
func NewMockupRESTAPIServer(config viperjacket.Config, blockchain Blockchain) RESTAPIServer
type TestImplement ¶ added in v1.1.1
type TestImplement struct{}
func (*TestImplement) Close ¶ added in v1.1.1
func (ti *TestImplement) Close() error
func (*TestImplement) Test ¶ added in v1.1.1
func (ti *TestImplement) Test() error
type TestInterface ¶ added in v1.1.1
func InjectMockupInvalidImplTest ¶ added in v1.1.1
func InjectMockupInvalidImplTest() (TestInterface, error)
InjectMockupInvalidImplTest injects test dependency for test.
func NewTestImplement ¶ added in v1.1.1
func NewTestImplement() TestInterface
Click to show internal directories.
Click to hide internal directories.