foundation

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 25, 2022 License: MIT Imports: 1 Imported by: 1

README

foundation

Go Report Card tests GoDoc MIT license

——The idea came from Laravel

未完结版

Installation

go get github.com/go-packagist/foundation

Usage

待完善

Documentation

Index

Constants

View Source
const VERSION = "0.0.1"

VERSION is the current version of the application.

Variables

This section is empty.

Functions

func SetInstance

func SetInstance(app *Application)

Types

type Application

type Application struct {
	// contains filtered or unexported fields
}

Application is the main application object.

func App

func App() *Application

func GetInstance

func GetInstance() *Application

func Instance

func Instance() *Application

func NewApplication

func NewApplication(basePath string) *Application

NewApplication creates a new application instance

func (*Application) Bind

func (app *Application) Bind(abstract string, concrete ConcreteFunc, shared bool)

Bind Register a binding with the container.

func (*Application) GetProviders

func (app *Application) GetProviders() []Provider

GetProviders returns all registered providers.

func (*Application) Make

func (app *Application) Make(abstract string) interface{}

Make Resolve the given type from the container.

func (*Application) Register

func (app *Application) Register(provider Provider)

Register registers a provider with the application.

func (*Application) Resolve

func (app *Application) Resolve(abstract string) interface{}

Resolve the given type from the container.

func (*Application) Singleton

func (app *Application) Singleton(abstract string, concrete ConcreteFunc)

Singleton Register a shared binding in the container.

func (*Application) Version

func (app *Application) Version() string

Version returns the current version of the application.

type ConcreteFunc

type ConcreteFunc func(*Application) interface{}

type Provider

type Provider interface {
	Register()
}

func NewTestProvider

func NewTestProvider(app *Application) Provider

type TestProvider

type TestProvider struct {
	// contains filtered or unexported fields
}

func (*TestProvider) Register

func (p *TestProvider) Register()

type TestService

type TestService struct {
	// contains filtered or unexported fields
}

TestService is a test service

func NewTestService

func NewTestService(app *Application) *TestService

func (*TestService) Application

func (s *TestService) Application() *Application

func (*TestService) ReadContent

func (s *TestService) ReadContent() string

func (*TestService) WriteContent

func (s *TestService) WriteContent(content string) *TestService

Jump to

Keyboard shortcuts

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